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 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 GTKDisableEvents();
79 virtual void GTKEnableEvents();
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 wxGtkCollatedArrayString
*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 wxSize
DoGetSizeFromTextSize(int xlen
, int ylen
= -1) const;
97 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
99 void **clientData
, wxClientDataType type
);
100 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
101 virtual void* DoGetItemClientData(unsigned int n
) const;
102 virtual void DoClear();
103 virtual void DoDeleteOneItem(unsigned int n
);
105 virtual GdkWindow
*GTKGetWindow(wxArrayGdkWindows
& windows
) const;
106 virtual void DoApplyWidgetStyle(GtkRcStyle
*style
);
108 // in derived classes, implement this to insert list store entry
109 // with all items default except text
110 virtual void GTKInsertComboBoxTextItem( unsigned int n
, const wxString
& text
);
115 DECLARE_DYNAMIC_CLASS(wxChoice
)
119 #endif // _WX_GTK_CHOICE_H_