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 |
11 #include "views/controls/menu/menu_delegate.h" | 11 #include "views/controls/menu/menu_delegate.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 class MenuItemView; | 18 class MenuItemView; |
19 | 19 |
20 // This class wraps an instance of ui::MenuModel with the | 20 // This class wraps an instance of ui::MenuModel with the |
21 // views::MenuDelegate interface required by views::MenuItemView. | 21 // views::MenuDelegate interface required by views::MenuItemView. |
22 class VIEWS_API MenuModelAdapter : public MenuDelegate { | 22 class VIEWS_EXPORT MenuModelAdapter : public MenuDelegate { |
23 public: | 23 public: |
24 // The caller retains ownership of the ui::MenuModel instance and | 24 // The caller retains ownership of the ui::MenuModel instance and |
25 // must ensure it exists for the lifetime of the adapter. | 25 // must ensure it exists for the lifetime of the adapter. |
26 explicit MenuModelAdapter(ui::MenuModel* menu_model); | 26 explicit MenuModelAdapter(ui::MenuModel* menu_model); |
27 virtual ~MenuModelAdapter(); | 27 virtual ~MenuModelAdapter(); |
28 | 28 |
29 // Populate a MenuItemView menu with the ui::MenuModel items | 29 // Populate a MenuItemView menu with the ui::MenuModel items |
30 // (including submenus). | 30 // (including submenus). |
31 virtual void BuildMenu(MenuItemView* menu); | 31 virtual void BuildMenu(MenuItemView* menu); |
32 | 32 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). | 68 // Map MenuItems to MenuModels. Used to implement WillShowMenu(). |
69 std::map<MenuItemView*, ui::MenuModel*> menu_map_; | 69 std::map<MenuItemView*, ui::MenuModel*> menu_map_; |
70 | 70 |
71 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); | 71 DISALLOW_COPY_AND_ASSIGN(MenuModelAdapter); |
72 }; | 72 }; |
73 | 73 |
74 } // namespace views | 74 } // namespace views |
75 | 75 |
76 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ | 76 #endif // VIEWS_CONTROLS_MENU_MENU_MODEL_ADAPTER_H_ |
OLD | NEW |