]> git.saurik.com Git - wxWidgets.git/blame - include/wx/cocoa/combobox.h
Fix wxPropertyGrid::GetPropertyRect when the last item is collapsed.
[wxWidgets.git] / include / wx / cocoa / combobox.h
CommitLineData
421a8431
DE
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/cocoa/combobox.h
3// Purpose: wxComboBox class
8f248607 4// Author: Ryan Norton
421a8431 5// Modified by:
8f248607 6// Created: 2005/02/16
421a8431 7// Copyright: (c) 2003 David Elliott
7d8268a1 8// Licence: wxWindows licence
421a8431
DE
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef __WX_COCOA_COMBOBOX_H__
12#define __WX_COCOA_COMBOBOX_H__
13
8f248607
RN
14//Begin NSComboBox.h
15
16#include "wx/hashmap.h"
17#include "wx/cocoa/ObjcAssociate.h"
18
e960ba59
DE
19#include "wx/textctrl.h"
20
8f248607
RN
21DECLARE_WXCOCOA_OBJC_CLASS(NSComboBox);
22
23WX_DECLARE_OBJC_HASHMAP(NSComboBox);
24class wxCocoaNSComboBox
25{
26 WX_DECLARE_OBJC_INTERFACE_HASHMAP(NSComboBox)
27public:
28 void AssociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
29 void DisassociateNSComboBox(WX_NSComboBox cocoaNSComboBox);
853dcc57 30
8f248607 31 virtual void doWxEvent(int nEvent) = 0;
31e57091 32 virtual ~wxCocoaNSComboBox() { }
8f248607
RN
33};
34
35//begin combobox.h
36
37#include "wx/dynarray.h"
421a8431
DE
38
39// ========================================================================
40// wxComboBox
41// ========================================================================
53a2db12 42class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase, protected wxCocoaNSComboBox, protected wxCocoaNSTextField
421a8431
DE
43{
44 DECLARE_DYNAMIC_CLASS(wxComboBox)
45 DECLARE_EVENT_TABLE()
8f248607 46 WX_DECLARE_COCOA_OWNER(NSComboBox,NSTextField,NSView)
e960ba59 47 WX_DECLARE_COCOA_OWNER(NSTextField,NSControl,NSView)
421a8431
DE
48// ------------------------------------------------------------------------
49// initialization
50// ------------------------------------------------------------------------
51public:
52 wxComboBox() { }
53 wxComboBox(wxWindow *parent, wxWindowID winid,
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 {
62 Create(parent, winid, value, pos, size, n, choices, style, validator, name);
63 }
584ad2a3
MB
64 wxComboBox(wxWindow *parent, wxWindowID winid,
65 const wxString& value,
66 const wxPoint& pos,
67 const wxSize& size,
68 const wxArrayString& choices,
69 long style = 0,
70 const wxValidator& validator = wxDefaultValidator,
71 const wxString& name = wxComboBoxNameStr)
72 {
73 Create(parent, winid, value, pos, size, choices, style,
74 validator, name);
75 }
421a8431
DE
76
77 bool Create(wxWindow *parent, wxWindowID winid,
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);
584ad2a3
MB
85 bool Create(wxWindow *parent, wxWindowID winid,
86 const wxString& value,
87 const wxPoint& pos,
88 const wxSize& size,
89 const wxArrayString& choices,
90 long style = 0,
91 const wxValidator& validator = wxDefaultValidator,
92 const wxString& name = wxComboBoxNameStr);
421a8431
DE
93 virtual ~wxComboBox();
94
95// ------------------------------------------------------------------------
96// Cocoa callbacks
97// ------------------------------------------------------------------------
98protected:
8f248607
RN
99 wxArrayPtrVoid m_Datas;
100 virtual void doWxEvent(int nEvent);
101
e960ba59
DE
102 virtual void Cocoa_didChangeText()
103 {}
421a8431
DE
104// ------------------------------------------------------------------------
105// Implementation
106// ------------------------------------------------------------------------
107public:
05ef417f
DE
108 void Clear() // HACK
109 { wxComboBoxBase::Clear(); }
110
421a8431 111 // wxCombobox methods
aa61d352 112 virtual void SetSelection(int pos);
421a8431
DE
113 // Overlapping methods
114 virtual wxString GetStringSelection();
421a8431 115 // wxItemContainer
a236aa20
VZ
116 virtual void DoClear();
117 virtual void DoDeleteOneItem(unsigned int n);
aa61d352
VZ
118 virtual unsigned int GetCount() const;
119 virtual wxString GetString(unsigned int) const;
120 virtual void SetString(unsigned int pos, const wxString&);
853dcc57 121 virtual int FindString(const wxString& s, bool bCase = false) const;
421a8431 122 virtual int GetSelection() const;
a236aa20
VZ
123 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
124 unsigned int pos,
125 void **clientData, wxClientDataType type);
aa61d352
VZ
126 virtual void DoSetItemClientData(unsigned int, void*);
127 virtual void* DoGetItemClientData(unsigned int) const;
a236aa20 128 virtual bool IsSorted() const { return HasFlag(wxCB_SORT); }
e960ba59
DE
129
130// ------------------------------------------------------------------------
131// wxTextEntryBase virtual implementations:
132// ------------------------------------------------------------------------
133 // FIXME: This needs to be moved to some sort of common code.
134 virtual void WriteText(const wxString&);
135 virtual wxString GetValue() const;
136 virtual void Remove(long, long);
137 virtual void Cut();
138 virtual void Copy();
139 virtual void Paste();
140 virtual void Undo();
141 virtual void Redo();
142 virtual bool CanUndo() const;
143 virtual bool CanRedo() const;
144 virtual void SetInsertionPoint(long pos);
145 virtual long GetInsertionPoint() const;
146 virtual wxTextPos GetLastPosition() const;
147 virtual void SetSelection(long from, long to);
148 virtual void GetSelection(long *from, long *to) const;
149 virtual bool IsEditable() const;
150 virtual void SetEditable(bool editable);
63f7d502
VZ
151
152private:
153 // implement wxTextEntry pure virtual method
154 virtual wxWindow *GetEditableWindow() { return this; }
421a8431
DE
155};
156
157#endif // __WX_COCOA_COMBOBOX_H__