]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/control.h
use wxON_BLOCK_EXIT instead of just ON_BLOCK_EXIT
[wxWidgets.git] / include / wx / mac / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "control.h"
17 #endif
18
19 WXDLLEXPORT_DATA(extern const wxChar*) wxControlNameStr;
20
21 // General item class
22 class WXDLLEXPORT wxControl : public wxControlBase
23 {
24 DECLARE_ABSTRACT_CLASS(wxControl)
25
26 public:
27 wxControl();
28 wxControl(wxWindow *parent, wxWindowID id,
29 const wxPoint& pos = wxDefaultPosition,
30 const wxSize& size = wxDefaultSize, 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 virtual ~wxControl();
43
44 // Simulates an event
45 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
46
47 // implementation from now on
48 // --------------------------
49
50 // Calls the callback and appropriate event handlers
51 bool ProcessCommand(wxCommandEvent& event);
52 virtual void SetLabel(const wxString& title) ;
53
54 wxList& GetSubcontrols() { return m_subControls; }
55
56 void OnEraseBackground(wxEraseEvent& event);
57
58 virtual bool Enable(bool enable = TRUE) ;
59 virtual bool Show(bool show = TRUE) ;
60
61 virtual void MacRedrawControl () ;
62 virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ;
63 virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
64 const wxPoint& pos,
65 const wxSize& size, long style,
66 const wxValidator& validator,
67 const wxString& name ,
68 WXRECTPTR outBounds ,
69 unsigned char* maclabel ) ;
70 virtual void MacPostControlCreate() ;
71 virtual void MacAdjustControlRect() ;
72 virtual WXWidget MacGetContainerForEmbedding() ;
73 virtual void MacSuperChangedPosition() ;
74 virtual void MacSuperEnabled( bool enabled ) ;
75 virtual void MacSuperShown( bool show ) ;
76 virtual bool MacCanFocus() const ;
77 virtual void MacUpdateDimensions() ;
78 void* MacGetControlAction() { return m_macControlAction ; }
79
80 virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
81 void OnKeyDown( wxKeyEvent &event ) ;
82 void OnMouseEvent( wxMouseEvent &event ) ;
83 void OnPaint(wxPaintEvent& event) ;
84 virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ;
85 WXWidget GetMacControl() { return m_macControl ;}
86
87 protected:
88 // For controls like radiobuttons which are really composite
89 WXWidget m_macControl ;
90 void* m_macControlAction ;
91 bool m_macControlIsShown ;
92 wxList m_subControls;
93 int m_macHorizontalBorder ;
94 int m_macVerticalBorder ;
95
96 virtual wxSize DoGetBestSize() const;
97
98 private:
99 DECLARE_EVENT_TABLE()
100 };
101
102
103 wxControl *wxFindControlFromMacControl(WXWidget inControl ) ;
104 void wxAssociateControlWithMacControl(WXWidget inControl, wxControl *control) ;
105 void wxRemoveMacControlAssociation(wxControl *control) ;
106
107 #endif
108 // _WX_CONTROL_H_