]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/choice.h
add back wxChoice::DoGetBestSize() removed by the previous refactoring, it's still...
[wxWidgets.git] / include / wx / gtk / choice.h
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 WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
21 {
22 public:
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 {
32 m_strings = (wxSortedArrayString *)NULL;
33
34 Create(parent, id, pos, size, n, choices, style, validator, name);
35 }
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 }
48 virtual ~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 );
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 );
63
64 void SendSelectionChangedEvent(wxEventType evt_type);
65
66 int GetSelection() const;
67 void SetSelection(int n);
68
69 virtual unsigned int GetCount() const;
70 virtual int FindString(const wxString& s, bool bCase = false) const;
71 virtual wxString GetString(unsigned int n) const;
72 virtual void SetString(unsigned int n, const wxString& string);
73
74 virtual void DisableEvents();
75 virtual void EnableEvents();
76
77 static wxVisualAttributes
78 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
79
80 protected:
81 // this array is only used for controls with wxCB_SORT style, so only
82 // allocate it if it's needed (hence using pointer)
83 wxSortedArrayString *m_strings;
84
85 // contains the client data for the items
86 wxArrayPtrVoid m_clientData;
87
88 virtual wxSize DoGetBestSize() const;
89 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
90 unsigned int pos,
91 void **clientData, wxClientDataType type);
92 virtual void DoSetItemClientData(unsigned int n, void* clientData);
93 virtual void* DoGetItemClientData(unsigned int n) const;
94 virtual void DoClear();
95 virtual void DoDeleteOneItem(unsigned int n);
96
97 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
98
99 private:
100 DECLARE_DYNAMIC_CLASS(wxChoice)
101 };
102
103
104 #endif // _WX_GTK_CHOICE_H_