| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // states change. | 177 // states change. |
| 178 virtual void UpdateColor(); | 178 virtual void UpdateColor(); |
| 179 | 179 |
| 180 // Updates text_size_ and max_text_size_ from the current text/font. This is | 180 // Updates text_size_ and max_text_size_ from the current text/font. This is |
| 181 // invoked when the font list or text changes. | 181 // invoked when the font list or text changes. |
| 182 void UpdateTextSize(); | 182 void UpdateTextSize(); |
| 183 | 183 |
| 184 // Calculate the size of the text size without setting any of the members. | 184 // Calculate the size of the text size without setting any of the members. |
| 185 void CalculateTextSize(gfx::Size* text_size, int max_width); | 185 void CalculateTextSize(gfx::Size* text_size, int max_width); |
| 186 | 186 |
| 187 // Paint the button's text into the specified canvas. If |mode| is |
| 188 // |PB_FOR_DRAG|, the function paints a drag image representation. Derived |
| 189 // can override this function to change only the text rendering. |
| 190 virtual void OnPaintText(gfx::Canvas* canvas, PaintButtonMode mode); |
| 191 |
| 187 void set_color_enabled(SkColor color) { color_enabled_ = color; } | 192 void set_color_enabled(SkColor color) { color_enabled_ = color; } |
| 188 void set_color_disabled(SkColor color) { color_disabled_ = color; } | 193 void set_color_disabled(SkColor color) { color_disabled_ = color; } |
| 189 void set_color_hover(SkColor color) { color_hover_ = color; } | 194 void set_color_hover(SkColor color) { color_hover_ = color; } |
| 190 | 195 |
| 191 bool use_enabled_color_from_theme() const { | 196 bool use_enabled_color_from_theme() const { |
| 192 return use_enabled_color_from_theme_; | 197 return use_enabled_color_from_theme_; |
| 193 } | 198 } |
| 194 | 199 |
| 195 bool use_disabled_color_from_theme() const { | 200 bool use_disabled_color_from_theme() const { |
| 196 return use_disabled_color_from_theme_; | 201 return use_disabled_color_from_theme_; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void set_full_justification(bool full_justification); | 326 void set_full_justification(bool full_justification); |
| 322 | 327 |
| 323 // Overridden from View: | 328 // Overridden from View: |
| 324 virtual gfx::Size GetPreferredSize() OVERRIDE; | 329 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 325 virtual const char* GetClassName() const OVERRIDE; | 330 virtual const char* GetClassName() const OVERRIDE; |
| 326 | 331 |
| 327 // Overridden from TextButtonBase: | 332 // Overridden from TextButtonBase: |
| 328 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; | 333 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; |
| 329 | 334 |
| 330 protected: | 335 protected: |
| 336 // Paint the button's icon into the specified canvas. If |mode| is |
| 337 // |PB_FOR_DRAG|, the function paints a drag image representation. Derived |
| 338 // can override this function to change only the icon rendering. |
| 339 virtual void OnPaintIcon(gfx::Canvas* canvas, PaintButtonMode mode); |
| 340 |
| 331 gfx::ImageSkia icon() const { return icon_; } | 341 gfx::ImageSkia icon() const { return icon_; } |
| 332 | 342 |
| 333 virtual const gfx::ImageSkia& GetImageToPaint() const; | 343 virtual const gfx::ImageSkia& GetImageToPaint() const; |
| 334 | 344 |
| 335 // Overridden from NativeThemeDelegate: | 345 // Overridden from NativeThemeDelegate: |
| 336 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; | 346 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; |
| 337 | 347 |
| 338 // Overridden from TextButtonBase: | 348 // Overridden from TextButtonBase: |
| 339 virtual void GetExtraParams( | 349 virtual void GetExtraParams( |
| 340 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 350 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 365 // True if the icon and the text are aligned along both the left and right | 375 // True if the icon and the text are aligned along both the left and right |
| 366 // margins of the button. | 376 // margins of the button. |
| 367 bool full_justification_; | 377 bool full_justification_; |
| 368 | 378 |
| 369 DISALLOW_COPY_AND_ASSIGN(TextButton); | 379 DISALLOW_COPY_AND_ASSIGN(TextButton); |
| 370 }; | 380 }; |
| 371 | 381 |
| 372 } // namespace views | 382 } // namespace views |
| 373 | 383 |
| 374 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 384 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| OLD | NEW |