1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKCHOICEH__
11 #define __GTKCHOICEH__
13 #if defined(__GNUG__) && !defined(__APPLE__)
14 #pragma interface "choice.h"
17 class WXDLLIMPEXP_BASE wxSortedArrayString
;
19 //-----------------------------------------------------------------------------
21 //-----------------------------------------------------------------------------
23 class wxChoice
: public wxChoiceBase
27 wxChoice( wxWindow
*parent
, wxWindowID id
,
28 const wxPoint
& pos
= wxDefaultPosition
,
29 const wxSize
& size
= wxDefaultSize
,
30 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
32 const wxValidator
& validator
= wxDefaultValidator
,
33 const wxString
& name
= wxChoiceNameStr
)
35 m_strings
= (wxSortedArrayString
*)NULL
;
37 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
40 bool Create( wxWindow
*parent
, wxWindowID id
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
43 int n
= 0, const wxString choices
[] = (wxString
*) NULL
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
);
48 // implement base class pure virtuals
52 int GetSelection() const;
53 void SetSelection( int n
);
55 virtual int GetCount() const;
56 int FindString( const wxString
& string
) const;
57 wxString
GetString( int n
) const;
58 void SetString( int n
, const wxString
& string
);
61 wxList m_clientList
; // contains the client data for the items
63 void ApplyWidgetStyle();
64 virtual int DoAppend(const wxString
& item
);
65 virtual int DoInsert(const wxString
& item
, int pos
);
67 virtual void DoSetItemClientData( int n
, void* clientData
);
68 virtual void* DoGetItemClientData( int n
) const;
69 virtual void DoSetItemClientObject( int n
, wxClientData
* clientData
);
70 virtual wxClientData
* DoGetItemClientObject( int n
) const;
72 virtual wxSize
DoGetBestSize() const;
74 virtual bool IsOwnGtkWindow( GdkWindow
*window
);
76 // common part of Create() and DoAppend()
77 int GtkAddHelper(GtkWidget
*menu
, int pos
, const wxString
& item
);
79 // this array is only used for controls with wxCB_SORT style, so only
80 // allocate it if it's needed (hence using pointer)
81 wxSortedArrayString
*m_strings
;
83 DECLARE_DYNAMIC_CLASS(wxChoice
)
87 #endif // __GTKCHOICEH__