]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
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 | |
7491d644 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CONTROL_H_ | |
13 | #define _WX_CONTROL_H_ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "control.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/window.h" | |
20 | #include "wx/list.h" | |
21 | #include "wx/validate.h" | |
22 | ||
0148fe1e VZ |
23 | #define wxControlNameStr _T("control") |
24 | ||
9b6dbb09 JS |
25 | // General item class |
26 | class WXDLLEXPORT wxControl: public wxWindow | |
27 | { | |
a4294b78 | 28 | DECLARE_ABSTRACT_CLASS(wxControl) |
7491d644 | 29 | |
9b6dbb09 | 30 | public: |
a4294b78 | 31 | wxControl(); |
0148fe1e VZ |
32 | wxControl( wxWindow *parent, |
33 | wxWindowID id, | |
34 | const wxPoint &pos = wxDefaultPosition, | |
35 | const wxSize &size = wxDefaultSize, | |
36 | long style = 0, | |
37 | const wxString &name = wxControlNameStr ); | |
38 | ||
39 | #if wxUSE_VALIDATORS | |
40 | wxControl( wxWindow *parent, | |
41 | wxWindowID id, | |
42 | const wxPoint &pos = wxDefaultPosition, | |
43 | const wxSize &size = wxDefaultSize, | |
44 | long style = 0, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString &name = wxControlNameStr ); | |
47 | #endif | |
a4294b78 | 48 | ~wxControl(); |
9b6dbb09 | 49 | |
31528cd3 VZ |
50 | // simulates the event, returns TRUE if the event was processed |
51 | virtual void Command(wxCommandEvent& WXUNUSED(event)) { } | |
52 | ||
53 | // calls the callback and appropriate event handlers, returns TRUE if | |
54 | // event was processed | |
55 | virtual bool ProcessCommand(wxCommandEvent& event); | |
56 | ||
a4294b78 JS |
57 | virtual void SetLabel(const wxString& label); |
58 | virtual wxString GetLabel() const ; | |
9b6dbb09 | 59 | |
31528cd3 | 60 | #if WXWIN_COMPATIBILITY |
7491d644 VZ |
61 | void Callback(const wxFunction function) { m_callback = function; }; // Adds callback |
62 | ||
63 | wxFunction GetCallback() { return m_callback; } | |
31528cd3 | 64 | #endif // WXWIN_COMPATIBILITY |
9b6dbb09 | 65 | |
7491d644 | 66 | bool InSetValue() const { return m_inSetValue; } |
9b6dbb09 JS |
67 | |
68 | protected: | |
31528cd3 | 69 | #if WXWIN_COMPATIBILITY |
a4294b78 | 70 | wxFunction m_callback; // Callback associated with the window |
31528cd3 | 71 | #endif // WXWIN_COMPATIBILITY |
9b6dbb09 | 72 | |
a4294b78 JS |
73 | bool m_inSetValue; // Motif: prevent callbacks being called while |
74 | // in SetValue | |
75 | ||
76 | DECLARE_EVENT_TABLE() | |
9b6dbb09 JS |
77 | }; |
78 | ||
79 | #endif | |
80 | // _WX_CONTROL_H_ |