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