| 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // Sets the icon. | 321 // Sets the icon. |
| 322 virtual void SetIcon(const gfx::ImageSkia& icon); | 322 virtual void SetIcon(const gfx::ImageSkia& icon); |
| 323 virtual void SetHoverIcon(const gfx::ImageSkia& icon); | 323 virtual void SetHoverIcon(const gfx::ImageSkia& icon); |
| 324 virtual void SetPushedIcon(const gfx::ImageSkia& icon); | 324 virtual void SetPushedIcon(const gfx::ImageSkia& icon); |
| 325 | 325 |
| 326 bool HasIcon() const { return !icon_.isNull(); } | 326 bool HasIcon() const { return !icon_.isNull(); } |
| 327 | 327 |
| 328 // Meanings are reversed for right-to-left layouts. | 328 // Meanings are reversed for right-to-left layouts. |
| 329 enum IconPlacement { | 329 enum IconPlacement { |
| 330 ICON_ON_LEFT, | 330 ICON_ON_LEFT, |
| 331 ICON_ON_RIGHT | 331 ICON_ON_RIGHT, |
| 332 ICON_CENTERED // Centered is valid only when text is empty. |
| 332 }; | 333 }; |
| 333 | 334 |
| 334 IconPlacement icon_placement() { return icon_placement_; } | 335 IconPlacement icon_placement() { return icon_placement_; } |
| 335 void set_icon_placement(IconPlacement icon_placement) { | 336 void set_icon_placement(IconPlacement icon_placement) { |
| 337 // ICON_CENTERED works only when |text_| is empty. |
| 338 DCHECK((icon_placement != ICON_CENTERED) || text_.empty()); |
| 336 icon_placement_ = icon_placement; | 339 icon_placement_ = icon_placement; |
| 337 } | 340 } |
| 338 | 341 |
| 339 void set_ignore_minimum_size(bool ignore_minimum_size); | 342 void set_ignore_minimum_size(bool ignore_minimum_size); |
| 340 | 343 |
| 341 // Overridden from View: | 344 // Overridden from View: |
| 342 virtual gfx::Size GetPreferredSize() OVERRIDE; | 345 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 343 virtual std::string GetClassName() const OVERRIDE; | 346 virtual std::string GetClassName() const OVERRIDE; |
| 344 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; | 347 virtual void OnPaintFocusBorder(gfx::Canvas* canvas) OVERRIDE; |
| 345 | 348 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 // Overridden from TextButton: | 416 // Overridden from TextButton: |
| 414 virtual void GetExtraParams( | 417 virtual void GetExtraParams( |
| 415 ui::NativeTheme::ExtraParams* params) const OVERRIDE; | 418 ui::NativeTheme::ExtraParams* params) const OVERRIDE; |
| 416 | 419 |
| 417 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); | 420 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); |
| 418 }; | 421 }; |
| 419 | 422 |
| 420 } // namespace views | 423 } // namespace views |
| 421 | 424 |
| 422 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 425 #endif // UI_VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
| OLD | NEW |