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

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

Issue 6961032: Allow adjustment of MenuItemView top and bottom margins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment. Created 9 years, 7 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 | « views/controls/menu/menu_item_view.h ('k') | no next file » | 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 b2ab49c0dbd06d2a95d3bf6f5eb1023e2980ef71..a914f4020a22bf0c9cfbe10ff6be8aef88f93998 100644
--- a/views/controls/menu/menu_item_view.cc
+++ b/views/controls/menu/menu_item_view.cc
@@ -90,7 +90,9 @@ MenuItemView::MenuItemView(MenuDelegate* delegate)
submenu_(NULL),
has_mnemonics_(false),
show_mnemonics_(false),
- has_icons_(false) {
+ has_icons_(false),
+ top_margin_(-1),
+ bottom_margin_(-1) {
// NOTE: don't check the delegate for NULL, UpdateMenuPartSizes supplies a
// NULL delegate.
Init(NULL, 0, SUBMENU, delegate);
@@ -507,7 +509,9 @@ MenuItemView::MenuItemView(MenuItemView* parent,
submenu_(NULL),
has_mnemonics_(false),
show_mnemonics_(false),
- has_icons_(false) {
+ has_icons_(false),
+ top_margin_(-1),
+ bottom_margin_(-1) {
Init(parent, command, type, NULL);
}
@@ -701,6 +705,9 @@ void MenuItemView::DestroyAllMenuHosts() {
}
int MenuItemView::GetTopMargin() {
+ if (top_margin_ >= 0)
+ return top_margin_;
+
MenuItemView* root = GetRootMenuItem();
return root && root->has_icons_
? MenuConfig::instance().item_top_margin :
@@ -708,6 +715,9 @@ int MenuItemView::GetTopMargin() {
}
int MenuItemView::GetBottomMargin() {
+ if (bottom_margin_ >= 0)
+ return bottom_margin_;
+
MenuItemView* root = GetRootMenuItem();
return root && root->has_icons_
? MenuConfig::instance().item_bottom_margin :
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698