]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/choice.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKCHOICEH__
11 #define __GTKCHOICEH__
14 #pragma interface "choice.h"
17 //-----------------------------------------------------------------------------
19 //-----------------------------------------------------------------------------
21 class wxChoice
: public wxChoiceBase
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
,
30 const wxValidator
& validator
= wxDefaultValidator
,
31 const wxString
& name
= wxChoiceNameStr
)
33 m_strings
= (wxSortedArrayString
*)NULL
;
35 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
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
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxChoiceNameStr
);
46 // implement base class pure virtuals
50 int GetSelection() const;
51 void SetSelection( int n
);
53 virtual int GetCount() const;
54 int FindString( const wxString
&string
) const;
55 wxString
GetString( int n
) const;
58 wxList m_clientList
; // contains the client data for the items
62 void AppendCommon( const wxString
&item
);
63 void ApplyWidgetStyle();
66 virtual int DoAppend(const wxString
& item
);
68 virtual void DoSetClientData( int n
, void* clientData
);
69 virtual void* DoGetClientData( int n
) const;
70 virtual void DoSetClientObject( int n
, wxClientData
* clientData
);
71 virtual wxClientData
* DoGetClientObject( int n
) const;
73 // the above virtuals hide these virtuals in wxChoiceBase
74 virtual void DoSetClientData(void* clientData
)
75 { wxWindowBase::DoSetClientData(clientData
); };
76 virtual void* DoGetClientData() const
77 { return(wxWindowBase::DoGetClientData()); };
78 virtual void DoSetClientObject( wxClientData
* clientData
)
79 { wxWindowBase::DoSetClientObject(clientData
); };
80 virtual wxClientData
* DoGetClientObject() const
81 { return(wxWindowBase::DoGetClientObject()); };
84 // common part of Create() and DoAppend()
85 size_t AppendHelper(GtkWidget
*menu
, const wxString
& item
);
87 // this array is only used for controls with wxCB_SORT style, so only
88 // allocate it if it's needed (hence using pointer)
89 wxSortedArrayString
*m_strings
;
91 DECLARE_DYNAMIC_CLASS(wxChoice
)
95 #endif // __GTKCHOICEH__