| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 5 #ifndef UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| 6 #define UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 6 #define UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "ui/views/controls/menu/menu_delegate.h" | 10 #include "ui/views/controls/menu/menu_delegate.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual MenuItemView* AppendMenuItem(MenuItemView* menu, | 60 virtual MenuItemView* AppendMenuItem(MenuItemView* menu, |
| 61 ui::MenuModel* model, | 61 ui::MenuModel* model, |
| 62 int index); | 62 int index); |
| 63 | 63 |
| 64 // views::MenuDelegate implementation. | 64 // views::MenuDelegate implementation. |
| 65 virtual void ExecuteCommand(int id) OVERRIDE; | 65 virtual void ExecuteCommand(int id) OVERRIDE; |
| 66 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; | 66 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; |
| 67 virtual bool IsTriggerableEvent(MenuItemView* source, | 67 virtual bool IsTriggerableEvent(MenuItemView* source, |
| 68 const ui::Event& e) OVERRIDE; | 68 const ui::Event& e) OVERRIDE; |
| 69 virtual bool GetAccelerator(int id, | 69 virtual bool GetAccelerator(int id, |
| 70 ui::Accelerator* accelerator) OVERRIDE; | 70 ui::Accelerator* accelerator) const OVERRIDE; |
| 71 virtual base::string16 GetLabel(int id) const OVERRIDE; | 71 virtual base::string16 GetLabel(int id) const OVERRIDE; |
| 72 virtual const gfx::FontList* GetLabelFontList(int id) const OVERRIDE; | 72 virtual const gfx::FontList* GetLabelFontList(int id) const OVERRIDE; |
| 73 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 73 virtual bool IsCommandEnabled(int id) const OVERRIDE; |
| 74 virtual bool IsItemChecked(int id) const OVERRIDE; | 74 virtual bool IsItemChecked(int id) const OVERRIDE; |
| 75 virtual void SelectionChanged(MenuItemView* menu) OVERRIDE; | 75 virtual void SelectionChanged(MenuItemView* menu) OVERRIDE; |
| 76 virtual void WillShowMenu(MenuItemView* menu) OVERRIDE; | 76 virtual void WillShowMenu(MenuItemView* menu) OVERRIDE; |
| 77 virtual void WillHideMenu(MenuItemView* menu) OVERRIDE; | 77 virtual void WillHideMenu(MenuItemView* menu) OVERRIDE; |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // Implementation of BuildMenu(). | 80 // Implementation of BuildMenu(). |
| 81 void BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model); | 81 void BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model); |
| 82 | 82 |
| 83 // Container of ui::MenuModel pointers as encountered by preorder | 83 // Container of ui::MenuModel pointers as encountered by preorder |
| 84 // traversal. The first element is always the top-level model | 84 // traversal. The first element is always the top-level model |
| 85 // passed to the constructor. | 85 // passed to the constructor. |
| 86 ui::MenuModel* menu_model_; | 86 ui::MenuModel* menu_model_; |
| 87 | 87 |
| 88 // Mouse event flags which can trigger menu actions. | 88 // Mouse event flags which can trigger menu actions. |
| 89 int triggerable_event_flags_; | 89 int triggerable_event_flags_; |
| 90 | 90 |
| 91 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). | 91 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). |
| 92 std::map<MenuItemView*, ui::MenuModel*> menu_map_; | 92 std::map<MenuItemView*, ui::MenuModel*> menu_map_; |
| 93 | 93 |
| 94 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); | 94 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 } // namespace views | 97 } // namespace views |
| 98 | 98 |
| 99 #endif // UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 99 #endif // UI_VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| OLD | NEW |