]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/checklst.cpp
Round the values in wxDC coordinate calculations.
[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
ffecfa5a
JS
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
e6e83933 24 #pragma hdrstop
ffecfa5a
JS
25#endif
26
e6e83933
WS
27#if wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN
28
29#include "wx/checklst.h"
ffecfa5a
JS
30
31#ifndef WX_PRECOMP
32 #include "wx/object.h"
33 #include "wx/colour.h"
34 #include "wx/font.h"
35 #include "wx/bitmap.h"
36 #include "wx/window.h"
37 #include "wx/listbox.h"
38 #include "wx/dcmemory.h"
39
40 #include "wx/settings.h"
41
42 #include "wx/log.h"
43#endif
44
45#include "wx/ownerdrw.h"
ffecfa5a
JS
46
47#include "wx/palmos/wrapwin.h"
48
49#include "wx/palmos/private.h"
50
51// ----------------------------------------------------------------------------
52// private functions
53// ----------------------------------------------------------------------------
54
55// get item (converted to right type)
56#define GetItem(n) ((wxCheckListBoxItem *)(GetItem(n)))
57
58// ============================================================================
59// implementation
60// ============================================================================
61
ffecfa5a
JS
62// ----------------------------------------------------------------------------
63// declaration and implementation of wxCheckListBoxItem class
64// ----------------------------------------------------------------------------
65
66class wxCheckListBoxItem : public wxOwnerDrawn
67{
68friend class WXDLLEXPORT wxCheckListBox;
69public:
70 // ctor
71 wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex);
72
73 // drawing functions
74 virtual bool OnDrawItem(wxDC& dc, const wxRect& rc, wxODAction act, wxODStatus stat);
75
76 // simple accessors and operations
77 bool IsChecked() const { return m_bChecked; }
78
79 void Check(bool bCheck);
80 void Toggle() { Check(!IsChecked()); }
81
82 void SendEvent();
83
84private:
85
c0c133e1 86 wxDECLARE_NO_COPY_CLASS(wxCheckListBoxItem);
ffecfa5a
JS
87 bool m_bChecked;
88 wxCheckListBox *m_pParent;
89 size_t m_nIndex;
90};
91
92wxCheckListBoxItem::wxCheckListBoxItem(wxCheckListBox *pParent, size_t nIndex)
aa61d352 93 : wxOwnerDrawn(wxEmptyString, true) // checkable
ffecfa5a
JS
94{
95}
96
97bool wxCheckListBoxItem::OnDrawItem(wxDC& dc, const wxRect& rc,
98 wxODAction act, wxODStatus stat)
99{
aa61d352 100 return false;
ffecfa5a
JS
101}
102
103// change the state of the item and redraw it
104void wxCheckListBoxItem::Check(bool check)
105{
106}
107
108// send an "item checked" event
109void wxCheckListBoxItem::SendEvent()
110{
111}
112
113// ----------------------------------------------------------------------------
114// implementation of wxCheckListBox class
115// ----------------------------------------------------------------------------
116
117// define event table
118// ------------------
119BEGIN_EVENT_TABLE(wxCheckListBox, wxListBox)
120 EVT_KEY_DOWN(wxCheckListBox::OnKeyDown)
121 EVT_LEFT_DOWN(wxCheckListBox::OnLeftClick)
122END_EVENT_TABLE()
123
124// control creation
125// ----------------
126
127// def ctor: use Create() to really create the control
128wxCheckListBox::wxCheckListBox()
129{
130}
131
132// ctor which creates the associated control
133wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
134 const wxPoint& pos, const wxSize& size,
135 int nStrings, const wxString choices[],
136 long style, const wxValidator& val,
137 const wxString& name)
138{
139 Create(parent, id, pos, size, nStrings, choices, style, val, name);
140}
141
142wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id,
143 const wxPoint& pos, const wxSize& size,
144 const wxArrayString& choices,
145 long style, const wxValidator& val,
146 const wxString& name)
147{
148 Create(parent, id, pos, size, choices, style, val, name);
149}
150
151bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
152 const wxPoint& pos, const wxSize& size,
153 int n, const wxString choices[],
154 long style,
155 const wxValidator& validator, const wxString& name)
156{
157 return wxListBox::Create(parent, id, pos, size, n, choices,
158 style | wxLB_OWNERDRAW, validator, name);
159}
160
161bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
162 const wxPoint& pos, const wxSize& size,
163 const wxArrayString& choices,
164 long style,
165 const wxValidator& validator, const wxString& name)
166{
167 return wxListBox::Create(parent, id, pos, size, choices,
168 style | wxLB_OWNERDRAW, validator, name);
169}
170
171// misc overloaded methods
172// -----------------------
173
aa61d352 174void wxCheckListBox::Delete(unsigned int n)
ffecfa5a
JS
175{
176}
177
178bool wxCheckListBox::SetFont( const wxFont &font )
179{
180 return false;
181}
182
183// create/retrieve item
184// --------------------
185
186// create a check list box item
187wxOwnerDrawn *wxCheckListBox::CreateLboxItem(size_t nIndex)
188{
189 wxCheckListBoxItem *pItem = new wxCheckListBoxItem(this, nIndex);
190 return pItem;
191}
192
193// return item size
194// ----------------
195bool wxCheckListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
196{
197 return false;
198}
199
200// check items
201// -----------
202
aa61d352 203bool wxCheckListBox::IsChecked(unsigned int uiIndex) const
ffecfa5a
JS
204{
205 return false;
206}
207
aa61d352 208void wxCheckListBox::Check(unsigned int uiIndex, bool bCheck)
ffecfa5a
JS
209{
210}
211
212// process events
213// --------------
214
215void wxCheckListBox::OnKeyDown(wxKeyEvent& event)
216{
217}
218
219void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
220{
221}
222
223int wxCheckListBox::DoHitTestItem(wxCoord x, wxCoord y) const
224{
225 return wxNOT_FOUND;
226}
227
e6e83933 228#endif // wxUSE_CHECKLISTBOX && wxUSE_OWNER_DRAWN