| 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_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 5 #ifndef UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| 6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 6 #define UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "ui/base/models/menu_model.h" | 12 #include "ui/base/models/menu_model.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Image; | 15 class Image; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 class ButtonMenuItemModel; | 20 class ButtonMenuItemModel; |
| 21 | 21 |
| 22 // A simple MenuModel implementation with an imperative API for adding menu | 22 // A simple MenuModel implementation with an imperative API for adding menu |
| 23 // items. This makes it easy to construct fixed menus. Menus populated by | 23 // items. This makes it easy to construct fixed menus. Menus populated by |
| 24 // dynamic data sources may be better off implementing MenuModel directly. | 24 // dynamic data sources may be better off implementing MenuModel directly. |
| 25 // The breadth of MenuModel is not exposed through this API. | 25 // The breadth of MenuModel is not exposed through this API. |
| 26 class UI_EXPORT SimpleMenuModel : public MenuModel { | 26 class UI_BASE_EXPORT SimpleMenuModel : public MenuModel { |
| 27 public: | 27 public: |
| 28 class UI_EXPORT Delegate { | 28 class UI_BASE_EXPORT Delegate { |
| 29 public: | 29 public: |
| 30 // Methods for determining the state of specific command ids. | 30 // Methods for determining the state of specific command ids. |
| 31 virtual bool IsCommandIdChecked(int command_id) const = 0; | 31 virtual bool IsCommandIdChecked(int command_id) const = 0; |
| 32 virtual bool IsCommandIdEnabled(int command_id) const = 0; | 32 virtual bool IsCommandIdEnabled(int command_id) const = 0; |
| 33 virtual bool IsCommandIdVisible(int command_id) const; | 33 virtual bool IsCommandIdVisible(int command_id) const; |
| 34 | 34 |
| 35 // Gets the accelerator for the specified command id. Returns true if the | 35 // Gets the accelerator for the specified command id. Returns true if the |
| 36 // command id has a valid accelerator, false otherwise. | 36 // command id has a valid accelerator, false otherwise. |
| 37 virtual bool GetAcceleratorForCommandId( | 37 virtual bool GetAcceleratorForCommandId( |
| 38 int command_id, | 38 int command_id, |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 MenuModelDelegate* menu_model_delegate_; | 200 MenuModelDelegate* menu_model_delegate_; |
| 201 | 201 |
| 202 base::WeakPtrFactory<SimpleMenuModel> method_factory_; | 202 base::WeakPtrFactory<SimpleMenuModel> method_factory_; |
| 203 | 203 |
| 204 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 204 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 205 }; | 205 }; |
| 206 | 206 |
| 207 } // namespace ui | 207 } // namespace ui |
| 208 | 208 |
| 209 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 209 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |