]> git.saurik.com Git - wxWidgets.git/blob - include/wx/control.h
some OS/2 updates
[wxWidgets.git] / include / wx / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/control.h
3 // Purpose: wxControl common interface
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 26.07.99
7 // RCS-ID: $Id$
8 // Copyright: (c) wxWindows team
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CONTROL_H_BASE_
13 #define _WX_CONTROL_H_BASE_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #ifdef __GNUG__
20 #pragma interface "controlbase.h"
21 #endif
22
23 #if wxUSE_CONTROLS
24
25 #include "wx/window.h" // base class
26
27 WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
28
29 // ----------------------------------------------------------------------------
30 // wxControl is the base class for all controls
31 // ----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxControlBase : public wxWindow
34 {
35 public:
36 virtual ~wxControlBase();
37
38 // Create() function adds the validator parameter
39 bool Create(wxWindow *parent, wxWindowID id,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxControlNameStr);
45
46 // simulates the event of given type (i.e. wxButton::Command() is just as
47 // if the button was clicked)
48 virtual void Command(wxCommandEvent &event);
49
50 // get the control alignment (left/right/centre, top/bottom/centre)
51 int GetAlignment() const { return m_windowStyle & wxALIGN_MASK; }
52
53 protected:
54 // creates the control (calls wxWindowBase::CreateBase inside) and adds it
55 // to the list of parents children
56 bool CreateControl(wxWindowBase *parent,
57 wxWindowID id,
58 const wxPoint& pos,
59 const wxSize& size,
60 long style,
61 const wxValidator& validator,
62 const wxString& name);
63
64 // inherit colour and font settings from the parent window
65 void InheritAttributes();
66
67 // initialize the common fields of wxCommandEvent
68 void InitCommandEvent(wxCommandEvent& event) const;
69 };
70
71 // ----------------------------------------------------------------------------
72 // include platform-dependent wxControl declarations
73 // ----------------------------------------------------------------------------
74
75 #if defined(__WXUNIVERSAL__)
76 #include "wx/univ/control.h"
77 #elif defined(__WXMSW__)
78 #include "wx/msw/control.h"
79 #elif defined(__WXMOTIF__)
80 #include "wx/motif/control.h"
81 #elif defined(__WXGTK__)
82 #include "wx/gtk/control.h"
83 #elif defined(__WXMAC__)
84 #include "wx/mac/control.h"
85 #elif defined(__WXPM__)
86 #include "wx/os2/control.h"
87 #elif defined(__WXSTUBS__)
88 #include "wx/stubs/control.h"
89 #endif
90
91 #endif // wxUSE_CONTROLS
92
93 #endif
94 // _WX_CONTROL_H_BASE_