OLD | NEW |
1 // Copyright (c) 2010 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_GTK_H_ | 5 #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_ |
6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_ | 6 #define VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/gtk_signal.h" | 9 #include "app/gtk_signal.h" |
10 #include "views/controls/button/native_button_wrapper.h" | 10 #include "views/controls/button/native_button_wrapper.h" |
11 #include "views/controls/native_control_gtk.h" | 11 #include "views/controls/native_control_gtk.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
(...skipping 20 matching lines...) Expand all Loading... |
34 | 34 |
35 protected: | 35 protected: |
36 CHROMEG_CALLBACK_0(NativeButtonGtk, void, CallClicked, GtkButton*); | 36 CHROMEG_CALLBACK_0(NativeButtonGtk, void, CallClicked, GtkButton*); |
37 | 37 |
38 virtual void CreateNativeControl(); | 38 virtual void CreateNativeControl(); |
39 virtual void NativeControlCreated(GtkWidget* widget); | 39 virtual void NativeControlCreated(GtkWidget* widget); |
40 | 40 |
41 // Invoked when the user clicks on the button. | 41 // Invoked when the user clicks on the button. |
42 virtual void OnClicked(); | 42 virtual void OnClicked(); |
43 | 43 |
44 protected: | |
45 // The NativeButton we are bound to. | 44 // The NativeButton we are bound to. |
46 NativeButton* native_button_; | 45 NativeButton* native_button_; |
47 | 46 |
48 private: | 47 private: |
49 | |
50 // The preferred size from the last size_request. We save this until we are | 48 // The preferred size from the last size_request. We save this until we are |
51 // notified that data may have caused the preferred size to change because | 49 // notified that data may have caused the preferred size to change because |
52 // otherwise it seems every time we call gtk_widget_size_request the size | 50 // otherwise it seems every time we call gtk_widget_size_request the size |
53 // returned is a little larger (?!). | 51 // returned is a little larger (?!). |
54 gfx::Size preferred_size_; | 52 gfx::Size preferred_size_; |
55 | 53 |
56 DISALLOW_COPY_AND_ASSIGN(NativeButtonGtk); | 54 DISALLOW_COPY_AND_ASSIGN(NativeButtonGtk); |
57 }; | 55 }; |
58 | 56 |
59 // A View that hosts a native Gtk checkbox button. | 57 // A View that hosts a native Gtk checkbox button. |
(...skipping 11 matching lines...) Expand all Loading... |
71 | 69 |
72 virtual void CreateNativeControl(); | 70 virtual void CreateNativeControl(); |
73 | 71 |
74 // Invoked when the user clicks on the button. | 72 // Invoked when the user clicks on the button. |
75 virtual void OnClicked(); | 73 virtual void OnClicked(); |
76 | 74 |
77 // Overidden from NativeButtonWrapper | 75 // Overidden from NativeButtonWrapper |
78 virtual void UpdateChecked(); | 76 virtual void UpdateChecked(); |
79 virtual void UpdateDefault(); | 77 virtual void UpdateDefault(); |
80 | 78 |
81 // a flag to prevent OnClicked event when updating | 79 // A flag to prevent OnClicked event when updating |
82 // gtk control via API gtk_toggle_button_set_active. | 80 // gtk control via API gtk_toggle_button_set_active. |
83 bool deliver_click_event_; | 81 bool deliver_click_event_; |
84 | 82 |
85 DISALLOW_COPY_AND_ASSIGN(NativeCheckboxGtk); | 83 DISALLOW_COPY_AND_ASSIGN(NativeCheckboxGtk); |
86 }; | 84 }; |
87 | 85 |
88 // A View that hosts a native Gtk radio button. | 86 // A View that hosts a native Gtk radio button. |
89 class NativeRadioButtonGtk : public NativeCheckboxGtk { | 87 class NativeRadioButtonGtk : public NativeCheckboxGtk { |
90 public: | 88 public: |
91 explicit NativeRadioButtonGtk(RadioButton* radio_button); | 89 explicit NativeRadioButtonGtk(RadioButton* radio_button); |
(...skipping 12 matching lines...) Expand all Loading... |
104 // Return RadioButton we are bound to. | 102 // Return RadioButton we are bound to. |
105 RadioButton* radio_button(); | 103 RadioButton* radio_button(); |
106 // Set the gtk radio button's group to that of given wrapper's gruop. | 104 // Set the gtk radio button's group to that of given wrapper's gruop. |
107 void SetGroupFrom(NativeButtonWrapper* wrapper); | 105 void SetGroupFrom(NativeButtonWrapper* wrapper); |
108 // Invoked when the radio button's state is changed. | 106 // Invoked when the radio button's state is changed. |
109 void OnToggled(); | 107 void OnToggled(); |
110 | 108 |
111 DISALLOW_COPY_AND_ASSIGN(NativeRadioButtonGtk); | 109 DISALLOW_COPY_AND_ASSIGN(NativeRadioButtonGtk); |
112 }; | 110 }; |
113 | 111 |
114 | |
115 } // namespace views | 112 } // namespace views |
116 | 113 |
117 #endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_ | 114 #endif // VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_ |
OLD | NEW |