]>
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 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
20 | #pragma interface "choicece.h" | |
21 | #endif | |
22 | ||
23 | #include "wx/defs.h" | |
24 | ||
25 | #if wxUSE_CHOICE | |
26 | ||
27 | #include "wx/dynarray.h" | |
28 | ||
29 | class WXDLLEXPORT wxChoice; | |
30 | WX_DEFINE_EXPORTED_ARRAY_PTR(wxChoice *, wxArrayChoiceSpins); | |
31 | ||
32 | // ---------------------------------------------------------------------------- | |
33 | // Choice item | |
34 | // ---------------------------------------------------------------------------- | |
35 | ||
36 | class WXDLLEXPORT wxChoice : public wxChoiceBase | |
37 | { | |
38 | public: | |
39 | // ctors | |
40 | wxChoice() { } | |
41 | virtual ~wxChoice(); | |
42 | ||
43 | wxChoice(wxWindow *parent, | |
44 | wxWindowID id, | |
45 | const wxPoint& pos = wxDefaultPosition, | |
46 | const wxSize& size = wxDefaultSize, | |
47 | int n = 0, const wxString choices[] = NULL, | |
48 | long style = 0, | |
49 | const wxValidator& validator = wxDefaultValidator, | |
50 | const wxString& name = wxChoiceNameStr) | |
51 | { | |
52 | Create(parent, id, pos, size, n, choices, style, validator, name); | |
53 | } | |
54 | wxChoice(wxWindow *parent, | |
55 | wxWindowID id, | |
56 | const wxPoint& pos, | |
57 | const wxSize& size, | |
58 | const wxArrayString& choices, | |
59 | long style = 0, | |
60 | const wxValidator& validator = wxDefaultValidator, | |
61 | const wxString& name = wxChoiceNameStr) | |
62 | { | |
63 | Create(parent, id, pos, size, choices, style, validator, name); | |
64 | } | |
65 | ||
66 | bool Create(wxWindow *parent, | |
67 | wxWindowID id, | |
68 | const wxPoint& pos = wxDefaultPosition, | |
69 | const wxSize& size = wxDefaultSize, | |
70 | int n = 0, const wxString choices[] = NULL, | |
71 | long style = 0, | |
72 | const wxValidator& validator = wxDefaultValidator, | |
73 | const wxString& name = wxChoiceNameStr); | |
74 | ||
75 | bool Create(wxWindow *parent, | |
76 | wxWindowID id, | |
77 | const wxPoint& pos, | |
78 | const wxSize& size, | |
79 | const wxArrayString& choices, | |
80 | long style = 0, | |
81 | const wxValidator& validator = wxDefaultValidator, | |
82 | const wxString& name = wxChoiceNameStr); | |
83 | ||
84 | // implement base class pure virtuals | |
85 | virtual int DoAppend(const wxString& item); | |
86 | virtual int DoInsert(const wxString& item, int pos); | |
87 | virtual void Delete(int n); | |
88 | virtual void Clear() ; | |
89 | ||
90 | virtual int GetCount() const; | |
91 | virtual int GetSelection() const; | |
92 | virtual void SetSelection(int n); | |
93 | ||
94 | virtual int FindString(const wxString& s) const; | |
95 | virtual wxString GetString(int n) const; | |
96 | virtual void SetString(int n, const wxString& s); | |
97 | ||
98 | // get the subclassed window proc of the buddy list of choices | |
99 | WXFARPROC GetBuddyWndProc() const { return m_wndProcBuddy; } | |
100 | ||
101 | // return the choice object whose buddy is the given window or NULL | |
102 | static wxChoice *GetChoiceForListBox(WXHWND hwndBuddy); | |
103 | ||
104 | virtual bool MSWCommand(WXUINT param, WXWORD id); | |
105 | ||
106 | protected: | |
107 | virtual void DoSetItemClientData( int n, void* clientData ); | |
108 | virtual void* DoGetItemClientData( int n ) const; | |
109 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
110 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
111 | ||
112 | // MSW implementation | |
113 | virtual void DoGetPosition(int *x, int *y) const; | |
114 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
115 | virtual wxSize DoGetBestSize() const; | |
116 | virtual void DoGetSize(int *width, int *height) const; | |
117 | ||
118 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
119 | ||
120 | // create and initialize the control | |
121 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
122 | const wxPoint& pos, | |
123 | const wxSize& size, | |
124 | int n, const wxString choices[], | |
125 | long style, | |
126 | const wxValidator& validator, | |
127 | const wxString& name); | |
128 | ||
129 | // free all memory we have (used by Clear() and dtor) | |
130 | void Free(); | |
131 | ||
132 | // the data for the "buddy" list | |
133 | WXHWND m_hwndBuddy; | |
134 | WXFARPROC m_wndProcBuddy; | |
135 | ||
136 | // all existing wxChoice - this allows to find the one corresponding to | |
137 | // the given buddy window in GetSpinChoiceCtrl() | |
138 | static wxArrayChoiceSpins ms_allChoiceSpins; | |
139 | ||
140 | private: | |
141 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxChoice) | |
142 | }; | |
143 | ||
144 | #endif // wxUSE_CHOICE | |
145 | ||
146 | #endif // _WX_CHOICECE_H_BASE_ |