OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ |
6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ | 6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ |
7 | 7 |
8 #include "app/gfx/chrome_font.h" | 8 #include "app/gfx/chrome_font.h" |
9 #include "views/controls/button/button.h" | 9 #include "views/controls/button/button.h" |
10 #include "views/controls/button/native_button_wrapper.h" | 10 #include "views/controls/button/native_button_wrapper.h" |
11 | 11 |
12 class ChromeFont; | 12 namespace gfx { |
| 13 class Font; |
| 14 } |
13 | 15 |
14 namespace views { | 16 namespace views { |
15 | 17 |
16 class NativeButton : public Button { | 18 class NativeButton : public Button { |
17 public: | 19 public: |
18 // The button's class name. | 20 // The button's class name. |
19 static const char kViewClassName[]; | 21 static const char kViewClassName[]; |
20 | 22 |
21 explicit NativeButton(ButtonListener* listener); | 23 explicit NativeButton(ButtonListener* listener); |
22 NativeButton(ButtonListener* listener, const std::wstring& label); | 24 NativeButton(ButtonListener* listener, const std::wstring& label); |
23 virtual ~NativeButton(); | 25 virtual ~NativeButton(); |
24 | 26 |
25 // Sets/Gets the text to be used as the button's label. | 27 // Sets/Gets the text to be used as the button's label. |
26 void SetLabel(const std::wstring& label); | 28 void SetLabel(const std::wstring& label); |
27 std::wstring label() const { return label_; } | 29 std::wstring label() const { return label_; } |
28 | 30 |
29 // Sets the font to be used when displaying the button's label. | 31 // Sets the font to be used when displaying the button's label. |
30 void set_font(const ChromeFont& font) { font_ = font; } | 32 void set_font(const gfx::Font& font) { font_ = font; } |
31 const ChromeFont& font() const { return font_; } | 33 const gfx::Font& font() const { return font_; } |
32 | 34 |
33 // Sets/Gets whether or not the button appears and behaves as the default | 35 // Sets/Gets whether or not the button appears and behaves as the default |
34 // button in its current context. | 36 // button in its current context. |
35 void SetIsDefault(bool default_button); | 37 void SetIsDefault(bool default_button); |
36 bool is_default() const { return is_default_; } | 38 bool is_default() const { return is_default_; } |
37 | 39 |
38 // Sets whether or not the button appears as the default button. This does | 40 // Sets whether or not the button appears as the default button. This does |
39 // not make it behave as the default (i.e. no enter key accelerator is | 41 // not make it behave as the default (i.e. no enter key accelerator is |
40 // registered, use SetIsDefault for that). | 42 // registered, use SetIsDefault for that). |
41 void SetAppearsAsDefault(bool default_button); | 43 void SetAppearsAsDefault(bool default_button); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 NativeButtonWrapper* native_wrapper_; | 75 NativeButtonWrapper* native_wrapper_; |
74 | 76 |
75 private: | 77 private: |
76 // The button label. | 78 // The button label. |
77 std::wstring label_; | 79 std::wstring label_; |
78 | 80 |
79 // True if the button is the default button in its context. | 81 // True if the button is the default button in its context. |
80 bool is_default_; | 82 bool is_default_; |
81 | 83 |
82 // The font used to render the button label. | 84 // The font used to render the button label. |
83 ChromeFont font_; | 85 gfx::Font font_; |
84 | 86 |
85 // True if the button should ignore the minimum size for the platform. Default | 87 // True if the button should ignore the minimum size for the platform. Default |
86 // is false. Set to true to create narrower buttons. | 88 // is false. Set to true to create narrower buttons. |
87 bool ignore_minimum_size_; | 89 bool ignore_minimum_size_; |
88 | 90 |
89 // The minimum size of the button from the specified size in native dialog | 91 // The minimum size of the button from the specified size in native dialog |
90 // units. The definition of this unit may vary from platform to platform. If | 92 // units. The definition of this unit may vary from platform to platform. If |
91 // the width/height is non-zero, the preferred size of the button will not be | 93 // the width/height is non-zero, the preferred size of the button will not be |
92 // less than this value when the dialog units are converted to pixels. | 94 // less than this value when the dialog units are converted to pixels. |
93 gfx::Size minimum_size_; | 95 gfx::Size minimum_size_; |
94 | 96 |
95 DISALLOW_COPY_AND_ASSIGN(NativeButton); | 97 DISALLOW_COPY_AND_ASSIGN(NativeButton); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace views | 100 } // namespace views |
99 | 101 |
100 #endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ | 102 #endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_H_ |
OLD | NEW |