OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
6 #define VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 6 #define 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 "views/controls/button/custom_button.h" | 10 #include "views/controls/button/custom_button.h" |
11 | 11 |
12 namespace views { | 12 namespace views { |
13 | 13 |
14 // An image button. | 14 // An image button. |
15 | 15 |
16 // Note that this type of button is not focusable by default and will not be | 16 // Note that this type of button is not focusable by default and will not be |
17 // part of the focus chain. Call set_focusable(true) to make it part of the | 17 // part of the focus chain. Call set_focusable(true) to make it part of the |
18 // focus chain. | 18 // focus chain. |
19 | 19 |
20 class VIEWS_API ImageButton : public CustomButton { | 20 class VIEWS_EXPORT ImageButton : public CustomButton { |
21 public: | 21 public: |
22 explicit ImageButton(ButtonListener* listener); | 22 explicit ImageButton(ButtonListener* listener); |
23 virtual ~ImageButton(); | 23 virtual ~ImageButton(); |
24 | 24 |
25 // Set the image the button should use for the provided state. | 25 // Set the image the button should use for the provided state. |
26 virtual void SetImage(ButtonState aState, const SkBitmap* anImage); | 26 virtual void SetImage(ButtonState aState, const SkBitmap* anImage); |
27 | 27 |
28 // Set the background details. | 28 // Set the background details. |
29 void SetBackground(SkColor color, | 29 void SetBackground(SkColor color, |
30 const SkBitmap* image, | 30 const SkBitmap* image, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 DISALLOW_COPY_AND_ASSIGN(ImageButton); | 72 DISALLOW_COPY_AND_ASSIGN(ImageButton); |
73 }; | 73 }; |
74 | 74 |
75 //////////////////////////////////////////////////////////////////////////////// | 75 //////////////////////////////////////////////////////////////////////////////// |
76 // | 76 // |
77 // ToggleImageButton | 77 // ToggleImageButton |
78 // | 78 // |
79 // A toggle-able ImageButton. It swaps out its graphics when toggled. | 79 // A toggle-able ImageButton. It swaps out its graphics when toggled. |
80 // | 80 // |
81 //////////////////////////////////////////////////////////////////////////////// | 81 //////////////////////////////////////////////////////////////////////////////// |
82 class VIEWS_API ToggleImageButton : public ImageButton { | 82 class VIEWS_EXPORT ToggleImageButton : public ImageButton { |
83 public: | 83 public: |
84 explicit ToggleImageButton(ButtonListener* listener); | 84 explicit ToggleImageButton(ButtonListener* listener); |
85 virtual ~ToggleImageButton(); | 85 virtual ~ToggleImageButton(); |
86 | 86 |
87 // Change the toggled state. | 87 // Change the toggled state. |
88 void SetToggled(bool toggled); | 88 void SetToggled(bool toggled); |
89 | 89 |
90 // Like ImageButton::SetImage(), but to set the graphics used for the | 90 // Like ImageButton::SetImage(), but to set the graphics used for the |
91 // "has been toggled" state. Must be called for each button state | 91 // "has been toggled" state. Must be called for each button state |
92 // before the button is toggled. | 92 // before the button is toggled. |
(...skipping 20 matching lines...) Expand all Loading... |
113 // The parent class's tooltip_text_ is displayed when not toggled, and | 113 // The parent class's tooltip_text_ is displayed when not toggled, and |
114 // this one is shown when toggled. | 114 // this one is shown when toggled. |
115 string16 toggled_tooltip_text_; | 115 string16 toggled_tooltip_text_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); | 117 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace views | 120 } // namespace views |
121 | 121 |
122 #endif // VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 122 #endif // VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
OLD | NEW |