]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/choice.h
Destroy the wxDialog::ShowWindowModalThenDo() functor a.s.a.p.
[wxWidgets.git] / include / wx / osx / choice.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/osx/choice.h
3 // Purpose: wxChoice class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_CHOICE_H_
12 #define _WX_CHOICE_H_
13
14 #include "wx/control.h"
15
16 #include "wx/dynarray.h"
17 #include "wx/arrstr.h"
18
19 WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
20
21 // Choice item
22 class WXDLLIMPEXP_CORE wxChoice: public wxChoiceBase
23 {
24 DECLARE_DYNAMIC_CLASS(wxChoice)
25
26 public:
27 wxChoice()
28 : m_strings(), m_datas()
29 {}
30
31 virtual ~wxChoice() ;
32
33 wxChoice(wxWindow *parent, wxWindowID id,
34 const wxPoint& pos = wxDefaultPosition,
35 const wxSize& size = wxDefaultSize,
36 int n = 0, const wxString choices[] = NULL,
37 long style = 0,
38 const wxValidator& validator = wxDefaultValidator,
39 const wxString& name = wxChoiceNameStr)
40 {
41 Create(parent, id, pos, size, n, choices, style, validator, name);
42 }
43 wxChoice(wxWindow *parent, wxWindowID id,
44 const wxPoint& pos,
45 const wxSize& size,
46 const wxArrayString& choices,
47 long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxChoiceNameStr)
50 {
51 Create(parent, id, pos, size, choices, style, validator, name);
52 }
53
54 bool Create(wxWindow *parent, wxWindowID id,
55 const wxPoint& pos = wxDefaultPosition,
56 const wxSize& size = wxDefaultSize,
57 int n = 0, const wxString choices[] = NULL,
58 long style = 0,
59 const wxValidator& validator = wxDefaultValidator,
60 const wxString& name = wxChoiceNameStr);
61 bool Create(wxWindow *parent, wxWindowID id,
62 const wxPoint& pos,
63 const wxSize& size,
64 const wxArrayString& choices,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxChoiceNameStr);
68
69 virtual unsigned int GetCount() const ;
70 virtual int GetSelection() const ;
71 virtual void SetSelection(int n);
72
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 pos, const wxString& s);
76 // osx specific event handling common for all osx-ports
77
78 virtual bool OSXHandleClicked( double timestampsec );
79
80 protected:
81 virtual void DoDeleteOneItem(unsigned int n);
82 virtual void DoClear();
83
84 virtual wxSize DoGetBestSize() const ;
85 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
86 unsigned int pos,
87 void **clientData, wxClientDataType type);
88
89 virtual void DoSetItemClientData(unsigned int n, void* clientData);
90 virtual void* DoGetItemClientData(unsigned int n) const;
91
92 wxArrayString m_strings;
93 wxChoiceDataArray m_datas ;
94 wxMenu* m_popUpMenu ;
95
96 private:
97 // This should be called when the number of items in the control changes.
98 void DoAfterItemCountChange();
99 };
100
101 #endif
102 // _WX_CHOICE_H_