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 49 // Overridden from views::ButtonListener: 50 virtual void ButtonPressed(views::Button* sender, 51 const ui::Event& event) OVERRIDE; 52 53 // Overridden from views::MenuDelegate: 54 virtual void ExecuteCommand(int id, int event_flags) OVERRIDE; 55 56 // Override from views::ContextMenuController: 57 virtual void ShowContextMenuForView(views::View* source, 58 const gfx::Point& point, 59 ui::MenuSourceType source_type) OVERRIDE; 60 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_; 76 scoped_ptr<views::MenuRunner> menu_runner_; 77 78 DISALLOW_COPY_AND_ASSIGN(WindowTypeLauncher); 79 }; 80 81 } // namespace shell 82 } // namespace ash 83 84 #endif // ASH_SHELL_WINDOW_TYPE_LAUNCHER_H_ 85