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_TEXT_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 | 153 |
154 void SetEnabledColor(SkColor color); | 154 void SetEnabledColor(SkColor color); |
155 void SetDisabledColor(SkColor color); | 155 void SetDisabledColor(SkColor color); |
156 void SetHighlightColor(SkColor color); | 156 void SetHighlightColor(SkColor color); |
157 void SetHoverColor(SkColor color); | 157 void SetHoverColor(SkColor color); |
158 void SetTextHaloColor(SkColor color); | 158 void SetTextHaloColor(SkColor color); |
159 // The shadow color used is determined by whether the widget is active or | 159 // The shadow color used is determined by whether the widget is active or |
160 // inactive. Both possible colors are set in this method, and the | 160 // inactive. Both possible colors are set in this method, and the |
161 // appropriate one is chosen during Paint. | 161 // appropriate one is chosen during Paint. |
162 void SetTextShadowColors(SkColor active_color, SkColor inactive_color); | 162 void SetTextShadowColors(SkColor active_color, SkColor inactive_color); |
| 163 void SetTextShadowOffset(int x, int y); |
163 | 164 |
164 bool normal_has_border() const { return normal_has_border_; } | 165 bool normal_has_border() const { return normal_has_border_; } |
165 void SetNormalHasBorder(bool normal_has_border); | 166 void SetNormalHasBorder(bool normal_has_border); |
166 | 167 |
167 // Sets whether or not to show the hot and pushed states for the button icon | 168 // Sets whether or not to show the hot and pushed states for the button icon |
168 // (if present) in addition to the normal state. Defaults to true. | 169 // (if present) in addition to the normal state. Defaults to true. |
169 bool show_multiple_icon_states() const { return show_multiple_icon_states_; } | 170 bool show_multiple_icon_states() const { return show_multiple_icon_states_; } |
170 void SetShowMultipleIconStates(bool show_multiple_icon_states); | 171 void SetShowMultipleIconStates(bool show_multiple_icon_states); |
171 | 172 |
| 173 // Clears halo and shadow settings. |
| 174 void ClearEmbellishing(); |
| 175 |
172 // Paint the button into the specified canvas. If |mode| is |PB_FOR_DRAG|, the | 176 // Paint the button into the specified canvas. If |mode| is |PB_FOR_DRAG|, the |
173 // function paints a drag image representation into the canvas. | 177 // function paints a drag image representation into the canvas. |
174 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG }; | 178 enum PaintButtonMode { PB_NORMAL, PB_FOR_DRAG }; |
175 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode); | 179 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode); |
176 | 180 |
177 // Overridden from View: | 181 // Overridden from View: |
178 virtual gfx::Size GetPreferredSize() OVERRIDE; | 182 virtual gfx::Size GetPreferredSize() OVERRIDE; |
179 virtual gfx::Size GetMinimumSize() OVERRIDE; | 183 virtual gfx::Size GetMinimumSize() OVERRIDE; |
180 virtual void SetEnabled(bool enabled) OVERRIDE; | 184 virtual void SetEnabled(bool enabled) OVERRIDE; |
181 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 185 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 SkColor color_hover_; | 244 SkColor color_hover_; |
241 | 245 |
242 // An optional halo around text. | 246 // An optional halo around text. |
243 SkColor text_halo_color_; | 247 SkColor text_halo_color_; |
244 bool has_text_halo_; | 248 bool has_text_halo_; |
245 | 249 |
246 // Optional shadow text colors for active and inactive widget states. | 250 // Optional shadow text colors for active and inactive widget states. |
247 SkColor active_text_shadow_color_; | 251 SkColor active_text_shadow_color_; |
248 SkColor inactive_text_shadow_color_; | 252 SkColor inactive_text_shadow_color_; |
249 bool has_shadow_; | 253 bool has_shadow_; |
| 254 // Space between text and shadow. Defaults to (1,1). |
| 255 gfx::Point shadow_offset_; |
250 | 256 |
251 // The width of the button will never be larger than this value. A value <= 0 | 257 // The width of the button will never be larger than this value. A value <= 0 |
252 // indicates the width is not constrained. | 258 // indicates the width is not constrained. |
253 int max_width_; | 259 int max_width_; |
254 | 260 |
255 // This is true if normal state has a border frame; default is false. | 261 // This is true if normal state has a border frame; default is false. |
256 bool normal_has_border_; | 262 bool normal_has_border_; |
257 | 263 |
258 // Whether or not to show the hot and pushed icon states. | 264 // Whether or not to show the hot and pushed icon states. |
259 bool show_multiple_icon_states_; | 265 bool show_multiple_icon_states_; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 347 |
342 // Space between icon and text. | 348 // Space between icon and text. |
343 int icon_text_spacing_; | 349 int icon_text_spacing_; |
344 | 350 |
345 DISALLOW_COPY_AND_ASSIGN(TextButton); | 351 DISALLOW_COPY_AND_ASSIGN(TextButton); |
346 }; | 352 }; |
347 | 353 |
348 } // namespace views | 354 } // namespace views |
349 | 355 |
350 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 356 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
OLD | NEW |