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/base/layout.h" | 10 #include "ui/base/layout.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Change the toggled state. | 139 // Change the toggled state. |
140 void SetToggled(bool toggled); | 140 void SetToggled(bool toggled); |
141 | 141 |
142 // Like ImageButton::SetImage(), but to set the graphics used for the | 142 // Like ImageButton::SetImage(), but to set the graphics used for the |
143 // "has been toggled" state. Must be called for each button state | 143 // "has been toggled" state. Must be called for each button state |
144 // before the button is toggled. | 144 // before the button is toggled. |
145 void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); | 145 void SetToggledImage(ButtonState state, const gfx::ImageSkia* image); |
146 | 146 |
147 // Set the tooltip text displayed when the button is toggled. | 147 // Set the tooltip text displayed when the button is toggled. |
148 void SetToggledTooltipText(const string16& tooltip); | 148 void SetToggledTooltipText(const base::string16& tooltip); |
149 | 149 |
150 // Overridden from ImageButton: | 150 // Overridden from ImageButton: |
151 virtual const gfx::ImageSkia& GetImage(ButtonState state) const OVERRIDE; | 151 virtual const gfx::ImageSkia& GetImage(ButtonState state) const OVERRIDE; |
152 virtual void SetImage(ButtonState state, | 152 virtual void SetImage(ButtonState state, |
153 const gfx::ImageSkia* image) OVERRIDE; | 153 const gfx::ImageSkia* image) OVERRIDE; |
154 | 154 |
155 // Overridden from View: | 155 // Overridden from View: |
156 virtual bool GetTooltipText(const gfx::Point& p, | 156 virtual bool GetTooltipText(const gfx::Point& p, |
157 string16* tooltip) const OVERRIDE; | 157 base::string16* tooltip) const OVERRIDE; |
158 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 158 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
159 | 159 |
160 private: | 160 private: |
161 // The parent class's images_ member is used for the current images, | 161 // The parent class's images_ member is used for the current images, |
162 // and this array is used to hold the alternative images. | 162 // and this array is used to hold the alternative images. |
163 // We swap between the two when toggling. | 163 // We swap between the two when toggling. |
164 gfx::ImageSkia alternate_images_[STATE_COUNT]; | 164 gfx::ImageSkia alternate_images_[STATE_COUNT]; |
165 | 165 |
166 // True if the button is currently toggled. | 166 // True if the button is currently toggled. |
167 bool toggled_; | 167 bool toggled_; |
168 | 168 |
169 // The parent class's tooltip_text_ is displayed when not toggled, and | 169 // The parent class's tooltip_text_ is displayed when not toggled, and |
170 // this one is shown when toggled. | 170 // this one is shown when toggled. |
171 string16 toggled_tooltip_text_; | 171 base::string16 toggled_tooltip_text_; |
172 | 172 |
173 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); | 173 DISALLOW_COPY_AND_ASSIGN(ToggleImageButton); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace views | 176 } // namespace views |
177 | 177 |
178 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ | 178 #endif // UI_VIEWS_CONTROLS_BUTTON_IMAGE_BUTTON_H_ |
OLD | NEW |