]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/gtk/choice.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
01111366 | 5 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 6 | // Licence: wxWindows licence |
c801d85f KB |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
3c75d8ba PC |
9 | #ifndef _WX_GTK_CHOICE_H_ |
10 | #define _WX_GTK_CHOICE_H_ | |
c801d85f | 11 | |
b5dbe15d VS |
12 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; |
13 | class WXDLLIMPEXP_FWD_BASE wxArrayString; | |
b5f6b52a | 14 | |
c801d85f KB |
15 | //----------------------------------------------------------------------------- |
16 | // wxChoice | |
17 | //----------------------------------------------------------------------------- | |
18 | ||
c272f12f RR |
19 | class wxGtkCollatedArrayString; |
20 | ||
20123d49 | 21 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase |
c801d85f | 22 | { |
fd0eed64 | 23 | public: |
e78c1d78 RR |
24 | wxChoice() |
25 | { | |
26 | Init(); | |
27 | } | |
29006414 VZ |
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, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxChoiceNameStr ) | |
35 | { | |
e78c1d78 | 36 | Init(); |
29006414 VZ |
37 | Create(parent, id, pos, size, n, choices, style, validator, name); |
38 | } | |
584ad2a3 MB |
39 | wxChoice( wxWindow *parent, wxWindowID id, |
40 | const wxPoint& pos, | |
41 | const wxSize& size, | |
42 | const wxArrayString& choices, | |
43 | long style = 0, | |
44 | const wxValidator& validator = wxDefaultValidator, | |
45 | const wxString& name = wxChoiceNameStr ) | |
46 | { | |
e78c1d78 | 47 | Init(); |
584ad2a3 MB |
48 | Create(parent, id, pos, size, choices, style, validator, name); |
49 | } | |
d3c7fc99 | 50 | virtual ~wxChoice(); |
29006414 VZ |
51 | bool Create( wxWindow *parent, wxWindowID id, |
52 | const wxPoint& pos = wxDefaultPosition, | |
53 | const wxSize& size = wxDefaultSize, | |
d3b9f782 | 54 | int n = 0, const wxString choices[] = NULL, |
29006414 VZ |
55 | long style = 0, |
56 | const wxValidator& validator = wxDefaultValidator, | |
57 | const wxString& name = wxChoiceNameStr ); | |
584ad2a3 MB |
58 | bool Create( wxWindow *parent, wxWindowID id, |
59 | const wxPoint& pos, | |
60 | const wxSize& size, | |
61 | const wxArrayString& choices, | |
62 | long style = 0, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = wxChoiceNameStr ); | |
c801d85f | 65 | |
9abe166a | 66 | int GetSelection() const; |
aa61d352 | 67 | void SetSelection(int n); |
29006414 | 68 | |
aa61d352 | 69 | virtual unsigned int GetCount() const; |
853dcc57 | 70 | virtual int FindString(const wxString& s, bool bCase = false) const; |
aa61d352 VZ |
71 | virtual wxString GetString(unsigned int n) const; |
72 | virtual void SetString(unsigned int n, const wxString& string); | |
29006414 | 73 | |
3f16e52c RR |
74 | virtual void SetColumns(int n=1); |
75 | virtual int GetColumns() const; | |
76 | ||
bce926c5 VZ |
77 | virtual void GTKDisableEvents(); |
78 | virtual void GTKEnableEvents(); | |
a2c94110 | 79 | |
9d522606 RD |
80 | static wxVisualAttributes |
81 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
82 | ||
20e05ffb | 83 | protected: |
a2c94110 VZ |
84 | // this array is only used for controls with wxCB_SORT style, so only |
85 | // allocate it if it's needed (hence using pointer) | |
c272f12f | 86 | wxGtkCollatedArrayString *m_strings; |
29006414 | 87 | |
a2c94110 VZ |
88 | // contains the client data for the items |
89 | wxArrayPtrVoid m_clientData; | |
ef5c70f9 | 90 | |
e78c1d78 RR |
91 | // index to GtkListStore cell which displays the item text |
92 | int m_stringCellIndex; | |
93 | ||
0662f990 | 94 | virtual wxSize DoGetBestSize() const; |
7a78a937 | 95 | virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; |
a236aa20 VZ |
96 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
97 | unsigned int pos, | |
98 | void **clientData, wxClientDataType type); | |
aa61d352 VZ |
99 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
100 | virtual void* DoGetItemClientData(unsigned int n) const; | |
a2c94110 VZ |
101 | virtual void DoClear(); |
102 | virtual void DoDeleteOneItem(unsigned int n); | |
d6538e2c | 103 | |
a2c94110 | 104 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; |
c2193ac9 | 105 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); |
5f3565a2 | 106 | |
e78c1d78 RR |
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 ); | |
110 | ||
5f3565a2 | 111 | private: |
e78c1d78 RR |
112 | void Init(); |
113 | ||
738f9e5a | 114 | DECLARE_DYNAMIC_CLASS(wxChoice) |
c801d85f KB |
115 | }; |
116 | ||
ce4169a4 | 117 | |
3c75d8ba | 118 | #endif // _WX_GTK_CHOICE_H_ |