]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/notebook.cpp
Applied patch [ 1171467 ] Fix for DocManager not checking OnNewDocument's return...
[wxWidgets.git] / src / palmos / notebook.cpp
CommitLineData
ffecfa5a 1///////////////////////////////////////////////////////////////////////////////
e2731512 2// Name: src/palmos/notebook.cpp
ffecfa5a 3// Purpose: implementation of wxNotebook
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#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
ffecfa5a
JS
30// ----------------------------------------------------------------------------
31// macros
32// ----------------------------------------------------------------------------
33
34// check that the page index is valid
35#define IS_VALID_PAGE(nPage) ((nPage) < GetPageCount())
36
ffecfa5a
JS
37// ----------------------------------------------------------------------------
38// event table
39// ----------------------------------------------------------------------------
40
41#include <wx/listimpl.cpp>
42
43WX_DEFINE_LIST( wxNotebookPageInfoList ) ;
44
45DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
46DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
47
48BEGIN_EVENT_TABLE(wxNotebook, wxControl)
49 EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
50
51 EVT_SIZE(wxNotebook::OnSize)
52
53 EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
54END_EVENT_TABLE()
55
56#if wxUSE_EXTENDED_RTTI
57WX_DEFINE_FLAGS( wxNotebookStyle )
58
59wxBEGIN_FLAGS( wxNotebookStyle )
60 // new style border flags, we put them first to
61 // use them for streaming out
62 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
63 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
64 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
65 wxFLAGS_MEMBER(wxBORDER_RAISED)
66 wxFLAGS_MEMBER(wxBORDER_STATIC)
67 wxFLAGS_MEMBER(wxBORDER_NONE)
e2731512 68
ffecfa5a
JS
69 // old style border flags
70 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
71 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
72 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
73 wxFLAGS_MEMBER(wxRAISED_BORDER)
74 wxFLAGS_MEMBER(wxSTATIC_BORDER)
75 wxFLAGS_MEMBER(wxBORDER)
76
77 // standard window styles
78 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
79 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
80 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
81 wxFLAGS_MEMBER(wxWANTS_CHARS)
82 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
83 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
84 wxFLAGS_MEMBER(wxVSCROLL)
85 wxFLAGS_MEMBER(wxHSCROLL)
86
87 wxFLAGS_MEMBER(wxNB_FIXEDWIDTH)
88 wxFLAGS_MEMBER(wxNB_LEFT)
89 wxFLAGS_MEMBER(wxNB_RIGHT)
90 wxFLAGS_MEMBER(wxNB_BOTTOM)
91
92wxEND_FLAGS( wxNotebookStyle )
93
94IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebook, wxControl,"wx/notebook.h")
95IMPLEMENT_DYNAMIC_CLASS_XTI(wxNotebookPageInfo, wxObject , "wx/notebook.h" )
96
97wxCOLLECTION_TYPE_INFO( wxNotebookPageInfo * , wxNotebookPageInfoList ) ;
98
99template<> void wxCollectionToVariantArray( wxNotebookPageInfoList const &theList, wxxVariantArray &value)
100{
101 wxListCollectionToVariantArray<wxNotebookPageInfoList::compatibility_iterator>( theList , value ) ;
102}
103
104wxBEGIN_PROPERTIES_TABLE(wxNotebook)
105 wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent )
106 wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent )
107
108 wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
109 wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
110wxEND_PROPERTIES_TABLE()
111
112wxBEGIN_HANDLERS_TABLE(wxNotebook)
113wxEND_HANDLERS_TABLE()
114
e2731512 115wxCONSTRUCTOR_5( wxNotebook , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle)
ffecfa5a
JS
116
117
118wxBEGIN_PROPERTIES_TABLE(wxNotebookPageInfo)
119 wxREADONLY_PROPERTY( Page , wxNotebookPage* , GetPage , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
120 wxREADONLY_PROPERTY( Text , wxString , GetText , wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
121 wxREADONLY_PROPERTY( Selected , bool , GetSelected , false, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
122 wxREADONLY_PROPERTY( ImageId , int , GetImageId , -1 , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
123wxEND_PROPERTIES_TABLE()
124
125wxBEGIN_HANDLERS_TABLE(wxNotebookPageInfo)
126wxEND_HANDLERS_TABLE()
127
e2731512 128wxCONSTRUCTOR_4( wxNotebookPageInfo , wxNotebookPage* , Page , wxString , Text , bool , Selected , int , ImageId )
ffecfa5a
JS
129
130#else
131IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
132IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
133#endif
134IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
135
136// ============================================================================
137// implementation
138// ============================================================================
139
140// ----------------------------------------------------------------------------
141// wxNotebook construction
142// ----------------------------------------------------------------------------
143
144const wxNotebookPageInfoList& wxNotebook::GetPageInfos() const
145{
146 wxNotebookPageInfoList* list;
147
148 return m_pageInfos ;
149}
150
151// common part of all ctors
152void wxNotebook::Init()
153{
154}
155
156// default for dynamic class
157wxNotebook::wxNotebook()
158{
159}
160
161// the same arguments as for wxControl
162wxNotebook::wxNotebook(wxWindow *parent,
163 wxWindowID id,
164 const wxPoint& pos,
165 const wxSize& size,
166 long style,
167 const wxString& name)
168{
169}
170
171// Create() function
172bool wxNotebook::Create(wxWindow *parent,
173 wxWindowID id,
174 const wxPoint& pos,
175 const wxSize& size,
176 long style,
177 const wxString& name)
178{
179 return false;
180}
181
ffecfa5a
JS
182// ----------------------------------------------------------------------------
183// wxNotebook accessors
184// ----------------------------------------------------------------------------
185
186size_t wxNotebook::GetPageCount() const
187{
630ad6c6 188 return 0;
ffecfa5a
JS
189}
190
191int wxNotebook::GetRowCount() const
192{
630ad6c6 193 return 0;
ffecfa5a
JS
194}
195
196int wxNotebook::SetSelection(size_t nPage)
197{
198 return 0;
199}
200
201bool wxNotebook::SetPageText(size_t nPage, const wxString& strText)
202{
203 return false;
204}
205
206wxString wxNotebook::GetPageText(size_t nPage) const
207{
630ad6c6 208 return wxEmptyString;
ffecfa5a
JS
209}
210
211int wxNotebook::GetPageImage(size_t nPage) const
212{
630ad6c6 213 return -1;
ffecfa5a
JS
214}
215
216bool wxNotebook::SetPageImage(size_t nPage, int nImage)
217{
218 return false;
219}
220
221void wxNotebook::SetImageList(wxImageList* imageList)
222{
223}
224
225// ----------------------------------------------------------------------------
226// wxNotebook size settings
227// ----------------------------------------------------------------------------
228
229void wxNotebook::SetPageSize(const wxSize& size)
230{
231}
232
233void wxNotebook::SetPadding(const wxSize& padding)
234{
235}
236
237void wxNotebook::SetTabSize(const wxSize& sz)
238{
239}
240
241wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
242{
243 return wxSize(0,0);
244}
245
246void wxNotebook::AdjustPageSize(wxNotebookPage *page)
247{
248}
249
250// ----------------------------------------------------------------------------
251// wxNotebook operations
252// ----------------------------------------------------------------------------
253
254// remove one page from the notebook, without deleting
255wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
256{
257 return NULL;
258}
259
260// remove all pages
261bool wxNotebook::DeleteAllPages()
262{
630ad6c6 263 return true;
ffecfa5a
JS
264}
265
266// same as AddPage() but does it at given position
267bool wxNotebook::InsertPage(size_t nPage,
268 wxNotebookPage *pPage,
269 const wxString& strText,
270 bool bSelect,
271 int imageId)
272{
273 return false;
274}
275
276int wxNotebook::HitTest(const wxPoint& pt, long *flags) const
277{
278 return 0;
279}
280
281
282// ----------------------------------------------------------------------------
283// wxNotebook callbacks
284// ----------------------------------------------------------------------------
285
286void wxNotebook::OnSize(wxSizeEvent& event)
287{
288}
289
290void wxNotebook::OnSelChange(wxNotebookEvent& event)
291{
292}
293
ffecfa5a
JS
294void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
295{
296}
297
298// ----------------------------------------------------------------------------
299// wxNotebook base class virtuals
300// ----------------------------------------------------------------------------
301
302#if wxUSE_CONSTRAINTS
303
304// override these 2 functions to do nothing: everything is done in OnSize
305
306void wxNotebook::SetConstraintSizes(bool WXUNUSED(recurse))
307{
308}
309
310bool wxNotebook::DoPhase(int WXUNUSED(nPhase))
311{
312 return true;
313}
314
315#endif // wxUSE_CONSTRAINTS
316
ffecfa5a 317#endif // wxUSE_NOTEBOOK