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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // Returns the image currently displayed or NULL of none is currently set. | 48 // Returns the image currently displayed or NULL of none is currently set. |
49 // The returned image is still owned by the ImageView. | 49 // The returned image is still owned by the ImageView. |
50 const gfx::ImageSkia& GetImage(); | 50 const gfx::ImageSkia& GetImage(); |
51 | 51 |
52 // Set the desired image size for the receiving ImageView. | 52 // Set the desired image size for the receiving ImageView. |
53 void SetImageSize(const gfx::Size& image_size); | 53 void SetImageSize(const gfx::Size& image_size); |
54 | 54 |
55 // Return the preferred size for the receiving view. Returns false if the | 55 // Return the preferred size for the receiving view. Returns false if the |
56 // preferred size is not defined, which means that the view uses the image | 56 // preferred size is not defined, which means that the view uses the image |
57 // size. | 57 // size. |
58 bool GetImageSize(gfx::Size* image_size); | 58 bool GetImageSize(gfx::Size* image_size) const; |
59 | 59 |
60 // Returns the actual bounds of the visible image inside the view. | 60 // Returns the actual bounds of the visible image inside the view. |
61 gfx::Rect GetImageBounds() const; | 61 gfx::Rect GetImageBounds() const; |
62 | 62 |
63 // Reset the image size to the current image dimensions. | 63 // Reset the image size to the current image dimensions. |
64 void ResetImageSize(); | 64 void ResetImageSize(); |
65 | 65 |
66 // Set / Get the horizontal alignment. | 66 // Set / Get the horizontal alignment. |
67 void SetHorizontalAlignment(Alignment ha); | 67 void SetHorizontalAlignment(Alignment ha); |
68 Alignment GetHorizontalAlignment() const; | 68 Alignment GetHorizontalAlignment() const; |
69 | 69 |
70 // Set / Get the vertical alignment. | 70 // Set / Get the vertical alignment. |
71 void SetVerticalAlignment(Alignment va); | 71 void SetVerticalAlignment(Alignment va); |
72 Alignment GetVerticalAlignment() const; | 72 Alignment GetVerticalAlignment() const; |
73 | 73 |
74 // Set / Get the tooltip text. | 74 // Set / Get the tooltip text. |
75 void SetTooltipText(const base::string16& tooltip); | 75 void SetTooltipText(const base::string16& tooltip); |
76 base::string16 GetTooltipText() const; | 76 base::string16 GetTooltipText() const; |
77 | 77 |
78 void set_interactive(bool interactive) { interactive_ = interactive; } | 78 void set_interactive(bool interactive) { interactive_ = interactive; } |
79 | 79 |
80 void SetFocusPainter(scoped_ptr<Painter> focus_painter); | 80 void SetFocusPainter(scoped_ptr<Painter> focus_painter); |
81 | 81 |
82 // Overriden from View: | 82 // Overriden from View: |
83 virtual gfx::Size GetPreferredSize() OVERRIDE; | 83 virtual gfx::Size GetPreferredSize() const OVERRIDE; |
84 virtual void OnFocus() OVERRIDE; | 84 virtual void OnFocus() OVERRIDE; |
85 virtual void OnBlur() OVERRIDE; | 85 virtual void OnBlur() OVERRIDE; |
86 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 86 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
87 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 87 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; |
88 virtual bool GetTooltipText(const gfx::Point& p, | 88 virtual bool GetTooltipText(const gfx::Point& p, |
89 base::string16* tooltip) const OVERRIDE; | 89 base::string16* tooltip) const OVERRIDE; |
90 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 90 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; |
91 | 91 |
92 private: | 92 private: |
93 void OnPaintImage(gfx::Canvas* canvas); | 93 void OnPaintImage(gfx::Canvas* canvas); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void* last_painted_bitmap_pixels_; | 130 void* last_painted_bitmap_pixels_; |
131 | 131 |
132 scoped_ptr<views::Painter> focus_painter_; | 132 scoped_ptr<views::Painter> focus_painter_; |
133 | 133 |
134 DISALLOW_COPY_AND_ASSIGN(ImageView); | 134 DISALLOW_COPY_AND_ASSIGN(ImageView); |
135 }; | 135 }; |
136 | 136 |
137 } // namespace views | 137 } // namespace views |
138 | 138 |
139 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ | 139 #endif // UI_VIEWS_CONTROLS_IMAGE_VIEW_H_ |
OLD | NEW |