]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/control.h
3 // Purpose: wxControl class
4 // Author: David Elliott
8 // Copyright: (c) 2003 David Elliott
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __WX_COCOA_CONTROL_H__
13 #define __WX_COCOA_CONTROL_H__
15 #include "wx/cocoa/NSControl.h"
17 // ========================================================================
19 // ========================================================================
21 class WXDLLEXPORT wxControl
: public wxControlBase
, public wxCocoaNSControl
23 DECLARE_ABSTRACT_CLASS(wxControl
)
24 WX_DECLARE_COCOA_OWNER(NSControl
,NSView
,NSView
)
26 // ------------------------------------------------------------------------
28 // ------------------------------------------------------------------------
31 wxControl(wxWindow
*parent
, wxWindowID winid
,
32 const wxPoint
& pos
= wxDefaultPosition
,
33 const wxSize
& size
= wxDefaultSize
, long style
= 0,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxControlNameStr
)
37 Create(parent
, winid
, pos
, size
, style
, validator
, name
);
40 bool Create(wxWindow
*parent
, wxWindowID winid
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
, long style
= 0,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxControlNameStr
);
47 // ------------------------------------------------------------------------
49 // ------------------------------------------------------------------------
52 // implementation from now on
53 // --------------------------
55 void OnEraseBackground(wxEraseEvent
& event
);
57 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
59 // Calls the callback and appropriate event handlers
60 bool ProcessCommand(wxCommandEvent
& event
);
62 #if WXWIN_COMPATIBILITY
63 virtual void SetButtonColour(const wxColour
& WXUNUSED(col
)) { }
64 wxColour
* GetButtonColour() const { return NULL
; }
66 inline virtual void SetLabelFont(const wxFont
& font
);
67 inline virtual void SetButtonFont(const wxFont
& font
);
68 inline wxFont
& GetLabelFont() const;
69 inline wxFont
& GetButtonFont() const;
72 inline void Callback(const wxFunction function
);
74 wxFunction
GetCallback() { return m_callback
; }
77 wxFunction m_callback
; // Callback associated with the window
78 #endif // WXWIN_COMPATIBILITY
81 virtual wxSize
DoGetBestSize() const;
85 #if WXWIN_COMPATIBILITY
86 inline void wxControl::Callback(const wxFunction f
) { m_callback
= f
; };
87 inline wxFont
& wxControl::GetLabelFont() const { return GetFont(); }
88 inline wxFont
& wxControl::GetButtonFont() const { return GetFont(); }
89 inline void wxControl::SetLabelFont(const wxFont
& font
) { SetFont(font
); }
90 inline void wxControl::SetButtonFont(const wxFont
& font
) { SetFont(font
); }
91 #endif // WXWIN_COMPATIBILITY
93 #endif // __WX_COCOA_CONTROL_H__