| 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_LABEL_BUTTON_H_ | 5 #ifndef UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 6 #define UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 LabelButton(ButtonListener* listener, const base::string16& text); | 38 LabelButton(ButtonListener* listener, const base::string16& text); |
| 39 ~LabelButton() override; | 39 ~LabelButton() override; |
| 40 | 40 |
| 41 // Gets or sets the image shown for the specified button state. | 41 // Gets or sets the image shown for the specified button state. |
| 42 // GetImage returns the image for STATE_NORMAL if the state's image is empty. | 42 // GetImage returns the image for STATE_NORMAL if the state's image is empty. |
| 43 virtual const gfx::ImageSkia& GetImage(ButtonState for_state); | 43 virtual const gfx::ImageSkia& GetImage(ButtonState for_state); |
| 44 void SetImage(ButtonState for_state, const gfx::ImageSkia& image); | 44 void SetImage(ButtonState for_state, const gfx::ImageSkia& image); |
| 45 | 45 |
| 46 // Gets or sets the text shown on the button. | 46 // Gets or sets the text shown on the button. |
| 47 const base::string16& GetText() const; | 47 const base::string16& GetText() const; |
| 48 void SetText(const base::string16& text); | 48 virtual void SetText(const base::string16& text); |
| 49 | 49 |
| 50 // Sets the text color shown for the specified button |for_state| to |color|. | 50 // Sets the text color shown for the specified button |for_state| to |color|. |
| 51 void SetTextColor(ButtonState for_state, SkColor color); | 51 void SetTextColor(ButtonState for_state, SkColor color); |
| 52 | 52 |
| 53 // Sets the text colors shown for the non-disabled states to |color|. | 53 // Sets the text colors shown for the non-disabled states to |color|. |
| 54 void SetEnabledTextColors(SkColor color); | 54 void SetEnabledTextColors(SkColor color); |
| 55 | 55 |
| 56 // Sets drop shadows underneath the text. | 56 // Sets drop shadows underneath the text. |
| 57 void SetTextShadows(const gfx::ShadowValues& shadows); | 57 void SetTextShadows(const gfx::ShadowValues& shadows); |
| 58 | 58 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 gfx::Rect GetThemePaintRect() const override; | 140 gfx::Rect GetThemePaintRect() const override; |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); | 143 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Init); |
| 144 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); | 144 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Label); |
| 145 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); | 145 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, Image); |
| 146 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); | 146 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, LabelAndImage); |
| 147 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList); | 147 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, FontList); |
| 148 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, ButtonStyleIsDefaultSize); | 148 FRIEND_TEST_ALL_PREFIXES(LabelButtonTest, ButtonStyleIsDefaultSize); |
| 149 | 149 |
| 150 void SetTextInternal(const base::string16& text); |
| 151 |
| 150 // View: | 152 // View: |
| 151 void ChildPreferredSizeChanged(View* child) override; | 153 void ChildPreferredSizeChanged(View* child) override; |
| 152 | 154 |
| 153 // NativeThemeDelegate: | 155 // NativeThemeDelegate: |
| 154 ui::NativeTheme::Part GetThemePart() const override; | 156 ui::NativeTheme::Part GetThemePart() const override; |
| 155 ui::NativeTheme::State GetThemeState( | 157 ui::NativeTheme::State GetThemeState( |
| 156 ui::NativeTheme::ExtraParams* params) const override; | 158 ui::NativeTheme::ExtraParams* params) const override; |
| 157 const gfx::Animation* GetThemeAnimation() const override; | 159 const gfx::Animation* GetThemeAnimation() const override; |
| 158 ui::NativeTheme::State GetBackgroundThemeState( | 160 ui::NativeTheme::State GetBackgroundThemeState( |
| 159 ui::NativeTheme::ExtraParams* params) const override; | 161 ui::NativeTheme::ExtraParams* params) const override; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 gfx::HorizontalAlignment horizontal_alignment_; | 216 gfx::HorizontalAlignment horizontal_alignment_; |
| 215 | 217 |
| 216 scoped_ptr<Painter> focus_painter_; | 218 scoped_ptr<Painter> focus_painter_; |
| 217 | 219 |
| 218 DISALLOW_COPY_AND_ASSIGN(LabelButton); | 220 DISALLOW_COPY_AND_ASSIGN(LabelButton); |
| 219 }; | 221 }; |
| 220 | 222 |
| 221 } // namespace views | 223 } // namespace views |
| 222 | 224 |
| 223 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ | 225 #endif // UI_VIEWS_CONTROLS_BUTTON_LABEL_BUTTON_H_ |
| OLD | NEW |