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