| 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_MENU_MODEL_ADAPTER_H_ | 5 #ifndef VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| 6 #define VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 6 #define VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 virtual void ExecuteCommand(int id) OVERRIDE; | 36 virtual void ExecuteCommand(int id) OVERRIDE; |
| 37 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; | 37 virtual void ExecuteCommand(int id, int mouse_event_flags) OVERRIDE; |
| 38 virtual bool GetAccelerator(int id, | 38 virtual bool GetAccelerator(int id, |
| 39 views::Accelerator* accelerator) OVERRIDE; | 39 views::Accelerator* accelerator) OVERRIDE; |
| 40 virtual std::wstring GetLabel(int id) const OVERRIDE; | 40 virtual std::wstring GetLabel(int id) const OVERRIDE; |
| 41 virtual const gfx::Font& GetLabelFont(int id) const OVERRIDE; | 41 virtual const gfx::Font& GetLabelFont(int id) const OVERRIDE; |
| 42 virtual bool IsCommandEnabled(int id) const OVERRIDE; | 42 virtual bool IsCommandEnabled(int id) const OVERRIDE; |
| 43 virtual bool IsItemChecked(int id) const OVERRIDE; | 43 virtual bool IsItemChecked(int id) const OVERRIDE; |
| 44 virtual void SelectionChanged(MenuItemView* menu) OVERRIDE; | 44 virtual void SelectionChanged(MenuItemView* menu) OVERRIDE; |
| 45 virtual void WillShowMenu(MenuItemView* menu) OVERRIDE; | 45 virtual void WillShowMenu(MenuItemView* menu) OVERRIDE; |
| 46 virtual void WillHideMenu(MenuItemView* menu) OVERRIDE; |
| 46 | 47 |
| 47 private: | 48 private: |
| 48 // Implementation of BuildMenu(). index_offset is both input and output; | 49 // Implementation of BuildMenu(). index_offset is both input and output; |
| 49 // on input it contains the offset from index to command id for the model, | 50 // on input it contains the offset from index to command id for the model, |
| 50 // and on output it contains the offset for the next model. | 51 // and on output it contains the offset for the next model. |
| 51 void BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model); | 52 void BuildMenuImpl(MenuItemView* menu, ui::MenuModel* model); |
| 52 | 53 |
| 53 // Container of ui::MenuModel pointers as encountered by preorder | 54 // Container of ui::MenuModel pointers as encountered by preorder |
| 54 // traversal. The first element is always the top-level model | 55 // traversal. The first element is always the top-level model |
| 55 // passed to the constructor. | 56 // passed to the constructor. |
| 56 ui::MenuModel* menu_model_; | 57 ui::MenuModel* menu_model_; |
| 57 | 58 |
| 58 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). | 59 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). |
| 59 std::map<MenuItemView*, ui::MenuModel*> menu_map_; | 60 std::map<MenuItemView*, ui::MenuModel*> menu_map_; |
| 60 | 61 |
| 61 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); | 62 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace views | 65 } // namespace views |
| 65 | 66 |
| 66 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 67 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
| OLD | NEW |