]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/control.h
introduced wxICON_DEFAULT_TYPE and wxBITMAP_DEFAULT_TYPE; documented these default...
[wxWidgets.git] / include / wx / cocoa / control.h
CommitLineData
fb896a32
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/control.h
3// Purpose: wxControl class
4// Author: David Elliott
5// Modified by:
6// Created: 2003/02/15
1b88201f 7// RCS-ID: $Id$
fb896a32 8// Copyright: (c) 2003 David Elliott
1b88201f 9// Licence: wxWindows licence
fb896a32
DE
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef __WX_COCOA_CONTROL_H__
13#define __WX_COCOA_CONTROL_H__
14
15#include "wx/cocoa/NSControl.h"
16
17// ========================================================================
18// wxControl
19// ========================================================================
20
53a2db12 21class WXDLLIMPEXP_CORE wxControl : public wxControlBase, public wxCocoaNSControl
fb896a32
DE
22{
23 DECLARE_ABSTRACT_CLASS(wxControl)
24 WX_DECLARE_COCOA_OWNER(NSControl,NSView,NSView)
25 DECLARE_EVENT_TABLE()
26// ------------------------------------------------------------------------
27// initialization
28// ------------------------------------------------------------------------
29public:
30 wxControl() {}
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)
36 {
37 Create(parent, winid, pos, size, style, validator, name);
38 }
39
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);
45 virtual ~wxControl();
46
47// ------------------------------------------------------------------------
48// Implementation
49// ------------------------------------------------------------------------
50public:
51
52 // implementation from now on
53 // --------------------------
54
55 void OnEraseBackground(wxEraseEvent& event);
1b88201f 56
fb896a32
DE
57 virtual void Command(wxCommandEvent& event) { ProcessCommand(event); }
58
59 // Calls the callback and appropriate event handlers
60 bool ProcessCommand(wxCommandEvent& event);
61
c5172ed1
DE
62 // Enables the control
63 virtual void CocoaSetEnabled(bool enable);
fb896a32
DE
64protected:
65 virtual wxSize DoGetBestSize() const;
525007cf
DE
66
67 // Provides a common implementation of title setting which strips mnemonics
68 // and then calls setTitle: with the stripped string. May be implemented
69 // to call setTitleWithMnemonic: on OpenStep-compatible systems. Only
70 // intended for use by views or cells which implement at least setTitle:
71 // and possibly setTitleWithMnemonic: such as NSBox and NSButton or NSCell
72 // classes, for example as used by wxRadioBox. Not usable with classes like
73 // NSTextField which expect setStringValue:.
74 static void CocoaSetLabelForObject(const wxString& labelWithWxMnemonic, struct objc_object *anObject);
fb896a32
DE
75};
76
1b88201f
WS
77#endif
78 // __WX_COCOA_CONTROL_H__