]> git.saurik.com Git - wxWidgets.git/blob - include/wx/mac/carbon/combobox.h
added stock buttons support
[wxWidgets.git] / include / wx / mac / carbon / combobox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: 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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "combobox.h"
17 #endif
18
19 #include "wx/textctrl.h"
20 #include "wx/choice.h"
21
22 WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
23
24 // forward declaration of private implementation classes
25
26 class wxComboBoxText ;
27 class wxComboBoxChoice ;
28
29 // Combobox item
30 class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase
31 {
32 DECLARE_DYNAMIC_CLASS(wxComboBox)
33
34 public:
35 inline wxComboBox() {}
36 virtual ~wxComboBox();
37 // override the base class virtuals involved in geometry calculations
38 virtual wxSize DoGetBestSize() const;
39 virtual void DoMoveWindow(int x, int y, int width, int height);
40
41 // forward these functions to all subcontrols
42 virtual bool Enable(bool enable = TRUE);
43 virtual bool Show(bool show = TRUE);
44 virtual void SetFocus();
45
46 // callback functions
47 virtual void DelegateTextChanged( const wxString& value );
48 virtual void DelegateChoice( const wxString& value );
49
50 inline wxComboBox(wxWindow *parent, wxWindowID id,
51 const wxString& value = wxEmptyString,
52 const wxPoint& pos = wxDefaultPosition,
53 const wxSize& size = wxDefaultSize,
54 int n = 0, const wxString choices[] = NULL,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
57 const wxString& name = wxComboBoxNameStr)
58 {
59 Create(parent, id, value, pos, size, n, choices, style, validator, name);
60 }
61 inline wxComboBox(wxWindow *parent, wxWindowID id,
62 const wxString& value,
63 const wxPoint& pos,
64 const wxSize& size,
65 const wxArrayString& choices,
66 long style = 0,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString& name = wxComboBoxNameStr)
69 {
70 Create(parent, id, value, pos, size, choices, style, validator, name);
71 }
72
73 bool Create(wxWindow *parent, wxWindowID id,
74 const wxString& value = wxEmptyString,
75 const wxPoint& pos = wxDefaultPosition,
76 const wxSize& size = wxDefaultSize,
77 int n = 0, const wxString choices[] = NULL,
78 long style = 0,
79 const wxValidator& validator = wxDefaultValidator,
80 const wxString& name = wxComboBoxNameStr);
81 bool Create(wxWindow *parent, wxWindowID id,
82 const wxString& value,
83 const wxPoint& pos,
84 const wxSize& size,
85 const wxArrayString& choices,
86 long style = 0,
87 const wxValidator& validator = wxDefaultValidator,
88 const wxString& name = wxComboBoxNameStr);
89
90 // List functions
91 virtual void Delete(int n);
92 virtual void Clear();
93
94 virtual int GetSelection() const ;
95 virtual void SetSelection(int n);
96 virtual void Select(int n) { SetSelection(n) ; }
97 virtual int FindString(const wxString& s) const;
98 virtual wxString GetString(int n) const ;
99 virtual wxString GetStringSelection() const ;
100 virtual void SetString(int n, const wxString& s) ;
101 virtual bool SetStringSelection(const wxString& sel);
102
103 // Text field functions
104 virtual wxString GetValue() const ;
105 virtual void SetValue(const wxString& value);
106
107 // Clipboard operations
108 virtual void Copy();
109 virtual void Cut();
110 virtual void Paste();
111 virtual void SetInsertionPoint(long pos);
112 virtual void SetInsertionPointEnd();
113 virtual long GetInsertionPoint() const ;
114 virtual long GetLastPosition() const ;
115 virtual void Replace(long from, long to, const wxString& value);
116 virtual void Remove(long from, long to);
117 virtual void SetSelection(long from, long to);
118 virtual void SetEditable(bool editable);
119 virtual int GetCount() const ;
120 wxInt32 MacControlHit( WXEVENTHANDLERREF handler , WXEVENTREF event ) ;
121
122 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
123
124 protected:
125 virtual int DoAppend(const wxString& item) ;
126 virtual int DoInsert(const wxString& item, int pos) ;
127
128 virtual void DoSetItemClientData(int n, void* clientData) ;
129 virtual void* DoGetItemClientData(int n) const ;
130 virtual void DoSetItemClientObject(int n, wxClientData* clientData) ;
131 virtual wxClientData* DoGetItemClientObject(int n) const ;
132
133 void FreeData();
134
135 // the subcontrols
136 wxComboBoxText* m_text;
137 wxComboBoxChoice* m_choice;
138 };
139
140 #endif
141 // _WX_COMBOBOX_H_