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

Unified Diff: ui/views/controls/menu/menu_separator_views.cc

Issue 431473003: Make all views platforms use 'new' (cros-style) wrench menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile errors Created 6 years, 4 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 | « ui/views/controls/menu/menu_separator.h ('k') | ui/views/controls/menu/menu_separator_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_separator_views.cc
diff --git a/ui/views/controls/menu/menu_separator_views.cc b/ui/views/controls/menu/menu_separator_views.cc
index 34f85453501d62a86dc44d1cde338e647ba80d50..cf5a8fbbf85046bcbe1eefadf089c9af435589f7 100644
--- a/ui/views/controls/menu/menu_separator_views.cc
+++ b/ui/views/controls/menu/menu_separator_views.cc
@@ -22,32 +22,9 @@ namespace views {
void MenuSeparator::OnPaint(gfx::Canvas* canvas) {
OnPaintAura(canvas);
}
-
-gfx::Size MenuSeparator::GetPreferredSize() const {
- return GetPreferredSizeAura();
-}
#endif
-void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) {
- int pos = 0;
- switch (type_) {
- case ui::LOWER_SEPARATOR:
- pos = height() - kSeparatorHeight;
- break;
- case ui::SPACING_SEPARATOR:
- return;
- case ui::UPPER_SEPARATOR:
- break;
- default:
- pos = height() / 2;
- break;
- }
- canvas->FillRect(gfx::Rect(0, pos, width(), kSeparatorHeight),
- GetNativeTheme()->GetSystemColor(
- ui::NativeTheme::kColorId_MenuSeparatorColor));
-}
-
-gfx::Size MenuSeparator::GetPreferredSizeAura() const {
+gfx::Size MenuSeparator::GetPreferredSize() const {
const MenuConfig& menu_config = parent_menu_item_->GetMenuConfig();
int height = menu_config.separator_height;
switch(type_) {
@@ -68,4 +45,28 @@ gfx::Size MenuSeparator::GetPreferredSizeAura() const {
height);
}
+gfx::Rect MenuSeparator::GetPaintBounds() {
+ int pos = 0;
+ switch (type_) {
+ case ui::LOWER_SEPARATOR:
+ pos = height() - kSeparatorHeight;
+ break;
+ case ui::SPACING_SEPARATOR:
+ return gfx::Rect();
+ case ui::UPPER_SEPARATOR:
+ break;
+ default:
+ pos = height() / 2;
+ break;
+ }
+
+ return gfx::Rect(0, pos, width(), kSeparatorHeight);
+}
+
+void MenuSeparator::OnPaintAura(gfx::Canvas* canvas) {
+ canvas->FillRect(GetPaintBounds(),
+ GetNativeTheme()->GetSystemColor(
+ ui::NativeTheme::kColorId_MenuSeparatorColor));
+}
+
} // namespace views
« no previous file with comments | « ui/views/controls/menu/menu_separator.h ('k') | ui/views/controls/menu/menu_separator_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698