| OLD | NEW |
| 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 #ifndef UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ | 5 #ifndef UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| 6 #define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ | 6 #define UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
| 10 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 11 | 11 |
| 12 namespace gfx { | 12 namespace gfx { |
| 13 class Canvas; | 13 class CanvasSkia; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace views { | 16 namespace views { |
| 17 | 17 |
| 18 ///////////////////////////////////////////////////////////////////////////// | 18 ///////////////////////////////////////////////////////////////////////////// |
| 19 // | 19 // |
| 20 // ImageView class. | 20 // ImageView class. |
| 21 // | 21 // |
| 22 // An ImageView can display an image from an SkBitmap. If a size is provided, | 22 // An ImageView can display an image from an SkBitmap. If a size is provided, |
| 23 // the ImageView will resize the provided image to fit if it is too big or will | 23 // the ImageView will resize the provided image to fit if it is too big or will |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // Set / Get the vertical alignment. | 69 // Set / Get the vertical alignment. |
| 70 void SetVerticalAlignment(Alignment va); | 70 void SetVerticalAlignment(Alignment va); |
| 71 Alignment GetVerticalAlignment() const; | 71 Alignment GetVerticalAlignment() const; |
| 72 | 72 |
| 73 // Set / Get the tooltip text. | 73 // Set / Get the tooltip text. |
| 74 void SetTooltipText(const string16& tooltip); | 74 void SetTooltipText(const string16& tooltip); |
| 75 string16 GetTooltipText() const; | 75 string16 GetTooltipText() const; |
| 76 | 76 |
| 77 // Overriden from View | 77 // Overriden from View |
| 78 virtual gfx::Size GetPreferredSize() OVERRIDE; | 78 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 79 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 79 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 80 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 80 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 81 virtual bool GetTooltipText(const gfx::Point& p, | 81 virtual bool GetTooltipText(const gfx::Point& p, |
| 82 string16* tooltip) const OVERRIDE; | 82 string16* tooltip) const OVERRIDE; |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 // Compute the image origin given the desired size and the receiver alignment | 85 // Compute the image origin given the desired size and the receiver alignment |
| 86 // properties. | 86 // properties. |
| 87 gfx::Point ComputeImageOrigin(const gfx::Size& image_size) const; | 87 gfx::Point ComputeImageOrigin(const gfx::Size& image_size) const; |
| 88 | 88 |
| 89 // Whether the image size is set. | 89 // Whether the image size is set. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 103 | 103 |
| 104 // The current tooltip text. | 104 // The current tooltip text. |
| 105 string16 tooltip_text_; | 105 string16 tooltip_text_; |
| 106 | 106 |
| 107 DISALLOW_COPY_AND_ASSIGN(ImageView); | 107 DISALLOW_COPY_AND_ASSIGN(ImageView); |
| 108 }; | 108 }; |
| 109 | 109 |
| 110 } // namespace views | 110 } // namespace views |
| 111 | 111 |
| 112 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ | 112 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| OLD | NEW |