]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: combobox.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Created: 01/02/97 | |
6 | // Id: $Id$ | |
7 | // Copyright: (c) 1998 Robert Roebling | |
8 | // Licence: wxWindows licence | |
9 | ///////////////////////////////////////////////////////////////////////////// | |
10 | ||
11 | ||
12 | #ifndef __GTKCOMBOBOXH__ | |
13 | #define __GTKCOMBOBOXH__ | |
14 | ||
15 | #ifdef __GNUG__ | |
16 | #pragma interface "combobox.h" | |
17 | #endif | |
18 | ||
19 | #include "wx/defs.h" | |
20 | ||
21 | #include "wx/object.h" | |
22 | #include "wx/control.h" | |
23 | ||
24 | //----------------------------------------------------------------------------- | |
25 | // classes | |
26 | //----------------------------------------------------------------------------- | |
27 | ||
28 | class wxComboBox; | |
29 | ||
30 | //----------------------------------------------------------------------------- | |
31 | // global data | |
32 | //----------------------------------------------------------------------------- | |
33 | ||
34 | extern const char* wxComboBoxNameStr; | |
35 | extern const wxChar* wxEmptyString; | |
36 | ||
37 | //----------------------------------------------------------------------------- | |
38 | // wxComboBox | |
39 | //----------------------------------------------------------------------------- | |
40 | ||
41 | class wxComboBox : public wxControl | |
42 | { | |
43 | DECLARE_DYNAMIC_CLASS(wxComboBox) | |
44 | ||
45 | public: | |
46 | ||
47 | inline wxComboBox() {} | |
48 | inline wxComboBox(wxWindow *parent, wxWindowID id, | |
49 | const wxString& value = wxEmptyString, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
53 | long style = 0, | |
54 | const wxValidator& validator = wxDefaultValidator, | |
55 | const wxString& name = wxComboBoxNameStr) | |
56 | { | |
57 | Create(parent, id, value, pos, size, n, choices, style, validator, name); | |
58 | } | |
59 | ~wxComboBox(); | |
60 | bool Create(wxWindow *parent, wxWindowID id, | |
61 | const wxString& value = wxEmptyString, | |
62 | const wxPoint& pos = wxDefaultPosition, | |
63 | const wxSize& size = wxDefaultSize, | |
64 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
65 | long style = 0, | |
66 | const wxValidator& validator = wxDefaultValidator, | |
67 | const wxString& name = wxComboBoxNameStr); | |
68 | ||
69 | void Append( const wxString &item ); | |
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 | ||
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 | ||
83 | void Clear(); | |
84 | void Delete( int n ); | |
85 | ||
86 | int FindString( const wxString &item ); | |
87 | int GetSelection() const; | |
88 | wxString GetString( int n ) const; | |
89 | wxString GetStringSelection() const; | |
90 | int Number() const; | |
91 | void SetSelection( int n ); | |
92 | void SetStringSelection( const wxString &string ); | |
93 | ||
94 | wxString GetValue() const; | |
95 | void SetValue(const wxString& value); | |
96 | ||
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 ); | |
108 | ||
109 | void OnSize( wxSizeEvent &event ); | |
110 | void OnChar( wxKeyEvent &event ); | |
111 | ||
112 | // implementation | |
113 | ||
114 | bool m_alreadySent; | |
115 | wxList m_clientDataList; | |
116 | wxList m_clientObjectList; | |
117 | ||
118 | void AppendCommon( const wxString &item ); | |
119 | GtkWidget* GetConnectWidget(); | |
120 | bool IsOwnGtkWindow( GdkWindow *window ); | |
121 | void ApplyWidgetStyle(); | |
122 | ||
123 | DECLARE_EVENT_TABLE() | |
124 | }; | |
125 | ||
126 | #endif | |
127 | ||
128 | // __GTKCOMBOBOXH__ |