]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/control.h
compatibility changes: WXWIN_COMPATIBILITY_EVENT_TYPES and DECLARE_EVENT_TABLE_ENTRY...
[wxWidgets.git] / include / wx / motif / control.h
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 #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
23 #define wxControlNameStr _T("control")
24
25 // General item class
26 class WXDLLEXPORT wxControl: public wxControlBase
27 {
28 DECLARE_ABSTRACT_CLASS(wxControl)
29
30 public:
31 wxControl();
32 wxControl( wxWindow *parent,
33 wxWindowID id,
34 const wxPoint &pos = wxDefaultPosition,
35 const wxSize &size = wxDefaultSize,
36 long style = 0,
37 const wxValidator& validator = wxDefaultValidator,
38 const wxString &name = wxControlNameStr )
39 {
40 Create(parent, id, pos, size, style, validator, name);
41 }
42
43 bool Create(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize, long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxControlNameStr);
48
49 ~wxControl();
50
51 // simulates the event, returns TRUE if the event was processed
52 virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
53
54 // calls the callback and appropriate event handlers, returns TRUE if
55 // event was processed
56 virtual bool ProcessCommand(wxCommandEvent& event);
57
58 virtual void SetLabel(const wxString& label);
59 virtual wxString GetLabel() const ;
60
61 #if WXWIN_COMPATIBILITY
62 void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
63
64 wxFunction GetCallback() { return m_callback; }
65 #endif // WXWIN_COMPATIBILITY
66
67 bool InSetValue() const { return m_inSetValue; }
68
69 protected:
70 #if WXWIN_COMPATIBILITY
71 wxFunction m_callback; // Callback associated with the window
72 #endif // WXWIN_COMPATIBILITY
73
74 bool m_inSetValue; // Motif: prevent callbacks being called while
75 // in SetValue
76
77 DECLARE_EVENT_TABLE()
78 };
79
80 #endif
81 // _WX_CONTROL_H_