]> git.saurik.com Git - wxWidgets.git/blobdiff - src/univ/checkbox.cpp
Remove unneeded workaround for a ScrolledWindow issue that is now fixed
[wxWidgets.git] / src / univ / checkbox.cpp
index d02c0c1d0b264124d938ac0ae03a7af1125547be..520a2edf058dc20b47cf0c1b13f5bb864467f1d2 100644 (file)
 #include "wx/univ/inphand.h"
 #include "wx/univ/colschem.h"
 
+// ----------------------------------------------------------------------------
+// wxStdCheckboxInputHandler: handles the mouse events for the check and radio
+// boxes (handling the keyboard input is simple, but its handling differs a
+// lot between GTK and MSW, so a new class should be derived for this)
+// ----------------------------------------------------------------------------
+
+class WXDLLEXPORT wxStdCheckboxInputHandler : public wxStdInputHandler
+{
+public:
+    wxStdCheckboxInputHandler(wxInputHandler *inphand);
+
+    // we have to override this one as wxStdButtonInputHandler version works
+    // only with the buttons
+    virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
+};
+
 // ============================================================================
 // implementation
 // ============================================================================
@@ -68,7 +84,7 @@ bool wxCheckBox::Create(wxWindow *parent,
         return false;
 
     SetLabel(label);
-    SetBestSize(size);
+    SetInitialSize(size);
 
     CreateInputHandler(wxINP_HANDLER_CHECKBOX);
 
@@ -323,12 +339,20 @@ bool wxCheckBox::PerformAction(const wxControlAction& action,
     return true;
 }
 
+/* static */
+wxInputHandler *wxCheckBox::CreateStdInputHandler(wxInputHandler *handlerDef)
+{
+    static wxStdCheckboxInputHandler s_handler(handlerDef);
+
+    return &s_handler;
+}
+
 // ----------------------------------------------------------------------------
 // wxStdCheckboxInputHandler
 // ----------------------------------------------------------------------------
 
-wxStdCheckboxInputHandler::wxStdCheckboxInputHandler(wxInputHandler *inphand)
-                         : wxStdButtonInputHandler(inphand)
+wxStdCheckboxInputHandler::wxStdCheckboxInputHandler(wxInputHandler *def)
+                         : wxStdInputHandler(wxButton::GetStdInputHandler(def))
 {
 }