]>
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 | ||
c801d85f KB |
10 | #ifndef __GTKCHOICEH__ |
11 | #define __GTKCHOICEH__ | |
12 | ||
b5f6b52a | 13 | class WXDLLIMPEXP_BASE wxSortedArrayString; |
584ad2a3 | 14 | class WXDLLIMPEXP_BASE wxArrayString; |
b5f6b52a | 15 | |
c801d85f KB |
16 | //----------------------------------------------------------------------------- |
17 | // wxChoice | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
20123d49 | 20 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase |
c801d85f | 21 | { |
fd0eed64 | 22 | public: |
29006414 VZ |
23 | wxChoice(); |
24 | wxChoice( wxWindow *parent, wxWindowID id, | |
25 | const wxPoint& pos = wxDefaultPosition, | |
26 | const wxSize& size = wxDefaultSize, | |
27 | int n = 0, const wxString choices[] = (const wxString *) NULL, | |
28 | long style = 0, | |
29 | const wxValidator& validator = wxDefaultValidator, | |
30 | const wxString& name = wxChoiceNameStr ) | |
31 | { | |
e01c8145 VZ |
32 | m_strings = (wxSortedArrayString *)NULL; |
33 | ||
29006414 VZ |
34 | Create(parent, id, pos, size, n, choices, style, validator, name); |
35 | } | |
584ad2a3 MB |
36 | wxChoice( wxWindow *parent, wxWindowID id, |
37 | const wxPoint& pos, | |
38 | const wxSize& size, | |
39 | const wxArrayString& choices, | |
40 | long style = 0, | |
41 | const wxValidator& validator = wxDefaultValidator, | |
42 | const wxString& name = wxChoiceNameStr ) | |
43 | { | |
44 | m_strings = (wxSortedArrayString *)NULL; | |
45 | ||
46 | Create(parent, id, pos, size, choices, style, validator, name); | |
47 | } | |
29006414 VZ |
48 | ~wxChoice(); |
49 | bool Create( wxWindow *parent, wxWindowID id, | |
50 | const wxPoint& pos = wxDefaultPosition, | |
51 | const wxSize& size = wxDefaultSize, | |
52 | int n = 0, const wxString choices[] = (wxString *) NULL, | |
53 | long style = 0, | |
54 | const wxValidator& validator = wxDefaultValidator, | |
55 | const wxString& name = wxChoiceNameStr ); | |
584ad2a3 MB |
56 | bool Create( wxWindow *parent, wxWindowID id, |
57 | const wxPoint& pos, | |
58 | const wxSize& size, | |
59 | const wxArrayString& choices, | |
60 | long style = 0, | |
61 | const wxValidator& validator = wxDefaultValidator, | |
62 | const wxString& name = wxChoiceNameStr ); | |
c801d85f | 63 | |
9abe166a | 64 | // implement base class pure virtuals |
29006414 | 65 | void Delete(int n); |
9abe166a VZ |
66 | void Clear(); |
67 | ||
68 | int GetSelection() const; | |
40eb3606 | 69 | int GetCurrentSelection() const { return GetSelection(); } |
9abe166a | 70 | void SetSelection( int n ); |
29006414 | 71 | |
8228b893 | 72 | virtual size_t GetCount() const; |
853dcc57 | 73 | virtual int FindString(const wxString& s, bool bCase = false) const; |
29006414 | 74 | wxString GetString( int n ) const; |
6c8a980f | 75 | void SetString( int n, const wxString& string ); |
29006414 | 76 | |
9d522606 RD |
77 | static wxVisualAttributes |
78 | GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL); | |
79 | ||
6f02a879 VZ |
80 | virtual bool IsOwnGtkWindow( GdkWindow *window ); |
81 | ||
20e05ffb | 82 | protected: |
e01c8145 | 83 | wxList m_clientList; // contains the client data for the items |
29006414 | 84 | |
f40fdaa3 | 85 | void DoApplyWidgetStyle(GtkRcStyle *style); |
9abe166a | 86 | virtual int DoAppend(const wxString& item); |
243dbf1a | 87 | virtual int DoInsert(const wxString& item, int pos); |
9abe166a | 88 | |
6c8a980f VZ |
89 | virtual void DoSetItemClientData( int n, void* clientData ); |
90 | virtual void* DoGetItemClientData( int n ) const; | |
91 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
92 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
d6538e2c | 93 | |
f68586e5 VZ |
94 | virtual wxSize DoGetBestSize() const; |
95 | ||
738f9e5a | 96 | private: |
e01c8145 | 97 | // common part of Create() and DoAppend() |
8228b893 | 98 | int GtkAddHelper(GtkWidget *menu, size_t pos, const wxString& item); |
e01c8145 VZ |
99 | |
100 | // this array is only used for controls with wxCB_SORT style, so only | |
101 | // allocate it if it's needed (hence using pointer) | |
102 | wxSortedArrayString *m_strings; | |
103 | ||
5f3565a2 | 104 | public: |
853dcc57 WS |
105 | // this circumvents a GTK+ 2.0 bug so that the selection is |
106 | // invalidated properly | |
16edee16 | 107 | int m_selection_hack; |
5f3565a2 RR |
108 | |
109 | private: | |
738f9e5a | 110 | DECLARE_DYNAMIC_CLASS(wxChoice) |
c801d85f KB |
111 | }; |
112 | ||
ce4169a4 | 113 | |
c801d85f | 114 | #endif // __GTKCHOICEH__ |