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_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 | 7 |
8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ui/gfx/image/image_skia.h" | 10 #include "ui/gfx/image/image_skia.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // A toggle-able ImageButton. It swaps out its graphics when toggled. | 102 // A toggle-able ImageButton. It swaps out its graphics when toggled. |
103 // | 103 // |
104 //////////////////////////////////////////////////////////////////////////////// | 104 //////////////////////////////////////////////////////////////////////////////// |
105 class VIEWS_EXPORT ToggleImageButton : public ImageButton { | 105 class VIEWS_EXPORT ToggleImageButton : public ImageButton { |
106 public: | 106 public: |
107 explicit ToggleImageButton(ButtonListener* listener); | 107 explicit ToggleImageButton(ButtonListener* listener); |
108 virtual ~ToggleImageButton(); | 108 virtual ~ToggleImageButton(); |
109 | 109 |
110 // Change the toggled state. | 110 // Change the toggled state. |
111 void SetToggled(bool toggled); | 111 void SetToggled(bool toggled); |
| 112 bool toggled() const { return toggled_; } |
112 | 113 |
113 // Like ImageButton::SetImage(), but to set the graphics used for the | 114 // Like ImageButton::SetImage(), but to set the graphics used for the |
114 // "has been toggled" state. Must be called for each button state | 115 // "has been toggled" state. Must be called for each button state |
115 // before the button is toggled. | 116 // before the button is toggled. |
116 void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); | 117 void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); |
117 | 118 |
118 // Set the tooltip text displayed when the button is toggled. | 119 // Set the tooltip text displayed when the button is toggled. |
119 void SetToggledTooltipText(const string16& tooltip); | 120 void SetToggledTooltipText(const string16& tooltip); |
120 | 121 |
121 // Overridden from ImageButton: | 122 // Overridden from ImageButton: |
(...skipping 18 matching lines...) Expand all Loading... |
140 // The parent class's tooltip_text_ is displayed when not toggled, and | 141 // The parent class's tooltip_text_ is displayed when not toggled, and |
141 // this one is shown when toggled. | 142 // this one is shown when toggled. |
142 string16 toggled_tooltip_text_; | 143 string16 toggled_tooltip_text_; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); | 145 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); |
145 }; | 146 }; |
146 | 147 |
147 } // namespace views | 148 } // namespace views |
148 | 149 |
149 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 150 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
OLD | NEW |