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 wxGtkCollatedArrayString
;
22 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
29 wxChoice( wxWindow
*parent
, wxWindowID id
,
30 const wxPoint
& pos
= wxDefaultPosition
,
31 const wxSize
& size
= wxDefaultSize
,
32 int n
= 0, const wxString choices
[] = (const wxString
*) NULL
,
34 const wxValidator
& validator
= wxDefaultValidator
,
35 const wxString
& name
= wxChoiceNameStr
)
38 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
40 wxChoice( wxWindow
*parent
, wxWindowID id
,
43 const wxArrayString
& choices
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
)
49 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
52 bool Create( wxWindow
*parent
, wxWindowID id
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
55 int n
= 0, const wxString choices
[] = NULL
,
57 const wxValidator
& validator
= wxDefaultValidator
,
58 const wxString
& name
= wxChoiceNameStr
);
59 bool Create( wxWindow
*parent
, wxWindowID id
,
62 const wxArrayString
& choices
,
64 const wxValidator
& validator
= wxDefaultValidator
,
65 const wxString
& name
= wxChoiceNameStr
);
67 void SendSelectionChangedEvent(wxEventType evt_type
);
69 int GetSelection() const;
70 void SetSelection(int n
);
72 virtual unsigned int GetCount() const;
73 virtual int FindString(const wxString
& s
, bool bCase
= false) const;
74 virtual wxString
GetString(unsigned int n
) const;
75 virtual void SetString(unsigned int n
, const wxString
& string
);
77 virtual void SetColumns(int n
=1);
78 virtual int GetColumns() const;
80 virtual void GTKDisableEvents();
81 virtual void GTKEnableEvents();
83 static wxVisualAttributes
84 GetClassDefaultAttributes(wxWindowVariant variant
= wxWINDOW_VARIANT_NORMAL
);
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 wxGtkCollatedArrayString
*m_strings
;
91 // contains the client data for the items
92 wxArrayPtrVoid m_clientData
;
94 // index to GtkListStore cell which displays the item text
95 int m_stringCellIndex
;
97 virtual wxSize
DoGetBestSize() const;
98 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
100 void **clientData
, wxClientDataType type
);
101 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
102 virtual void* DoGetItemClientData(unsigned int n
) const;
103 virtual void DoClear();
104 virtual void DoDeleteOneItem(unsigned int n
);
106 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
107 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
109 // in derived classes, implement this to insert list store entry
110 // with all items default except text
111 virtual void GTKInsertComboBoxTextItem( unsigned int n
, const wxString
& text
);
116 DECLARE_DYNAMIC_CLASS(wxChoice
)
120 #endif // _WX_GTK_CHOICE_H_