]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/combobox.h
Finally deprecated callbacks.
[wxWidgets.git] / include / wx / gtk1 / combobox.h
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 #if wxUSE_COMBOBOX
22
23 #include "wx/object.h"
24 #include "wx/control.h"
25
26 //-----------------------------------------------------------------------------
27 // classes
28 //-----------------------------------------------------------------------------
29
30 class wxComboBox;
31
32 //-----------------------------------------------------------------------------
33 // global data
34 //-----------------------------------------------------------------------------
35
36 extern const char* wxComboBoxNameStr;
37 extern const wxChar* wxEmptyString;
38
39 //-----------------------------------------------------------------------------
40 // wxComboBox
41 //-----------------------------------------------------------------------------
42
43 class wxComboBox : public wxControl
44 {
45 public:
46 inline wxComboBox() {}
47 inline wxComboBox(wxWindow *parent, wxWindowID id,
48 const wxString& value = wxEmptyString,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 int n = 0, const wxString choices[] = (const wxString *) NULL,
52 long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxComboBoxNameStr)
55 {
56 Create(parent, id, value, pos, size, n, choices, style, validator, name);
57 }
58 ~wxComboBox();
59 bool Create(wxWindow *parent, wxWindowID id,
60 const wxString& value = wxEmptyString,
61 const wxPoint& pos = wxDefaultPosition,
62 const wxSize& size = wxDefaultSize,
63 int n = 0, const wxString choices[] = (const wxString *) NULL,
64 long style = 0,
65 const wxValidator& validator = wxDefaultValidator,
66 const wxString& name = wxComboBoxNameStr);
67
68 void Append( const wxString &item );
69 void Append( const wxString &item, void* clientData );
70 void Append( const wxString &item, wxClientData* clientData );
71
72 void SetClientData( int n, void* clientData );
73 void* GetClientData( int n );
74 void SetClientObject( int n, wxClientData* clientData );
75 wxClientData* GetClientObject( int n );
76
77 void SetClientObject( wxClientData *data ) { wxControl::SetClientObject( data ); }
78 wxClientData *GetClientObject() const { return wxControl::GetClientObject(); }
79 void SetClientData( void *data ) { wxControl::SetClientData( data ); }
80 void *GetClientData() const { return wxControl::GetClientData(); }
81
82 void Clear();
83 void Delete( int n );
84
85 int FindString( const wxString &item );
86 int GetSelection() const;
87 wxString GetString( int n ) const;
88 wxString GetStringSelection() const;
89 int Number() const;
90 void SetSelection( int n );
91 void SetStringSelection( const wxString &string );
92
93 wxString GetValue() const;
94 void SetValue(const wxString& value);
95
96 void Copy();
97 void Cut();
98 void Paste();
99 void SetInsertionPoint( long pos );
100 void SetInsertionPointEnd();
101 long GetInsertionPoint() const;
102 long GetLastPosition() const;
103 void Replace( long from, long to, const wxString& value );
104 void Remove( long from, long to );
105 void SetSelection( long from, long to );
106 void SetEditable( bool editable );
107
108 // implementation
109
110 void OnSize( wxSizeEvent &event );
111 void OnChar( wxKeyEvent &event );
112
113 bool m_alreadySent;
114 wxList m_clientDataList;
115 wxList m_clientObjectList;
116
117 void DisableEvents();
118 void EnableEvents();
119 void AppendCommon( const wxString &item );
120 GtkWidget* GetConnectWidget();
121 bool IsOwnGtkWindow( GdkWindow *window );
122 void ApplyWidgetStyle();
123
124 protected:
125 virtual wxSize DoGetBestSize() const;
126
127 private:
128 DECLARE_DYNAMIC_CLASS(wxComboBox)
129 DECLARE_EVENT_TABLE()
130 };
131
132 #endif
133
134 #endif
135
136 // __GTKCOMBOBOXH__