1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/control.h
3 // Purpose: wxControl class
4 // Author: David Elliott
7 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef __WX_COCOA_CONTROL_H__
12 #define __WX_COCOA_CONTROL_H__
14 #include "wx/cocoa/NSControl.h"
16 // ========================================================================
18 // ========================================================================
20 class WXDLLIMPEXP_CORE wxControl
: public wxControlBase
, public wxCocoaNSControl
22 DECLARE_ABSTRACT_CLASS(wxControl
)
23 WX_DECLARE_COCOA_OWNER(NSControl
,NSView
,NSView
)
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
30 wxControl(wxWindow
*parent
, wxWindowID winid
,
31 const wxPoint
& pos
= wxDefaultPosition
,
32 const wxSize
& size
= wxDefaultSize
, long style
= 0,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxControlNameStr
)
36 Create(parent
, winid
, pos
, size
, style
, validator
, name
);
39 bool Create(wxWindow
*parent
, wxWindowID winid
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
, long style
= 0,
42 const wxValidator
& validator
= wxDefaultValidator
,
43 const wxString
& name
= wxControlNameStr
);
46 // ------------------------------------------------------------------------
48 // ------------------------------------------------------------------------
51 // implementation from now on
52 // --------------------------
54 void OnEraseBackground(wxEraseEvent
& event
);
56 virtual void Command(wxCommandEvent
& event
) { ProcessCommand(event
); }
58 // Calls the callback and appropriate event handlers
59 bool ProcessCommand(wxCommandEvent
& event
);
61 // Enables the control
62 virtual void CocoaSetEnabled(bool enable
);
64 virtual wxSize
DoGetBestSize() const;
66 // Provides a common implementation of title setting which strips mnemonics
67 // and then calls setTitle: with the stripped string. May be implemented
68 // to call setTitleWithMnemonic: on OpenStep-compatible systems. Only
69 // intended for use by views or cells which implement at least setTitle:
70 // and possibly setTitleWithMnemonic: such as NSBox and NSButton or NSCell
71 // classes, for example as used by wxRadioBox. Not usable with classes like
72 // NSTextField which expect setStringValue:.
73 static void CocoaSetLabelForObject(const wxString
& labelWithWxMnemonic
, struct objc_object
*anObject
);
77 // __WX_COCOA_CONTROL_H__