]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/combobox.h
fix after adding wxFORCE_LINK_MODULE
[wxWidgets.git] / include / wx / gtk / combobox.h
CommitLineData
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
7d8268a1 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
c801d85f
KB
11#ifndef __GTKCOMBOBOXH__
12#define __GTKCOMBOBOXH__
13
c801d85f 14#include "wx/defs.h"
ac57418f 15
dcf924a3
RR
16#if wxUSE_COMBOBOX
17
c801d85f 18#include "wx/object.h"
c801d85f
KB
19
20//-----------------------------------------------------------------------------
21// classes
22//-----------------------------------------------------------------------------
23
20123d49 24class WXDLLIMPEXP_CORE wxComboBox;
c801d85f 25
7f4dc78d
RR
26//-----------------------------------------------------------------------------
27// global data
28//-----------------------------------------------------------------------------
29
20123d49
MW
30extern WXDLLIMPEXP_CORE const wxChar* wxComboBoxNameStr;
31extern WXDLLIMPEXP_BASE const wxChar* wxEmptyString;
7f4dc78d 32
c801d85f
KB
33//-----------------------------------------------------------------------------
34// wxComboBox
35//-----------------------------------------------------------------------------
36
20123d49 37class WXDLLIMPEXP_CORE wxComboBox : public wxControl, public wxComboBoxBase
7f4dc78d 38{
fd0eed64 39public:
738f9e5a
RR
40 inline wxComboBox() {}
41 inline wxComboBox(wxWindow *parent, wxWindowID id,
7f4dc78d
RR
42 const wxString& value = wxEmptyString,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
c67daf87 45 int n = 0, const wxString choices[] = (const wxString *) NULL,
debe6624 46 long style = 0,
6de97a3b 47 const wxValidator& validator = wxDefaultValidator,
7f4dc78d 48 const wxString& name = wxComboBoxNameStr)
738f9e5a
RR
49 {
50 Create(parent, id, value, pos, size, n, choices, style, validator, name);
51 }
584ad2a3
MB
52 inline wxComboBox(wxWindow *parent, wxWindowID id,
53 const wxString& value,
54 const wxPoint& pos,
55 const wxSize& size,
56 const wxArrayString& choices,
57 long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxComboBoxNameStr)
60 {
61 Create(parent, id, value, pos, size, choices, style, validator, name);
62 }
6f6f938f 63
738f9e5a 64 ~wxComboBox();
6f6f938f 65
738f9e5a 66 bool Create(wxWindow *parent, wxWindowID id,
7f4dc78d
RR
67 const wxString& value = wxEmptyString,
68 const wxPoint& pos = wxDefaultPosition,
69 const wxSize& size = wxDefaultSize,
c67daf87 70 int n = 0, const wxString choices[] = (const wxString *) NULL,
debe6624 71 long style = 0,
6de97a3b 72 const wxValidator& validator = wxDefaultValidator,
7f4dc78d 73 const wxString& name = wxComboBoxNameStr);
584ad2a3
MB
74 bool Create(wxWindow *parent, wxWindowID id,
75 const wxString& value,
76 const wxPoint& pos,
77 const wxSize& size,
78 const wxArrayString& choices,
79 long style = 0,
80 const wxValidator& validator = wxDefaultValidator,
81 const wxString& name = wxComboBoxNameStr);
7f4dc78d 82
738f9e5a
RR
83 void Clear();
84 void Delete( int n );
30ed6e5c 85
6f6f938f 86 virtual int FindString( const wxString &item ) const;
738f9e5a 87 int GetSelection() const;
40eb3606
VZ
88#if wxABI_VERSION >= 20602
89 int GetCurrentSelection() const;
90#endif
738f9e5a
RR
91 wxString GetString( int n ) const;
92 wxString GetStringSelection() const;
6f6f938f
VZ
93 int GetCount() const;
94 int Number() const { return GetCount(); }
738f9e5a 95 void SetSelection( int n );
1a44c925 96 void SetString(int n, const wxString &text);
738f9e5a
RR
97
98 wxString GetValue() const;
99 void SetValue(const wxString& value);
100
101 void Copy();
102 void Cut();
103 void Paste();
150e31d2
JS
104 bool CanCopy() const;
105 bool CanCut() const;
106 bool CanPaste() const;
738f9e5a 107 void SetInsertionPoint( long pos );
6f6f938f 108 void SetInsertionPointEnd() { SetInsertionPoint( -1 ); }
738f9e5a 109 long GetInsertionPoint() const;
7d8268a1 110 virtual wxTextPos GetLastPosition() const;
6f6f938f 111 void Remove(long from, long to) { Replace(from, to, wxEmptyString); }
738f9e5a 112 void Replace( long from, long to, const wxString& value );
738f9e5a 113 void SetSelection( long from, long to );
150e31d2 114 void GetSelection( long* from, long* to ) const;
738f9e5a 115 void SetEditable( bool editable );
150e31d2
JS
116 void Undo() ;
117 void Redo() ;
118 bool CanUndo() const;
119 bool CanRedo() const;
120 void SelectAll();
4e324a3f 121 bool IsEditable() const ;
150e31d2 122 bool HasSelection() const ;
30ed6e5c 123
738f9e5a 124 // implementation
30ed6e5c 125
2b5f62a0 126 virtual void SetFocus();
30ed6e5c 127
738f9e5a
RR
128 void OnSize( wxSizeEvent &event );
129 void OnChar( wxKeyEvent &event );
30ed6e5c 130
150e31d2
JS
131 // Standard event handling
132 void OnCut(wxCommandEvent& event);
133 void OnCopy(wxCommandEvent& event);
134 void OnPaste(wxCommandEvent& event);
135 void OnUndo(wxCommandEvent& event);
136 void OnRedo(wxCommandEvent& event);
137 void OnDelete(wxCommandEvent& event);
138 void OnSelectAll(wxCommandEvent& event);
139
140 void OnUpdateCut(wxUpdateUIEvent& event);
141 void OnUpdateCopy(wxUpdateUIEvent& event);
142 void OnUpdatePaste(wxUpdateUIEvent& event);
143 void OnUpdateUndo(wxUpdateUIEvent& event);
144 void OnUpdateRedo(wxUpdateUIEvent& event);
145 void OnUpdateDelete(wxUpdateUIEvent& event);
146 void OnUpdateSelectAll(wxUpdateUIEvent& event);
147
78b3b018 148 bool m_ignoreNextUpdate:1;
738f9e5a
RR
149 wxList m_clientDataList;
150 wxList m_clientObjectList;
159b66c0 151 int m_prevSelection;
738f9e5a
RR
152
153 void DisableEvents();
154 void EnableEvents();
738f9e5a
RR
155 GtkWidget* GetConnectWidget();
156 bool IsOwnGtkWindow( GdkWindow *window );
f40fdaa3 157 void DoApplyWidgetStyle(GtkRcStyle *style);
30ed6e5c 158
6f6f938f
VZ
159 wxCONTROL_ITEMCONTAINER_CLIENTDATAOBJECT_RECAST
160
9d522606
RD
161 static wxVisualAttributes
162 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
150e31d2 163
f68586e5 164protected:
6f6f938f
VZ
165 virtual int DoAppend(const wxString& item);
166 virtual int DoInsert(const wxString& item, int pos);
167
168 virtual void DoSetItemClientData( int n, void* clientData );
169 virtual void* DoGetItemClientData( int n ) const;
170 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
171 virtual wxClientData* DoGetItemClientObject( int n ) const;
172
f68586e5
VZ
173 virtual wxSize DoGetBestSize() const;
174
9d522606
RD
175 // Widgets that use the style->base colour for the BG colour should
176 // override this and return true.
177 virtual bool UseGTKStyleBase() const { return true; }
178
30ed6e5c 179private:
6f6f938f 180 DECLARE_DYNAMIC_CLASS_NO_COPY(wxComboBox)
738f9e5a 181 DECLARE_EVENT_TABLE()
7f4dc78d
RR
182};
183
dcf924a3
RR
184#endif
185
ac57418f
RR
186#endif
187
188 // __GTKCOMBOBOXH__