]> git.saurik.com Git - wxWidgets.git/blob - include/wx/univ/control.h
Added MSWPositionForWxMenu() method which is used to translate wxWindows
[wxWidgets.git] / include / wx / univ / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/control.h
3 // Purpose: universal wxControl: adds handling of mnemonics
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 14.08.00
7 // RCS-ID: $Id$
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_CONTROL_H_
13 #define _WX_UNIV_CONTROL_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "control.h"
17 #endif
18
19 class WXDLLEXPORT wxControlRenderer;
20 class WXDLLEXPORT wxInputHandler;
21 class WXDLLEXPORT wxRenderer;
22
23 // we must include it as most/all control classes derive their handlers from
24 // it
25 #include "wx/univ/inphand.h"
26
27 #include "wx/univ/inpcons.h"
28
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 // ----------------------------------------------------------------------------
33
34 typedef wxString wxControlAction;
35
36 // the list of actions which apply to all controls (other actions are defined
37 // in the controls headers)
38
39 #define wxACTION_NONE _T("") // no action to perform
40
41 // ----------------------------------------------------------------------------
42 // wxControl: the base class for all GUI controls
43 // ----------------------------------------------------------------------------
44
45 class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer
46 {
47 public:
48 wxControl();
49
50 wxControl(wxWindow *parent,
51 wxWindowID id,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize, long style = 0,
54 const wxValidator& validator = wxDefaultValidator,
55 const wxString& name = wxControlNameStr);
56
57 bool Create(wxWindow *parent,
58 wxWindowID id,
59 const wxPoint& pos = wxDefaultPosition,
60 const wxSize& size = wxDefaultSize, long style = 0,
61 const wxValidator& validator = wxDefaultValidator,
62 const wxString& name = wxControlNameStr);
63
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;
68
69 // wxUniversal-specific methods
70
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);
75
76 // return the index of the accel char in the label or -1 if none
77 int GetAccelIndex() const { return m_indexAccel; }
78
79 // return the accel char itself or 0 if none
80 wxChar GetAccelChar() const
81 {
82 return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel];
83 }
84
85 virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
86
87 protected:
88 // common part of all ctors
89 void Init();
90
91 private:
92 // label and accel info
93 wxString m_label;
94 int m_indexAccel;
95
96 DECLARE_DYNAMIC_CLASS(wxControl)
97 DECLARE_EVENT_TABLE()
98 WX_DECLARE_INPUT_CONSUMER()
99 };
100
101 #endif // _WX_UNIV_CONTROL_H_