]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/combobox.h
fix memory leak in the usage example
[wxWidgets.git] / include / wx / mac / carbon / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/mac/carbon/combobox.h
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"
17
18 WXDLLEXPORT_DATA(extern const wxChar) wxComboBoxNameStr[];
19
20 // forward declaration of private implementation classes
21
22 class wxComboBoxText;
23 class wxComboBoxChoice;
24
25 // Combobox item
26 class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
27 {
28 DECLARE_DYNAMIC_CLASS(wxComboBox)
29
30 public:
31 virtual ~wxComboBox();
32
33 // forward these functions to all subcontrols
34 virtual bool Enable(bool enable = true);
35 virtual bool Show(bool show = true);
36
37 // callback functions
38 virtual void DelegateTextChanged( const wxString& value );
39 virtual void DelegateChoice( const wxString& value );
40
41 wxComboBox() { Init(); }
42
43 wxComboBox(wxWindow *parent, wxWindowID id,
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 {
52 Init();
53 Create(parent, id, value, pos, size, n, choices, style, validator, name);
54 }
55
56 wxComboBox(wxWindow *parent, wxWindowID id,
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 {
65 Init();
66 Create(parent, id, value, pos, size, choices, style, validator, name);
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);
77
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
87 // List functions
88 virtual void DoDeleteOneItem(unsigned int n);
89 virtual void DoClear();
90
91 virtual int GetSelection() const;
92 virtual void SetSelection(int n);
93 virtual int FindString(const wxString& s, bool bCase = false) const;
94 virtual wxString GetString(unsigned int n) const;
95 virtual wxString GetStringSelection() const;
96 virtual void SetString(unsigned int n, const wxString& s);
97
98 // Text field functions
99 virtual void SetValue(const wxString& value);
100 virtual wxString GetValue() const;
101 virtual void WriteText(const wxString& text);
102 virtual void GetSelection(long *from, long *to) const;
103
104 // Clipboard operations
105 virtual void Copy();
106 virtual void Cut();
107 virtual void Paste();
108 virtual void SetInsertionPoint(long pos);
109 virtual void SetInsertionPointEnd();
110 virtual long GetInsertionPoint() const;
111 virtual wxTextPos GetLastPosition() const;
112 virtual void Replace(long from, long to, const wxString& value);
113 virtual void Remove(long from, long to);
114 virtual void SetSelection(long from, long to);
115 virtual void SetEditable(bool editable);
116 virtual bool IsEditable() const;
117
118 virtual unsigned int GetCount() const;
119
120 virtual void Undo();
121 virtual void Redo();
122 virtual void SelectAll();
123
124 virtual bool CanCopy() const;
125 virtual bool CanCut() const;
126 virtual bool CanPaste() const;
127 virtual bool CanUndo() const;
128 virtual bool CanRedo() const;
129
130 wxInt32 MacControlHit( WXEVENTHANDLERREF handler, WXEVENTREF event );
131
132 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
133
134 WX_DECLARE_CONTROL_CONTAINER();
135
136 protected:
137 // common part of all ctors
138 void Init();
139
140 // override the base class virtuals involved in geometry calculations
141 virtual wxSize DoGetBestSize() const;
142 virtual void DoMoveWindow(int x, int y, int width, int height);
143
144 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
145 unsigned int pos,
146 void **clientData, wxClientDataType type);
147
148 virtual void DoSetItemClientData(unsigned int n, void* clientData);
149 virtual void * DoGetItemClientData(unsigned int n) const;
150
151 virtual wxClientDataType GetClientDataType() const;
152 virtual void SetClientDataType(wxClientDataType clientDataItemsType);
153
154 // the subcontrols
155 wxComboBoxText* m_text;
156 wxComboBoxChoice* m_choice;
157
158 DECLARE_EVENT_TABLE()
159 };
160
161 #endif // _WX_COMBOBOX_H_