]>
Commit | Line | Data |
---|---|---|
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 WXDLLEXPORT wxChoice; | |
26 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); | |
27 | ||
28 | // ---------------------------------------------------------------------------- | |
29 | // Choice item | |
30 | // ---------------------------------------------------------------------------- | |
31 | ||
32 | class WXDLLEXPORT 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 int DoAppend(const wxString& item); | |
82 | virtual int DoInsert(const wxString& item, int pos); | |
83 | virtual void Delete(int n); | |
84 | virtual void Clear() ; | |
85 | ||
86 | virtual int GetCount() const; | |
87 | virtual int GetSelection() const; | |
88 | virtual void SetSelection(int n); | |
89 | ||
90 | virtual int FindString(const wxString& s, bool bCase = false) const; | |
91 | virtual wxString GetString(int n) const; | |
92 | virtual void SetString(int n, const wxString& s); | |
93 | ||
94 | // get the subclassed window proc of the buddy list of choices | |
95 | WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } | |
96 | ||
97 | // return the choice object whose buddy is the given window or NULL | |
98 | static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); | |
99 | ||
100 | virtual bool MSWCommand(WXUINT param, WXWORD id); | |
101 | ||
102 | protected: | |
103 | virtual void DoSetItemClientData( int n, void* clientData ); | |
104 | virtual void* DoGetItemClientData( int n ) const; | |
105 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
106 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
107 | ||
108 | // MSW implementation | |
109 | virtual void DoGetPosition(int *x, int *y) const; | |
110 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
111 | virtual wxSize DoGetBestSize() const; | |
112 | virtual void DoGetSize(int *width, int *height) const; | |
113 | ||
114 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
115 | ||
116 | // create and initialize the control | |
117 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
118 | const wxPoint& pos, | |
119 | const wxSize& size, | |
120 | int n, const wxString choices[], | |
121 | long style, | |
122 | const wxValidator& validator, | |
123 | const wxString& name); | |
124 | ||
125 | // free all memory we have (used by Clear() and dtor) | |
126 | void Free(); | |
127 | ||
128 | // the data for the "buddy" list | |
129 | WXHWND m_hwndBuddy; | |
130 | WXFARPROC m_wndProcBuddy; | |
131 | ||
132 | // all existing wxChoice - this allows to find the one corresponding to | |
133 | // the given buddy window in GetSpinChoiceCtrl() | |
134 | static wxArrayChoiceSpins ms_allChoiceSpins; | |
135 | ||
136 | private: | |
137 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) | |
138 | }; | |
139 | ||
140 | #endif // wxUSE_CHOICE | |
141 | ||
142 | #endif // _WX_CHOICECE_H_BASE_ |