]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/choice.h
Add wxActivateEvent::GetActivationReason().
[wxWidgets.git] / include / wx / gtk1 / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/choice.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Copyright: (c) 1998 Robert Roebling
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
8
9 #ifndef __GTKCHOICEH__
10 #define __GTKCHOICEH__
11
12 class WXDLLIMPEXP_FWD_BASE wxSortedArrayString;
13 class WXDLLIMPEXP_FWD_BASE wxArrayString;
14
15 //-----------------------------------------------------------------------------
16 // wxChoice
17 //-----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
20 {
21 public:
22 wxChoice();
23 wxChoice( wxWindow *parent, wxWindowID id,
24 const wxPoint& pos = wxDefaultPosition,
25 const wxSize& size = wxDefaultSize,
26 int n = 0, const wxString choices[] = (const wxString *) NULL,
27 long style = 0,
28 const wxValidator& validator = wxDefaultValidator,
29 const wxString& name = wxChoiceNameStr )
30 {
31 m_strings = NULL;
32
33 Create(parent, id, pos, size, n, choices, style, validator, name);
34 }
35 wxChoice( wxWindow *parent, wxWindowID id,
36 const wxPoint& pos,
37 const wxSize& size,
38 const wxArrayString& choices,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxChoiceNameStr )
42 {
43 m_strings = NULL;
44
45 Create(parent, id, pos, size, choices, style, validator, name);
46 }
47 virtual ~wxChoice();
48 bool Create( wxWindow *parent, wxWindowID id,
49 const wxPoint& pos = wxDefaultPosition,
50 const wxSize& size = wxDefaultSize,
51 int n = 0, const wxString choices[] = NULL,
52 long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxChoiceNameStr );
55 bool Create( wxWindow *parent, wxWindowID id,
56 const wxPoint& pos,
57 const wxSize& size,
58 const wxArrayString& choices,
59 long style = 0,
60 const wxValidator& validator = wxDefaultValidator,
61 const wxString& name = wxChoiceNameStr );
62
63 // implement base class pure virtuals
64 void DoDeleteOneItem(unsigned int n);
65 void DoClear();
66
67 int GetSelection() const;
68 virtual 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 static wxVisualAttributes
76 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
77
78 protected:
79 wxList m_clientList; // contains the client data for the items
80
81 void DoApplyWidgetStyle(GtkRcStyle *style);
82 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
83 unsigned int pos,
84 void **clientData, wxClientDataType type);
85
86 virtual void DoSetItemClientData(unsigned int n, void* clientData);
87 virtual void* DoGetItemClientData(unsigned int n) const;
88
89 virtual wxSize DoGetBestSize() const;
90
91 virtual bool IsOwnGtkWindow( GdkWindow *window );
92
93 private:
94 // DoInsertItems() helper
95 int GtkAddHelper(GtkWidget *menu, unsigned int pos, const wxString& item);
96
97 // this array is only used for controls with wxCB_SORT style, so only
98 // allocate it if it's needed (hence using pointer)
99 wxSortedArrayString *m_strings;
100
101 public:
102 // this circumvents a GTK+ 2.0 bug so that the selection is
103 // invalidated properly
104 int m_selection_hack;
105
106 private:
107 DECLARE_DYNAMIC_CLASS(wxChoice)
108 };
109
110
111 #endif // __GTKCHOICEH__