]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/motif/control.h
disable use of #pragma interface under Mac OS X
[wxWidgets.git] / include / wx / motif / control.h
... / ...
CommitLineData
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#if defined(__GNUG__) && !defined(__APPLE__)
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
24class WXDLLEXPORT wxControl: public wxControlBase
25{
26 DECLARE_ABSTRACT_CLASS(wxControl)
27
28public:
29 wxControl();
30 wxControl( wxWindow *parent,
31 wxWindowID id,
32 const wxPoint &pos = wxDefaultPosition,
33 const wxSize &size = wxDefaultSize,
34 long style = 0,
35 const wxValidator& validator = wxDefaultValidator,
36 const wxString &name = wxControlNameStr )
37 {
38 Create(parent, id, pos, size, style, validator, name);
39 }
40
41 bool Create(wxWindow *parent, wxWindowID id,
42 const wxPoint& pos = wxDefaultPosition,
43 const wxSize& size = wxDefaultSize, long style = 0,
44 const wxValidator& validator = wxDefaultValidator,
45 const wxString& name = wxControlNameStr);
46
47 // simulates the event, returns TRUE if the event was processed
48 virtual void Command(wxCommandEvent& WXUNUSED(event)) { }
49
50 // calls the callback and appropriate event handlers, returns TRUE if
51 // event was processed
52 virtual bool ProcessCommand(wxCommandEvent& event);
53
54 virtual void SetLabel(const wxString& label);
55 virtual wxString GetLabel() const ;
56
57#if WXWIN_COMPATIBILITY
58 void Callback(const wxFunction function) { m_callback = function; }; // Adds callback
59
60 wxFunction GetCallback() { return m_callback; }
61#endif // WXWIN_COMPATIBILITY
62
63 bool InSetValue() const { return m_inSetValue; }
64
65protected:
66 // calls wxControlBase::CreateControl, also sets foreground, background and
67 // font to parent's values
68 bool CreateControl(wxWindow *parent,
69 wxWindowID id,
70 const wxPoint& pos,
71 const wxSize& size,
72 long style,
73 const wxValidator& validator,
74 const wxString& name);
75
76#if WXWIN_COMPATIBILITY
77 wxFunction m_callback; // Callback associated with the window
78#endif // WXWIN_COMPATIBILITY
79
80 bool m_inSetValue; // Motif: prevent callbacks being called while
81 // in SetValue
82
83 DECLARE_EVENT_TABLE()
84};
85
86#endif
87// _WX_CONTROL_H_