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