]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e1d63b79 | 2 | // Name: wx/palmos/choice.h |
ffecfa5a | 3 | // Purpose: wxChoice class |
e1d63b79 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
6afc1b46 | 5 | // Modified by: Yunhui Fu |
ffecfa5a | 6 | // Created: 10/13/04 |
e1d63b79 | 7 | // RCS-ID: $Id$ |
ffecfa5a JS |
8 | // Copyright: (c) William Osborne |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_CHOICE_H_ | |
13 | #define _WX_CHOICE_H_ | |
14 | ||
ffecfa5a JS |
15 | // ---------------------------------------------------------------------------- |
16 | // Choice item | |
17 | // ---------------------------------------------------------------------------- | |
18 | ||
53a2db12 | 19 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase |
ffecfa5a JS |
20 | { |
21 | public: | |
22 | // ctors | |
23 | wxChoice() { } | |
24 | virtual ~wxChoice(); | |
25 | ||
26 | wxChoice(wxWindow *parent, | |
27 | wxWindowID id, | |
28 | const wxPoint& pos = wxDefaultPosition, | |
29 | const wxSize& size = wxDefaultSize, | |
30 | int n = 0, const wxString choices[] = NULL, | |
31 | long style = 0, | |
32 | const wxValidator& validator = wxDefaultValidator, | |
33 | const wxString& name = wxChoiceNameStr) | |
34 | { | |
35 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
36 | } | |
37 | wxChoice(wxWindow *parent, | |
38 | wxWindowID id, | |
39 | const wxPoint& pos, | |
40 | const wxSize& size, | |
41 | const wxArrayString& choices, | |
42 | long style = 0, | |
43 | const wxValidator& validator = wxDefaultValidator, | |
44 | const wxString& name = wxChoiceNameStr) | |
45 | { | |
46 | Create(parent, id, pos, size, choices, style, validator, name); | |
47 | } | |
48 | ||
49 | bool Create(wxWindow *parent, | |
50 | wxWindowID id, | |
51 | const wxPoint& pos = wxDefaultPosition, | |
52 | const wxSize& size = wxDefaultSize, | |
53 | int n = 0, const wxString choices[] = NULL, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxChoiceNameStr); | |
57 | bool Create(wxWindow *parent, | |
58 | wxWindowID id, | |
59 | const wxPoint& pos, | |
60 | const wxSize& size, | |
61 | const wxArrayString& choices, | |
62 | long style = 0, | |
63 | const wxValidator& validator = wxDefaultValidator, | |
64 | const wxString& name = wxChoiceNameStr); | |
65 | ||
66 | // implement base class pure virtuals | |
a236aa20 VZ |
67 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
68 | unsigned int pos, | |
69 | void **clientData, wxClientDataType type); | |
70 | virtual void DoDeleteOneItem(unsigned int n); | |
71 | virtual void DoClear(); | |
ffecfa5a | 72 | |
aa61d352 | 73 | virtual unsigned int GetCount() const; |
ffecfa5a JS |
74 | virtual int GetSelection() const; |
75 | virtual void SetSelection(int n); | |
76 | ||
aa61d352 VZ |
77 | virtual wxString GetString(unsigned int n) const; |
78 | virtual void SetString(unsigned int n, const wxString& s); | |
ffecfa5a | 79 | |
ffecfa5a JS |
80 | protected: |
81 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
aa61d352 VZ |
82 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
83 | virtual void* DoGetItemClientData(unsigned int n) const; | |
ffecfa5a JS |
84 | |
85 | // MSW implementation | |
86 | virtual wxSize DoGetBestSize() const; | |
87 | virtual void DoGetSize(int *w, int *h) const; | |
88 | virtual void DoSetSize(int x, int y, | |
89 | int width, int height, | |
90 | int sizeFlags = wxSIZE_AUTO); | |
91 | ||
ffecfa5a JS |
92 | |
93 | // update the height of the drop down list to fit the number of items we | |
94 | // have (without changing the visible height) | |
95 | void UpdateVisibleHeight(); | |
96 | ||
97 | // create and initialize the control | |
98 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
99 | const wxPoint& pos, | |
100 | const wxSize& size, | |
101 | int n, const wxString choices[], | |
102 | long style, | |
103 | const wxValidator& validator, | |
104 | const wxString& name); | |
105 | ||
106 | // free all memory we have (used by Clear() and dtor) | |
107 | void Free(); | |
108 | ||
109 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) | |
110 | }; | |
111 | ||
112 | #endif // _WX_CHOICE_H_ |