]> git.saurik.com Git - wxWidgets.git/blame - include/wx/osx/combobox.h
using 10.5 API for cursor updates as well
[wxWidgets.git] / include / wx / osx / combobox.h
CommitLineData
6762286d 1/////////////////////////////////////////////////////////////////////////////
c84030e0 2// Name: wx/osx/combobox.h
6762286d
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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_COMBOBOX_H_
13#define _WX_COMBOBOX_H_
14
15#include "wx/containr.h"
16#include "wx/choice.h"
c84030e0 17#include "wx/textctrl.h"
6762286d 18
c84030e0
KO
19WX_DEFINE_ARRAY( char * , wxComboBoxDataArray ) ;
20
6762286d
SC
21// forward declaration of private implementation classes
22
23class wxComboBoxText;
24class wxComboBoxChoice;
c84030e0 25class wxComboWidgetImpl;
6762286d
SC
26
27// Combobox item
90230407 28class WXDLLIMPEXP_CORE wxComboBox :
bf8f1022 29 public wxWindowWithItems<
90230407 30#if wxOSX_USE_CARBON
bf8f1022 31 wxNavigationEnabled<wxControl>,
90230407 32#else
bf8f1022 33 wxControl,
90230407 34#endif
bf8f1022 35 wxComboBoxBase>
6762286d
SC
36{
37 DECLARE_DYNAMIC_CLASS(wxComboBox)
38
39 public:
40 virtual ~wxComboBox();
41
c84030e0 42#if wxOSX_USE_CARBON
6762286d
SC
43 // forward these functions to all subcontrols
44 virtual bool Enable(bool enable = true);
45 virtual bool Show(bool show = true);
f941a30b 46#endif
6762286d
SC
47
48 // callback functions
49 virtual void DelegateTextChanged( const wxString& value );
50 virtual void DelegateChoice( const wxString& value );
51
90230407 52 wxComboBox() { }
6762286d
SC
53
54 wxComboBox(wxWindow *parent, wxWindowID id,
55 const wxString& value = wxEmptyString,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize,
58 int n = 0, const wxString choices[] = NULL,
59 long style = 0,
60 const wxValidator& validator = wxDefaultValidator,
61 const wxString& name = wxComboBoxNameStr)
62 {
6762286d
SC
63 Create(parent, id, value, pos, size, n, choices, style, validator, name);
64 }
65
66 wxComboBox(wxWindow *parent, wxWindowID id,
67 const wxString& value,
68 const wxPoint& pos,
69 const wxSize& size,
70 const wxArrayString& choices,
71 long style = 0,
72 const wxValidator& validator = wxDefaultValidator,
73 const wxString& name = wxComboBoxNameStr)
74 {
6762286d
SC
75 Create(parent, id, value, pos, size, choices, style, validator, name);
76 }
77
78 bool Create(wxWindow *parent, wxWindowID id,
79 const wxString& value = wxEmptyString,
80 const wxPoint& pos = wxDefaultPosition,
81 const wxSize& size = wxDefaultSize,
82 int n = 0, const wxString choices[] = NULL,
83 long style = 0,
84 const wxValidator& validator = wxDefaultValidator,
85 const wxString& name = wxComboBoxNameStr);
86
87 bool Create(wxWindow *parent, wxWindowID id,
88 const wxString& value,
89 const wxPoint& pos,
90 const wxSize& size,
91 const wxArrayString& choices,
92 long style = 0,
93 const wxValidator& validator = wxDefaultValidator,
94 const wxString& name = wxComboBoxNameStr);
95
96 virtual int GetSelection() const;
c84030e0 97 virtual void GetSelection(long *from, long *to) const;
6762286d 98 virtual void SetSelection(int n);
c84030e0 99 virtual void SetSelection(long from, long to);
6762286d
SC
100 virtual int FindString(const wxString& s, bool bCase = false) const;
101 virtual wxString GetString(unsigned int n) const;
102 virtual wxString GetStringSelection() const;
103 virtual void SetString(unsigned int n, const wxString& s);
104
c84030e0 105 virtual unsigned int GetCount() const;
ce00f59b 106
c84030e0
KO
107// these methods are provided by wxTextEntry for the native impl.
108#if wxOSX_USE_CARBON
6762286d
SC
109 // Text field functions
110 virtual void SetValue(const wxString& value);
111 virtual wxString GetValue() const;
112 virtual void WriteText(const wxString& text);
6762286d
SC
113
114 // Clipboard operations
115 virtual void Copy();
116 virtual void Cut();
117 virtual void Paste();
118 virtual void SetInsertionPoint(long pos);
119 virtual void SetInsertionPointEnd();
120 virtual long GetInsertionPoint() const;
121 virtual wxTextPos GetLastPosition() const;
122 virtual void Replace(long from, long to, const wxString& value);
123 virtual void Remove(long from, long to);
6762286d
SC
124 virtual void SetEditable(bool editable);
125 virtual bool IsEditable() const;
126
6762286d
SC
127 virtual void Undo();
128 virtual void Redo();
129 virtual void SelectAll();
130
131 virtual bool CanCopy() const;
132 virtual bool CanCut() const;
133 virtual bool CanPaste() const;
134 virtual bool CanUndo() const;
135 virtual bool CanRedo() const;
136
137 virtual wxClientDataType GetClientDataType() const;
356fd0b5
VZ
138
139 virtual wxTextWidgetImpl* GetTextPeer() const;
140#endif // wxOSX_USE_CARBON
c84030e0 141
4ce3452d 142#if wxOSX_USE_COCOA
ff8cb900
VZ
143 virtual void Popup();
144 virtual void Dismiss();
4ce3452d 145#endif // wxOSX_USE_COCOA
c84030e0 146
6762286d
SC
147
148 // osx specific event handling common for all osx-ports
00c89b22 149
12b5f4b4 150 virtual bool OSXHandleClicked( double timestampsec );
6762286d 151
c84030e0
KO
152#if wxOSX_USE_COCOA
153 wxComboWidgetImpl* GetComboPeer() const;
154#endif
6762286d 155protected:
6762286d
SC
156 // List functions
157 virtual void DoDeleteOneItem(unsigned int n);
158 virtual void DoClear();
159
00c89b22 160 // wxTextEntry functions
c84030e0 161#if wxOSX_USE_CARBON
00c89b22 162 virtual wxString DoGetValue() const;
c84030e0 163#endif
00c89b22
VZ
164 virtual wxWindow *GetEditableWindow() { return this; }
165
6762286d
SC
166 // override the base class virtuals involved in geometry calculations
167 virtual wxSize DoGetBestSize() const;
5bd77105 168#if wxOSX_USE_CARBON
6762286d 169 virtual void DoMoveWindow(int x, int y, int width, int height);
f941a30b 170#endif
6762286d
SC
171
172 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
173 unsigned int pos,
174 void **clientData, wxClientDataType type);
175
176 virtual void DoSetItemClientData(unsigned int n, void* clientData);
177 virtual void * DoGetItemClientData(unsigned int n) const;
178
c84030e0 179#if wxOSX_USE_CARBON
6762286d 180 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
c84030e0 181#endif
6762286d 182
d9d551f6
SC
183 virtual void EnableTextChangedEvents(bool enable);
184
6762286d
SC
185 // the subcontrols
186 wxComboBoxText* m_text;
187 wxComboBoxChoice* m_choice;
188
c84030e0 189 wxComboBoxDataArray m_datas;
6762286d
SC
190};
191
192#endif // _WX_COMBOBOX_H_