]>
Commit | Line | Data |
---|---|---|
1550d5f8 WS |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/msw/wince/choicece.h | |
9b141468 | 3 | // Purpose: wxChoice implementation for smart phones driven by WinCE |
1550d5f8 WS |
4 | // Author: Wlodzimierz ABX Skiba |
5 | // Modified by: | |
6 | // Created: 29.07.2004 | |
1550d5f8 | 7 | // Copyright: (c) Wlodzimierz Skiba |
526954c5 | 8 | // Licence: wxWindows licence |
1550d5f8 WS |
9 | /////////////////////////////////////////////////////////////////////////////// |
10 | ||
11 | #ifndef _WX_CHOICECE_H_BASE_ | |
12 | #define _WX_CHOICECE_H_BASE_ | |
13 | ||
14 | // ---------------------------------------------------------------------------- | |
15 | // headers | |
16 | // ---------------------------------------------------------------------------- | |
17 | ||
1550d5f8 WS |
18 | #include "wx/defs.h" |
19 | ||
20 | #if wxUSE_CHOICE | |
21 | ||
22 | #include "wx/dynarray.h" | |
23 | ||
b5dbe15d | 24 | class WXDLLIMPEXP_FWD_CORE wxChoice; |
1550d5f8 WS |
25 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); |
26 | ||
27 | // ---------------------------------------------------------------------------- | |
28 | // Choice item | |
29 | // ---------------------------------------------------------------------------- | |
30 | ||
53a2db12 | 31 | class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase |
1550d5f8 WS |
32 | { |
33 | public: | |
34 | // ctors | |
35 | wxChoice() { } | |
36 | virtual ~wxChoice(); | |
37 | ||
38 | wxChoice(wxWindow *parent, | |
39 | wxWindowID id, | |
40 | const wxPoint& pos = wxDefaultPosition, | |
41 | const wxSize& size = wxDefaultSize, | |
42 | int n = 0, const wxString choices[] = NULL, | |
43 | long style = 0, | |
44 | const wxValidator& validator = wxDefaultValidator, | |
45 | const wxString& name = wxChoiceNameStr) | |
46 | { | |
47 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
48 | } | |
49 | wxChoice(wxWindow *parent, | |
50 | wxWindowID id, | |
51 | const wxPoint& pos, | |
52 | const wxSize& size, | |
53 | const wxArrayString& choices, | |
54 | long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxChoiceNameStr) | |
57 | { | |
58 | Create(parent, id, pos, size, choices, style, validator, name); | |
59 | } | |
60 | ||
61 | bool Create(wxWindow *parent, | |
62 | wxWindowID id, | |
63 | const wxPoint& pos = wxDefaultPosition, | |
64 | const wxSize& size = wxDefaultSize, | |
65 | int n = 0, const wxString choices[] = NULL, | |
66 | long style = 0, | |
67 | const wxValidator& validator = wxDefaultValidator, | |
68 | const wxString& name = wxChoiceNameStr); | |
69 | ||
70 | bool Create(wxWindow *parent, | |
71 | wxWindowID id, | |
72 | const wxPoint& pos, | |
73 | const wxSize& size, | |
74 | const wxArrayString& choices, | |
75 | long style = 0, | |
76 | const wxValidator& validator = wxDefaultValidator, | |
77 | const wxString& name = wxChoiceNameStr); | |
78 | ||
79 | // implement base class pure virtuals | |
a236aa20 VZ |
80 | virtual void DoDeleteOneItem(unsigned int n); |
81 | virtual void DoClear(); | |
1550d5f8 | 82 | |
aa61d352 | 83 | virtual unsigned int GetCount() const; |
1550d5f8 WS |
84 | virtual int GetSelection() const; |
85 | virtual void SetSelection(int n); | |
86 | ||
853dcc57 | 87 | virtual int FindString(const wxString& s, bool bCase = false) const; |
aa61d352 VZ |
88 | virtual wxString GetString(unsigned int n) const; |
89 | virtual void SetString(unsigned int n, const wxString& s); | |
1550d5f8 WS |
90 | |
91 | // get the subclassed window proc of the buddy list of choices | |
92 | WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } | |
93 | ||
01d2bf4d WS |
94 | // return the choice object whose buddy is the given window or NULL |
95 | static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); | |
96 | ||
97 | virtual bool MSWCommand(WXUINT param, WXWORD id); | |
98 | ||
1550d5f8 | 99 | protected: |
a236aa20 VZ |
100 | virtual int DoInsertItems(const wxArrayStringsAdapter& items, |
101 | unsigned int pos, | |
102 | void **clientData, wxClientDataType type); | |
103 | ||
aa61d352 VZ |
104 | virtual void DoSetItemClientData(unsigned int n, void* clientData); |
105 | virtual void* DoGetItemClientData(unsigned int n) const; | |
a236aa20 VZ |
106 | |
107 | virtual WXHWND MSWGetItemsHWND() const { return m_hwndBuddy; } | |
1550d5f8 WS |
108 | |
109 | // MSW implementation | |
110 | virtual void DoGetPosition(int *x, int *y) const; | |
111 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
112 | virtual wxSize DoGetBestSize() const; | |
113 | virtual void DoGetSize(int *width, int *height) const; | |
114 | ||
115 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
116 | ||
117 | // create and initialize the control | |
118 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
119 | const wxPoint& pos, | |
120 | const wxSize& size, | |
121 | int n, const wxString choices[], | |
122 | long style, | |
123 | const wxValidator& validator, | |
124 | const wxString& name); | |
125 | ||
1550d5f8 WS |
126 | // the data for the "buddy" list |
127 | WXHWND m_hwndBuddy; | |
128 | WXFARPROC m_wndProcBuddy; | |
129 | ||
130 | // all existing wxChoice - this allows to find the one corresponding to | |
131 | // the given buddy window in GetSpinChoiceCtrl() | |
132 | static wxArrayChoiceSpins ms_allChoiceSpins; | |
133 | ||
134 | private: | |
135 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) | |
136 | }; | |
137 | ||
138 | #endif // wxUSE_CHOICE | |
139 | ||
140 | #endif // _WX_CHOICECE_H_BASE_ |