]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/control.h
OS/2 Updates
[wxWidgets.git] / include / wx / mac / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: control.h
3 // Purpose: wxControl class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
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 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 virtual ~wxControl();
29
30 bool Create(wxWindow *parent, wxWindowID id,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize, long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxControlNameStr);
35
36 // Simulates an event
37 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
38
39 // implementation from now on
40 // --------------------------
41
42 // Calls the callback and appropriate event handlers
43 bool ProcessCommand(wxCommandEvent& event);
44 virtual void SetLabel(const wxString& title) ;
45
46 wxList& GetSubcontrols() { return m_subControls; }
47
48 void OnEraseBackground(wxEraseEvent& event);
49
50 virtual bool Enable(bool enabled) ;
51 virtual bool Show(bool show) ;
52
53 virtual void MacHandleControlClick( ControlHandle control , SInt16 controlpart ) ;
54 virtual void MacPreControlCreate( wxWindow *parent, wxWindowID id, wxString label ,
55 const wxPoint& pos,
56 const wxSize& size, long style,
57 const wxValidator& validator,
58 const wxString& name , Rect *outBounds , StringPtr maclabel ) ;
59 virtual void MacPostControlCreate() ;
60 virtual void MacAdjustControlRect() ;
61 virtual ControlHandle MacGetContainerForEmbedding() ;
62 virtual void MacSuperChangedPosition() ;
63 virtual void MacSuperEnabled( bool enabled ) ;
64 virtual void MacSuperShown( bool show ) ;
65 virtual bool MacCanFocus() const ;
66
67 virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags ) ;
68 virtual void OnKeyDown( wxKeyEvent &event ) ;
69 virtual void OnMouseEvent( wxMouseEvent &event ) ;
70 virtual void OnPaint(wxPaintEvent& event) ;
71 virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL) ;
72 ControlHandle GetMacControl() { return m_macControl ;}
73
74 #if WXWIN_COMPATIBILITY
75 virtual void SetButtonColour(const wxColour& WXUNUSED(col)) { }
76 wxColour* GetButtonColour() const { return NULL; }
77
78 inline virtual void SetLabelFont(const wxFont& font);
79 inline virtual void SetButtonFont(const wxFont& font);
80 inline wxFont& GetLabelFont() const;
81 inline wxFont& GetButtonFont() const;
82
83 // Adds callback
84 inline void Callback(const wxFunction function);
85
86 wxFunction GetCallback() { return m_callback; }
87
88 protected:
89 wxFunction m_callback; // Callback associated with the window
90 #endif // WXWIN_COMPATIBILITY
91
92 protected:
93 // For controls like radiobuttons which are really composite
94 ControlHandle m_macControl ;
95 int m_macHorizontalBorder ;
96 int m_macVerticalBorder ;
97 wxList m_subControls;
98
99 virtual wxSize DoGetBestSize() const ;
100
101 private:
102 DECLARE_EVENT_TABLE()
103 };
104
105
106 #if WXWIN_COMPATIBILITY
107 inline void wxControl::Callback(const wxFunction f) { m_callback = f; };
108 inline wxFont& wxControl::GetLabelFont() const { return GetFont(); }
109 inline wxFont& wxControl::GetButtonFont() const { return GetFont(); }
110 inline void wxControl::SetLabelFont(const wxFont& font) { SetFont(font); }
111 inline void wxControl::SetButtonFont(const wxFont& font) { SetFont(font); }
112 #endif // WXWIN_COMPATIBILITY
113
114 wxControl *wxFindControlFromMacControl(ControlHandle inControl ) ;
115 void wxAssociateControlWithMacControl(ControlHandle inControl, wxControl *control) ;
116 void wxRemoveMacControlAssociation(wxControl *control) ;
117
118 #endif
119 // _WX_CONTROL_H_