1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/choice.h
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_GTK_CHOICE_H_
11 #define _WX_GTK_CHOICE_H_
13 class WXDLLIMPEXP_FWD_BASE wxSortedArrayString
;
14 class WXDLLIMPEXP_FWD_BASE wxArrayString
;
16 //-----------------------------------------------------------------------------
18 //-----------------------------------------------------------------------------
20 class WXDLLIMPEXP_CORE 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
)
36 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
38 wxChoice( wxWindow
*parent
, wxWindowID id
,
41 const wxArrayString
& choices
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxChoiceNameStr
)
47 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
50 bool Create( wxWindow
*parent
, wxWindowID id
,
51 const wxPoint
& pos
= wxDefaultPosition
,
52 const wxSize
& size
= wxDefaultSize
,
53 int n
= 0, const wxString choices
[] = NULL
,
55 const wxValidator
& validator
= wxDefaultValidator
,
56 const wxString
& name
= wxChoiceNameStr
);
57 bool Create( wxWindow
*parent
, wxWindowID id
,
60 const wxArrayString
& choices
,
62 const wxValidator
& validator
= wxDefaultValidator
,
63 const wxString
& name
= wxChoiceNameStr
);
65 void SendSelectionChangedEvent(wxEventType evt_type
);
67 int GetSelection() const;
68 void SetSelection(int n
);
70 virtual unsigned int GetCount() const;
71 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
72 virtual wxString
GetString(unsigned int n
) const;
73 virtual void SetString(unsigned int n
, const wxString
& string
);
75 virtual void SetColumns(int n
=1);
76 virtual int GetColumns() const;
78 virtual void DisableEvents();
79 virtual void EnableEvents();
81 static wxVisualAttributes
82 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
85 // this array is only used for controls with wxCB_SORT style, so only
86 // allocate it if it's needed (hence using pointer)
87 wxSortedArrayString
*m_strings
;
89 // contains the client data for the items
90 wxArrayPtrVoid m_clientData
;
92 // index to GtkListStore cell which displays the item text
93 int m_stringCellIndex
;
95 virtual wxSize
DoGetBestSize() const;
96 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
98 void **clientData
, wxClientDataType type
);
99 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
100 virtual void* DoGetItemClientData(unsigned int n
) const;
101 virtual void DoClear();
102 virtual void DoDeleteOneItem(unsigned int n
);
104 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
105 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
107 // in derived classes, implement this to insert list store entry
108 // with all items default except text
109 virtual void GTKInsertComboBoxTextItem( unsigned int n
, const wxString
& text
);
114 DECLARE_DYNAMIC_CLASS(wxChoice
)
118 #endif // _WX_GTK_CHOICE_H_