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