]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/gtk/choice.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_GTK_CHOICE_H_ | |
11 | #define _WX_GTK_CHOICE_H_ | |
12 | ||
13 | class WXDLLIMPEXP_FWD_BASE wxSortedArrayString; | |
14 | class WXDLLIMPEXP_FWD_BASE wxArrayString; | |
15 | ||
16 | //----------------------------------------------------------------------------- | |
17 | // wxChoice | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
20 | class wxGtkCollatedArrayString; | |
21 | ||
22 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase | |
23 | { | |
24 | public: | |
25 | wxChoice() | |
26 | { | |
27 | Init(); | |
28 | } | |
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 | { | |
37 | Init(); | |
38 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
39 | } | |
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 | { | |
48 | Init(); | |
49 | Create(parent, id, pos, size, choices, style, validator, name); | |
50 | } | |
51 | virtual ~wxChoice(); | |
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, | |
56 | long style = 0, | |
57 | const wxValidator& validator = wxDefaultValidator, | |
58 | const wxString& name = wxChoiceNameStr ); | |
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 ); | |
66 | ||
67 | void SendSelectionChangedEvent(wxEventType evt_type); | |
68 | ||
69 | int GetSelection() const; | |
70 | void SetSelection(int n); | |
71 | ||
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); | |
76 | ||
77 | virtual void SetColumns(int n=1); | |
78 | virtual int GetColumns() const; | |
79 | ||
80 | virtual void GTKDisableEvents(); | |
81 | virtual void GTKEnableEvents(); | |
82 | ||
83 | static wxVisualAttributes | |
84 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
85 | ||
86 | protected: | |
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; | |
90 | ||
91 | // contains the client data for the items | |
92 | wxArrayPtrVoid m_clientData; | |
93 | ||
94 | // index to GtkListStore cell which displays the item text | |
95 | int m_stringCellIndex; | |
96 | ||
97 | virtual wxSize DoGetBestSize() const; | |
98 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
99 | unsigned int pos, | |
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); | |
105 | ||
106 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
107 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); | |
108 | ||
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 ); | |
112 | ||
113 | private: | |
114 | void Init(); | |
115 | ||
116 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
117 | }; | |
118 | ||
119 | ||
120 | #endif // _WX_GTK_CHOICE_H_ |