Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: app/menus/button_menu_item_model.h

Issue 3026025: The Mac wrench menu zoom controls honor the global enabled state of the zoom commands. (Closed)
Patch Set: Removed unneeded disabling of percentage display. Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | app/menus/button_menu_item_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ 5 #ifndef APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_
6 #define APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ 6 #define APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 }; 24 };
25 25
26 class Delegate { 26 class Delegate {
27 public: 27 public:
28 // Some command ids have labels that change over time. 28 // Some command ids have labels that change over time.
29 virtual bool IsLabelForCommandIdDynamic(int command_id) const; 29 virtual bool IsLabelForCommandIdDynamic(int command_id) const;
30 virtual string16 GetLabelForCommandId(int command_id) const; 30 virtual string16 GetLabelForCommandId(int command_id) const;
31 31
32 // Performs the action associated with the specified command id. 32 // Performs the action associated with the specified command id.
33 virtual void ExecuteCommand(int command_id) = 0; 33 virtual void ExecuteCommand(int command_id) = 0;
34 virtual bool IsCommandIdEnabled(int command_id) const { return true; }
34 }; 35 };
35 36
36 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate); 37 ButtonMenuItemModel(int string_id, ButtonMenuItemModel::Delegate* delegate);
37 ~ButtonMenuItemModel(); 38 ~ButtonMenuItemModel();
38 39
39 // Adds a button that will emit |command_id|. All buttons created through 40 // Adds a button that will emit |command_id|. All buttons created through
40 // this method will have the same size, based on the largest button. 41 // this method will have the same size, based on the largest button.
41 void AddGroupItemWithStringId(int command_id, int string_id); 42 void AddGroupItemWithStringId(int command_id, int string_id);
42 43
43 // Adds a button that has an icon instead of a label. 44 // Adds a button that has an icon instead of a label.
(...skipping 26 matching lines...) Expand all
70 // sets the IDR |icon|. 71 // sets the IDR |icon|.
71 bool GetIconAt(int index, int* icon) const; 72 bool GetIconAt(int index, int* icon) const;
72 73
73 // If the button at |index| should have its size equalized along with all 74 // If the button at |index| should have its size equalized along with all
74 // other items that have their PartOfGroup bit set. 75 // other items that have their PartOfGroup bit set.
75 bool PartOfGroup(int index) const; 76 bool PartOfGroup(int index) const;
76 77
77 // Called from implementations. 78 // Called from implementations.
78 void ActivatedCommand(int command_id); 79 void ActivatedCommand(int command_id);
79 80
81 // Returns the enabled state of the button at |index|.
82 bool IsEnabledAt(int index) const;
83
80 const string16& label() const { return item_label_; } 84 const string16& label() const { return item_label_; }
81 85
82 private: 86 private:
83 // The non-clickable label to the left of the buttons. 87 // The non-clickable label to the left of the buttons.
84 string16 item_label_; 88 string16 item_label_;
85 89
86 struct Item; 90 struct Item;
87 std::vector<Item> items_; 91 std::vector<Item> items_;
88 92
89 Delegate* delegate_; 93 Delegate* delegate_;
90 94
91 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel); 95 DISALLOW_COPY_AND_ASSIGN(ButtonMenuItemModel);
92 }; 96 };
93 97
94 } // namespace menus 98 } // namespace menus
95 99
96 #endif // APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_ 100 #endif // APP_MENUS_BUTTON_MENU_ITEM_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | app/menus/button_menu_item_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698