X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0ea273496aa6b689769a0028055e50a3d9c4bc11..a95f37bc57cd0318ee2ae5cc94ac447cce47a5cf:/src/univ/checkbox.cpp diff --git a/src/univ/checkbox.cpp b/src/univ/checkbox.cpp index 7f807740e4..520a2edf05 100644 --- a/src/univ/checkbox.cpp +++ b/src/univ/checkbox.cpp @@ -25,9 +25,10 @@ #if wxUSE_CHECKBOX +#include "wx/checkbox.h" + #ifndef WX_PRECOMP #include "wx/dcclient.h" - #include "wx/checkbox.h" #include "wx/validate.h" #include "wx/button.h" // for wxACTION_BUTTON_XXX @@ -38,6 +39,22 @@ #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 // ============================================================================ @@ -67,7 +84,7 @@ bool wxCheckBox::Create(wxWindow *parent, return false; SetLabel(label); - SetBestSize(size); + SetInitialSize(size); CreateInputHandler(wxINP_HANDLER_CHECKBOX); @@ -322,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)) { }