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

Unified Diff: ui/views/controls/menu/menu_item_view.h

Issue 10532171: Added support for icon views (view used instead of icon in a menu item). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added support for icon views (view used instead of icon in a menu item). Created 8 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 | « no previous file | ui/views/controls/menu/menu_item_view.cc » ('j') | ui/views/controls/menu/menu_item_view.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_item_view.h
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h
index 6f4b89ad6f60bfacfb1bd74faf8b2c899aa769f0..979b155841dd180f41e460aa3392a2bc8cb4668f 100644
--- a/ui/views/controls/menu/menu_item_view.h
+++ b/ui/views/controls/menu/menu_item_view.h
@@ -242,6 +242,11 @@ class VIEWS_EXPORT MenuItemView : public View {
// Returns the icon.
const gfx::ImageSkia& GetIcon() const { return icon_; }
+ // Set/Get a View to be used instead of icon.
+ // It always be inserted as a first child view.
+ void SetIconView(View* icon_view);
+ View* GetIconView();
Aaron Boodman 2012/06/19 00:06:33 If these are just simple getters and setters, the
Aaron Boodman 2012/06/19 21:45:38 Nevermind, I forgot to remove this comment.
+
// Sets the command id of this menu item.
void SetCommand(int command) { command_ = command; }
@@ -277,6 +282,10 @@ class VIEWS_EXPORT MenuItemView : public View {
has_icons_ = has_icons;
}
+ void set_has_icon_views(bool has_icon_views) {
+ has_icon_views_ = has_icon_views;
+ }
+
// Returns the descendant with the specified command.
MenuItemView* GetMenuItemByID(int id);
@@ -310,6 +319,9 @@ class VIEWS_EXPORT MenuItemView : public View {
use_right_margin_ = use_right_margin;
}
+ virtual Border* GetMenuBorder();
+ virtual Background* GetMenuBackground();
+
protected:
// Creates a MenuItemView. This is used by the various AddXXX methods.
MenuItemView(MenuItemView* parent, int command, Type type);
@@ -321,13 +333,13 @@ class VIEWS_EXPORT MenuItemView : public View {
virtual std::string GetClassName() const OVERRIDE;
- private:
- friend class internal::MenuRunnerImpl; // For access to ~MenuItemView.
-
// Calculates all sizes that we can from the OS.
//
// This is invoked prior to Running a menu.
- static void UpdateMenuPartSizes(bool has_icons);
+ void UpdateMenuPartSizes();
+
+ private:
+ friend class internal::MenuRunnerImpl; // For access to ~MenuItemView.
// Called by the two constructors to initialize this menu item.
void Init(MenuItemView* parent,
@@ -405,6 +417,9 @@ class VIEWS_EXPORT MenuItemView : public View {
// that is responsible for rendering the content.
bool IsContainer() const;
+ // Returns true if menu item has non icon view child.
+ bool HasNonIconChildViews();
+
// The delegate. This is only valid for the root menu item. You shouldn't
// use this directly, instead use GetDelegate() which walks the tree as
// as necessary.
@@ -445,7 +460,13 @@ class VIEWS_EXPORT MenuItemView : public View {
// MenuConfig says mnemonics should be shown. Only used on the root menu item.
bool show_mnemonics_;
+ // One of them is set if menu has icons or icon_views
+ // (applies to root menu item only).
bool has_icons_;
+ bool has_icon_views_;
+
+ // Menu item has icon view
+ bool has_icon_view_;
// The tooltip to show on hover for this menu item.
string16 tooltip_;
« no previous file with comments | « no previous file | ui/views/controls/menu/menu_item_view.cc » ('j') | ui/views/controls/menu/menu_item_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698