summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/chrome.gyp2
-rw-r--r--views/controls/button/checkbox.cc3
-rw-r--r--views/controls/button/native_button_gtk.cc21
-rw-r--r--views/controls/button/native_button_gtk.h12
4 files changed, 36 insertions, 2 deletions
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index a7e442a..8ca0259 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -3350,7 +3350,6 @@
'../views/accessibility/view_accessibility.cc',
'../views/controls/scrollbar/bitmap_scroll_bar.cc',
'../views/controls/button/button_dropdown.cc',
- '../views/controls/button/checkbox.cc',
'../views/controls/button/menu_button.cc',
'../views/controls/combo_box.cc',
'../views/controls/hwnd_view.cc',
@@ -3406,7 +3405,6 @@
'../views/accessibility/view_accessibility_wrapper.cc',
'../views/controls/scrollbar/bitmap_scroll_bar.cc',
'../views/controls/button/button_dropdown.cc',
- '../views/controls/button/checkbox.cc',
'../views/controls/menu/chrome_menu.cc',
'../views/controls/combo_box.cc',
'../views/focus/focus_manager.cc',
diff --git a/views/controls/button/checkbox.cc b/views/controls/button/checkbox.cc
index 8783bcf..af6a7b4 100644
--- a/views/controls/button/checkbox.cc
+++ b/views/controls/button/checkbox.cc
@@ -53,6 +53,9 @@ int Checkbox::GetTextIndent() {
// Checkbox, View overrides:
gfx::Size Checkbox::GetPreferredSize() {
+ if (!native_wrapper_)
+ return gfx::Size();
+
gfx::Size prefsize = native_wrapper_->GetView()->GetPreferredSize();
prefsize.set_width(
prefsize.width() + kCheckboxLabelSpacing +
diff --git a/views/controls/button/native_button_gtk.cc b/views/controls/button/native_button_gtk.cc
index e140b21..858fdcd 100644
--- a/views/controls/button/native_button_gtk.cc
+++ b/views/controls/button/native_button_gtk.cc
@@ -86,10 +86,31 @@ void NativeButtonGtk::NativeControlCreated(GtkWidget* widget) {
UpdateDefault();
}
+NativeCheckboxGtk::NativeCheckboxGtk(Checkbox* checkbox)
+ : NativeButtonGtk(checkbox) {
+}
+
+void NativeCheckboxGtk::CreateNativeControl() {
+ GtkWidget* widget = gtk_check_button_new();
+ NativeControlCreated(widget);
+}
+
+// static
+int NativeButtonWrapper::GetFixedWidth() {
+ // TODO(brettw) implement this properly.
+ return 10;
+}
+
// static
NativeButtonWrapper* NativeButtonWrapper::CreateNativeButtonWrapper(
NativeButton* native_button) {
return new NativeButtonGtk(native_button);
}
+// static
+NativeButtonWrapper* NativeButtonWrapper::CreateCheckboxWrapper(
+ Checkbox* checkbox) {
+ return new NativeCheckboxGtk(checkbox);
+}
+
} // namespace views
diff --git a/views/controls/button/native_button_gtk.h b/views/controls/button/native_button_gtk.h
index e76a703..d526dcd 100644
--- a/views/controls/button/native_button_gtk.h
+++ b/views/controls/button/native_button_gtk.h
@@ -41,6 +41,18 @@ class NativeButtonGtk : public NativeControlGtk, public NativeButtonWrapper {
DISALLOW_COPY_AND_ASSIGN(NativeButtonGtk);
};
+class NativeCheckboxGtk : public NativeButtonGtk {
+ public:
+ explicit NativeCheckboxGtk(Checkbox* checkbox);
+
+ private:
+ virtual void CreateNativeControl();
+
+ // Returns true if this button is actually a checkbox or radio button.
+ virtual bool IsCheckbox() const { return true; }
+ DISALLOW_COPY_AND_ASSIGN(NativeCheckboxGtk);
+};
+
} // namespace views
#endif // #ifndef VIEWS_CONTROLS_BUTTON_NATIVE_BUTTON_GTK_H_