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

Side by Side Diff: chrome/views/menu_button.cc

Issue 7344: Convert GetPreferredSize from:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <atlbase.h> 5 #include <atlbase.h>
6 #include <atlapp.h> 6 #include <atlapp.h>
7 7
8 #include "chrome/views/menu_button.h" 8 #include "chrome/views/menu_button.h"
9 9
10 #include "chrome/app/theme/theme_resources.h" 10 #include "chrome/app/theme/theme_resources.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 58
59 MenuButton::~MenuButton() { 59 MenuButton::~MenuButton() {
60 } 60 }
61 61
62 //////////////////////////////////////////////////////////////////////////////// 62 ////////////////////////////////////////////////////////////////////////////////
63 // 63 //
64 // MenuButton - Public APIs 64 // MenuButton - Public APIs
65 // 65 //
66 //////////////////////////////////////////////////////////////////////////////// 66 ////////////////////////////////////////////////////////////////////////////////
67 67
68 void MenuButton::GetPreferredSize(CSize* result) { 68 gfx::Size MenuButton::GetPreferredSize() {
69 TextButton::GetPreferredSize(result); 69 gfx::Size prefsize = TextButton::GetPreferredSize();
70 if (show_menu_marker_) { 70 if (show_menu_marker_) {
71 result->cx += kMenuMarker->width() + kMenuMarkerPaddingLeft + 71 prefsize.Enlarge(kMenuMarker->width() + kMenuMarkerPaddingLeft +
72 kMenuMarkerPaddingRight; 72 kMenuMarkerPaddingRight,
73 0);
73 } 74 }
75 return prefsize;
74 } 76 }
75 77
76 void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) { 78 void MenuButton::Paint(ChromeCanvas* canvas, bool for_drag) {
77 TextButton::Paint(canvas, for_drag); 79 TextButton::Paint(canvas, for_drag);
78 80
79 if (show_menu_marker_) { 81 if (show_menu_marker_) {
80 gfx::Insets insets = GetInsets(); 82 gfx::Insets insets = GetInsets();
81 83
82 // We can not use the ChromeViews' mirroring infrastructure for mirroring 84 // We can not use the ChromeViews' mirroring infrastructure for mirroring
83 // a MenuButton control (see TextButton::Paint() for a detailed 85 // a MenuButton control (see TextButton::Paint() for a detailed
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // cause the button to appear depressed while the menu is displayed. 251 // cause the button to appear depressed while the menu is displayed.
250 void MenuButton::OnMouseExited(const MouseEvent& event) { 252 void MenuButton::OnMouseExited(const MouseEvent& event) {
251 using namespace ChromeViews; 253 using namespace ChromeViews;
252 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) { 254 if ((state_ != BS_DISABLED) && (!menu_visible_) && (!InDrag())) {
253 SetState(BS_NORMAL); 255 SetState(BS_NORMAL);
254 } 256 }
255 } 257 }
256 258
257 } // namespace ChromeViews 259 } // namespace ChromeViews
258 260
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698