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

@@ -47,7 +47,7 @@ public:
Create(parent, id, bitmap, label, pos, size, style, validator, name);
}
wxButton(wxWindow *parent,
wxWindowID id,
const wxString& label = wxEmptyString,
@@ -74,7 +74,7 @@ public:
return Create(parent, id, wxNullBitmap, label,
pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxBitmap& bitmap,
@@ -106,9 +106,16 @@ public:
virtual bool CanBeHighlighted() const { return true; }
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
{
return GetStdInputHandler(handlerDef);
}
protected:
virtual wxSize DoGetBestClientSize() const;
virtual bool DoDrawBackground(wxDC& dc);
virtual void DoDraw(wxControlRenderer *renderer);
@@ -128,31 +135,5 @@ private:
DECLARE_DYNAMIC_CLASS(wxButton)
};
// ----------------------------------------------------------------------------
// wxStdButtonInputHandler: translates SPACE and ENTER keys and the left mouse
// click into button press/release actions
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxStdButtonInputHandler : public wxStdInputHandler
{
public:
wxStdButtonInputHandler(wxInputHandler *inphand);
virtual bool HandleKey(wxInputConsumer *consumer,
const wxKeyEvent& event,
bool pressed);
virtual bool HandleMouse(wxInputConsumer *consumer,
const wxMouseEvent& event);
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
private:
// the window (button) which has capture or NULL and the flag telling if
// the mouse is inside the button which captured it or not
wxWindow *m_winCapture;
bool m_winHasMouse;
};
#endif // _WX_UNIV_BUTTON_H_