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

Side by Side Diff: ui/views/controls/image_view.cc

Issue 11068012: Add new views::LabelButton and LabelButtonBorder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove stray semicolon. Created 8 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
« no previous file with comments | « ui/views/controls/image_view.h ('k') | ui/views/controls/label.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/image_view.h" 5 #include "ui/views/controls/image_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "third_party/skia/include/core/SkPaint.h" 9 #include "third_party/skia/include/core/SkPaint.h"
10 #include "ui/base/accessibility/accessible_view_state.h" 10 #include "ui/base/accessibility/accessible_view_state.h"
11 #include "ui/gfx/canvas.h" 11 #include "ui/gfx/canvas.h"
12 #include "ui/gfx/insets.h" 12 #include "ui/gfx/insets.h"
13 13
14 namespace views { 14 namespace views {
15 15
16 ImageView::ImageView() 16 ImageView::ImageView()
17 : image_size_set_(false), 17 : image_size_set_(false),
18 horiz_alignment_(CENTER), 18 horiz_alignment_(CENTER),
19 vert_alignment_(CENTER) { 19 vert_alignment_(CENTER),
20 interactive_(true) {
20 } 21 }
21 22
22 ImageView::~ImageView() { 23 ImageView::~ImageView() {
23 } 24 }
24 25
25 void ImageView::SetImage(const gfx::ImageSkia& img) { 26 void ImageView::SetImage(const gfx::ImageSkia& img) {
26 gfx::Size pref_size(GetPreferredSize()); 27 gfx::Size pref_size(GetPreferredSize());
27 image_ = img; 28 image_ = img;
28 if (pref_size != GetPreferredSize()) 29 if (pref_size != GetPreferredSize())
29 PreferredSizeChanged(); 30 PreferredSizeChanged();
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 166 }
166 167
167 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const { 168 bool ImageView::GetTooltipText(const gfx::Point& p, string16* tooltip) const {
168 if (tooltip_text_.empty()) 169 if (tooltip_text_.empty())
169 return false; 170 return false;
170 171
171 *tooltip = GetTooltipText(); 172 *tooltip = GetTooltipText();
172 return true; 173 return true;
173 } 174 }
174 175
176 bool ImageView::HitTestRect(const gfx::Rect& rect) const {
177 return interactive_ ? View::HitTestRect(rect) : false;
178 }
179
175 } // namespace views 180 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/image_view.h ('k') | ui/views/controls/label.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698