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