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

Side by Side Diff: views/controls/menu/menu_item_view.cc

Issue 8621006: Remove most obvious TOUCH_UI code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert file that CQ does not like. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/controls/menu/menu_host.cc ('k') | views/controls/menu/nested_dispatcher_gtk.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/menu/menu_item_view.h" 5 #include "views/controls/menu/menu_item_view.h"
6 6
7 #include "base/i18n/case_conversion.h" 7 #include "base/i18n/case_conversion.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_strings.h" 10 #include "grit/ui_strings.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 private: 48 private:
49 DISALLOW_COPY_AND_ASSIGN(EmptyMenuMenuItem); 49 DISALLOW_COPY_AND_ASSIGN(EmptyMenuMenuItem);
50 }; 50 };
51 51
52 } // namespace 52 } // namespace
53 53
54 // Padding between child views. 54 // Padding between child views.
55 static const int kChildXPadding = 8; 55 static const int kChildXPadding = 8;
56 56
57 #if defined(TOUCH_UI)
58 const int kMinItemHeightTouch = 40;
59 #endif
60
61 // MenuItemView --------------------------------------------------------------- 57 // MenuItemView ---------------------------------------------------------------
62 58
63 // static 59 // static
64 const int MenuItemView::kMenuItemViewID = 1001; 60 const int MenuItemView::kMenuItemViewID = 1001;
65 61
66 // static 62 // static
67 const int MenuItemView::kEmptyMenuItemViewID = 63 const int MenuItemView::kEmptyMenuItemViewID =
68 MenuItemView::kMenuItemViewID + 1; 64 MenuItemView::kMenuItemViewID + 1;
69 65
70 // static 66 // static
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 739
744 gfx::Size MenuItemView::CalculatePreferredSize() { 740 gfx::Size MenuItemView::CalculatePreferredSize() {
745 gfx::Size child_size = GetChildPreferredSize(); 741 gfx::Size child_size = GetChildPreferredSize();
746 if (IsContainer()) { 742 if (IsContainer()) {
747 return gfx::Size( 743 return gfx::Size(
748 child_size.width(), 744 child_size.width(),
749 child_size.height() + GetBottomMargin() + GetTopMargin()); 745 child_size.height() + GetBottomMargin() + GetTopMargin());
750 } 746 }
751 747
752 const gfx::Font& font = GetFont(); 748 const gfx::Font& font = GetFont();
753 #if defined(TOUCH_UI)
754 int height = std::max(font.GetHeight(), kMinItemHeightTouch);
755 #else
756 int height = font.GetHeight(); 749 int height = font.GetHeight();
757 #endif
758 return gfx::Size( 750 return gfx::Size(
759 font.GetStringWidth(title_) + label_start_ + 751 font.GetStringWidth(title_) + label_start_ +
760 item_right_margin_ + child_size.width(), 752 item_right_margin_ + child_size.width(),
761 std::max(height, child_size.height()) + GetBottomMargin() + 753 std::max(height, child_size.height()) + GetBottomMargin() +
762 GetTopMargin()); 754 GetTopMargin());
763 } 755 }
764 756
765 string16 MenuItemView::GetAcceleratorText() { 757 string16 MenuItemView::GetAcceleratorText() {
766 if (id() == kEmptyMenuItemViewID) { 758 if (id() == kEmptyMenuItemViewID) {
767 // Don't query the delegate for menus that represent no children. 759 // Don't query the delegate for menus that represent no children.
(...skipping 10 matching lines...) Expand all
778 } 770 }
779 771
780 bool MenuItemView::IsContainer() const { 772 bool MenuItemView::IsContainer() const {
781 // Let the first child take over |this| when we only have one child and no 773 // Let the first child take over |this| when we only have one child and no
782 // title. Note that what child_count() returns is the number of children, 774 // title. Note that what child_count() returns is the number of children,
783 // not the number of menu items. 775 // not the number of menu items.
784 return child_count() == 1 && title_.empty(); 776 return child_count() == 1 && title_.empty();
785 } 777 }
786 778
787 } // namespace views 779 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/menu/menu_host.cc ('k') | views/controls/menu/nested_dispatcher_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698