]>
Commit | Line | Data |
---|---|---|
c801d85f | 1 | ///////////////////////////////////////////////////////////////////////////// |
853dcc57 | 2 | // Name: wx/gtk/choice.h |
c801d85f KB |
3 | // Purpose: |
4 | // Author: Robert Roebling | |
dbf858b5 | 5 | // Id: $Id$ |
01111366 | 6 | // Copyright: (c) 1998 Robert Roebling |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
3c75d8ba PC |
10 | #ifndef _WX_GTK_CHOICE_H_ |
11 | #define _WX_GTK_CHOICE_H_ | |
c801d85f | 12 | |
b5dbe15d VS |
13 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; |
14 | class WXDLLIMPEXP_FWD_BASE wxArrayString; | |
b5f6b52a | 15 | |
c801d85f KB |
16 | //----------------------------------------------------------------------------- |
17 | // wxChoice | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
20123d49 | 20 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase |
c801d85f | 21 | { |
fd0eed64 | 22 | public: |
e78c1d78 RR |
23 | wxChoice() |
24 | { | |
25 | Init(); | |
26 | } | |
29006414 VZ |
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, | |
31 | long style = 0, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
33 | const wxString& name = wxChoiceNameStr ) | |
34 | { | |
e78c1d78 | 35 | Init(); |
29006414 VZ |
36 | Create(parent, id, pos, size, n, choices, style, validator, name); |
37 | } | |
584ad2a3 MB |
38 | wxChoice( wxWindow *parent, wxWindowID id, |
39 | const wxPoint& pos, | |
40 | const wxSize& size, | |
41 | const wxArrayString& choices, | |
42 | long style = 0, | |
43 | const wxValidator& validator = wxDefaultValidator, | |
44 | const wxString& name = wxChoiceNameStr ) | |
45 | { | |
e78c1d78 | 46 | Init(); |
584ad2a3 MB |
47 | Create(parent, id, pos, size, choices, style, validator, name); |
48 | } | |
d3c7fc99 | 49 | virtual ~wxChoice(); |
29006414 VZ |
50 | bool Create( wxWindow *parent, wxWindowID id, |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = (wxString *) NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxChoiceNameStr ); | |
584ad2a3 MB |
57 | bool Create( wxWindow *parent, wxWindowID id, |
58 | const wxPoint& pos, | |
59 | const wxSize& size, | |
60 | const wxArrayString& choices, | |
61 | long style = 0, | |
62 | const wxValidator& validator = wxDefaultValidator, | |
63 | const wxString& name = wxChoiceNameStr ); | |
c801d85f | 64 | |
a2c94110 VZ |
65 | void SendSelectionChangedEvent(wxEventType evt_type); |
66 | ||
9abe166a | 67 | int GetSelection() const; |
aa61d352 | 68 | void SetSelection(int n); |
29006414 | 69 | |
aa61d352 | 70 | virtual unsigned int GetCount() const; |
853dcc57 | 71 | virtual int FindString(const wxString& s, bool bCase = false) const; |
aa61d352 VZ |
72 | virtual wxString GetString(unsigned int n) const; |
73 | virtual void SetString(unsigned int n, const wxString& string); | |
29006414 | 74 | |
3f16e52c RR |
75 | virtual void SetColumns(int n=1); |
76 | virtual int GetColumns() const; | |
77 | ||
a2c94110 VZ |
78 | virtual void DisableEvents(); |
79 | virtual void EnableEvents(); | |
80 | ||
9d522606 RD |
81 | static wxVisualAttributes |
82 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
83 | ||
20e05ffb | 84 | protected: |
a2c94110 VZ |
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; | |
29006414 | 88 | |
a2c94110 VZ |
89 | // contains the client data for the items |
90 | wxArrayPtrVoid m_clientData; | |
ef5c70f9 | 91 | |
e78c1d78 RR |
92 | // index to GtkListStore cell which displays the item text |
93 | int m_stringCellIndex; | |
94 | ||
0662f990 | 95 | virtual wxSize DoGetBestSize() 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_ |