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

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

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 years, 7 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
« no previous file with comments | « ui/views/controls/button/image_button.h ('k') | ui/views/controls/button/label_button.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) 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/image_button.h" 5 #include "ui/views/controls/button/image_button.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "ui/accessibility/ax_view_state.h" 8 #include "ui/accessibility/ax_view_state.h"
9 #include "ui/gfx/animation/throb_animation.h" 9 #include "ui/gfx/animation/throb_animation.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 SchedulePaint(); 67 SchedulePaint();
68 } 68 }
69 69
70 void ImageButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) { 70 void ImageButton::SetFocusPainter(scoped_ptr<Painter> focus_painter) {
71 focus_painter_ = focus_painter.Pass(); 71 focus_painter_ = focus_painter.Pass();
72 } 72 }
73 73
74 //////////////////////////////////////////////////////////////////////////////// 74 ////////////////////////////////////////////////////////////////////////////////
75 // ImageButton, View overrides: 75 // ImageButton, View overrides:
76 76
77 gfx::Size ImageButton::GetPreferredSize() { 77 gfx::Size ImageButton::GetPreferredSize() const {
78 gfx::Size size = preferred_size_; 78 gfx::Size size = preferred_size_;
79 if (!images_[STATE_NORMAL].isNull()) { 79 if (!images_[STATE_NORMAL].isNull()) {
80 size = gfx::Size(images_[STATE_NORMAL].width(), 80 size = gfx::Size(images_[STATE_NORMAL].width(),
81 images_[STATE_NORMAL].height()); 81 images_[STATE_NORMAL].height());
82 } 82 }
83 83
84 gfx::Insets insets = GetInsets(); 84 gfx::Insets insets = GetInsets();
85 size.Enlarge(insets.width(), insets.height()); 85 size.Enlarge(insets.width(), insets.height());
86 return size; 86 return size;
87 } 87 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 *tooltip = toggled_tooltip_text_; 245 *tooltip = toggled_tooltip_text_;
246 return true; 246 return true;
247 } 247 }
248 248
249 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) { 249 void ToggleImageButton::GetAccessibleState(ui::AXViewState* state) {
250 ImageButton::GetAccessibleState(state); 250 ImageButton::GetAccessibleState(state);
251 GetTooltipText(gfx::Point(), &state->name); 251 GetTooltipText(gfx::Point(), &state->name);
252 } 252 }
253 253
254 } // namespace views 254 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/button/image_button.h ('k') | ui/views/controls/button/label_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698