| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // Updates text_size_ and max_text_size_ from the current text/font. This is | 219 // Updates text_size_ and max_text_size_ from the current text/font. This is |
| 220 // invoked when the font or text changes. | 220 // invoked when the font or text changes. |
| 221 void UpdateTextSize(); | 221 void UpdateTextSize(); |
| 222 | 222 |
| 223 // Calculate the size of the text size without setting any of the members. | 223 // Calculate the size of the text size without setting any of the members. |
| 224 void CalculateTextSize(gfx::Size* text_size, int max_width); | 224 void CalculateTextSize(gfx::Size* text_size, int max_width); |
| 225 | 225 |
| 226 // Overridden from NativeThemeDelegate: | 226 // Overridden from NativeThemeDelegate: |
| 227 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; | 227 virtual gfx::Rect GetThemePaintRect() const OVERRIDE; |
| 228 virtual ui::NativeTheme::State GetThemeState( | 228 virtual gfx::NativeTheme::State GetThemeState( |
| 229 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 229 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 230 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; | 230 virtual const ui::Animation* GetThemeAnimation() const OVERRIDE; |
| 231 virtual ui::NativeTheme::State GetBackgroundThemeState( | 231 virtual gfx::NativeTheme::State GetBackgroundThemeState( |
| 232 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 232 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 233 virtual ui::NativeTheme::State GetForegroundThemeState( | 233 virtual gfx::NativeTheme::State GetForegroundThemeState( |
| 234 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 234 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 235 | 235 |
| 236 virtual void GetExtraParams(ui::NativeTheme::ExtraParams* params) const; | 236 virtual void GetExtraParams(gfx::NativeTheme::ExtraParams* params) const; |
| 237 | 237 |
| 238 virtual gfx::Rect GetTextBounds() const; | 238 virtual gfx::Rect GetTextBounds() const; |
| 239 | 239 |
| 240 int ComputeCanvasStringFlags() const; | 240 int ComputeCanvasStringFlags() const; |
| 241 | 241 |
| 242 // Calculate the bounds of the content of this button, including any extra | 242 // Calculate the bounds of the content of this button, including any extra |
| 243 // width needed on top of the text width. | 243 // width needed on top of the text width. |
| 244 gfx::Rect GetContentBounds(int extra_width) const; | 244 gfx::Rect GetContentBounds(int extra_width) const; |
| 245 | 245 |
| 246 // The text string that is displayed in the button. | 246 // The text string that is displayed in the button. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 // Overridden from TextButtonBase: | 347 // Overridden from TextButtonBase: |
| 348 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; | 348 virtual void PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) OVERRIDE; |
| 349 | 349 |
| 350 protected: | 350 protected: |
| 351 SkBitmap icon() const { return icon_; } | 351 SkBitmap icon() const { return icon_; } |
| 352 | 352 |
| 353 virtual const SkBitmap& GetImageToPaint() const; | 353 virtual const SkBitmap& GetImageToPaint() const; |
| 354 | 354 |
| 355 // Overridden from NativeThemeDelegate: | 355 // Overridden from NativeThemeDelegate: |
| 356 virtual ui::NativeTheme::Part GetThemePart() const OVERRIDE; | 356 virtual gfx::NativeTheme::Part GetThemePart() const OVERRIDE; |
| 357 | 357 |
| 358 // Overridden from TextButtonBase: | 358 // Overridden from TextButtonBase: |
| 359 virtual void GetExtraParams( | 359 virtual void GetExtraParams( |
| 360 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 360 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 361 virtual gfx::Rect GetTextBounds() const OVERRIDE; | 361 virtual gfx::Rect GetTextBounds() const OVERRIDE; |
| 362 | 362 |
| 363 private: | 363 private: |
| 364 // The position of the icon. | 364 // The position of the icon. |
| 365 IconPlacement icon_placement_; | 365 IconPlacement icon_placement_; |
| 366 | 366 |
| 367 // An icon displayed with the text. | 367 // An icon displayed with the text. |
| 368 SkBitmap icon_; | 368 SkBitmap icon_; |
| 369 | 369 |
| 370 // An optional different version of the icon for hover state. | 370 // An optional different version of the icon for hover state. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 virtual std::string GetClassName() const OVERRIDE; | 406 virtual std::string GetClassName() const OVERRIDE; |
| 407 | 407 |
| 408 private: | 408 private: |
| 409 void Init(); | 409 void Init(); |
| 410 | 410 |
| 411 // Overridden from View: | 411 // Overridden from View: |
| 412 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 412 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 413 | 413 |
| 414 // Overridden from TextButton: | 414 // Overridden from TextButton: |
| 415 virtual void GetExtraParams( | 415 virtual void GetExtraParams( |
| 416 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 416 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 417 | 417 |
| 418 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); | 418 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); |
| 419 }; | 419 }; |
| 420 | 420 |
| 421 } // namespace views | 421 } // namespace views |
| 422 | 422 |
| 423 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 423 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| OLD | NEW |