]>
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 | ||
ab7ce33c | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
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 | #include "wx/control.h" |
25 | ||
26 | //----------------------------------------------------------------------------- | |
27 | // classes | |
28 | //----------------------------------------------------------------------------- | |
29 | ||
30 | class wxComboBox; | |
31 | ||
7f4dc78d RR |
32 | //----------------------------------------------------------------------------- |
33 | // global data | |
34 | //----------------------------------------------------------------------------- | |
35 | ||
401eb3de | 36 | extern const wxChar* wxComboBoxNameStr; |
9d2f3c71 | 37 | extern const wxChar* wxEmptyString; |
7f4dc78d | 38 | |
c801d85f KB |
39 | //----------------------------------------------------------------------------- |
40 | // wxComboBox | |
41 | //----------------------------------------------------------------------------- | |
42 | ||
fd0eed64 | 43 | class wxComboBox : public wxControl |
7f4dc78d | 44 | { |
fd0eed64 | 45 | public: |
738f9e5a RR |
46 | inline wxComboBox() {} |
47 | inline wxComboBox(wxWindow *parent, wxWindowID id, | |
7f4dc78d RR |
48 | const wxString& value = wxEmptyString, |
49 | const wxPoint& pos = wxDefaultPosition, | |
50 | const wxSize& size = wxDefaultSize, | |
c67daf87 | 51 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
debe6624 | 52 | long style = 0, |
6de97a3b | 53 | const wxValidator& validator = wxDefaultValidator, |
7f4dc78d | 54 | const wxString& name = wxComboBoxNameStr) |
738f9e5a RR |
55 | { |
56 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
57 | } | |
58 | ~wxComboBox(); | |
59 | bool Create(wxWindow *parent, wxWindowID id, | |
7f4dc78d RR |
60 | const wxString& value = wxEmptyString, |
61 | const wxPoint& pos = wxDefaultPosition, | |
62 | const wxSize& size = wxDefaultSize, | |
c67daf87 | 63 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
debe6624 | 64 | long style = 0, |
6de97a3b | 65 | const wxValidator& validator = wxDefaultValidator, |
7f4dc78d RR |
66 | const wxString& name = wxComboBoxNameStr); |
67 | ||
738f9e5a RR |
68 | void Append( const wxString &item ); |
69 | void Append( const wxString &item, void* clientData ); | |
70 | void Append( const wxString &item, wxClientData* clientData ); | |
30ed6e5c | 71 | |
243dbf1a VZ |
72 | void Insert( const wxString &item, int pos ); |
73 | void Insert( const wxString &item, int pos, void* clientData ); | |
74 | void Insert( const wxString &item, int pos, wxClientData* clientData ); | |
30ed6e5c | 75 | |
738f9e5a | 76 | void SetClientData( int n, void* clientData ); |
30ed6e5c | 77 | void* GetClientData( int n ) const; |
738f9e5a | 78 | void SetClientObject( int n, wxClientData* clientData ); |
30ed6e5c VZ |
79 | wxClientData* GetClientObject( int n ) const; |
80 | ||
738f9e5a RR |
81 | void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); } |
82 | wxClientData *GetClientObject() const { return wxControl::GetClientObject(); } | |
83 | void SetClientData( void *data ) { wxControl::SetClientData( data ); } | |
84 | void *GetClientData() const { return wxControl::GetClientData(); } | |
30ed6e5c | 85 | |
738f9e5a RR |
86 | void Clear(); |
87 | void Delete( int n ); | |
30ed6e5c | 88 | |
738f9e5a RR |
89 | int FindString( const wxString &item ); |
90 | int GetSelection() const; | |
91 | wxString GetString( int n ) const; | |
92 | wxString GetStringSelection() const; | |
1e6feb95 | 93 | int GetCount() const { return Number(); } |
738f9e5a RR |
94 | int Number() const; |
95 | void SetSelection( int n ); | |
96 | void SetStringSelection( const wxString &string ); | |
1a44c925 | 97 | void SetString(int n, const wxString &text); |
738f9e5a RR |
98 | |
99 | wxString GetValue() const; | |
100 | void SetValue(const wxString& value); | |
101 | ||
102 | void Copy(); | |
103 | void Cut(); | |
104 | void Paste(); | |
105 | void SetInsertionPoint( long pos ); | |
106 | void SetInsertionPointEnd(); | |
107 | long GetInsertionPoint() const; | |
108 | long GetLastPosition() const; | |
109 | void Replace( long from, long to, const wxString& value ); | |
110 | void Remove( long from, long to ); | |
111 | void SetSelection( long from, long to ); | |
112 | void SetEditable( bool editable ); | |
30ed6e5c | 113 | |
738f9e5a | 114 | // implementation |
30ed6e5c | 115 | |
2b5f62a0 | 116 | virtual void SetFocus(); |
30ed6e5c | 117 | |
738f9e5a RR |
118 | void OnSize( wxSizeEvent &event ); |
119 | void OnChar( wxKeyEvent &event ); | |
30ed6e5c | 120 | |
738f9e5a RR |
121 | bool m_alreadySent; |
122 | wxList m_clientDataList; | |
123 | wxList m_clientObjectList; | |
159b66c0 | 124 | int m_prevSelection; |
738f9e5a RR |
125 | |
126 | void DisableEvents(); | |
127 | void EnableEvents(); | |
128 | void AppendCommon( const wxString &item ); | |
243dbf1a | 129 | void InsertCommon( const wxString &item, int pos ); |
738f9e5a RR |
130 | GtkWidget* GetConnectWidget(); |
131 | bool IsOwnGtkWindow( GdkWindow *window ); | |
132 | void ApplyWidgetStyle(); | |
30ed6e5c | 133 | |
f68586e5 VZ |
134 | protected: |
135 | virtual wxSize DoGetBestSize() const; | |
136 | ||
30ed6e5c | 137 | private: |
738f9e5a RR |
138 | DECLARE_DYNAMIC_CLASS(wxComboBox) |
139 | DECLARE_EVENT_TABLE() | |
7f4dc78d RR |
140 | }; |
141 | ||
dcf924a3 RR |
142 | #endif |
143 | ||
ac57418f RR |
144 | #endif |
145 | ||
146 | // __GTKCOMBOBOXH__ |