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

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

Issue 9562038: ui/gfx: Make gfx::Canvas inherit from gfx::CanvasSkia. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more fixes Created 8 years, 9 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) 2011 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/utf_string_conversions.h" 7 #include "base/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"
11 #include "ui/base/dragdrop/drag_drop_types.h" 11 #include "ui/base/dragdrop/drag_drop_types.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 SetState(BS_NORMAL); 129 SetState(BS_NORMAL);
130 130
131 // We must return false here so that the RootView does not get stuck 131 // We must return false here so that the RootView does not get stuck
132 // sending all mouse pressed events to us instead of the appropriate 132 // sending all mouse pressed events to us instead of the appropriate
133 // target. 133 // target.
134 return false; 134 return false;
135 } 135 }
136 return true; 136 return true;
137 } 137 }
138 138
139 void MenuButton::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) { 139 void MenuButton::PaintButton(gfx::CanvasSkia* canvas, PaintButtonMode mode) {
140 TextButton::PaintButton(canvas, mode); 140 TextButton::PaintButton(canvas, mode);
141 141
142 if (show_menu_marker_) { 142 if (show_menu_marker_) {
143 gfx::Insets insets = GetInsets(); 143 gfx::Insets insets = GetInsets();
144 144
145 // We can not use the views' mirroring infrastructure for mirroring a 145 // We can not use the views' mirroring infrastructure for mirroring a
146 // MenuButton control (see TextButton::OnPaint() for a detailed explanation 146 // MenuButton control (see TextButton::OnPaint() for a detailed explanation
147 // regarding why we can not flip the canvas). Therefore, we need to 147 // regarding why we can not flip the canvas). Therefore, we need to
148 // manually mirror the position of the down arrow. 148 // manually mirror the position of the down arrow.
149 gfx::Rect arrow_bounds(width() - insets.right() - 149 gfx::Rect arrow_bounds(width() - insets.right() -
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 if (!GetWidget()) { 254 if (!GetWidget()) {
255 NOTREACHED(); 255 NOTREACHED();
256 return 0; 256 return 0;
257 } 257 }
258 258
259 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen(); 259 gfx::Rect monitor_bounds = GetWidget()->GetWorkAreaBoundsInScreen();
260 return monitor_bounds.right() - 1; 260 return monitor_bounds.right() - 1;
261 } 261 }
262 262
263 } // namespace views 263 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698