1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
7 // Copyright: (c) 1998 Robert Roebling
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __GTKCOMBOBOXH__
13 #define __GTKCOMBOBOXH__
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "combobox.h"
23 #include "wx/object.h"
24 #include "wx/control.h"
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
32 //-----------------------------------------------------------------------------
34 //-----------------------------------------------------------------------------
36 extern const wxChar
* wxComboBoxNameStr
;
37 extern const wxChar
* wxEmptyString
;
39 //-----------------------------------------------------------------------------
41 //-----------------------------------------------------------------------------
43 class wxComboBox
: public wxControl
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
,
53 const wxValidator
& validator
= wxDefaultValidator
,
54 const wxString
& name
= wxComboBoxNameStr
)
56 Create(parent
, id
, value
, pos
, size
, n
, choices
, style
, validator
, name
);
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
,
65 const wxValidator
& validator
= wxDefaultValidator
,
66 const wxString
& name
= wxComboBoxNameStr
);
68 void Append( const wxString
&item
);
69 void Append( const wxString
&item
, void* clientData
);
70 void Append( const wxString
&item
, wxClientData
* clientData
);
72 void Insert( const wxString
&item
, int pos
);
73 void Insert( const wxString
&item
, int pos
, void* clientData
);
74 void Insert( const wxString
&item
, int pos
, wxClientData
* clientData
);
76 void SetClientData( int n
, void* clientData
);
77 void* GetClientData( int n
) const;
78 void SetClientObject( int n
, wxClientData
* clientData
);
79 wxClientData
* GetClientObject( int n
) const;
81 void SetClientObject( wxClientData
*data
) { wxControl::SetClientObject( data
); }
82 wxClientData
*GetClientObject() const { return wxControl::GetClientObject(); }
83 void SetClientData( void *data
) { wxControl::SetClientData( data
); }
84 void *GetClientData() const { return wxControl::GetClientData(); }
89 int FindString( const wxString
&item
);
90 int GetSelection() const;
91 wxString
GetString( int n
) const;
92 wxString
GetStringSelection() const;
93 int GetCount() const { return Number(); }
95 void SetSelection( int n
);
96 void SetStringSelection( const wxString
&string
);
97 void SetString(int n
, const wxString
&text
);
99 wxString
GetValue() const;
100 void SetValue(const wxString
& value
);
105 void SetInsertionPoint( long pos
);
106 void SetInsertionPointEnd();
107 long GetInsertionPoint() const;
108 long GetLastPosition() const;
109 void Replace( long from
, long to
, const wxString
& value
);
110 void Remove( long from
, long to
);
111 void SetSelection( long from
, long to
);
112 void SetEditable( bool editable
);
116 virtual void SetFocus();
118 void OnSize( wxSizeEvent
&event
);
119 void OnChar( wxKeyEvent
&event
);
122 wxList m_clientDataList
;
123 wxList m_clientObjectList
;
126 void DisableEvents();
128 void AppendCommon( const wxString
&item
);
129 void InsertCommon( const wxString
&item
, int pos
);
130 GtkWidget
* GetConnectWidget();
131 bool IsOwnGtkWindow( GdkWindow
*window
);
132 void ApplyWidgetStyle();
135 virtual wxSize
DoGetBestSize() const;
138 DECLARE_DYNAMIC_CLASS(wxComboBox
)
139 DECLARE_EVENT_TABLE()