blob: 7a088d90c50f7550645206d32d61c18d9cccb26a [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// Copyright (c) 2012 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_
6#define ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_
7
8#include "ui/views/context_menu_controller.h"
9#include "ui/views/controls/button/button.h"
10#include "ui/views/controls/menu/menu_delegate.h"
11#include "ui/views/widget/widget_delegate.h"
12
13namespace views {
14class MenuRunner;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000015class LabelButton;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000016}
17
18namespace ash {
19namespace shell {
20
21// The contents view/delegate of a window that shows some buttons that create
22// various window types.
Torne (Richard Coles)58218062012-11-14 11:43:16 +000023class WindowTypeLauncher : public views::WidgetDelegateView,
24 public views::ButtonListener,
25 public views::MenuDelegate,
26 public views::ContextMenuController {
Torne (Richard Coles)58218062012-11-14 11:43:16 +000027 public:
28 WindowTypeLauncher();
29 virtual ~WindowTypeLauncher();
30
31 private:
32 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
33
34 enum MenuCommands {
35 COMMAND_NEW_WINDOW = 1,
36 COMMAND_TOGGLE_FULLSCREEN = 3,
37 };
38
39 // Overridden from views::View:
40 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
41 virtual bool OnMousePressed(const ui::MouseEvent& event) OVERRIDE;
42
43 // Overridden from views::WidgetDelegate:
44 virtual views::View* GetContentsView() OVERRIDE;
45 virtual bool CanResize() const OVERRIDE;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010046 virtual base::string16 GetWindowTitle() const OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000047 virtual bool CanMaximize() const OVERRIDE;
48
49 // Overridden from views::ButtonListener:
50 virtual void ButtonPressed(views::Button* sender,
51 const ui::Event& event) OVERRIDE;
52
Torne (Richard Coles)58218062012-11-14 11:43:16 +000053 // Overridden from views::MenuDelegate:
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000054 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000055
56 // Override from views::ContextMenuController:
57 virtual void ShowContextMenuForView(views::View* source,
Torne (Richard Coles)7d4cd472013-06-19 11:58:07 +010058 const gfx::Point& point,
59 ui::MenuSourceType source_type) OVERRIDE;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000060
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000061 views::LabelButton* create_button_;
62 views::LabelButton* create_persistant_button_;
63 views::LabelButton* panel_button_;
64 views::LabelButton* create_nonresizable_button_;
65 views::LabelButton* bubble_button_;
66 views::LabelButton* lock_button_;
67 views::LabelButton* widgets_button_;
68 views::LabelButton* system_modal_button_;
69 views::LabelButton* window_modal_button_;
70 views::LabelButton* child_modal_button_;
71 views::LabelButton* transient_button_;
72 views::LabelButton* examples_button_;
73 views::LabelButton* show_hide_window_button_;
74 views::LabelButton* show_screensaver_;
75 views::LabelButton* show_web_notification_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000076 scoped_ptr<views::MenuRunner> menu_runner_;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000077
78 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher);
79};
80
81} // namespace shell
82} // namespace ash
83
84#endif // ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_