]>
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 | int GetSelection() const; | |
68 | void SetSelection(int n); | |
69 | ||
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); | |
74 | ||
75 | virtual void SetColumns(int n=1); | |
76 | virtual int GetColumns() const; | |
77 | ||
78 | virtual void GTKDisableEvents(); | |
79 | virtual void GTKEnableEvents(); | |
80 | ||
81 | static wxVisualAttributes | |
82 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
83 | ||
84 | protected: | |
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; | |
88 | ||
89 | // contains the client data for the items | |
90 | wxArrayPtrVoid m_clientData; | |
91 | ||
92 | // index to GtkListStore cell which displays the item text | |
93 | int m_stringCellIndex; | |
94 | ||
95 | virtual wxSize DoGetBestSize() const; | |
96 | virtual wxSize DoGetSizeFromTextSize(int xlen, int ylen = -1) const; | |
97 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, | |
98 | unsigned int pos, | |
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); | |
104 | ||
105 | virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const; | |
106 | virtual void DoApplyWidgetStyle(GtkRcStyle *style); | |
107 | ||
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 ); | |
111 | ||
112 | private: | |
113 | void Init(); | |
114 | ||
115 | DECLARE_DYNAMIC_CLASS(wxChoice) | |
116 | }; | |
117 | ||
118 | ||
119 | #endif // _WX_GTK_CHOICE_H_ |