OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // A non-GTK implementation of MenuWrapper, used currently for touchui. | 19 // A non-GTK implementation of MenuWrapper, used currently for touchui. |
20 class NativeMenuX : public MenuWrapper, | 20 class NativeMenuLinux : public MenuWrapper, |
21 public MenuDelegate { | 21 public MenuDelegate { |
22 public: | 22 public: |
23 explicit NativeMenuX(Menu2* menu); | 23 explicit NativeMenuLinux(Menu2* menu); |
24 virtual ~NativeMenuX(); | 24 virtual ~NativeMenuLinux(); |
25 | 25 |
26 // Overridden from MenuWrapper: | 26 // Overridden from MenuWrapper: |
27 virtual void RunMenuAt(const gfx::Point& point, int alignment); | 27 virtual void RunMenuAt(const gfx::Point& point, int alignment); |
28 virtual void CancelMenu(); | 28 virtual void CancelMenu(); |
29 virtual void Rebuild(); | 29 virtual void Rebuild(); |
30 virtual void UpdateStates(); | 30 virtual void UpdateStates(); |
31 virtual gfx::NativeMenu GetNativeMenu() const; | 31 virtual gfx::NativeMenu GetNativeMenu() const; |
32 virtual MenuAction GetMenuAction() const; | 32 virtual MenuAction GetMenuAction() const; |
33 virtual void AddMenuListener(MenuListener* listener); | 33 virtual void AddMenuListener(MenuListener* listener); |
34 virtual void RemoveMenuListener(MenuListener* listener); | 34 virtual void RemoveMenuListener(MenuListener* listener); |
35 virtual void SetMinimumWidth(int width); | 35 virtual void SetMinimumWidth(int width); |
36 | 36 |
37 // Overridden from MenuDelegate: | 37 // Overridden from MenuDelegate: |
38 virtual bool IsItemChecked(int id) const; | 38 virtual bool IsItemChecked(int id) const; |
39 virtual bool IsCommandEnabled(int id) const; | 39 virtual bool IsCommandEnabled(int id) const; |
40 virtual void ExecuteCommand(int id); | 40 virtual void ExecuteCommand(int id); |
41 virtual bool GetAccelerator(int id, views::Accelerator* accelerator); | 41 virtual bool GetAccelerator(int id, views::Accelerator* accelerator); |
42 | 42 |
43 private: | 43 private: |
44 void AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model); | 44 void AddMenuItemsFromModel(MenuItemView* parent, ui::MenuModel* model); |
45 void UpdateMenuFromModel(SubmenuView* menu, ui::MenuModel* model); | 45 void UpdateMenuFromModel(SubmenuView* menu, ui::MenuModel* model); |
46 | 46 |
47 // The attached model and delegate. Does not assume ownership. | 47 // The attached model and delegate. Does not assume ownership. |
48 ui::MenuModel* model_; | 48 ui::MenuModel* model_; |
49 scoped_ptr<MenuItemView> root_; | 49 scoped_ptr<MenuItemView> root_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(NativeMenuX); | 51 DISALLOW_COPY_AND_ASSIGN(NativeMenuLinux); |
52 }; | 52 }; |
53 | 53 |
54 } // namespace views | 54 } // namespace views |
55 | 55 |
56 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_X_H_ | 56 #endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_LINUX_H_ |
OLD | NEW |