1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/wince/choicece.h
3 // Purpose: wxChoice implementation for smart phones driven by WinCE
4 // Author: Wlodzimierz ABX Skiba
8 // Copyright: (c) Wlodzimierz Skiba
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_CHOICECE_H_BASE_
13 #define _WX_CHOICECE_H_BASE_
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
23 #include "wx/dynarray.h"
25 class WXDLLIMPEXP_FWD_CORE wxChoice
;
26 WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice
*, wxArrayChoiceSpins
);
28 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
32 class WXDLLIMPEXP_CORE wxChoice
: public wxChoiceBase
39 wxChoice(wxWindow
*parent
,
41 const wxPoint
& pos
= wxDefaultPosition
,
42 const wxSize
& size
= wxDefaultSize
,
43 int n
= 0, const wxString choices
[] = NULL
,
45 const wxValidator
& validator
= wxDefaultValidator
,
46 const wxString
& name
= wxChoiceNameStr
)
48 Create(parent
, id
, pos
, size
, n
, choices
, style
, validator
, name
);
50 wxChoice(wxWindow
*parent
,
54 const wxArrayString
& choices
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxChoiceNameStr
)
59 Create(parent
, id
, pos
, size
, choices
, style
, validator
, name
);
62 bool Create(wxWindow
*parent
,
64 const wxPoint
& pos
= wxDefaultPosition
,
65 const wxSize
& size
= wxDefaultSize
,
66 int n
= 0, const wxString choices
[] = NULL
,
68 const wxValidator
& validator
= wxDefaultValidator
,
69 const wxString
& name
= wxChoiceNameStr
);
71 bool Create(wxWindow
*parent
,
75 const wxArrayString
& choices
,
77 const wxValidator
& validator
= wxDefaultValidator
,
78 const wxString
& name
= wxChoiceNameStr
);
80 // implement base class pure virtuals
81 virtual void DoDeleteOneItem(unsigned int n
);
82 virtual void DoClear();
84 virtual unsigned int GetCount() const;
85 virtual int GetSelection() const;
86 virtual void SetSelection(int n
);
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
);
92 // get the subclassed window proc of the buddy list of choices
93 WXFARPROC
GetBuddyWndProc() const { return m_wndProcBuddy
; }
95 // return the choice object whose buddy is the given window or NULL
96 static wxChoice
*GetChoiceForListBox(WXHWND hwndBuddy
);
98 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
101 virtual int DoInsertItems(const wxArrayStringsAdapter
& items
,
103 void **clientData
, wxClientDataType type
);
105 virtual void DoSetItemClientData(unsigned int n
, void* clientData
);
106 virtual void* DoGetItemClientData(unsigned int n
) const;
108 virtual WXHWND
MSWGetItemsHWND() const { return m_hwndBuddy
; }
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;
116 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
118 // create and initialize the control
119 bool CreateAndInit(wxWindow
*parent
, wxWindowID id
,
122 int n
, const wxString choices
[],
124 const wxValidator
& validator
,
125 const wxString
& name
);
127 // the data for the "buddy" list
129 WXFARPROC m_wndProcBuddy
;
131 // all existing wxChoice - this allows to find the one corresponding to
132 // the given buddy window in GetSpinChoiceCtrl()
133 static wxArrayChoiceSpins ms_allChoiceSpins
;
136 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice
)
139 #endif // wxUSE_CHOICE
141 #endif // _WX_CHOICECE_H_BASE_