| 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 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/task.h" | 12 #include "base/task.h" |
| 13 #include "ui/base/models/menu_model.h" | 13 #include "ui/base/models/menu_model.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 class ButtonMenuItemModel; | 17 class ButtonMenuItemModel; |
| 18 | 18 |
| 19 // A simple MenuModel implementation with an imperative API for adding menu | 19 // A simple MenuModel implementation with an imperative API for adding menu |
| 20 // items. This makes it easy to construct fixed menus. Menus populated by | 20 // items. This makes it easy to construct fixed menus. Menus populated by |
| 21 // dynamic data sources may be better off implementing MenuModel directly. | 21 // dynamic data sources may be better off implementing MenuModel directly. |
| 22 // The breadth of MenuModel is not exposed through this API. | 22 // The breadth of MenuModel is not exposed through this API. |
| 23 class SimpleMenuModel : public MenuModel { | 23 class UI_BASE_API SimpleMenuModel : public MenuModel { |
| 24 public: | 24 public: |
| 25 class Delegate { | 25 class UI_BASE_API Delegate { |
| 26 public: | 26 public: |
| 27 // Methods for determining the state of specific command ids. | 27 // Methods for determining the state of specific command ids. |
| 28 virtual bool IsCommandIdChecked(int command_id) const = 0; | 28 virtual bool IsCommandIdChecked(int command_id) const = 0; |
| 29 virtual bool IsCommandIdEnabled(int command_id) const = 0; | 29 virtual bool IsCommandIdEnabled(int command_id) const = 0; |
| 30 virtual bool IsCommandIdVisible(int command_id) const; | 30 virtual bool IsCommandIdVisible(int command_id) const; |
| 31 | 31 |
| 32 // Gets the accelerator for the specified command id. Returns true if the | 32 // Gets the accelerator for the specified command id. Returns true if the |
| 33 // command id has a valid accelerator, false otherwise. | 33 // command id has a valid accelerator, false otherwise. |
| 34 virtual bool GetAcceleratorForCommandId( | 34 virtual bool GetAcceleratorForCommandId( |
| 35 int command_id, | 35 int command_id, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 MenuModelDelegate* menu_model_delegate_; | 158 MenuModelDelegate* menu_model_delegate_; |
| 159 | 159 |
| 160 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; | 160 ScopedRunnableMethodFactory<SimpleMenuModel> method_factory_; |
| 161 | 161 |
| 162 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 162 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 } // namespace ui | 165 } // namespace ui |
| 166 | 166 |
| 167 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 167 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |