]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/combobox.h
fixing the regex mess that Ryan wasn't yet able to fix himself
[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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
25 //-----------------------------------------------------------------------------
26 // classes
27 //-----------------------------------------------------------------------------
28
29 class wxComboBox;
30
31 //-----------------------------------------------------------------------------
32 // global data
33 //-----------------------------------------------------------------------------
34
35 extern const wxChar* wxComboBoxNameStr;
36 extern const wxChar* wxEmptyString;
37
38 //-----------------------------------------------------------------------------
39 // wxComboBox
40 //-----------------------------------------------------------------------------
41
42 class wxComboBox : public wxControl, public wxComboBoxBase
43 {
44 public:
45 inline wxComboBox() {}
46 inline wxComboBox(wxWindow *parent, wxWindowID id,
47 const wxString& value = wxEmptyString,
48 const wxPoint& pos = wxDefaultPosition,
49 const wxSize& size = wxDefaultSize,
50 int n = 0, const wxString choices[] = (const wxString *) NULL,
51 long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxComboBoxNameStr)
54 {
55 Create(parent, id, value, pos, size, n, choices, style, validator, name);
56 }
57
58 ~wxComboBox();
59
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 Clear();
70 void Delete( int n );
71
72 virtual int FindString( const wxString &item ) const;
73 int GetSelection() const;
74 wxString GetString( int n ) const;
75 wxString GetStringSelection() const;
76 int GetCount() const;
77 int Number() const { return GetCount(); }
78 void SetSelection( int n );
79 void Select( int n ) { return SetSelection( n ); }
80 void SetStringSelection( const wxString &string );
81 void SetString(int n, const wxString &text);
82
83 wxString GetValue() const;
84 void SetValue(const wxString& value);
85
86 void Copy();
87 void Cut();
88 void Paste();
89 void SetInsertionPoint( long pos );
90 void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
91 long GetInsertionPoint() const;
92 long GetLastPosition() const;
93 void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
94 void Replace( long from, long to, const wxString& value );
95 void SetSelection( long from, long to );
96 void SetEditable( bool editable );
97
98 // implementation
99
100 virtual void SetFocus();
101
102 void OnSize( wxSizeEvent &event );
103 void OnChar( wxKeyEvent &event );
104
105 bool m_alreadySent;
106 wxList m_clientDataList;
107 wxList m_clientObjectList;
108 int m_prevSelection;
109
110 void DisableEvents();
111 void EnableEvents();
112 GtkWidget* GetConnectWidget();
113 bool IsOwnGtkWindow( GdkWindow *window );
114 void ApplyWidgetStyle();
115
116 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
117
118 protected:
119 virtual int DoAppend(const wxString& item);
120 virtual int DoInsert(const wxString& item, int pos);
121
122 virtual void DoSetItemClientData( int n, void* clientData );
123 virtual void* DoGetItemClientData( int n ) const;
124 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
125 virtual wxClientData* DoGetItemClientObject( int n ) const;
126
127 virtual wxSize DoGetBestSize() const;
128
129 private:
130 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
131 DECLARE_EVENT_TABLE()
132 };
133
134 #endif
135
136 #endif
137
138 // __GTKCOMBOBOXH__