]>
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 | ||
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
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 SC |
22 | WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; |
23 | WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString; | |
0dbd6262 SC |
24 | |
25 | // Combobox item | |
e71a0aa9 | 26 | class WXDLLEXPORT wxComboBox: public wxComboBoxBase , public wxControl |
0dbd6262 SC |
27 | { |
28 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
29 | ||
30 | public: | |
e71a0aa9 | 31 | inline wxComboBox() {} |
fdc8ef94 SC |
32 | virtual ~wxComboBox(); |
33 | // override the base class virtuals involved in geometry calculations | |
34 | virtual wxSize DoGetBestSize() const; | |
35 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
36 | ||
37 | // forward these functions to all subcontrols | |
38 | virtual bool Enable(bool enable = TRUE); | |
39 | virtual bool Show(bool show = TRUE); | |
72763bfe | 40 | virtual void SetFocus(); |
fdc8ef94 SC |
41 | |
42 | // callback functions | |
43 | virtual void DelegateTextChanged( const wxString& value ); | |
44 | virtual void DelegateChoice( const wxString& value ); | |
0dbd6262 | 45 | |
e71a0aa9 | 46 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
47 | const wxString& value = wxEmptyString, |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
50 | int n = 0, const wxString choices[] = NULL, | |
51 | long style = 0, | |
52 | const wxValidator& validator = wxDefaultValidator, | |
53 | const wxString& name = wxComboBoxNameStr) | |
e71a0aa9 | 54 | { |
0dbd6262 | 55 | Create(parent, id, value, pos, size, n, choices, style, validator, name); |
e71a0aa9 | 56 | } |
0dbd6262 | 57 | |
e71a0aa9 | 58 | bool Create(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
59 | const wxString& value = wxEmptyString, |
60 | const wxPoint& pos = wxDefaultPosition, | |
61 | const wxSize& size = wxDefaultSize, | |
62 | int n = 0, const wxString choices[] = NULL, | |
63 | long style = 0, | |
64 | const wxValidator& validator = wxDefaultValidator, | |
65 | const wxString& name = wxComboBoxNameStr); | |
66 | ||
e71a0aa9 SC |
67 | // List functions |
68 | virtual void Delete(int n); | |
69 | virtual void Clear(); | |
70 | ||
71 | virtual int GetSelection() const ; | |
72 | virtual void SetSelection(int n); | |
73 | virtual void Select(int n) { SetSelection(n) ; } | |
74 | virtual int FindString(const wxString& s) const; | |
75 | virtual wxString GetString(int n) const ; | |
76 | virtual wxString GetStringSelection() const ; | |
77 | virtual void SetString(int n, const wxString& s) ; | |
78 | virtual bool SetStringSelection(const wxString& sel); | |
79 | ||
80 | // Text field functions | |
81 | virtual wxString GetValue() const ; | |
82 | virtual void SetValue(const wxString& value); | |
83 | ||
84 | // Clipboard operations | |
85 | virtual void Copy(); | |
86 | virtual void Cut(); | |
87 | virtual void Paste(); | |
88 | virtual void SetInsertionPoint(long pos); | |
89 | virtual void SetInsertionPointEnd(); | |
90 | virtual long GetInsertionPoint() const ; | |
91 | virtual long GetLastPosition() const ; | |
92 | virtual void Replace(long from, long to, const wxString& value); | |
93 | virtual void Remove(long from, long to); | |
94 | virtual void SetSelection(long from, long to); | |
95 | virtual void SetEditable(bool editable); | |
96 | virtual int GetCount() const { return m_choice->GetCount() ; } | |
97 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; | |
98 | ||
519cb848 | 99 | protected: |
e71a0aa9 SC |
100 | virtual int DoAppend(const wxString& item) ; |
101 | virtual int DoInsert(const wxString& item, int pos) ; | |
102 | ||
103 | virtual void DoSetItemClientData(int n, void* clientData) ; | |
104 | virtual void* DoGetItemClientData(int n) const ; | |
105 | virtual void DoSetItemClientObject(int n, wxClientData* clientData) ; | |
106 | virtual wxClientData* DoGetItemClientObject(int n) const ; | |
107 | ||
fdc8ef94 SC |
108 | // the subcontrols |
109 | wxTextCtrl* m_text; | |
110 | wxChoice* m_choice; | |
0dbd6262 SC |
111 | }; |
112 | ||
113 | #endif | |
114 | // _WX_COMBOBOX_H_ |