]>
Commit | Line | Data |
---|---|---|
0dbd6262 SC |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: combobox.h | |
3 | // Purpose: wxComboBox class | |
a31a5f85 | 4 | // Author: Stefan Csomor |
0dbd6262 | 5 | // Modified by: |
a31a5f85 | 6 | // Created: 1998-01-01 |
0dbd6262 | 7 | // RCS-ID: $Id$ |
a31a5f85 | 8 | // Copyright: (c) Stefan Csomor |
72763bfe | 9 | // Licence: wxWindows licence |
0dbd6262 SC |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_COMBOBOX_H_ | |
13 | #define _WX_COMBOBOX_H_ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
0dbd6262 SC |
16 | #pragma interface "combobox.h" |
17 | #endif | |
18 | ||
fdc8ef94 | 19 | #include "wx/textctrl.h" |
0dbd6262 SC |
20 | #include "wx/choice.h" |
21 | ||
c4e41ce3 | 22 | WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; |
0dbd6262 SC |
23 | |
24 | // Combobox item | |
ace3ed2e | 25 | class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase |
0dbd6262 SC |
26 | { |
27 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
28 | ||
29 | public: | |
e71a0aa9 | 30 | inline wxComboBox() {} |
fdc8ef94 SC |
31 | virtual ~wxComboBox(); |
32 | // override the base class virtuals involved in geometry calculations | |
33 | virtual wxSize DoGetBestSize() const; | |
34 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
35 | ||
36 | // forward these functions to all subcontrols | |
37 | virtual bool Enable(bool enable = TRUE); | |
38 | virtual bool Show(bool show = TRUE); | |
72763bfe | 39 | virtual void SetFocus(); |
fdc8ef94 SC |
40 | |
41 | // callback functions | |
42 | virtual void DelegateTextChanged( const wxString& value ); | |
43 | virtual void DelegateChoice( const wxString& value ); | |
0dbd6262 | 44 | |
e71a0aa9 | 45 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
46 | const wxString& value = wxEmptyString, |
47 | const wxPoint& pos = wxDefaultPosition, | |
48 | const wxSize& size = wxDefaultSize, | |
49 | int n = 0, const wxString choices[] = NULL, | |
50 | long style = 0, | |
51 | const wxValidator& validator = wxDefaultValidator, | |
52 | const wxString& name = wxComboBoxNameStr) | |
e71a0aa9 | 53 | { |
0dbd6262 | 54 | Create(parent, id, value, pos, size, n, choices, style, validator, name); |
e71a0aa9 | 55 | } |
584ad2a3 MB |
56 | inline 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 | Create(parent, id, value, pos, size, choices, style, validator, name); | |
66 | } | |
0dbd6262 | 67 | |
e71a0aa9 | 68 | bool Create(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
69 | const wxString& value = wxEmptyString, |
70 | const wxPoint& pos = wxDefaultPosition, | |
71 | const wxSize& size = wxDefaultSize, | |
72 | int n = 0, const wxString choices[] = NULL, | |
73 | long style = 0, | |
74 | const wxValidator& validator = wxDefaultValidator, | |
75 | const wxString& name = wxComboBoxNameStr); | |
584ad2a3 MB |
76 | bool Create(wxWindow *parent, wxWindowID id, |
77 | const wxString& value, | |
78 | const wxPoint& pos, | |
79 | const wxSize& size, | |
80 | const wxArrayString& choices, | |
81 | long style = 0, | |
82 | const wxValidator& validator = wxDefaultValidator, | |
83 | const wxString& name = wxComboBoxNameStr); | |
0dbd6262 | 84 | |
e71a0aa9 SC |
85 | // List functions |
86 | virtual void Delete(int n); | |
87 | virtual void Clear(); | |
88 | ||
89 | virtual int GetSelection() const ; | |
90 | virtual void SetSelection(int n); | |
91 | virtual void Select(int n) { SetSelection(n) ; } | |
92 | virtual int FindString(const wxString& s) const; | |
93 | virtual wxString GetString(int n) const ; | |
94 | virtual wxString GetStringSelection() const ; | |
95 | virtual void SetString(int n, const wxString& s) ; | |
96 | virtual bool SetStringSelection(const wxString& sel); | |
97 | ||
98 | // Text field functions | |
99 | virtual wxString GetValue() const ; | |
100 | virtual void SetValue(const wxString& value); | |
101 | ||
102 | // Clipboard operations | |
103 | virtual void Copy(); | |
104 | virtual void Cut(); | |
105 | virtual void Paste(); | |
106 | virtual void SetInsertionPoint(long pos); | |
107 | virtual void SetInsertionPointEnd(); | |
108 | virtual long GetInsertionPoint() const ; | |
109 | virtual long GetLastPosition() const ; | |
110 | virtual void Replace(long from, long to, const wxString& value); | |
111 | virtual void Remove(long from, long to); | |
112 | virtual void SetSelection(long from, long to); | |
113 | virtual void SetEditable(bool editable); | |
114 | virtual int GetCount() const { return m_choice->GetCount() ; } | |
115 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; | |
116 | ||
6f6f938f VZ |
117 | wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST |
118 | ||
519cb848 | 119 | protected: |
e71a0aa9 SC |
120 | virtual int DoAppend(const wxString& item) ; |
121 | virtual int DoInsert(const wxString& item, int pos) ; | |
122 | ||
123 | virtual void DoSetItemClientData(int n, void* clientData) ; | |
124 | virtual void* DoGetItemClientData(int n) const ; | |
125 | virtual void DoSetItemClientObject(int n, wxClientData* clientData) ; | |
126 | virtual wxClientData* DoGetItemClientObject(int n) const ; | |
127 | ||
f148f2ba MB |
128 | void FreeData(); |
129 | ||
fdc8ef94 SC |
130 | // the subcontrols |
131 | wxTextCtrl* m_text; | |
132 | wxChoice* m_choice; | |
0dbd6262 SC |
133 | }; |
134 | ||
135 | #endif | |
136 | // _WX_COMBOBOX_H_ |