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

Unified Diff: views/controls/menu/menu_item_view.cc

Issue 5110011: A non-GTK version of menus for touchui. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix compile for touch on chromeos Created 10 years 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 | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/native_menu_x.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_item_view.cc
diff --git a/views/controls/menu/menu_item_view.cc b/views/controls/menu/menu_item_view.cc
index cdc0421131c5406fa3e120829bc7719f2ffc2ff3..e0bd038496a74e4cac0e7b6d0ae820f9b50406d9 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -5,6 +5,7 @@
#include "views/controls/menu/menu_item_view.h"
#include "app/l10n_util.h"
+#include "app/menus/menu_model.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas.h"
#include "grit/app_strings.h"
@@ -237,6 +238,43 @@ void MenuItemView::Cancel() {
}
}
+MenuItemView* MenuItemView::AppendMenuItemFromModel(menus::MenuModel* model,
+ int index,
+ int id) {
+ SkBitmap icon;
+ std::wstring label;
+ MenuItemView::Type type;
+ menus::MenuModel::ItemType menu_type = model->GetTypeAt(index);
+ switch (menu_type) {
+ case menus::MenuModel::TYPE_COMMAND:
+ model->GetIconAt(index, &icon);
+ type = MenuItemView::NORMAL;
+ label = UTF16ToWide(model->GetLabelAt(index));
+ break;
+ case menus::MenuModel::TYPE_CHECK:
+ type = MenuItemView::CHECKBOX;
+ label = UTF16ToWide(model->GetLabelAt(index));
+ break;
+ case menus::MenuModel::TYPE_RADIO:
+ type = MenuItemView::RADIO;
+ label = UTF16ToWide(model->GetLabelAt(index));
+ break;
+ case menus::MenuModel::TYPE_SEPARATOR:
+ type = MenuItemView::SEPARATOR;
+ break;
+ case menus::MenuModel::TYPE_SUBMENU:
+ type = MenuItemView::SUBMENU;
+ label = UTF16ToWide(model->GetLabelAt(index));
+ break;
+ default:
+ NOTREACHED();
+ type = MenuItemView::NORMAL;
+ break;
+ }
+
+ return AppendMenuItemImpl(id, label, icon, type);
+}
+
MenuItemView* MenuItemView::AppendMenuItemImpl(int item_id,
const std::wstring& label,
const SkBitmap& icon,
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | views/controls/menu/native_menu_x.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698