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; 15 class LabelButton; 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. 23 class WindowTypeLauncher : public views::WidgetDelegateView, 24 public views::ButtonListener, 25 public views::MenuDelegate, 26 public views::ContextMenuController { 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; 46 virtual base::string16 GetWindowTitle() const OVERRIDE; 47 virtual bool CanMaximize() const OVERRIDE; 48 virtual bool CanMinimize() const OVERRIDE; 49 50 // Overridden from views::ButtonListener: 51 virtual void ButtonPressed(views::Button* sender, 52 const ui::Event& event) OVERRIDE; 53 54 // Overridden from views::MenuDelegate: 55 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; 56 57 // Override from views::ContextMenuController: 58 virtual void ShowContextMenuForView(views::View* source, 59 const gfx::Point& point, 60 ui::MenuSourceType source_type) OVERRIDE; 61 62 views::LabelButton* create_button_; 63 views::LabelButton* create_persistant_button_; 64 views::LabelButton* panel_button_; 65 views::LabelButton* create_nonresizable_button_; 66 views::LabelButton* bubble_button_; 67 views::LabelButton* lock_button_; 68 views::LabelButton* widgets_button_; 69 views::LabelButton* system_modal_button_; 70 views::LabelButton* window_modal_button_; 71 views::LabelButton* child_modal_button_; 72 views::LabelButton* transient_button_; 73 views::LabelButton* examples_button_; 74 views::LabelButton* show_hide_window_button_; 75 views::LabelButton* show_screensaver_; 76 views::LabelButton* show_web_notification_; 77 scoped_ptr<views::MenuRunner> menu_runner_; 78 79 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher); 80 }; 81 82 } // namespace shell 83 } // namespace ash 84 85 #endif // ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_ 86