| 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_BUTTON_IMAGE_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_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/controls/button/custom_button.h" | 10 #include "ui/views/controls/button/custom_button.h" |
| 11 | 11 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 37 enum VerticalAlignment { ALIGN_TOP = 0, | 37 enum VerticalAlignment { ALIGN_TOP = 0, |
| 38 ALIGN_MIDDLE, | 38 ALIGN_MIDDLE, |
| 39 ALIGN_BOTTOM }; | 39 ALIGN_BOTTOM }; |
| 40 | 40 |
| 41 // Sets how the image is laid out within the button's bounds. | 41 // Sets how the image is laid out within the button's bounds. |
| 42 void SetImageAlignment(HorizontalAlignment h_align, | 42 void SetImageAlignment(HorizontalAlignment h_align, |
| 43 VerticalAlignment v_align); | 43 VerticalAlignment v_align); |
| 44 | 44 |
| 45 // Overridden from View: | 45 // Overridden from View: |
| 46 virtual gfx::Size GetPreferredSize() OVERRIDE; | 46 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 47 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 47 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
| 48 | 48 |
| 49 // Sets preferred size, so it could be correctly positioned in layout even if | 49 // Sets preferred size, so it could be correctly positioned in layout even if |
| 50 // it is NULL. | 50 // it is NULL. |
| 51 void SetPreferredSize(const gfx::Size& preferred_size) { | 51 void SetPreferredSize(const gfx::Size& preferred_size) { |
| 52 preferred_size_ = preferred_size; | 52 preferred_size_ = preferred_size; |
| 53 } | 53 } |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 // Returns the image to paint. This is invoked from paint and returns a value | 56 // Returns the image to paint. This is invoked from paint and returns a value |
| 57 // from images. | 57 // from images. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 // The parent class's tooltip_text_ is displayed when not toggled, and | 114 // The parent class's tooltip_text_ is displayed when not toggled, and |
| 115 // this one is shown when toggled. | 115 // this one is shown when toggled. |
| 116 string16 toggled_tooltip_text_; | 116 string16 toggled_tooltip_text_; |
| 117 | 117 |
| 118 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); | 118 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 } // namespace views | 121 } // namespace views |
| 122 | 122 |
| 123 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 123 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
| OLD | NEW |