1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/choice.h
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
9 #ifndef _WX_GTK_CHOICE_H_
10 #define _WX_GTK_CHOICE_H_
12 class WXDLLIMPEXP_FWD_BASE wxSortedArrayString
;
13 class WXDLLIMPEXP_FWD_BASE wxArrayString
;
15 //-----------------------------------------------------------------------------
17 //-----------------------------------------------------------------------------
19 class wxGtkCollatedArrayString
;
21 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
28 wxChoice( wxWindow
*parent
, wxWindowID id
,
29 const wxPoint
& pos
= wxDefaultPosition
,
30 const wxSize
& size
= wxDefaultSize
,
31 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxChoiceNameStr
)
37 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
39 wxChoice( wxWindow
*parent
, wxWindowID id
,
42 const wxArrayString
& choices
,
44 const wxValidator
& validator
= wxDefaultValidator
,
45 const wxString
& name
= wxChoiceNameStr
)
48 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
51 bool Create( wxWindow
*parent
, wxWindowID id
,
52 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxSize
& size
= wxDefaultSize
,
54 int n
= 0, const wxString choices
[] = NULL
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxChoiceNameStr
);
58 bool Create( wxWindow
*parent
, wxWindowID id
,
61 const wxArrayString
& choices
,
63 const wxValidator
& validator
= wxDefaultValidator
,
64 const wxString
& name
= wxChoiceNameStr
);
66 int GetSelection() const;
67 void SetSelection(int n
);
69 virtual unsigned int GetCount() const;
70 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
71 virtual wxString
GetString(unsigned int n
) const;
72 virtual void SetString(unsigned int n
, const wxString
& string
);
74 virtual void SetColumns(int n
=1);
75 virtual int GetColumns() const;
77 virtual void GTKDisableEvents();
78 virtual void GTKEnableEvents();
80 static wxVisualAttributes
81 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
84 // this array is only used for controls with wxCB_SORT style, so only
85 // allocate it if it's needed (hence using pointer)
86 wxGtkCollatedArrayString
*m_strings
;
88 // contains the client data for the items
89 wxArrayPtrVoid m_clientData
;
91 // index to GtkListStore cell which displays the item text
92 int m_stringCellIndex
;
94 virtual wxSize
DoGetBestSize() const;
95 virtual wxSize
DoGetSizeFromTextSize(int xlen
, int ylen
= -1) 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_