Many changes for wxInputHandler creation mainly related to:

1. Allow the theme to create only the input handlers it customizes instead
   of forcing it to always create a handler even if the standard one is used:
   wxTheme::GetInputHandler() now takes wxInputConsumer to make this possible

2. Prefer delegation to inheritance when creating customized input handlers,
   almost all (except for wxStdScrollbarInputHandler) standard handler classes
   are now private, use wxClassName::GetStdInputHandler() to retrieve the
   standard handler for any class or polymorphic DoGetStdInputHandler()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-09-14 19:36:47 +00:00
parent 5eefe02976
commit 9467bdb7f5
30 changed files with 611 additions and 499 deletions

View File

@@ -37,6 +37,22 @@
#include "wx/univ/inphand.h"
#include "wx/univ/theme.h"
// ----------------------------------------------------------------------------
// wxStdCheckListBoxInputHandler
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdInputHandler
{
public:
wxStdCheckListboxInputHandler(wxInputHandler *inphand);
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed);
virtual bool HandleMouse(wxInputConsumer *consumer,
const wxMouseEvent& event);
};
// ============================================================================
// implementation of wxCheckListBox
// ============================================================================
@@ -226,13 +242,21 @@ bool wxCheckListBox::PerformAction(const wxControlAction& action,
return true;
}
/* static */
wxInputHandler *wxCheckListBox::GetStdInputHandler(wxInputHandler *handlerDef)
{
static wxStdCheckListboxInputHandler s_handler(handlerDef);
return &s_handler;
}
// ----------------------------------------------------------------------------
// wxStdCheckListboxInputHandler
// ----------------------------------------------------------------------------
wxStdCheckListboxInputHandler::
wxStdCheckListboxInputHandler(wxInputHandler *inphand)
: wxStdListboxInputHandler(inphand)
: wxStdInputHandler(wxListBox::GetStdInputHandler(inphand))
{
}
@@ -243,7 +267,7 @@ bool wxStdCheckListboxInputHandler::HandleKey(wxInputConsumer *consumer,
if ( pressed && (event.GetKeyCode() == WXK_SPACE) )
consumer->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE);
return wxStdListboxInputHandler::HandleKey(consumer, event, pressed);
return wxStdInputHandler::HandleKey(consumer, event, pressed);
}
bool wxStdCheckListboxInputHandler::HandleMouse(wxInputConsumer *consumer,
@@ -273,7 +297,7 @@ bool wxStdCheckListboxInputHandler::HandleMouse(wxInputConsumer *consumer,
}
}
return wxStdListboxInputHandler::HandleMouse(consumer, event);
return wxStdInputHandler::HandleMouse(consumer, event);
}
#endif // wxUSE_CHECKLISTBOX