| 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_TEXT_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 void SetMultiLine(bool multi_line); | 163 void SetMultiLine(bool multi_line); |
| 164 | 164 |
| 165 // Return whether the button text can wrap on multiple lines. | 165 // Return whether the button text can wrap on multiple lines. |
| 166 bool multi_line() const { return multi_line_; } | 166 bool multi_line() const { return multi_line_; } |
| 167 | 167 |
| 168 // TextButton remembers the maximum display size of the text passed to | 168 // TextButton remembers the maximum display size of the text passed to |
| 169 // SetText. This method resets the cached maximum display size to the | 169 // SetText. This method resets the cached maximum display size to the |
| 170 // current size. | 170 // current size. |
| 171 void ClearMaxTextSize(); | 171 void ClearMaxTextSize(); |
| 172 | 172 |
| 173 void set_min_width(int min_width) { min_width_ = min_width; } |
| 174 void set_min_height(int min_height) { min_height_ = min_height; } |
| 173 void set_max_width(int max_width) { max_width_ = max_width; } | 175 void set_max_width(int max_width) { max_width_ = max_width; } |
| 174 void SetFont(const gfx::Font& font); | 176 void SetFont(const gfx::Font& font); |
| 175 // Return the font used by this button. | 177 // Return the font used by this button. |
| 176 gfx::Font font() const { return font_; } | 178 gfx::Font font() const { return font_; } |
| 177 | 179 |
| 178 void SetEnabledColor(SkColor color); | 180 void SetEnabledColor(SkColor color); |
| 179 void SetDisabledColor(SkColor color); | 181 void SetDisabledColor(SkColor color); |
| 180 void SetHighlightColor(SkColor color); | 182 void SetHighlightColor(SkColor color); |
| 181 void SetHoverColor(SkColor color); | 183 void SetHoverColor(SkColor color); |
| 182 void SetTextHaloColor(SkColor color); | 184 void SetTextHaloColor(SkColor color); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 SkColor text_halo_color_; | 273 SkColor text_halo_color_; |
| 272 bool has_text_halo_; | 274 bool has_text_halo_; |
| 273 | 275 |
| 274 // Optional shadow text colors for active and inactive widget states. | 276 // Optional shadow text colors for active and inactive widget states. |
| 275 SkColor active_text_shadow_color_; | 277 SkColor active_text_shadow_color_; |
| 276 SkColor inactive_text_shadow_color_; | 278 SkColor inactive_text_shadow_color_; |
| 277 bool has_shadow_; | 279 bool has_shadow_; |
| 278 // Space between text and shadow. Defaults to (1,1). | 280 // Space between text and shadow. Defaults to (1,1). |
| 279 gfx::Point shadow_offset_; | 281 gfx::Point shadow_offset_; |
| 280 | 282 |
| 283 // The dimensions of the button will be at least these values. |
| 284 int min_width_; |
| 285 int min_height_; |
| 286 |
| 281 // The width of the button will never be larger than this value. A value <= 0 | 287 // The width of the button will never be larger than this value. A value <= 0 |
| 282 // indicates the width is not constrained. | 288 // indicates the width is not constrained. |
| 283 int max_width_; | 289 int max_width_; |
| 284 | 290 |
| 285 // Whether or not to show the hot and pushed icon states. | 291 // Whether or not to show the hot and pushed icon states. |
| 286 bool show_multiple_icon_states_; | 292 bool show_multiple_icon_states_; |
| 287 | 293 |
| 288 // Whether or not the button appears and behaves as the default button in its | 294 // Whether or not the button appears and behaves as the default button in its |
| 289 // current context. | 295 // current context. |
| 290 bool is_default_; | 296 bool is_default_; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 IconPlacement icon_placement() { return icon_placement_; } | 340 IconPlacement icon_placement() { return icon_placement_; } |
| 335 void set_icon_placement(IconPlacement icon_placement) { | 341 void set_icon_placement(IconPlacement icon_placement) { |
| 336 icon_placement_ = icon_placement; | 342 icon_placement_ = icon_placement; |
| 337 } | 343 } |
| 338 | 344 |
| 339 void set_ignore_minimum_size(bool ignore_minimum_size); | 345 void set_ignore_minimum_size(bool ignore_minimum_size); |
| 340 | 346 |
| 341 // Overridden from View: | 347 // Overridden from View: |
| 342 virtual gfx::Size GetPreferredSize() OVERRIDE; | 348 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 343 virtual std::string GetClassName() const OVERRIDE; | 349 virtual std::string GetClassName() const OVERRIDE; |
| 344 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | |
| 345 | 350 |
| 346 // Overridden from TextButtonBase: | 351 // Overridden from TextButtonBase: |
| 347 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; | 352 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; |
| 348 | 353 |
| 349 protected: | 354 protected: |
| 350 gfx::ImageSkia icon() const { return icon_; } | 355 gfx::ImageSkia icon() const { return icon_; } |
| 351 | 356 |
| 352 virtual const gfx::ImageSkia& GetImageToPaint() const; | 357 virtual const gfx::ImageSkia& GetImageToPaint() const; |
| 353 | 358 |
| 354 // Overridden from NativeThemeDelegate: | 359 // Overridden from NativeThemeDelegate: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 // | 398 // |
| 394 //////////////////////////////////////////////////////////////////////////////// | 399 //////////////////////////////////////////////////////////////////////////////// |
| 395 class VIEWS_EXPORT NativeTextButton : public TextButton { | 400 class VIEWS_EXPORT NativeTextButton : public TextButton { |
| 396 public: | 401 public: |
| 397 // The button's class name. | 402 // The button's class name. |
| 398 static const char kViewClassName[]; | 403 static const char kViewClassName[]; |
| 399 | 404 |
| 400 explicit NativeTextButton(ButtonListener* listener); | 405 explicit NativeTextButton(ButtonListener* listener); |
| 401 NativeTextButton(ButtonListener* listener, const string16& text); | 406 NativeTextButton(ButtonListener* listener, const string16& text); |
| 402 | 407 |
| 403 // Overridden from View: | |
| 404 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | |
| 405 | |
| 406 // Overridden from TextButton: | 408 // Overridden from TextButton: |
| 407 virtual gfx::Size GetMinimumSize() OVERRIDE; | 409 virtual gfx::Size GetMinimumSize() OVERRIDE; |
| 408 virtual std::string GetClassName() const OVERRIDE; | 410 virtual std::string GetClassName() const OVERRIDE; |
| 409 | 411 |
| 410 private: | 412 private: |
| 411 void Init(); | 413 void Init(); |
| 412 | 414 |
| 413 // Overridden from TextButton: | 415 // Overridden from TextButton: |
| 414 virtual void GetExtraParams( | 416 virtual void GetExtraParams( |
| 415 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 417 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 416 | 418 |
| 417 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); | 419 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); |
| 418 }; | 420 }; |
| 419 | 421 |
| 420 } // namespace views | 422 } // namespace views |
| 421 | 423 |
| 422 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 424 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| OLD | NEW |