]>
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 | ||
15 | #ifdef __GNUG__ | |
5ebd1fb2 | 16 | #pragma interface "combobox.h" |
c801d85f KB |
17 | #endif |
18 | ||
19 | #include "wx/defs.h" | |
ac57418f | 20 | |
c801d85f | 21 | #include "wx/object.h" |
c801d85f KB |
22 | #include "wx/control.h" |
23 | ||
24 | //----------------------------------------------------------------------------- | |
25 | // classes | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
28 | class wxComboBox; | |
29 | ||
7f4dc78d RR |
30 | //----------------------------------------------------------------------------- |
31 | // global data | |
32 | //----------------------------------------------------------------------------- | |
33 | ||
34 | extern const char* wxComboBoxNameStr; | |
9d2f3c71 | 35 | extern const wxChar* wxEmptyString; |
7f4dc78d | 36 | |
c801d85f KB |
37 | //----------------------------------------------------------------------------- |
38 | // wxComboBox | |
39 | //----------------------------------------------------------------------------- | |
40 | ||
fd0eed64 | 41 | class wxComboBox : public wxControl |
7f4dc78d RR |
42 | { |
43 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
44 | ||
fd0eed64 | 45 | public: |
7f4dc78d | 46 | |
fd0eed64 | 47 | inline wxComboBox() {} |
debe6624 | 48 | inline wxComboBox(wxWindow *parent, wxWindowID id, |
7f4dc78d RR |
49 | const wxString& value = wxEmptyString, |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
c67daf87 | 52 | int n = 0, const wxString choices[] = (const wxString *) NULL, |
debe6624 | 53 | long style = 0, |
6de97a3b | 54 | const wxValidator& validator = wxDefaultValidator, |
7f4dc78d RR |
55 | const wxString& name = wxComboBoxNameStr) |
56 | { | |
6de97a3b | 57 | Create(parent, id, value, pos, size, n, choices, style, validator, name); |
7f4dc78d | 58 | } |
fd0eed64 | 59 | ~wxComboBox(); |
debe6624 | 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 | ||
7f4dc78d | 69 | void Append( const wxString &item ); |
fd0eed64 RR |
70 | void Append( const wxString &item, void* clientData ); |
71 | void Append( const wxString &item, wxClientData* clientData ); | |
72 | ||
73 | void SetClientData( int n, void* clientData ); | |
74 | void* GetClientData( int n ); | |
75 | void SetClientObject( int n, wxClientData* clientData ); | |
76 | wxClientData* GetClientObject( int n ); | |
77 | ||
0de9b5b2 RR |
78 | void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); } |
79 | wxClientData *GetClientObject() const { return wxControl::GetClientObject(); } | |
80 | void SetClientData( void *data ) { wxControl::SetClientData( data ); } | |
81 | void *GetClientData() const { return wxControl::GetClientData(); } | |
82 | ||
fd0eed64 | 83 | void Clear(); |
debe6624 | 84 | void Delete( int n ); |
fd0eed64 | 85 | |
7f4dc78d | 86 | int FindString( const wxString &item ); |
fd0eed64 | 87 | int GetSelection() const; |
debe6624 | 88 | wxString GetString( int n ) const; |
fd0eed64 RR |
89 | wxString GetStringSelection() const; |
90 | int Number() const; | |
debe6624 | 91 | void SetSelection( int n ); |
47908e25 | 92 | void SetStringSelection( const wxString &string ); |
debe6624 | 93 | |
fd0eed64 | 94 | wxString GetValue() const; |
7f4dc78d RR |
95 | void SetValue(const wxString& value); |
96 | ||
fd0eed64 RR |
97 | void Copy(); |
98 | void Cut(); | |
99 | void Paste(); | |
100 | void SetInsertionPoint( long pos ); | |
101 | void SetInsertionPointEnd(); | |
102 | long GetInsertionPoint() const; | |
103 | long GetLastPosition() const; | |
104 | void Replace( long from, long to, const wxString& value ); | |
105 | void Remove( long from, long to ); | |
106 | void SetSelection( long from, long to ); | |
107 | void SetEditable( bool editable ); | |
868a2826 | 108 | |
b4071e91 | 109 | void OnSize( wxSizeEvent &event ); |
fb9e1bc2 | 110 | void OnChar( wxKeyEvent &event ); |
868a2826 | 111 | |
fd0eed64 | 112 | // implementation |
868a2826 | 113 | |
fd0eed64 RR |
114 | bool m_alreadySent; |
115 | wxList m_clientDataList; | |
f5e27805 | 116 | wxList m_clientObjectList; |
b4071e91 | 117 | |
fd0eed64 RR |
118 | void AppendCommon( const wxString &item ); |
119 | GtkWidget* GetConnectWidget(); | |
120 | bool IsOwnGtkWindow( GdkWindow *window ); | |
121 | void ApplyWidgetStyle(); | |
47908e25 | 122 | |
b4071e91 | 123 | DECLARE_EVENT_TABLE() |
7f4dc78d RR |
124 | }; |
125 | ||
ac57418f RR |
126 | #endif |
127 | ||
128 | // __GTKCOMBOBOXH__ |