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