added wxInputHandler and initial support for it in wxControl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8132 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-08-18 17:33:09 +00:00
parent be1f93ab87
commit 3b2555e2d0
25 changed files with 503 additions and 109 deletions

View File

@@ -17,21 +17,44 @@
#endif
class WXDLLEXPORT wxControlRenderer;
class WXDLLEXPORT wxInputHandler;
// ----------------------------------------------------------------------------
// wxControlAction: the action is currently just a string which identifies it,
// later it might become an atom (i.e. an opaque handler to string)
// ----------------------------------------------------------------------------
typedef wxString wxControlAction;
// no action to perform (other actions are defined in the controls headers)
#define wxACTION_NONE _T("")
// ----------------------------------------------------------------------------
// wxControl: the base class for all GUI controls
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxControl : public wxControlBase
{
public:
wxControl();
wxControl(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr)
wxControl(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr)
{
Create(parent, id, pos, size, style, validator, name);
}
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxControlNameStr);
// this function will filter out '&' characters and will put the
// accelerator char (the one immediately after '&') into m_chAccel
virtual void SetLabel(const wxString &label);
@@ -54,13 +77,27 @@ public:
}
protected:
// create the event translator object for this control: the base class
// action creates the default one which doesn't do anything
virtual wxInputHandler *CreateInputHandler() const;
// draw the controls contents
virtual void DoDraw(wxControlRenderer *renderer);
// perform the action, return TRUE if the control must be updated
virtual bool PerformAction(const wxControlAction& action);
// event handlers
void OnMouse(wxMouseEvent& event);
void OnKeyDown(wxKeyEvent& event);
void OnKeyUp(wxKeyEvent& event);
void OnPaint(wxPaintEvent& event);
private:
// input processor
wxInputHandler *m_handler;
// label with accel into
wxString m_label;
int m_indexAccel;