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

Side by Side Diff: ui/views/controls/button/menu_button.cc

Issue 59383003: Add the button style for combobox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/controls/button/menu_button.h" 5 #include "ui/views/controls/button/menu_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "grit/ui_resources.h" 8 #include "grit/ui_resources.h"
9 #include "grit/ui_strings.h" 9 #include "grit/ui_strings.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 //////////////////////////////////////////////////////////////////////////////// 143 ////////////////////////////////////////////////////////////////////////////////
144 // 144 //
145 // MenuButton - Events 145 // MenuButton - Events
146 // 146 //
147 //////////////////////////////////////////////////////////////////////////////// 147 ////////////////////////////////////////////////////////////////////////////////
148 148
149 gfx::Size MenuButton::GetPreferredSize() { 149 gfx::Size MenuButton::GetPreferredSize() {
150 gfx::Size prefsize = TextButton::GetPreferredSize(); 150 gfx::Size prefsize = TextButton::GetPreferredSize();
151 if (show_menu_marker_) { 151 if (show_menu_marker_) {
152 prefsize.Enlarge(menu_marker_->width() + kMenuMarkerPaddingLeft + 152 int width = menu_marker_->width() + kMenuMarkerPaddingRight;
153 kMenuMarkerPaddingRight, 153 if (!text().empty())
154 0); 154 width += kMenuMarkerPaddingLeft;
155 prefsize.Enlarge(width, 0);
155 } 156 }
156 return prefsize; 157 return prefsize;
157 } 158 }
158 159
159 const char* MenuButton::GetClassName() const { 160 const char* MenuButton::GetClassName() const {
160 return kViewClassName; 161 return kViewClassName;
161 } 162 }
162 163
163 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) { 164 bool MenuButton::OnMousePressed(const ui::MouseEvent& event) {
164 RequestFocus(); 165 RequestFocus();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 if (!GetWidget()) { 272 if (!GetWidget()) {
272 NOTREACHED(); 273 NOTREACHED();
273 return 0; 274 return 0;
274 } 275 }
275 276
276 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 277 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
277 return monitor_bounds.right() - 1; 278 return monitor_bounds.right() - 1;
278 } 279 }
279 280
280 } // namespace views 281 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698