]>
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 | 22 | WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr; |
0dbd6262 SC |
23 | |
24 | // Combobox item | |
e71a0aa9 | 25 | class WXDLLEXPORT wxComboBox: public wxComboBoxBase , public wxControl |
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 | } |
0dbd6262 | 56 | |
e71a0aa9 | 57 | bool Create(wxWindow *parent, wxWindowID id, |
0dbd6262 SC |
58 | const wxString& value = wxEmptyString, |
59 | const wxPoint& pos = wxDefaultPosition, | |
60 | const wxSize& size = wxDefaultSize, | |
61 | int n = 0, const wxString choices[] = NULL, | |
62 | long style = 0, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = wxComboBoxNameStr); | |
65 | ||
e71a0aa9 SC |
66 | // List functions |
67 | virtual void Delete(int n); | |
68 | virtual void Clear(); | |
69 | ||
70 | virtual int GetSelection() const ; | |
71 | virtual void SetSelection(int n); | |
72 | virtual void Select(int n) { SetSelection(n) ; } | |
73 | virtual int FindString(const wxString& s) const; | |
74 | virtual wxString GetString(int n) const ; | |
75 | virtual wxString GetStringSelection() const ; | |
76 | virtual void SetString(int n, const wxString& s) ; | |
77 | virtual bool SetStringSelection(const wxString& sel); | |
78 | ||
79 | // Text field functions | |
80 | virtual wxString GetValue() const ; | |
81 | virtual void SetValue(const wxString& value); | |
82 | ||
83 | // Clipboard operations | |
84 | virtual void Copy(); | |
85 | virtual void Cut(); | |
86 | virtual void Paste(); | |
87 | virtual void SetInsertionPoint(long pos); | |
88 | virtual void SetInsertionPointEnd(); | |
89 | virtual long GetInsertionPoint() const ; | |
90 | virtual long GetLastPosition() const ; | |
91 | virtual void Replace(long from, long to, const wxString& value); | |
92 | virtual void Remove(long from, long to); | |
93 | virtual void SetSelection(long from, long to); | |
94 | virtual void SetEditable(bool editable); | |
95 | virtual int GetCount() const { return m_choice->GetCount() ; } | |
96 | void MacHandleControlClick( WXWidget control , wxInt16 controlpart , bool mouseStillDown ) ; | |
97 | ||
519cb848 | 98 | protected: |
e71a0aa9 SC |
99 | virtual int DoAppend(const wxString& item) ; |
100 | virtual int DoInsert(const wxString& item, int pos) ; | |
101 | ||
102 | virtual void DoSetItemClientData(int n, void* clientData) ; | |
103 | virtual void* DoGetItemClientData(int n) const ; | |
104 | virtual void DoSetItemClientObject(int n, wxClientData* clientData) ; | |
105 | virtual wxClientData* DoGetItemClientObject(int n) const ; | |
106 | ||
fdc8ef94 SC |
107 | // the subcontrols |
108 | wxTextCtrl* m_text; | |
109 | wxChoice* m_choice; | |
0dbd6262 SC |
110 | }; |
111 | ||
112 | #endif | |
113 | // _WX_COMBOBOX_H_ |