| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // The Delegate can be NULL, though if it is items can't be checked or | 69 // The Delegate can be NULL, though if it is items can't be checked or |
| 70 // disabled. | 70 // disabled. |
| 71 explicit SimpleMenuModel(Delegate* delegate); | 71 explicit SimpleMenuModel(Delegate* delegate); |
| 72 virtual ~SimpleMenuModel(); | 72 virtual ~SimpleMenuModel(); |
| 73 | 73 |
| 74 // Methods for adding items to the model. | 74 // Methods for adding items to the model. |
| 75 void AddItem(int command_id, const string16& label); | 75 void AddItem(int command_id, const string16& label); |
| 76 void AddItemWithStringId(int command_id, int string_id); | 76 void AddItemWithStringId(int command_id, int string_id); |
| 77 void AddSeparator(); | 77 void AddSeparator(const string16& separator_type); |
| 78 void AddCheckItem(int command_id, const string16& label); | 78 void AddCheckItem(int command_id, const string16& label); |
| 79 void AddCheckItemWithStringId(int command_id, int string_id); | 79 void AddCheckItemWithStringId(int command_id, int string_id); |
| 80 void AddRadioItem(int command_id, const string16& label, int group_id); | 80 void AddRadioItem(int command_id, const string16& label, int group_id); |
| 81 void AddRadioItemWithStringId(int command_id, int string_id, int group_id); | 81 void AddRadioItemWithStringId(int command_id, int string_id, int group_id); |
| 82 | 82 |
| 83 // These three methods take pointers to various sub-models. These models | 83 // These three methods take pointers to various sub-models. These models |
| 84 // should be owned by the same owner of this SimpleMenuModel. | 84 // should be owned by the same owner of this SimpleMenuModel. |
| 85 void AddButtonItem(int command_id, ButtonMenuItemModel* model); | 85 void AddButtonItem(int command_id, ButtonMenuItemModel* model); |
| 86 void AddSubMenu(int command_id, const string16& label, MenuModel* model); | 86 void AddSubMenu(int command_id, const string16& label, MenuModel* model); |
| 87 void AddSubMenuWithStringId(int command_id, int string_id, MenuModel* model); | 87 void AddSubMenuWithStringId(int command_id, int string_id, MenuModel* model); |
| 88 | 88 |
| 89 // Methods for inserting items into the model. | 89 // Methods for inserting items into the model. |
| 90 void InsertItemAt(int index, int command_id, const string16& label); | 90 void InsertItemAt(int index, int command_id, const string16& label); |
| 91 void InsertItemWithStringIdAt(int index, int command_id, int string_id); | 91 void InsertItemWithStringIdAt(int index, int command_id, int string_id); |
| 92 void InsertSeparatorAt(int index); | 92 void InsertSeparatorAt(int index, const string16& separator_type); |
| 93 void InsertCheckItemAt(int index, int command_id, const string16& label); | 93 void InsertCheckItemAt(int index, int command_id, const string16& label); |
| 94 void InsertCheckItemWithStringIdAt(int index, int command_id, int string_id); | 94 void InsertCheckItemWithStringIdAt(int index, int command_id, int string_id); |
| 95 void InsertRadioItemAt( | 95 void InsertRadioItemAt( |
| 96 int index, int command_id, const string16& label, int group_id); | 96 int index, int command_id, const string16& label, int group_id); |
| 97 void InsertRadioItemWithStringIdAt( | 97 void InsertRadioItemWithStringIdAt( |
| 98 int index, int command_id, int string_id, int group_id); | 98 int index, int command_id, int string_id, int group_id); |
| 99 void InsertSubMenuAt( | 99 void InsertSubMenuAt( |
| 100 int index, int command_id, const string16& label, MenuModel* model); | 100 int index, int command_id, const string16& label, MenuModel* model); |
| 101 void InsertSubMenuWithStringIdAt( | 101 void InsertSubMenuWithStringIdAt( |
| 102 int index, int command_id, int string_id, MenuModel* model); | 102 int index, int command_id, int string_id, MenuModel* model); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 MenuModelDelegate* menu_model_delegate_; | 172 MenuModelDelegate* menu_model_delegate_; |
| 173 | 173 |
| 174 base::WeakPtrFactory<SimpleMenuModel> method_factory_; | 174 base::WeakPtrFactory<SimpleMenuModel> method_factory_; |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 176 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace ui | 179 } // namespace ui |
| 180 | 180 |
| 181 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ | 181 #endif // UI_BASE_MODELS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |