1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxControl class
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CONTROL_H_
13 #define _WX_CONTROL_H_
16 #pragma interface "control.h"
20 class WXDLLEXPORT wxControl
: public wxControlBase
22 DECLARE_ABSTRACT_CLASS(wxControl
)
29 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
31 // implementation from now on
32 // --------------------------
34 // Calls the callback and appropriate event handlers
35 bool ProcessCommand(wxCommandEvent
& event
);
36 virtual void SetLabel(const wxString
& title
) ;
38 wxList
& GetSubcontrols() { return m_subControls
; }
40 void OnEraseBackground(wxEraseEvent
& event
);
42 virtual bool Enable(bool enabled
) ;
43 virtual bool Show(bool show
) ;
45 virtual void MacHandleControlClick( ControlHandle control
, SInt16 controlpart
) ;
46 virtual void MacPreControlCreate( wxWindow
*parent
, wxWindowID id
, wxString label
,
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 ;
59 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
;}
66 #if WXWIN_COMPATIBILITY
67 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
68 wxColour
* GetButtonColour() const { return NULL
; }
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;
76 inline void Callback(const wxFunction function
);
78 wxFunction
GetCallback() { return m_callback
; }
81 wxFunction m_callback
; // Callback associated with the window
82 #endif // WXWIN_COMPATIBILITY
85 // For controls like radiobuttons which are really composite
86 ControlHandle m_macControl
;
87 int m_macHorizontalBorder
;
88 int m_macVerticalBorder
;
91 virtual wxSize
DoGetBestSize();
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
106 wxControl
*wxFindControlFromMacControl(ControlHandle inControl
) ;
107 void wxAssociateControlWithMacControl(ControlHandle inControl
, wxControl
*control
) ;
108 void wxRemoveMacControlAssociation(wxControl
*control
) ;