]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/notebook.cpp
fixed SaveDIB() crash with BW images (patch 1045884)
[wxWidgets.git] / src / palmos / notebook.cpp
CommitLineData
ffecfa5a
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: palmos/notebook.cpp
3// Purpose: implementation of wxNotebook
4// Author: William Osborne
5// Modified by:
6// Created: 10/13/04
7// RCS-ID: $Id:
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "notebook.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20 #pragma hdrstop
21#endif
22
23#if wxUSE_NOTEBOOK
24
25// wxWidgets
26#ifndef WX_PRECOMP
27 #include "wx/string.h"
28#endif // WX_PRECOMP
29
30#include "wx/log.h"
31#include "wx/imaglist.h"
32#include "wx/event.h"
33#include "wx/control.h"
34#include "wx/notebook.h"
35#include "wx/app.h"
36
37#include "wx/palmos/private.h"
38
39#include "wx/palmos/winundef.h"
40
41#if wxUSE_UXTHEME
42#include "wx/palmos/uxtheme.h"
43
44#include "wx/radiobut.h"
45#include "wx/radiobox.h"
46#include "wx/checkbox.h"
47#include "wx/bmpbuttn.h"
48#include "wx/statline.h"
49#include "wx/statbox.h"
50#include "wx/stattext.h"
51#include "wx/slider.h"
52#include "wx/scrolwin.h"
53#include "wx/panel.h"
54#endif
55
56// ----------------------------------------------------------------------------
57// macros
58// ----------------------------------------------------------------------------
59
60// check that the page index is valid
61#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
62
63// hide the ugly cast
64#define m_hwnd (HWND)GetHWND()
65
66// ----------------------------------------------------------------------------
67// constants
68// ----------------------------------------------------------------------------
69
70// This is a work-around for missing defines in gcc-2.95 headers
71#ifndef TCS_RIGHT
72 #define TCS_RIGHT 0x0002
73#endif
74
75#ifndef TCS_VERTICAL
76 #define TCS_VERTICAL 0x0080
77#endif
78
79#ifndef TCS_BOTTOM
80 #define TCS_BOTTOM TCS_RIGHT
81#endif
82
83// ----------------------------------------------------------------------------
84// event table
85// ----------------------------------------------------------------------------
86
87#include <wx/listimpl.cpp>
88
89WX_DEFINE_LIST( wxNotebookPageInfoList ) ;
90
91DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
92DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
93
94BEGIN_EVENT_TABLE(wxNotebook, wxControl)
95 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
96
97 EVT_SIZE(wxNotebook::OnSize)
98
99 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
100END_EVENT_TABLE()
101
102#if wxUSE_EXTENDED_RTTI
103WX_DEFINE_FLAGS( wxNotebookStyle )
104
105wxBEGIN_FLAGS( wxNotebookStyle )
106 // new style border flags, we put them first to
107 // use them for streaming out
108 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
109 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
110 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
111 wxFLAGS_MEMBER(wxBORDER_RAISED)
112 wxFLAGS_MEMBER(wxBORDER_STATIC)
113 wxFLAGS_MEMBER(wxBORDER_NONE)
114
115 // old style border flags
116 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
117 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
118 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
119 wxFLAGS_MEMBER(wxRAISED_BORDER)
120 wxFLAGS_MEMBER(wxSTATIC_BORDER)
121 wxFLAGS_MEMBER(wxBORDER)
122
123 // standard window styles
124 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
125 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
126 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
127 wxFLAGS_MEMBER(wxWANTS_CHARS)
128 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
129 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
130 wxFLAGS_MEMBER(wxVSCROLL)
131 wxFLAGS_MEMBER(wxHSCROLL)
132
133 wxFLAGS_MEMBER(wxNB_FIXEDWIDTH)
134 wxFLAGS_MEMBER(wxNB_LEFT)
135 wxFLAGS_MEMBER(wxNB_RIGHT)
136 wxFLAGS_MEMBER(wxNB_BOTTOM)
137
138wxEND_FLAGS( wxNotebookStyle )
139
140IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl,"wx/notebook.h")
141IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject , "wx/notebook.h" )
142
143wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo * , wxNotebookPageInfoList ) ;
144
145template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList, wxxVariantArray &value)
146{
147 wxListCollectionToVariantArray<wxNotebookPageInfoList::compatibility_iterator>( theList , value ) ;
148}
149
150wxBEGIN_PROPERTIES_TABLE(wxNotebook)
151 wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent )
152 wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent )
153
154 wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
155 wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
156wxEND_PROPERTIES_TABLE()
157
158wxBEGIN_HANDLERS_TABLE(wxNotebook)
159wxEND_HANDLERS_TABLE()
160
161wxCONSTRUCTOR_5( wxNotebook , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle)
162
163
164wxBEGIN_PROPERTIES_TABLE(wxNotebookPageInfo)
165 wxREADONLY_PROPERTY( Page , wxNotebookPage* , GetPage , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
166 wxREADONLY_PROPERTY( Text , wxString , GetText , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
167 wxREADONLY_PROPERTY( Selected , bool , GetSelected , false, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
168 wxREADONLY_PROPERTY( ImageId , int , GetImageId , -1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
169wxEND_PROPERTIES_TABLE()
170
171wxBEGIN_HANDLERS_TABLE(wxNotebookPageInfo)
172wxEND_HANDLERS_TABLE()
173
174wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , bool , Selected , int , ImageId )
175
176#else
177IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
178IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
179#endif
180IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
181
182// ============================================================================
183// implementation
184// ============================================================================
185
186// ----------------------------------------------------------------------------
187// wxNotebook construction
188// ----------------------------------------------------------------------------
189
190const wxNotebookPageInfoList& wxNotebook::GetPageInfos() const
191{
192 wxNotebookPageInfoList* list;
193
194 return m_pageInfos ;
195}
196
197// common part of all ctors
198void wxNotebook::Init()
199{
200}
201
202// default for dynamic class
203wxNotebook::wxNotebook()
204{
205}
206
207// the same arguments as for wxControl
208wxNotebook::wxNotebook(wxWindow *parent,
209 wxWindowID id,
210 const wxPoint& pos,
211 const wxSize& size,
212 long style,
213 const wxString& name)
214{
215}
216
217// Create() function
218bool wxNotebook::Create(wxWindow *parent,
219 wxWindowID id,
220 const wxPoint& pos,
221 const wxSize& size,
222 long style,
223 const wxString& name)
224{
225 return false;
226}
227
228WXDWORD wxNotebook::MSWGetStyle(long style, WXDWORD *exstyle) const
229{
230 return 0;
231}
232
233// ----------------------------------------------------------------------------
234// wxNotebook accessors
235// ----------------------------------------------------------------------------
236
237size_t wxNotebook::GetPageCount() const
238{
239 return 0;
240}
241
242int wxNotebook::GetRowCount() const
243{
244 return 0;
245}
246
247int wxNotebook::SetSelection(size_t nPage)
248{
249 return 0;
250}
251
252bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
253{
254 return false;
255}
256
257wxString wxNotebook::GetPageText(size_t nPage) const
258{
259 wxString str;
260
261 return str;
262}
263
264int wxNotebook::GetPageImage(size_t nPage) const
265{
266 return -1;
267}
268
269bool wxNotebook::SetPageImage(size_t nPage, int nImage)
270{
271 return false;
272}
273
274void wxNotebook::SetImageList(wxImageList* imageList)
275{
276}
277
278// ----------------------------------------------------------------------------
279// wxNotebook size settings
280// ----------------------------------------------------------------------------
281
282void wxNotebook::SetPageSize(const wxSize& size)
283{
284}
285
286void wxNotebook::SetPadding(const wxSize& padding)
287{
288}
289
290void wxNotebook::SetTabSize(const wxSize& sz)
291{
292}
293
294wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
295{
296 return wxSize(0,0);
297}
298
299void wxNotebook::AdjustPageSize(wxNotebookPage *page)
300{
301}
302
303// ----------------------------------------------------------------------------
304// wxNotebook operations
305// ----------------------------------------------------------------------------
306
307// remove one page from the notebook, without deleting
308wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
309{
310 return NULL;
311}
312
313// remove all pages
314bool wxNotebook::DeleteAllPages()
315{
316 return true;
317}
318
319// same as AddPage() but does it at given position
320bool wxNotebook::InsertPage(size_t nPage,
321 wxNotebookPage *pPage,
322 const wxString& strText,
323 bool bSelect,
324 int imageId)
325{
326 return false;
327}
328
329int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
330{
331 return 0;
332}
333
334
335// ----------------------------------------------------------------------------
336// wxNotebook callbacks
337// ----------------------------------------------------------------------------
338
339void wxNotebook::OnSize(wxSizeEvent& event)
340{
341}
342
343void wxNotebook::OnSelChange(wxNotebookEvent& event)
344{
345}
346
347bool wxNotebook::MSWTranslateMessage(WXMSG *wxmsg)
348{
349 return false;
350}
351
352void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
353{
354}
355
356// ----------------------------------------------------------------------------
357// wxNotebook base class virtuals
358// ----------------------------------------------------------------------------
359
360#if wxUSE_CONSTRAINTS
361
362// override these 2 functions to do nothing: everything is done in OnSize
363
364void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
365{
366}
367
368bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
369{
370 return true;
371}
372
373#endif // wxUSE_CONSTRAINTS
374
375// ----------------------------------------------------------------------------
376// wxNotebook Windows message handlers
377// ----------------------------------------------------------------------------
378
379bool wxNotebook::MSWOnScroll(int orientation, WXWORD nSBCode,
380 WXWORD pos, WXHWND control)
381{
382 return false;
383}
384
385bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
386{
387 return false;
388}
389
390// Windows only: attempts to get colour for UX theme page background
391wxColour wxNotebook::GetThemeBackgroundColour()
392{
393 return wxColour;
394}
395
396// Windows only: attempts to apply the UX theme page background to this page
397#if wxUSE_UXTHEME
398void wxNotebook::ApplyThemeBackground(wxWindow* window, const wxColour& colour)
399#else
400void wxNotebook::ApplyThemeBackground(wxWindow*, const wxColour&)
401#endif
402{
403}
404
405#if wxUSE_UXTHEME
406WXLRESULT wxNotebook::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
407{
408 return 0;
409}
410#endif // #if wxUSE_UXTHEME
411
412#endif // wxUSE_NOTEBOOK