OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ |
6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ | 6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ |
7 | 7 |
8 #include "views/controls/native_control_win.h" | 8 #include "views/controls/native_control_win.h" |
9 #include "views/controls/button/native_button_wrapper.h" | 9 #include "views/controls/button/native_button_wrapper.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 | 12 |
13 // A View that hosts a native Windows button. | 13 // A View that hosts a native Windows button. |
(...skipping 28 matching lines...) Expand all Loading... |
42 virtual void CreateNativeControl(); | 42 virtual void CreateNativeControl(); |
43 virtual void NativeControlCreated(HWND control_hwnd); | 43 virtual void NativeControlCreated(HWND control_hwnd); |
44 | 44 |
45 // Returns true if this button is actually a checkbox or radio button. | 45 // Returns true if this button is actually a checkbox or radio button. |
46 virtual bool IsCheckbox() const { return false; } | 46 virtual bool IsCheckbox() const { return false; } |
47 | 47 |
48 private: | 48 private: |
49 // The NativeButton we are bound to. | 49 // The NativeButton we are bound to. |
50 NativeButton* native_button_; | 50 NativeButton* native_button_; |
51 | 51 |
| 52 // It's expensive to find the size of a button on windows, so we cache it. |
| 53 mutable gfx::Size button_size_; |
| 54 mutable bool button_size_valid_; |
| 55 |
52 DISALLOW_COPY_AND_ASSIGN(NativeButtonWin); | 56 DISALLOW_COPY_AND_ASSIGN(NativeButtonWin); |
53 }; | 57 }; |
54 | 58 |
55 // A View that hosts a native Windows checkbox. | 59 // A View that hosts a native Windows checkbox. |
56 class NativeCheckboxWin : public NativeButtonWin { | 60 class NativeCheckboxWin : public NativeButtonWin { |
57 public: | 61 public: |
58 explicit NativeCheckboxWin(Checkbox* native_button); | 62 explicit NativeCheckboxWin(Checkbox* native_button); |
59 virtual ~NativeCheckboxWin(); | 63 virtual ~NativeCheckboxWin(); |
60 | 64 |
61 // Overridden from View: | 65 // Overridden from View: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 virtual void CreateNativeControl(); | 103 virtual void CreateNativeControl(); |
100 virtual bool IsRadioButton() const { return true; } | 104 virtual bool IsRadioButton() const { return true; } |
101 | 105 |
102 private: | 106 private: |
103 DISALLOW_COPY_AND_ASSIGN(NativeRadioButtonWin); | 107 DISALLOW_COPY_AND_ASSIGN(NativeRadioButtonWin); |
104 }; | 108 }; |
105 | 109 |
106 } // namespace views | 110 } // namespace views |
107 | 111 |
108 #endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ | 112 #endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_WIN_H_ |
OLD | NEW |