]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/msw/wince/choicece.h
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / msw / wince / choicece.h
... / ...
CommitLineData
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// Copyright: (c) Wlodzimierz Skiba
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_CHOICECE_H_BASE_
12#define _WX_CHOICECE_H_BASE_
13
14// ----------------------------------------------------------------------------
15// headers
16// ----------------------------------------------------------------------------
17
18#include "wx/defs.h"
19
20#if wxUSE_CHOICE
21
22#include "wx/dynarray.h"
23
24class WXDLLIMPEXP_FWD_CORE wxChoice;
25WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins);
26
27// ----------------------------------------------------------------------------
28// Choice item
29// ----------------------------------------------------------------------------
30
31class WXDLLIMPEXP_CORE wxChoice : public wxChoiceBase
32{
33public:
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
80 virtual void DoDeleteOneItem(unsigned int n);
81 virtual void DoClear();
82
83 virtual unsigned int GetCount() const;
84 virtual int GetSelection() const;
85 virtual void SetSelection(int n);
86
87 virtual int FindString(const wxString& s, bool bCase = false) const;
88 virtual wxString GetString(unsigned int n) const;
89 virtual void SetString(unsigned int n, const wxString& s);
90
91 // get the subclassed window proc of the buddy list of choices
92 WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; }
93
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
99protected:
100 virtual int DoInsertItems(const wxArrayStringsAdapter& items,
101 unsigned int pos,
102 void **clientData, wxClientDataType type);
103
104 virtual void DoSetItemClientData(unsigned int n, void* clientData);
105 virtual void* DoGetItemClientData(unsigned int n) const;
106
107 virtual WXHWND MSWGetItemsHWND() const { return m_hwndBuddy; }
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
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
134private:
135 DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice)
136};
137
138#endif // wxUSE_CHOICE
139
140#endif // _WX_CHOICECE_H_BASE_