]>
Commit | Line | Data |
---|---|---|
8cf73271 | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/mac/carbon/combobox.h |
8cf73271 SC |
3 | // Purpose: wxComboBox class |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 1998-01-01 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Stefan Csomor | |
65571936 | 9 | // Licence: wxWindows licence |
8cf73271 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COMBOBOX_H_ | |
13 | #define _WX_COMBOBOX_H_ | |
14 | ||
36287f1a | 15 | #include "wx/containr.h" |
8cf73271 SC |
16 | #include "wx/choice.h" |
17 | ||
64034845 | 18 | WXDLLEXPORT_DATA(extern const char) wxComboBoxNameStr[]; |
8cf73271 | 19 | |
18274a51 SC |
20 | // forward declaration of private implementation classes |
21 | ||
0ce0b76b DS |
22 | class wxComboBoxText; |
23 | class wxComboBoxChoice; | |
18274a51 | 24 | |
8cf73271 SC |
25 | // Combobox item |
26 | class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase | |
27 | { | |
0ce0b76b | 28 | DECLARE_DYNAMIC_CLASS(wxComboBox) |
8cf73271 SC |
29 | |
30 | public: | |
8cf73271 | 31 | virtual ~wxComboBox(); |
8cf73271 SC |
32 | |
33 | // forward these functions to all subcontrols | |
7d8268a1 WS |
34 | virtual bool Enable(bool enable = true); |
35 | virtual bool Show(bool show = true); | |
8cf73271 SC |
36 | |
37 | // callback functions | |
38 | virtual void DelegateTextChanged( const wxString& value ); | |
39 | virtual void DelegateChoice( const wxString& value ); | |
40 | ||
8dc6614e KH |
41 | wxComboBox() { Init(); } |
42 | ||
43 | wxComboBox(wxWindow *parent, wxWindowID id, | |
8cf73271 SC |
44 | const wxString& value = wxEmptyString, |
45 | const wxPoint& pos = wxDefaultPosition, | |
46 | const wxSize& size = wxDefaultSize, | |
47 | int n = 0, const wxString choices[] = NULL, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxComboBoxNameStr) | |
51 | { | |
8dc6614e KH |
52 | Init(); |
53 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
8cf73271 | 54 | } |
0ce0b76b | 55 | |
8dc6614e | 56 | wxComboBox(wxWindow *parent, wxWindowID id, |
8cf73271 SC |
57 | const wxString& value, |
58 | const wxPoint& pos, | |
59 | const wxSize& size, | |
60 | const wxArrayString& choices, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = wxComboBoxNameStr) | |
64 | { | |
8dc6614e KH |
65 | Init(); |
66 | Create(parent, id, value, pos, size, choices, style, validator, name); | |
8cf73271 SC |
67 | } |
68 | ||
69 | bool Create(wxWindow *parent, wxWindowID id, | |
70 | const wxString& value = wxEmptyString, | |
71 | const wxPoint& pos = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | int n = 0, const wxString choices[] = NULL, | |
74 | long style = 0, | |
75 | const wxValidator& validator = wxDefaultValidator, | |
76 | const wxString& name = wxComboBoxNameStr); | |
8dc6614e | 77 | |
8cf73271 SC |
78 | bool Create(wxWindow *parent, wxWindowID id, |
79 | const wxString& value, | |
80 | const wxPoint& pos, | |
81 | const wxSize& size, | |
82 | const wxArrayString& choices, | |
83 | long style = 0, | |
84 | const wxValidator& validator = wxDefaultValidator, | |
85 | const wxString& name = wxComboBoxNameStr); | |
86 | ||
0ce0b76b | 87 | virtual int GetSelection() const; |
8cf73271 | 88 | virtual void SetSelection(int n); |
853dcc57 | 89 | virtual int FindString(const wxString& s, bool bCase = false) const; |
aa61d352 | 90 | virtual wxString GetString(unsigned int n) const; |
0ce0b76b | 91 | virtual wxString GetStringSelection() const; |
aa61d352 | 92 | virtual void SetString(unsigned int n, const wxString& s); |
8cf73271 SC |
93 | |
94 | // Text field functions | |
8cf73271 | 95 | virtual void SetValue(const wxString& value); |
0ec1179b VZ |
96 | virtual wxString GetValue() const; |
97 | virtual void WriteText(const wxString& text); | |
98 | virtual void GetSelection(long *from, long *to) const; | |
8cf73271 SC |
99 | |
100 | // Clipboard operations | |
101 | virtual void Copy(); | |
102 | virtual void Cut(); | |
103 | virtual void Paste(); | |
104 | virtual void SetInsertionPoint(long pos); | |
105 | virtual void SetInsertionPointEnd(); | |
0ce0b76b DS |
106 | virtual long GetInsertionPoint() const; |
107 | virtual wxTextPos GetLastPosition() const; | |
8cf73271 SC |
108 | virtual void Replace(long from, long to, const wxString& value); |
109 | virtual void Remove(long from, long to); | |
110 | virtual void SetSelection(long from, long to); | |
111 | virtual void SetEditable(bool editable); | |
0ce0b76b | 112 | virtual bool IsEditable() const; |
150e31d2 | 113 | |
aa61d352 | 114 | virtual unsigned int GetCount() const; |
150e31d2 | 115 | |
0ce0b76b DS |
116 | virtual void Undo(); |
117 | virtual void Redo(); | |
118 | virtual void SelectAll(); | |
150e31d2 | 119 | |
0ce0b76b DS |
120 | virtual bool CanCopy() const; |
121 | virtual bool CanCut() const; | |
122 | virtual bool CanPaste() const; | |
123 | virtual bool CanUndo() const; | |
124 | virtual bool CanRedo() const; | |
150e31d2 | 125 | |
4e7b25f0 PC |
126 | virtual wxClientDataType GetClientDataType() const; |
127 | ||
0ce0b76b | 128 | wxInt32 MacControlHit( WXEVENTHANDLERREF handler, WXEVENTREF event ); |
8cf73271 SC |
129 | |
130 | wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST | |
131 | ||
1de43645 | 132 | WX_DECLARE_CONTROL_CONTAINER(); |
6f02a879 | 133 | |
0ce0b76b | 134 | protected: |
8dc6614e KH |
135 | // common part of all ctors |
136 | void Init(); | |
137 | ||
4e7b25f0 PC |
138 | // List functions |
139 | virtual void DoDeleteOneItem(unsigned int n); | |
140 | virtual void DoClear(); | |
141 | ||
0ce0b76b DS |
142 | // override the base class virtuals involved in geometry calculations |
143 | virtual wxSize DoGetBestSize() const; | |
144 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
8cf73271 | 145 | |
a236aa20 VZ |
146 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
147 | unsigned int pos, | |
148 | void **clientData, wxClientDataType type); | |
8cf73271 | 149 | |
aa61d352 VZ |
150 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
151 | virtual void * DoGetItemClientData(unsigned int n) const; | |
8cf73271 | 152 | |
0cf3e587 VZ |
153 | virtual void SetClientDataType(wxClientDataType clientDataItemsType); |
154 | ||
8cf73271 | 155 | // the subcontrols |
18274a51 SC |
156 | wxComboBoxText* m_text; |
157 | wxComboBoxChoice* m_choice; | |
1de43645 SC |
158 | |
159 | DECLARE_EVENT_TABLE() | |
8cf73271 SC |
160 | }; |
161 | ||
0ce0b76b | 162 | #endif // _WX_COMBOBOX_H_ |