| OLD | NEW |
| 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 #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 | 7 |
| 8 #include "ui/gfx/image/image_skia.h" | 8 #include "ui/gfx/image/image_skia.h" |
| 9 #include "ui/views/view.h" | 9 #include "ui/views/view.h" |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 Alignment GetHorizontalAlignment() const; | 66 Alignment GetHorizontalAlignment() const; |
| 67 | 67 |
| 68 // Set / Get the vertical alignment. | 68 // Set / Get the vertical alignment. |
| 69 void SetVerticalAlignment(Alignment va); | 69 void SetVerticalAlignment(Alignment va); |
| 70 Alignment GetVerticalAlignment() const; | 70 Alignment GetVerticalAlignment() const; |
| 71 | 71 |
| 72 // Set / Get the tooltip text. | 72 // Set / Get the tooltip text. |
| 73 void SetTooltipText(const string16& tooltip); | 73 void SetTooltipText(const string16& tooltip); |
| 74 string16 GetTooltipText() const; | 74 string16 GetTooltipText() const; |
| 75 | 75 |
| 76 // Overriden from View | 76 void set_interactive(bool interactive) { interactive_ = interactive; } |
| 77 |
| 78 // Overriden from View: |
| 77 virtual gfx::Size GetPreferredSize() OVERRIDE; | 79 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 78 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 80 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
| 79 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 81 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
| 80 virtual bool GetTooltipText(const gfx::Point& p, | 82 virtual bool GetTooltipText(const gfx::Point& p, |
| 81 string16* tooltip) const OVERRIDE; | 83 string16* tooltip) const OVERRIDE; |
| 84 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
| 82 | 85 |
| 83 private: | 86 private: |
| 84 // Compute the image origin given the desired size and the receiver alignment | 87 // Compute the image origin given the desired size and the receiver alignment |
| 85 // properties. | 88 // properties. |
| 86 gfx::Point ComputeImageOrigin(const gfx::Size& image_size) const; | 89 gfx::Point ComputeImageOrigin(const gfx::Size& image_size) const; |
| 87 | 90 |
| 88 // Whether the image size is set. | 91 // Whether the image size is set. |
| 89 bool image_size_set_; | 92 bool image_size_set_; |
| 90 | 93 |
| 91 // The actual image size. | 94 // The actual image size. |
| 92 gfx::Size image_size_; | 95 gfx::Size image_size_; |
| 93 | 96 |
| 94 // The underlying image. | 97 // The underlying image. |
| 95 gfx::ImageSkia image_; | 98 gfx::ImageSkia image_; |
| 96 | 99 |
| 97 // Horizontal alignment. | 100 // Horizontal alignment. |
| 98 Alignment horiz_alignment_; | 101 Alignment horiz_alignment_; |
| 99 | 102 |
| 100 // Vertical alignment. | 103 // Vertical alignment. |
| 101 Alignment vert_alignment_; | 104 Alignment vert_alignment_; |
| 102 | 105 |
| 103 // The current tooltip text. | 106 // The current tooltip text. |
| 104 string16 tooltip_text_; | 107 string16 tooltip_text_; |
| 105 | 108 |
| 109 // A flag controlling hit test handling for interactivity. |
| 110 bool interactive_; |
| 111 |
| 106 DISALLOW_COPY_AND_ASSIGN(ImageView); | 112 DISALLOW_COPY_AND_ASSIGN(ImageView); |
| 107 }; | 113 }; |
| 108 | 114 |
| 109 } // namespace views | 115 } // namespace views |
| 110 | 116 |
| 111 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ | 117 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
| OLD | NEW |