]>
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 | protected: | |
102 | virtual void DoSetItemClientData( int n, void* clientData ); | |
103 | virtual void* DoGetItemClientData( int n ) const; | |
104 | virtual void DoSetItemClientObject( int n, wxClientData* clientData ); | |
105 | virtual wxClientData* DoGetItemClientObject( int n ) const; | |
106 | ||
107 | // MSW implementation | |
108 | virtual void DoGetPosition(int *x, int *y) const; | |
109 | virtual void DoMoveWindow(int x, int y, int width, int height); | |
110 | virtual wxSize DoGetBestSize() const; | |
111 | virtual void DoGetSize(int *width, int *height) const; | |
112 | ||
113 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; | |
114 | ||
115 | // create and initialize the control | |
116 | bool CreateAndInit(wxWindow *parent, wxWindowID id, | |
117 | const wxPoint& pos, | |
118 | const wxSize& size, | |
119 | int n, const wxString choices[], | |
120 | long style, | |
121 | const wxValidator& validator, | |
122 | const wxString& name); | |
123 | ||
124 | // free all memory we have (used by Clear() and dtor) | |
125 | void Free(); | |
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_ |