| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ | 5 #ifndef CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ |
| 6 #define CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ | 6 #define CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 virtual string16 GetLabelForCommandId(int command_id) const { | 37 virtual string16 GetLabelForCommandId(int command_id) const { |
| 38 return string16(); | 38 return string16(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // Notifies the delegate that the item with the specified command id was | 41 // Notifies the delegate that the item with the specified command id was |
| 42 // visually highlighted within the menu. | 42 // visually highlighted within the menu. |
| 43 virtual void CommandIdHighlighted(int command_id) {} | 43 virtual void CommandIdHighlighted(int command_id) {} |
| 44 | 44 |
| 45 // Performs the action associated with the specified command id. | 45 // Performs the action associated with the specified command id. |
| 46 virtual void ExecuteCommand(int command_id) = 0; | 46 virtual void ExecuteCommand(int command_id) = 0; |
| 47 | |
| 48 protected: | |
| 49 ~Delegate() {} | |
| 50 }; | 47 }; |
| 51 | 48 |
| 52 // The Delegate can be NULL, though if it is items can't be checked or | 49 // The Delegate can be NULL, though if it is items can't be checked or |
| 53 // disabled. | 50 // disabled. |
| 54 explicit SimpleMenuModel(Delegate* delegate); | 51 explicit SimpleMenuModel(Delegate* delegate); |
| 55 virtual ~SimpleMenuModel(); | 52 virtual ~SimpleMenuModel(); |
| 56 | 53 |
| 57 // Methods for adding items to the model. | 54 // Methods for adding items to the model. |
| 58 void AddItem(int command_id, const string16& label); | 55 void AddItem(int command_id, const string16& label); |
| 59 void AddItemWithStringId(int command_id, int string_id); | 56 void AddItemWithStringId(int command_id, int string_id); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 std::vector<Item> items_; | 98 std::vector<Item> items_; |
| 102 | 99 |
| 103 Delegate* delegate_; | 100 Delegate* delegate_; |
| 104 | 101 |
| 105 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); | 102 DISALLOW_COPY_AND_ASSIGN(SimpleMenuModel); |
| 106 }; | 103 }; |
| 107 | 104 |
| 108 } // namespace views | 105 } // namespace views |
| 109 | 106 |
| 110 #endif // CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ | 107 #endif // CONTROLS_MENU_VIEWS_SIMPLE_MENU_MODEL_H_ |
| OLD | NEW |