]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: control.h | |
3 | // Purpose: wxControl class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CONTROL_H_ | |
13 | #define _WX_CONTROL_H_ | |
14 | ||
15 | #include "wx/window.h" | |
16 | #include "wx/list.h" | |
17 | #include "wx/validate.h" | |
18 | ||
19 | // General item class | |
20 | class WXDLLEXPORT wxControl: public wxControlBase | |
21 | { | |
22 | DECLARE_ABSTRACT_CLASS(wxControl) | |
23 | ||
24 | public: | |
25 | wxControl(); | |
26 | wxControl( wxWindow *parent, | |
27 | wxWindowID id, | |
28 | const wxPoint &pos = wxDefaultPosition, | |
29 | const wxSize &size = wxDefaultSize, | |
30 | long style = 0, | |
31 | const wxValidator& validator = wxDefaultValidator, | |
32 | const wxString &name = wxControlNameStr ) | |
33 | { | |
34 | Create(parent, id, pos, size, style, validator, name); | |
35 | } | |
36 | ||
37 | bool Create(wxWindow *parent, wxWindowID id, | |
38 | const wxPoint& pos = wxDefaultPosition, | |
39 | const wxSize& size = wxDefaultSize, long style = 0, | |
40 | const wxValidator& validator = wxDefaultValidator, | |
41 | const wxString& name = wxControlNameStr); | |
42 | ||
43 | // simulates the event, returns true if the event was processed | |
44 | virtual void Command(wxCommandEvent& WXUNUSED(event)) { } | |
45 | ||
46 | // calls the callback and appropriate event handlers, returns true if | |
47 | // event was processed | |
48 | virtual bool ProcessCommand(wxCommandEvent& event); | |
49 | ||
50 | virtual void SetLabel(const wxString& label); | |
51 | virtual wxString GetLabel() const ; | |
52 | ||
53 | bool InSetValue() const { return m_inSetValue; } | |
54 | ||
55 | protected: | |
56 | // calls wxControlBase::CreateControl, also sets foreground, background and | |
57 | // font to parent's values | |
58 | bool CreateControl(wxWindow *parent, | |
59 | wxWindowID id, | |
60 | const wxPoint& pos, | |
61 | const wxSize& size, | |
62 | long style, | |
63 | const wxValidator& validator, | |
64 | const wxString& name); | |
65 | ||
66 | // native implementation using XtQueryGeometry | |
67 | virtual wxSize DoGetBestSize() const; | |
68 | ||
69 | // Motif: prevent callbacks being called while in SetValue | |
70 | bool m_inSetValue; | |
71 | ||
72 | DECLARE_EVENT_TABLE() | |
73 | }; | |
74 | ||
75 | #endif // _WX_CONTROL_H_ | |
76 |