#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
// ============================================================================
-IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
-
// ----------------------------------------------------------------------------
// wxCheckBox
// ----------------------------------------------------------------------------
const wxValidator& validator,
const wxString &name)
{
+ WXValidateStyle( &style );
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
SetLabel(label);
- SetBestSize(size);
+ SetInitialSize(size);
CreateInputHandler(wxINP_HANDLER_CHECKBOX);
{
case wxCHK_UNCHECKED: status = Status_Unchecked; break;
case wxCHK_CHECKED: status = Status_Checked; break;
- default: wxFAIL_MSG(_T("Unknown checkbox state"));
+ default: wxFAIL_MSG(wxT("Unknown checkbox state"));
case wxCHK_UNDETERMINED: status = Status_3rdState; break;
}
if ( status != m_status )
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))
{
}