]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/choice.h
Some work on tabbing and menu accels,
[wxWidgets.git] / include / wx / gtk1 / choice.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: choice.h
3// Purpose:
4// Author: Robert Roebling
dbf858b5 5// Id: $Id$
01111366 6// Copyright: (c) 1998 Robert Roebling
29006414 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifndef __GTKCHOICEH__
11#define __GTKCHOICEH__
12
13#ifdef __GNUG__
9abe166a 14 #pragma interface "choice.h"
c801d85f
KB
15#endif
16
c801d85f
KB
17//-----------------------------------------------------------------------------
18// wxChoice
19//-----------------------------------------------------------------------------
20
9abe166a 21class wxChoice : public wxChoiceBase
c801d85f 22{
fd0eed64 23public:
29006414
VZ
24 wxChoice();
25 wxChoice( wxWindow *parent, wxWindowID id,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 int n = 0, const wxString choices[] = (const wxString *) NULL,
29 long style = 0,
30 const wxValidator& validator = wxDefaultValidator,
31 const wxString& name = wxChoiceNameStr )
32 {
e01c8145
VZ
33 m_strings = (wxSortedArrayString *)NULL;
34
29006414
VZ
35 Create(parent, id, pos, size, n, choices, style, validator, name);
36 }
37 ~wxChoice();
38 bool Create( wxWindow *parent, wxWindowID id,
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 int n = 0, const wxString choices[] = (wxString *) NULL,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxChoiceNameStr );
c801d85f 45
9abe166a 46 // implement base class pure virtuals
29006414 47 void Delete(int n);
9abe166a
VZ
48 void Clear();
49
50 int GetSelection() const;
51 void SetSelection( int n );
29006414 52
9abe166a 53 virtual int GetCount() const;
6c8a980f 54 int FindString( const wxString& string ) const;
29006414 55 wxString GetString( int n ) const;
6c8a980f 56 void SetString( int n, const wxString& string );
29006414
VZ
57
58 // implementation
e01c8145 59 wxList m_clientList; // contains the client data for the items
29006414 60
953704c1
RR
61 void DisableEvents();
62 void EnableEvents();
29006414
VZ
63 void AppendCommon( const wxString &item );
64 void ApplyWidgetStyle();
e01c8145 65
9abe166a
VZ
66protected:
67 virtual int DoAppend(const wxString& item);
68
6c8a980f
VZ
69 virtual void DoSetItemClientData( int n, void* clientData );
70 virtual void* DoGetItemClientData( int n ) const;
71 virtual void DoSetItemClientObject( int n, wxClientData* clientData );
72 virtual wxClientData* DoGetItemClientObject( int n ) const;
d6538e2c 73
738f9e5a 74private:
e01c8145
VZ
75 // common part of Create() and DoAppend()
76 size_t AppendHelper(GtkWidget *menu, const wxString& item);
77
78 // this array is only used for controls with wxCB_SORT style, so only
79 // allocate it if it's needed (hence using pointer)
80 wxSortedArrayString *m_strings;
81
738f9e5a 82 DECLARE_DYNAMIC_CLASS(wxChoice)
c801d85f
KB
83};
84
ce4169a4 85
c801d85f 86#endif // __GTKCHOICEH__