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