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

Unified Diff: app/menus/simple_menu_model.cc

Issue 2800015: GTK: First draft of the unified cut/copy/paste and +/-/Fullscreen menu items. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: estade cleanups Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/menus/simple_menu_model.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/menus/simple_menu_model.cc
diff --git a/app/menus/simple_menu_model.cc b/app/menus/simple_menu_model.cc
index 863166671e65dd308ff219ec3a8e1abd6e615cd9..3e519864edcfcab0c20536e11b6c67aa86c99402 100644
--- a/app/menus/simple_menu_model.cc
+++ b/app/menus/simple_menu_model.cc
@@ -20,7 +20,7 @@ SimpleMenuModel::~SimpleMenuModel() {
}
void SimpleMenuModel::AddItem(int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL };
+ Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
AppendItem(item);
}
@@ -30,7 +30,7 @@ void SimpleMenuModel::AddItemWithStringId(int command_id, int string_id) {
void SimpleMenuModel::AddSeparator() {
Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
- NULL };
+ NULL, NULL };
AppendItem(item);
}
@@ -45,7 +45,8 @@ void SimpleMenuModel::AddCheckItemWithStringId(int command_id, int string_id) {
void SimpleMenuModel::AddRadioItem(int command_id, const string16& label,
int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL };
+ Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ NULL };
AppendItem(item);
}
@@ -54,9 +55,15 @@ void SimpleMenuModel::AddRadioItemWithStringId(int command_id, int string_id,
AddRadioItem(command_id, l10n_util::GetStringUTF16(string_id), group_id);
}
+void SimpleMenuModel::AddButtonItem(int command_id,
+ ButtonMenuItemModel* model) {
+ Item item = { 0, string16(), SkBitmap(), TYPE_BUTTON_ITEM, -1, NULL, model };
+ AppendItem(item);
+}
+
void SimpleMenuModel::AddSubMenu(int command_id, const string16& label,
MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model };
+ Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
AppendItem(item);
}
@@ -67,7 +74,7 @@ void SimpleMenuModel::AddSubMenuWithStringId(int command_id,
void SimpleMenuModel::InsertItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL };
+ Item item = { command_id, label, SkBitmap(), TYPE_COMMAND, -1, NULL, NULL };
InsertItemAtIndex(item, index);
}
@@ -78,13 +85,13 @@ void SimpleMenuModel::InsertItemWithStringIdAt(
void SimpleMenuModel::InsertSeparatorAt(int index) {
Item item = { kSeparatorId, string16(), SkBitmap(), TYPE_SEPARATOR, -1,
- NULL };
+ NULL, NULL };
InsertItemAtIndex(item, index);
}
void SimpleMenuModel::InsertCheckItemAt(
int index, int command_id, const string16& label) {
- Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL };
+ Item item = { command_id, label, SkBitmap(), TYPE_CHECK, -1, NULL, NULL };
InsertItemAtIndex(item, index);
}
@@ -96,7 +103,8 @@ void SimpleMenuModel::InsertCheckItemWithStringIdAt(
void SimpleMenuModel::InsertRadioItemAt(
int index, int command_id, const string16& label, int group_id) {
- Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL };
+ Item item = { command_id, label, SkBitmap(), TYPE_RADIO, group_id, NULL,
+ NULL };
InsertItemAtIndex(item, index);
}
@@ -108,7 +116,7 @@ void SimpleMenuModel::InsertRadioItemWithStringIdAt(
void SimpleMenuModel::InsertSubMenuAt(
int index, int command_id, const string16& label, MenuModel* model) {
- Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model };
+ Item item = { command_id, label, SkBitmap(), TYPE_SUBMENU, -1, model, NULL };
InsertItemAtIndex(item, index);
}
@@ -199,9 +207,14 @@ bool SimpleMenuModel::GetIconAt(int index, SkBitmap* icon) const {
return true;
}
+ButtonMenuItemModel* SimpleMenuModel::GetButtonMenuItemAt(int index) const {
+ return items_.at(FlipIndex(index)).button_model;
+}
+
bool SimpleMenuModel::IsEnabledAt(int index) const {
int command_id = GetCommandIdAt(index);
- if (!delegate_ || command_id == kSeparatorId)
+ if (!delegate_ || command_id == kSeparatorId ||
+ items_.at(FlipIndex(index)).button_model)
return true;
return delegate_->IsCommandIdEnabled(command_id);
}
« no previous file with comments | « app/menus/simple_menu_model.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698