OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 // TextButtonBorder | 24 // TextButtonBorder |
25 // | 25 // |
26 // A Border subclass that paints a TextButton's background layer - | 26 // A Border subclass that paints a TextButton's background layer - |
27 // basically the button frame in the hot/pushed states. | 27 // basically the button frame in the hot/pushed states. |
28 // | 28 // |
29 // Note that this type of button is not focusable by default and will not be | 29 // Note that this type of button is not focusable by default and will not be |
30 // part of the focus chain. Call set_focusable(true) to make it part of the | 30 // part of the focus chain. Call set_focusable(true) to make it part of the |
31 // focus chain. | 31 // focus chain. |
32 // | 32 // |
33 //////////////////////////////////////////////////////////////////////////////// | 33 //////////////////////////////////////////////////////////////////////////////// |
34 class VIEWS_API TextButtonBorder : public Border { | 34 class VIEWS_EXPORT TextButtonBorder : public Border { |
35 public: | 35 public: |
36 TextButtonBorder(); | 36 TextButtonBorder(); |
37 virtual ~TextButtonBorder(); | 37 virtual ~TextButtonBorder(); |
38 | 38 |
39 // By default BS_NORMAL is drawn with no border. Call this to instead draw it | 39 // By default BS_NORMAL is drawn with no border. Call this to instead draw it |
40 // with the same border as the "hot" state. | 40 // with the same border as the "hot" state. |
41 // TODO(pkasting): You should also call set_animate_on_state_change(false) on | 41 // TODO(pkasting): You should also call set_animate_on_state_change(false) on |
42 // the button in this case... we should fix this. | 42 // the button in this case... we should fix this. |
43 void copy_normal_set_to_hot_set() { set_normal_set(hot_set_); } | 43 void copy_normal_set_to_hot_set() { set_normal_set(hot_set_); } |
44 | 44 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 //////////////////////////////////////////////////////////////////////////////// | 84 //////////////////////////////////////////////////////////////////////////////// |
85 // | 85 // |
86 // TextButtonNativeThemeBorder | 86 // TextButtonNativeThemeBorder |
87 // | 87 // |
88 // A Border subclass that paints a TextButton's background layer using the | 88 // A Border subclass that paints a TextButton's background layer using the |
89 // platform's native theme look. This handles normal/disabled/hot/pressed | 89 // platform's native theme look. This handles normal/disabled/hot/pressed |
90 // states, with possible animation between states. | 90 // states, with possible animation between states. |
91 // | 91 // |
92 //////////////////////////////////////////////////////////////////////////////// | 92 //////////////////////////////////////////////////////////////////////////////// |
93 class VIEWS_API TextButtonNativeThemeBorder : public Border { | 93 class VIEWS_EXPORT TextButtonNativeThemeBorder : public Border { |
94 public: | 94 public: |
95 TextButtonNativeThemeBorder(NativeThemeDelegate* delegate); | 95 TextButtonNativeThemeBorder(NativeThemeDelegate* delegate); |
96 virtual ~TextButtonNativeThemeBorder(); | 96 virtual ~TextButtonNativeThemeBorder(); |
97 | 97 |
98 // Implementation of Border: | 98 // Implementation of Border: |
99 virtual void Paint(const View& view, gfx::Canvas* canvas) const; | 99 virtual void Paint(const View& view, gfx::Canvas* canvas) const; |
100 virtual void GetInsets(gfx::Insets* insets) const; | 100 virtual void GetInsets(gfx::Insets* insets) const; |
101 | 101 |
102 private: | 102 private: |
103 // The delegate the controls the appearance of this border. | 103 // The delegate the controls the appearance of this border. |
104 NativeThemeDelegate* delegate_; | 104 NativeThemeDelegate* delegate_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(TextButtonNativeThemeBorder); | 106 DISALLOW_COPY_AND_ASSIGN(TextButtonNativeThemeBorder); |
107 }; | 107 }; |
108 | 108 |
109 | 109 |
110 //////////////////////////////////////////////////////////////////////////////// | 110 //////////////////////////////////////////////////////////////////////////////// |
111 // | 111 // |
112 // TextButtonBase | 112 // TextButtonBase |
113 // | 113 // |
114 // A base ckass for different types of buttons, like push buttons, radio | 114 // A base ckass for different types of buttons, like push buttons, radio |
115 // buttons, and checkboxes, that do not depende on native components for | 115 // buttons, and checkboxes, that do not depende on native components for |
116 // look and feel. TextButton reserves space for the largest string | 116 // look and feel. TextButton reserves space for the largest string |
117 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. | 117 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. |
118 // | 118 // |
119 //////////////////////////////////////////////////////////////////////////////// | 119 //////////////////////////////////////////////////////////////////////////////// |
120 class VIEWS_API TextButtonBase : public CustomButton, | 120 class VIEWS_EXPORT TextButtonBase : public CustomButton, |
121 public NativeThemeDelegate { | 121 public NativeThemeDelegate { |
122 public: | 122 public: |
123 // The menu button's class name. | 123 // The menu button's class name. |
124 static const char kViewClassName[]; | 124 static const char kViewClassName[]; |
125 | 125 |
126 // Enumeration of how the prefix ('&') character is processed. The default | 126 // Enumeration of how the prefix ('&') character is processed. The default |
127 // is |PREFIX_NONE|. | 127 // is |PREFIX_NONE|. |
128 enum PrefixType { | 128 enum PrefixType { |
129 // No special processing is done. | 129 // No special processing is done. |
130 PREFIX_NONE, | 130 PREFIX_NONE, |
131 | 131 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 //////////////////////////////////////////////////////////////////////////////// | 308 //////////////////////////////////////////////////////////////////////////////// |
309 // | 309 // |
310 // TextButton | 310 // TextButton |
311 // | 311 // |
312 // A button which displays text and/or and icon that can be changed in | 312 // A button which displays text and/or and icon that can be changed in |
313 // response to actions. TextButton reserves space for the largest string | 313 // response to actions. TextButton reserves space for the largest string |
314 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. | 314 // passed to SetText. To reset the cached max size invoke ClearMaxTextSize. |
315 // | 315 // |
316 //////////////////////////////////////////////////////////////////////////////// | 316 //////////////////////////////////////////////////////////////////////////////// |
317 class VIEWS_API TextButton : public TextButtonBase { | 317 class VIEWS_EXPORT TextButton : public TextButtonBase { |
318 public: | 318 public: |
319 // The button's class name. | 319 // The button's class name. |
320 static const char kViewClassName[]; | 320 static const char kViewClassName[]; |
321 | 321 |
322 TextButton(ButtonListener* listener, const std::wstring& text); | 322 TextButton(ButtonListener* listener, const std::wstring& text); |
323 virtual ~TextButton(); | 323 virtual ~TextButton(); |
324 | 324 |
325 void set_icon_text_spacing(int icon_text_spacing) { | 325 void set_icon_text_spacing(int icon_text_spacing) { |
326 icon_text_spacing_ = icon_text_spacing; | 326 icon_text_spacing_ = icon_text_spacing; |
327 } | 327 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 }; | 392 }; |
393 | 393 |
394 //////////////////////////////////////////////////////////////////////////////// | 394 //////////////////////////////////////////////////////////////////////////////// |
395 // | 395 // |
396 // NativeTextButton | 396 // NativeTextButton |
397 // | 397 // |
398 // A TextButton that uses the NativeTheme border and sets some properties, | 398 // A TextButton that uses the NativeTheme border and sets some properties, |
399 // like ignore-minimize-size and text alignment minimum size. | 399 // like ignore-minimize-size and text alignment minimum size. |
400 // | 400 // |
401 //////////////////////////////////////////////////////////////////////////////// | 401 //////////////////////////////////////////////////////////////////////////////// |
402 class VIEWS_API NativeTextButton : public TextButton { | 402 class VIEWS_EXPORT NativeTextButton : public TextButton { |
403 public: | 403 public: |
404 // The button's class name. | 404 // The button's class name. |
405 static const char kViewClassName[]; | 405 static const char kViewClassName[]; |
406 | 406 |
407 NativeTextButton(ButtonListener* listener); | 407 NativeTextButton(ButtonListener* listener); |
408 NativeTextButton(ButtonListener* listener, const std::wstring& text); | 408 NativeTextButton(ButtonListener* listener, const std::wstring& text); |
409 | 409 |
410 // Sets/Gets the text to be used as the button's label. | 410 // Sets/Gets the text to be used as the button's label. |
411 // TODO: Remove this function and replace all call sites with SetText(). | 411 // TODO: Remove this function and replace all call sites with SetText(). |
412 void SetLabel(const std::wstring& label) { | 412 void SetLabel(const std::wstring& label) { |
(...skipping 15 matching lines...) Expand all Loading... |
428 // Overridden from TextButton: | 428 // Overridden from TextButton: |
429 virtual void GetExtraParams( | 429 virtual void GetExtraParams( |
430 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; | 430 gfx::NativeTheme::ExtraParams* params) const OVERRIDE; |
431 | 431 |
432 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); | 432 DISALLOW_COPY_AND_ASSIGN(NativeTextButton); |
433 }; | 433 }; |
434 | 434 |
435 } // namespace views | 435 } // namespace views |
436 | 436 |
437 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ | 437 #endif // VIEWS_CONTROLS_BUTTON_TEXT_BUTTON_H_ |
OLD | NEW |