1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/control.h
3 // Purpose: universal wxControl: adds handling of mnemonics
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_UNIV_CONTROL_H_
13 #define _WX_UNIV_CONTROL_H_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "control.h"
19 class WXDLLEXPORT wxControlRenderer
;
20 class WXDLLEXPORT wxInputHandler
;
21 class WXDLLEXPORT wxRenderer
;
23 // we must include it as most/all control classes derive their handlers from
25 #include "wx/univ/inphand.h"
27 #include "wx/univ/inpcons.h"
29 // ----------------------------------------------------------------------------
30 // wxControlAction: the action is currently just a string which identifies it,
31 // later it might become an atom (i.e. an opaque handler to string).
32 // ----------------------------------------------------------------------------
34 typedef wxString wxControlAction
;
36 // the list of actions which apply to all controls (other actions are defined
37 // in the controls headers)
39 #define wxACTION_NONE _T("") // no action to perform
41 // ----------------------------------------------------------------------------
42 // wxControl: the base class for all GUI controls
43 // ----------------------------------------------------------------------------
45 class WXDLLEXPORT wxControl
: public wxControlBase
, public wxInputConsumer
50 wxControl(wxWindow
*parent
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
, long style
= 0,
54 const wxValidator
& validator
= wxDefaultValidator
,
55 const wxString
& name
= wxControlNameStr
);
57 bool Create(wxWindow
*parent
,
59 const wxPoint
& pos
= wxDefaultPosition
,
60 const wxSize
& size
= wxDefaultSize
, long style
= 0,
61 const wxValidator
& validator
= wxDefaultValidator
,
62 const wxString
& name
= wxControlNameStr
);
64 // this function will filter out '&' characters and will put the
65 // accelerator char (the one immediately after '&') into m_chAccel
66 virtual void SetLabel(const wxString
&label
);
67 virtual wxString
GetLabel() const;
69 // wxUniversal-specific methods
71 // return the accel index in the string or -1 if none and puts the modified
72 // string intosecond parameter if non NULL
73 static int FindAccelIndex(const wxString
& label
,
74 wxString
*labelOnly
= NULL
);
76 // return the index of the accel char in the label or -1 if none
77 int GetAccelIndex() const { return m_indexAccel
; }
79 // return the accel char itself or 0 if none
80 wxChar
GetAccelChar() const
82 return m_indexAccel
== -1 ? _T('\0') : m_label
[m_indexAccel
];
85 virtual wxWindow
*GetInputWindow() const { return (wxWindow
*)this; }
88 // common part of all ctors
92 // label and accel info
96 DECLARE_DYNAMIC_CLASS(wxControl
)
98 WX_DECLARE_INPUT_CONSUMER()
101 #endif // _WX_UNIV_CONTROL_H_