]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/control.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "control.h"
19 WXDLLEXPORT_DATA(extern const wxChar
*) wxControlNameStr
;
22 class WXDLLEXPORT wxControl
: public wxControlBase
24 DECLARE_ABSTRACT_CLASS(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
)
34 Create(parent
, id
, pos
, size
, style
, validator
, name
);
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
);
45 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
47 // implementation from now on
48 // --------------------------
50 // Calls the callback and appropriate event handlers
51 bool ProcessCommand(wxCommandEvent
& event
);
52 virtual void SetLabel(const wxString
& title
) ;
54 wxList
& GetSubcontrols() { return m_subControls
; }
56 void OnEraseBackground(wxEraseEvent
& event
);
58 virtual bool Enable(bool enable
= TRUE
) ;
59 virtual bool Show(bool show
= TRUE
) ;
61 virtual void MacRedrawControl () ;
62 virtual void MacHandleControlClick( WXWidget control
, wxInt16 controlpart
, bool mouseStillDown
) ;
63 virtual void MacPreControlCreate( wxWindow
*parent
, wxWindowID id
, wxString label
,
65 const wxSize
& size
, long style
,
66 const wxValidator
& validator
,
67 const wxString
& name
,
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
; }
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
;}
87 #if WXWIN_COMPATIBILITY
88 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
89 wxColour
* GetButtonColour() const { return NULL
; }
91 inline virtual void SetLabelFont(const wxFont
& font
);
92 inline virtual void SetButtonFont(const wxFont
& font
);
93 inline wxFont
& GetLabelFont() const;
94 inline wxFont
& GetButtonFont() const;
95 #endif // WXWIN_COMPATIBILITY
98 // For controls like radiobuttons which are really composite
99 WXWidget m_macControl
;
100 void* m_macControlAction
;
101 bool m_macControlIsShown
;
102 wxList m_subControls
;
103 int m_macHorizontalBorder
;
104 int m_macVerticalBorder
;
106 virtual wxSize
DoGetBestSize() const;
109 DECLARE_EVENT_TABLE()
113 #if WXWIN_COMPATIBILITY
114 inline wxFont
& wxControl::GetLabelFont() const { return GetFont(); }
115 inline wxFont
& wxControl::GetButtonFont() const { return GetFont(); }
116 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
117 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }
118 #endif // WXWIN_COMPATIBILITY
120 wxControl
*wxFindControlFromMacControl(WXWidget inControl
) ;
121 void wxAssociateControlWithMacControl(WXWidget inControl
, wxControl
*control
) ;
122 void wxRemoveMacControlAssociation(wxControl
*control
) ;