Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 1 | // 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 | |
| 13 | namespace views { |
| 14 | class MenuRunner; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 15 | class LabelButton; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | namespace ash { |
| 19 | namespace shell { |
| 20 | |
| 21 | // The contents view/delegate of a window that shows some buttons that create |
| 22 | // various window types. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 23 | class WindowTypeLauncher : public views::WidgetDelegateView, |
| 24 | public views::ButtonListener, |
| 25 | public views::MenuDelegate, |
| 26 | public views::ContextMenuController { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 27 | 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) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 46 | virtual base::string16 GetWindowTitle() const OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 47 | 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) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 53 | // Overridden from views::MenuDelegate: |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 54 | virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 55 | |
| 56 | // Override from views::ContextMenuController: |
| 57 | virtual void ShowContextMenuForView(views::View* source, |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 58 | const gfx::Point& point, |
| 59 | ui::MenuSourceType source_type) OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 60 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 61 | 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) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 76 | scoped_ptr<views::MenuRunner> menu_runner_; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 77 | |
| 78 | DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher); |
| 79 | }; |
| 80 | |
| 81 | } // namespace shell |
| 82 | } // namespace ash |
| 83 | |
| 84 | #endif // ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_ |