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"
19 WXDLLEXPORT_DATA(extern const wxChar
*) wxControlNameStr
;
22 class WXDLLEXPORT wxControl
: public wxControlBase
24 DECLARE_ABSTRACT_CLASS(wxControl
)
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
);
37 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
39 // implementation from now on
40 // --------------------------
42 // Calls the callback and appropriate event handlers
43 bool ProcessCommand(wxCommandEvent
& event
);
44 virtual void SetLabel(const wxString
& title
) ;
46 wxList
& GetSubcontrols() { return m_subControls
; }
48 void OnEraseBackground(wxEraseEvent
& event
);
50 virtual bool Enable(bool enabled
) ;
51 virtual bool Show(bool show
) ;
53 virtual void MacHandleControlClick( ControlHandle control
, SInt16 controlpart
) ;
54 virtual void MacPreControlCreate( wxWindow
*parent
, wxWindowID id
, wxString label
,
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 ;
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
;}
74 #if WXWIN_COMPATIBILITY
75 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
76 wxColour
* GetButtonColour() const { return NULL
; }
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;
84 inline void Callback(const wxFunction function
);
86 wxFunction
GetCallback() { return m_callback
; }
89 wxFunction m_callback
; // Callback associated with the window
90 #endif // WXWIN_COMPATIBILITY
93 // For controls like radiobuttons which are really composite
94 ControlHandle m_macControl
;
95 int m_macHorizontalBorder
;
96 int m_macVerticalBorder
;
99 virtual wxSize
DoGetBestSize() const ;
102 DECLARE_EVENT_TABLE()
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
114 wxControl
*wxFindControlFromMacControl(ControlHandle inControl
) ;
115 void wxAssociateControlWithMacControl(ControlHandle inControl
, wxControl
*control
) ;
116 void wxRemoveMacControlAssociation(wxControl
*control
) ;