]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: combobox.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
5ebd1fb2 | 6 | // Id: $Id$ |
dbf858b5 | 7 | // Copyright: (c) 1998 Robert Roebling |
c801d85f KB |
8 | // Licence: wxWindows licence |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | ||
12 | #ifndef __GTKCOMBOBOXH__ | |
13 | #define __GTKCOMBOBOXH__ | |
14 | ||
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
5ebd1fb2 | 16 | #pragma interface "combobox.h" |
c801d85f KB |
17 | #endif |
18 | ||
19 | #include "wx/defs.h" | |
ac57418f | 20 | |
dcf924a3 RR |
21 | #if wxUSE_COMBOBOX |
22 | ||
c801d85f | 23 | #include "wx/object.h" |
c801d85f KB |
24 | |
25 | //----------------------------------------------------------------------------- | |
26 | // classes | |
27 | //----------------------------------------------------------------------------- | |
28 | ||
29 | class wxComboBox; | |
30 | ||
7f4dc78d RR |
31 | //----------------------------------------------------------------------------- |
32 | // global data | |
33 | //----------------------------------------------------------------------------- | |
34 | ||
401eb3de | 35 | extern const wxChar* wxComboBoxNameStr; |
9d2f3c71 | 36 | extern const wxChar* wxEmptyString; |
7f4dc78d | 37 | |
c801d85f KB |
38 | //----------------------------------------------------------------------------- |
39 | // wxComboBox | |
40 | //----------------------------------------------------------------------------- | |
41 | ||
6f6f938f | 42 | class wxComboBox : public wxControl, public wxComboBoxBase |
7f4dc78d | 43 | { |
fd0eed64 | 44 | public: |
738f9e5a RR |
45 | inline wxComboBox() {} |
46 | inline wxComboBox(wxWindow *parent, wxWindowID id, | |
7f4dc78d RR |
47 | const wxString& value = wxEmptyString, |
48 | const wxPoint& pos = wxDefaultPosition, | |
49 | const wxSize& size = wxDefaultSize, | |
c67daf87 | 50 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
debe6624 | 51 | long style = 0, |
6de97a3b | 52 | const wxValidator& validator = wxDefaultValidator, |
7f4dc78d | 53 | const wxString& name = wxComboBoxNameStr) |
738f9e5a RR |
54 | { |
55 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
56 | } | |
6f6f938f | 57 | |
738f9e5a | 58 | ~wxComboBox(); |
6f6f938f | 59 | |
738f9e5a | 60 | bool Create(wxWindow *parent, wxWindowID id, |
7f4dc78d RR |
61 | const wxString& value = wxEmptyString, |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
c67daf87 | 64 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
debe6624 | 65 | long style = 0, |
6de97a3b | 66 | const wxValidator& validator = wxDefaultValidator, |
7f4dc78d RR |
67 | const wxString& name = wxComboBoxNameStr); |
68 | ||
738f9e5a RR |
69 | void Clear(); |
70 | void Delete( int n ); | |
30ed6e5c | 71 | |
6f6f938f | 72 | virtual int FindString( const wxString &item ) const; |
738f9e5a RR |
73 | int GetSelection() const; |
74 | wxString GetString( int n ) const; | |
75 | wxString GetStringSelection() const; | |
6f6f938f VZ |
76 | int GetCount() const; |
77 | int Number() const { return GetCount(); } | |
738f9e5a | 78 | void SetSelection( int n ); |
6f6f938f | 79 | void Select( int n ) { return SetSelection( n ); } |
738f9e5a | 80 | void SetStringSelection( const wxString &string ); |
1a44c925 | 81 | void SetString(int n, const wxString &text); |
738f9e5a RR |
82 | |
83 | wxString GetValue() const; | |
84 | void SetValue(const wxString& value); | |
85 | ||
86 | void Copy(); | |
87 | void Cut(); | |
88 | void Paste(); | |
89 | void SetInsertionPoint( long pos ); | |
6f6f938f | 90 | void SetInsertionPointEnd() { SetInsertionPoint( -1 ); } |
738f9e5a RR |
91 | long GetInsertionPoint() const; |
92 | long GetLastPosition() const; | |
6f6f938f | 93 | void Remove(long from, long to) { Replace(from, to, wxEmptyString); } |
738f9e5a | 94 | void Replace( long from, long to, const wxString& value ); |
738f9e5a RR |
95 | void SetSelection( long from, long to ); |
96 | void SetEditable( bool editable ); | |
30ed6e5c | 97 | |
738f9e5a | 98 | // implementation |
30ed6e5c | 99 | |
2b5f62a0 | 100 | virtual void SetFocus(); |
30ed6e5c | 101 | |
738f9e5a RR |
102 | void OnSize( wxSizeEvent &event ); |
103 | void OnChar( wxKeyEvent &event ); | |
30ed6e5c | 104 | |
738f9e5a RR |
105 | bool m_alreadySent; |
106 | wxList m_clientDataList; | |
107 | wxList m_clientObjectList; | |
159b66c0 | 108 | int m_prevSelection; |
738f9e5a RR |
109 | |
110 | void DisableEvents(); | |
111 | void EnableEvents(); | |
738f9e5a RR |
112 | GtkWidget* GetConnectWidget(); |
113 | bool IsOwnGtkWindow( GdkWindow *window ); | |
114 | void ApplyWidgetStyle(); | |
30ed6e5c | 115 | |
6f6f938f VZ |
116 | wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST |
117 | ||
f68586e5 | 118 | protected: |
6f6f938f VZ |
119 | virtual int DoAppend(const wxString& item); |
120 | virtual int DoInsert(const wxString& item, int pos); | |
121 | ||
122 | virtual void DoSetItemClientData( int n, void* clientData ); | |
123 | virtual void* DoGetItemClientData( int n ) const; | |
124 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
125 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
126 | ||
f68586e5 VZ |
127 | virtual wxSize DoGetBestSize() const; |
128 | ||
30ed6e5c | 129 | private: |
6f6f938f | 130 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox) |
738f9e5a | 131 | DECLARE_EVENT_TABLE() |
7f4dc78d RR |
132 | }; |
133 | ||
dcf924a3 RR |
134 | #endif |
135 | ||
ac57418f RR |
136 | #endif |
137 | ||
138 | // __GTKCOMBOBOXH__ |