]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/checklst.cpp
Fix STL compilation (note: this is not the correct fix, but since
[wxWidgets.git] / src / palmos / checklst.cpp
CommitLineData
ffecfa5a 1///////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/checklst.cpp
ffecfa5a 3// Purpose: implementation of wxCheckListBox class
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10.13.04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21#pragma implementation "checklst.h"
22#endif
23
24// For compilers that support precompilation, includes "wx.h".
25#include "wx/wxprec.h"
26
27#ifdef __BORLANDC__
28#pragma hdrstop
29#endif
30
31#if wxUSE_OWNER_DRAWN
32
33#ifndef WX_PRECOMP
34 #include "wx/object.h"
35 #include "wx/colour.h"
36 #include "wx/font.h"
37 #include "wx/bitmap.h"
38 #include "wx/window.h"
39 #include "wx/listbox.h"
40 #include "wx/dcmemory.h"
41
42 #include "wx/settings.h"
43
44 #include "wx/log.h"
45#endif
46
47#include "wx/ownerdrw.h"
48#include "wx/checklst.h"
49
50#include "wx/palmos/wrapwin.h"
51
52#include "wx/palmos/private.h"
53
54// ----------------------------------------------------------------------------
55// private functions
56// ----------------------------------------------------------------------------
57
58// get item (converted to right type)
59#define GetItem(n) ((wxCheckListBoxItem *)(GetItem(n)))
60
61// ============================================================================
62// implementation
63// ============================================================================
64
65
66#if wxUSE_EXTENDED_RTTI
67WX_DEFINE_FLAGS( wxCheckListBoxStyle )
68
69wxBEGIN_FLAGS( wxCheckListBoxStyle )
70 // new style border flags, we put them first to
71 // use them for streaming out
72 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
73 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
74 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
75 wxFLAGS_MEMBER(wxBORDER_RAISED)
76 wxFLAGS_MEMBER(wxBORDER_STATIC)
77 wxFLAGS_MEMBER(wxBORDER_NONE)
e2731512 78
ffecfa5a
JS
79 // old style border flags
80 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
81 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
82 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
83 wxFLAGS_MEMBER(wxRAISED_BORDER)
84 wxFLAGS_MEMBER(wxSTATIC_BORDER)
85 wxFLAGS_MEMBER(wxBORDER)
86
87 // standard window styles
88 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
89 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
90 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
91 wxFLAGS_MEMBER(wxWANTS_CHARS)
92 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
93 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
94 wxFLAGS_MEMBER(wxVSCROLL)
95 wxFLAGS_MEMBER(wxHSCROLL)
96
97 wxFLAGS_MEMBER(wxLB_SINGLE)
98 wxFLAGS_MEMBER(wxLB_MULTIPLE)
99 wxFLAGS_MEMBER(wxLB_EXTENDED)
100 wxFLAGS_MEMBER(wxLB_HSCROLL)
101 wxFLAGS_MEMBER(wxLB_ALWAYS_SB)
102 wxFLAGS_MEMBER(wxLB_NEEDED_SB)
103 wxFLAGS_MEMBER(wxLB_SORT)
104 wxFLAGS_MEMBER(wxLB_OWNERDRAW)
105
106wxEND_FLAGS( wxCheckListBoxStyle )
107
108IMPLEMENT_DYNAMIC_CLASS_XTI(wxCheckListBox, wxListBox,"wx/checklst.h")
109
110wxBEGIN_PROPERTIES_TABLE(wxCheckListBox)
111 wxEVENT_PROPERTY( Toggle , wxEVT_COMMAND_CHECKLISTBOX_TOGGLED , wxCommandEvent )
112 wxPROPERTY_FLAGS( WindowStyle , wxCheckListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , wxLB_OWNERDRAW /*flags*/ , wxT("Helpstring") , wxT("group")) // style
113wxEND_PROPERTIES_TABLE()
114
115wxBEGIN_HANDLERS_TABLE(wxCheckListBox)
116wxEND_HANDLERS_TABLE()
117
e2731512 118wxCONSTRUCTOR_4( wxCheckListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
ffecfa5a
JS
119
120#else
121IMPLEMENT_DYNAMIC_CLASS(wxCheckListBox, wxListBox)
122#endif
123
124// ----------------------------------------------------------------------------
125// declaration and implementation of wxCheckListBoxItem class
126// ----------------------------------------------------------------------------
127
128class wxCheckListBoxItem : public wxOwnerDrawn
129{
130friend class WXDLLEXPORT wxCheckListBox;
131public:
132 // ctor
133 wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex);
134
135 // drawing functions
136 virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat);
137
138 // simple accessors and operations
139 bool IsChecked() const { return m_bChecked; }
140
141 void Check(bool bCheck);
142 void Toggle() { Check(!IsChecked()); }
143
144 void SendEvent();
145
146private:
147
148 DECLARE_NO_COPY_CLASS(wxCheckListBoxItem)
149 bool m_bChecked;
150 wxCheckListBox *m_pParent;
151 size_t m_nIndex;
152};
153
154wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex)
155 : wxOwnerDrawn(wxEmptyString, TRUE) // checkable
156{
157}
158
159bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
160 wxODAction act, wxODStatus stat)
161{
162 return FALSE;
163}
164
165// change the state of the item and redraw it
166void wxCheckListBoxItem::Check(bool check)
167{
168}
169
170// send an "item checked" event
171void wxCheckListBoxItem::SendEvent()
172{
173}
174
175// ----------------------------------------------------------------------------
176// implementation of wxCheckListBox class
177// ----------------------------------------------------------------------------
178
179// define event table
180// ------------------
181BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
182 EVT_KEY_DOWN(wxCheckListBox::OnKeyDown)
183 EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick)
184END_EVENT_TABLE()
185
186// control creation
187// ----------------
188
189// def ctor: use Create() to really create the control
190wxCheckListBox::wxCheckListBox()
191{
192}
193
194// ctor which creates the associated control
195wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
196 const wxPoint& pos, const wxSize& size,
197 int nStrings, const wxString choices[],
198 long style, const wxValidator& val,
199 const wxString& name)
200{
201 Create(parent, id, pos, size, nStrings, choices, style, val, name);
202}
203
204wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
205 const wxPoint& pos, const wxSize& size,
206 const wxArrayString& choices,
207 long style, const wxValidator& val,
208 const wxString& name)
209{
210 Create(parent, id, pos, size, choices, style, val, name);
211}
212
213bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
214 const wxPoint& pos, const wxSize& size,
215 int n, const wxString choices[],
216 long style,
217 const wxValidator& validator, const wxString& name)
218{
219 return wxListBox::Create(parent, id, pos, size, n, choices,
220 style | wxLB_OWNERDRAW, validator, name);
221}
222
223bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
224 const wxPoint& pos, const wxSize& size,
225 const wxArrayString& choices,
226 long style,
227 const wxValidator& validator, const wxString& name)
228{
229 return wxListBox::Create(parent, id, pos, size, choices,
230 style | wxLB_OWNERDRAW, validator, name);
231}
232
233// misc overloaded methods
234// -----------------------
235
236void wxCheckListBox::Delete(int N)
237{
238}
239
240bool wxCheckListBox::SetFont( const wxFont &font )
241{
242 return false;
243}
244
245// create/retrieve item
246// --------------------
247
248// create a check list box item
249wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex)
250{
251 wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex);
252 return pItem;
253}
254
255// return item size
256// ----------------
257bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
258{
259 return false;
260}
261
262// check items
263// -----------
264
265bool wxCheckListBox::IsChecked(size_t uiIndex) const
266{
267 return false;
268}
269
270void wxCheckListBox::Check(size_t uiIndex, bool bCheck)
271{
272}
273
274// process events
275// --------------
276
277void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
278{
279}
280
281void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
282{
283}
284
285int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const
286{
287 return wxNOT_FOUND;
288}
289
290#endif
291