X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/442b35b53bf95f5c6c003ea9ddbefd17adbc2a00..aaedb44c5e7169db22d32e8a335936e3213da33a:/include/wx/univ/control.h diff --git a/include/wx/univ/control.h b/include/wx/univ/control.h index 58b28e770c..2c8afed8f6 100644 --- a/include/wx/univ/control.h +++ b/include/wx/univ/control.h @@ -6,24 +6,22 @@ // Created: 14.08.00 // RCS-ID: $Id$ // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com) -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_UNIV_CONTROL_H_ #define _WX_UNIV_CONTROL_H_ -#ifdef __GNUG__ - #pragma interface "control.h" -#endif - -class WXDLLEXPORT wxControlRenderer; -class WXDLLEXPORT wxInputHandler; -class WXDLLEXPORT wxRenderer; +class WXDLLIMPEXP_FWD_CORE wxControlRenderer; +class WXDLLIMPEXP_FWD_CORE wxInputHandler; +class WXDLLIMPEXP_FWD_CORE wxRenderer; // we must include it as most/all control classes derive their handlers from // it #include "wx/univ/inphand.h" +#include "wx/univ/inpcons.h" + // ---------------------------------------------------------------------------- // wxControlAction: the action is currently just a string which identifies it, // later it might become an atom (i.e. an opaque handler to string). @@ -34,13 +32,13 @@ typedef wxString wxControlAction; // the list of actions which apply to all controls (other actions are defined // in the controls headers) -#define wxACTION_NONE _T("") // no action to perform +#define wxACTION_NONE wxT("") // no action to perform // ---------------------------------------------------------------------------- // wxControl: the base class for all GUI controls // ---------------------------------------------------------------------------- -class WXDLLEXPORT wxControl : public wxControlBase +class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxInputConsumer { public: wxControl() { Init(); } @@ -66,15 +64,12 @@ public: // 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); - virtual wxString GetLabel() const; + virtual void SetLabel(const wxString& label); - // wxUniversal-specific methods + // return the current label + virtual wxString GetLabel() const { return m_label; } - // return the accel index in the string or -1 if none and puts the modified - // string intosecond parameter if non NULL - static int FindAccelIndex(const wxString& label, - wxString *labelOnly = NULL); + // wxUniversal-specific methods // return the index of the accel char in the label or -1 if none int GetAccelIndex() const { return m_indexAccel; } @@ -82,41 +77,19 @@ public: // return the accel char itself or 0 if none wxChar GetAccelChar() const { - return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel]; + return m_indexAccel == -1 ? wxT('\0') : (wxChar)m_label[m_indexAccel]; } - // get the input handler of this control - wxInputHandler *GetInputHandler() const { return m_handler; } - - // perform a control-dependent action: an action may have an optional - // numeric and another (also optional) string argument whose interpretation - // depends on the action - // - // NB: we might use ellipsis in PerformAction() declaration but this - // wouldn't be more efficient than always passing 2 unused parameters - // but would be more difficult. Another solution would be to have - // several overloaded versions but this will expose the problem of - // virtual function hiding we don't have here. - virtual bool PerformAction(const wxControlAction& action, - long numArg = -1l, - const wxString& strArg = wxEmptyString); + virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; } protected: - // event handlers - void OnMouse(wxMouseEvent& event); - void OnKeyDown(wxKeyEvent& event); - void OnKeyUp(wxKeyEvent& event); - void OnFocus(wxFocusEvent& event); - void OnActivate(wxActivateEvent& event); - // common part of all ctors void Init(); - // create input handler by name - void CreateInputHandler(const wxString& inphandler); - - // input processor (never deleted, the theme deletes it itself) - wxInputHandler *m_handler; + // set m_label and m_indexAccel and refresh the control to show the new + // label (but, unlike SetLabel(), don't call the base class SetLabel() thus + // avoiding to change wxControlBase::m_labelOrig) + void UnivDoSetLabel(const wxString& label); private: // label and accel info @@ -125,6 +98,7 @@ private: DECLARE_DYNAMIC_CLASS(wxControl) DECLARE_EVENT_TABLE() + WX_DECLARE_INPUT_CONSUMER() }; #endif // _WX_UNIV_CONTROL_H_