OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_X_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_LINUX_H_ |
6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_X_H_ | 6 #define VIEWS_CONTROLS_MENU_NATIVE_MENU_LINUX_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "views/controls/menu/menu_delegate.h" | 9 #include "views/controls/menu/menu_delegate.h" |
10 #include "views/controls/menu/menu_item_view.h" | 10 #include "views/controls/menu/menu_item_view.h" |
11 #include "views/controls/menu/menu_wrapper.h" | 11 #include "views/controls/menu/menu_wrapper.h" |
12 | 12 |
13 namespace ui { | 13 namespace ui { |
14 class MenuModel; | 14 class MenuModel; |
15 } | 15 } |
16 | 16 |
17 namespace views { | 17 namespace views { |
18 | 18 |
19 class MenuRunner; | 19 class MenuRunner; |
20 | 20 |
21 // A non-GTK implementation of MenuWrapper, used currently for touchui. | 21 // A non-GTK implementation of MenuWrapper, used currently for touchui. |
22 class NativeMenuX : public MenuWrapper, | 22 class NativeMenuLinux : public MenuWrapper, |
23 public MenuDelegate { | 23 public MenuDelegate { |
24 public: | 24 public: |
25 explicit NativeMenuX(Menu2* menu); | 25 explicit NativeMenuLinux(Menu2* menu); |
26 virtual ~NativeMenuX(); | 26 virtual ~NativeMenuLinux(); |
27 | 27 |
28 // Overridden from MenuWrapper: | 28 // Overridden from MenuWrapper: |
29 virtual void RunMenuAt(const gfx::Point& point, int alignment); | 29 virtual void RunMenuAt(const gfx::Point& point, int alignment); |
30 virtual void CancelMenu(); | 30 virtual void CancelMenu(); |
31 virtual void Rebuild(); | 31 virtual void Rebuild(); |
32 virtual void UpdateStates(); | 32 virtual void UpdateStates(); |
33 virtual gfx::NativeMenu GetNativeMenu() const; | 33 virtual gfx::NativeMenu GetNativeMenu() const; |
34 virtual MenuAction GetMenuAction() const; | 34 virtual MenuAction GetMenuAction() const; |
35 virtual void AddMenuListener(MenuListener* listener); | 35 virtual void AddMenuListener(MenuListener* listener); |
36 virtual void RemoveMenuListener(MenuListener* listener); | 36 virtual void RemoveMenuListener(MenuListener* listener); |
37 virtual void SetMinimumWidth(int width); | 37 virtual void SetMinimumWidth(int width); |
38 | 38 |
39 // Overridden from MenuDelegate: | 39 // Overridden from MenuDelegate: |
40 virtual bool IsItemChecked(int id) const; | 40 virtual bool IsItemChecked(int id) const; |
41 virtual bool IsCommandEnabled(int id) const; | 41 virtual bool IsCommandEnabled(int id) const; |
42 virtual void ExecuteCommand(int id); | 42 virtual void ExecuteCommand(int id); |
43 virtual bool GetAccelerator(int id, views::Accelerator* accelerator); | 43 virtual bool GetAccelerator(int id, views::Accelerator* accelerator); |
44 | 44 |
45 private: | 45 private: |
46 void AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model); | 46 void AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model); |
47 void UpdateMenuFromModel(SubmenuView* menu, ui::MenuModel* model); | 47 void UpdateMenuFromModel(SubmenuView* menu, ui::MenuModel* model); |
48 | 48 |
49 // The attached model and delegate. Does not assume ownership. | 49 // The attached model and delegate. Does not assume ownership. |
50 ui::MenuModel* model_; | 50 ui::MenuModel* model_; |
51 MenuItemView* root_; | 51 MenuItemView* root_; |
52 scoped_ptr<MenuRunner> menu_runner_; | 52 scoped_ptr<MenuRunner> menu_runner_; |
53 | 53 |
54 DISALLOW_COPY_AND_ASSIGN(NativeMenuX); | 54 DISALLOW_COPY_AND_ASSIGN(NativeMenuLinux); |
55 }; | 55 }; |
56 | 56 |
57 } // namespace views | 57 } // namespace views |
58 | 58 |
59 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_X_H_ | 59 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_LINUX_H_ |
OLD | NEW |