]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/control.h
Cured last focus bug (I hope); some wxMotif mods
[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 // General item class
24 class WXDLLEXPORT wxControl: public wxWindow
25 {
26 DECLARE_ABSTRACT_CLASS(wxControl)
27 public:
28 wxControl();
29 ~wxControl();
30
31 virtual void Command(wxCommandEvent& WXUNUSED(event)) {}; // Simulates an event
32 virtual void ProcessCommand(wxCommandEvent& event); // Calls the callback and
33 // appropriate event handlers
34 virtual void SetLabel(const wxString& label);
35 virtual wxString GetLabel() const ;
36
37 // Places item in centre of panel - so can't be used BEFORE panel->Fit()
38 void Centre(int direction = wxHORIZONTAL);
39 inline void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
40
41 inline wxFunction GetCallback() { return m_callback; }
42
43 inline bool InSetValue() const { return m_inSetValue; }
44 protected:
45 wxFunction m_callback; // Callback associated with the window
46
47 bool m_inSetValue; // Motif: prevent callbacks being called while
48 // in SetValue
49
50 DECLARE_EVENT_TABLE()
51 };
52
53 #endif
54 // _WX_CONTROL_H_