]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cocoa/control.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / cocoa / control.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/control.h
3 // Purpose: wxControl class
4 // Author: David Elliott
5 // Modified by:
6 // Created: 2003/02/15
7 // Copyright: (c) 2003 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __WX_COCOA_CONTROL_H__
12 #define __WX_COCOA_CONTROL_H__
13
14 #include "wx/cocoa/NSControl.h"
15
16 // ========================================================================
17 // wxControl
18 // ========================================================================
19
20 class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxCocoaNSControl
21 {
22 DECLARE_ABSTRACT_CLASS(wxControl)
23 WX_DECLARE_COCOA_OWNER(NSControl,NSView,NSView)
24 DECLARE_EVENT_TABLE()
25 // ------------------------------------------------------------------------
26 // initialization
27 // ------------------------------------------------------------------------
28 public:
29 wxControl() {}
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)
35 {
36 Create(parent, winid, pos, size, style, validator, name);
37 }
38
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);
44 virtual ~wxControl();
45
46 // ------------------------------------------------------------------------
47 // Implementation
48 // ------------------------------------------------------------------------
49 public:
50
51 // implementation from now on
52 // --------------------------
53
54 void OnEraseBackground(wxEraseEvent& event);
55
56 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
57
58 // Calls the callback and appropriate event handlers
59 bool ProcessCommand(wxCommandEvent& event);
60
61 // Enables the control
62 virtual void CocoaSetEnabled(bool enable);
63 protected:
64 virtual wxSize DoGetBestSize() const;
65
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);
74 };
75
76 #endif
77 // __WX_COCOA_CONTROL_H__