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