changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / WindowSystem / EAGL / OSGEAGLWindowBase.cpp
blobc788fd7e76298d8b18ceef487750c1c585a36b0c
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
41 ** **
42 ** This file is automatically generated. **
43 ** **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
46 ** **
47 ** Do not change this file, changes should be done in the derived **
48 ** class EAGLWindow!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #include "OSGConfig.h"
61 #include "OSGEAGLWindowBase.h"
62 #include "OSGEAGLWindow.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
68 #endif
70 OSG_BEGIN_NAMESPACE
72 /***************************************************************************\
73 * Description *
74 \***************************************************************************/
76 /*! \class OSG::EAGLWindow
77 The class for MacOS X EAGL windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var EAGLContextP EAGLWindowBase::_sfContext
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 PointerType FieldTraits<EAGLWindow *, nsOSG>::_type(
95 "EAGLWindowPtr",
96 "WindowPtr",
97 EAGLWindow::getClassType(),
98 nsOSG);
99 #endif
101 OSG_FIELDTRAITS_GETTYPE_NS(EAGLWindow *, nsOSG)
103 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
104 EAGLWindow *,
105 nsOSG);
107 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
108 EAGLWindow *,
109 nsOSG);
111 /***************************************************************************\
112 * Field Description *
113 \***************************************************************************/
115 void EAGLWindowBase::classDescInserter(TypeObject &oType)
117 FieldDescriptionBase *pDesc = NULL;
120 pDesc = new SFEAGLContextP::Description(
121 SFEAGLContextP::getClassType(),
122 "context",
124 ContextFieldId, ContextFieldMask,
125 true,
126 (Field::SFDefaultFlags | Field::FStdAccess),
127 static_cast<FieldEditMethodSig>(&EAGLWindow::editHandleContext),
128 static_cast<FieldGetMethodSig >(&EAGLWindow::getHandleContext));
130 oType.addInitialDesc(pDesc);
134 EAGLWindowBase::TypeObject EAGLWindowBase::_type(
135 EAGLWindowBase::getClassname(),
136 Inherited::getClassname(),
137 "NULL",
138 nsOSG, //Namespace
139 reinterpret_cast<PrototypeCreateF>(&EAGLWindowBase::createEmptyLocal),
140 EAGLWindow::initMethod,
141 EAGLWindow::exitMethod,
142 reinterpret_cast<InitalInsertDescFunc>(&EAGLWindow::classDescInserter),
143 false,
145 "<?xml version=\"1.0\"?>\n"
146 "\n"
147 "<FieldContainer\n"
148 " name=\"EAGLWindow\"\n"
149 " parent=\"Window\"\n"
150 " library=\"WindowEAGL\"\n"
151 " pointerfieldtypes=\"both\"\n"
152 " structure=\"concrete\"\n"
153 " systemcomponent=\"true\"\n"
154 " parentsystemcomponent=\"true\"\n"
155 " docGroupBase=\"GrpWindowCocao\"\n"
156 " >\n"
157 " The class for MacOS X EAGL windows.\n"
158 " <Field\n"
159 "\t name=\"context\"\n"
160 "\t type=\"EAGLContextP\"\n"
161 "\t cardinality=\"single\"\n"
162 "\t visibility=\"internal\"\n"
163 "\t defaultValue=\"0\"\n"
164 "\t fieldHeader=\"OSGEAGLWindowDataFields.h\"\n"
165 "\t access=\"public\"\n"
166 "\t >\n"
167 " </Field>\n"
168 "</FieldContainer>\n",
169 "The class for MacOS X EAGL windows.\n"
172 /*------------------------------ get -----------------------------------*/
174 FieldContainerType &EAGLWindowBase::getType(void)
176 return _type;
179 const FieldContainerType &EAGLWindowBase::getType(void) const
181 return _type;
184 UInt32 EAGLWindowBase::getContainerSize(void) const
186 return sizeof(EAGLWindow);
189 /*------------------------- decorator get ------------------------------*/
192 SFEAGLContextP *EAGLWindowBase::editSFContext(void)
194 editSField(ContextFieldMask);
196 return &_sfContext;
199 const SFEAGLContextP *EAGLWindowBase::getSFContext(void) const
201 return &_sfContext;
209 /*------------------------------ access -----------------------------------*/
211 SizeT EAGLWindowBase::getBinSize(ConstFieldMaskArg whichField)
213 SizeT returnValue = Inherited::getBinSize(whichField);
215 if(FieldBits::NoField != (ContextFieldMask & whichField))
217 returnValue += _sfContext.getBinSize();
220 return returnValue;
223 void EAGLWindowBase::copyToBin(BinaryDataHandler &pMem,
224 ConstFieldMaskArg whichField)
226 Inherited::copyToBin(pMem, whichField);
228 if(FieldBits::NoField != (ContextFieldMask & whichField))
230 _sfContext.copyToBin(pMem);
234 void EAGLWindowBase::copyFromBin(BinaryDataHandler &pMem,
235 ConstFieldMaskArg whichField)
237 Inherited::copyFromBin(pMem, whichField);
239 if(FieldBits::NoField != (ContextFieldMask & whichField))
241 editSField(ContextFieldMask);
242 _sfContext.copyFromBin(pMem);
246 //! create a new instance of the class
247 EAGLWindowTransitPtr EAGLWindowBase::createLocal(BitVector bFlags)
249 EAGLWindowTransitPtr fc;
251 if(getClassType().getPrototype() != NULL)
253 FieldContainerTransitPtr tmpPtr =
254 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
256 fc = dynamic_pointer_cast<EAGLWindow>(tmpPtr);
259 return fc;
262 //! create a new instance of the class, copy the container flags
263 EAGLWindowTransitPtr EAGLWindowBase::createDependent(BitVector bFlags)
265 EAGLWindowTransitPtr fc;
267 if(getClassType().getPrototype() != NULL)
269 FieldContainerTransitPtr tmpPtr =
270 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
272 fc = dynamic_pointer_cast<EAGLWindow>(tmpPtr);
275 return fc;
278 //! create a new instance of the class
279 EAGLWindowTransitPtr EAGLWindowBase::create(void)
281 EAGLWindowTransitPtr fc;
283 if(getClassType().getPrototype() != NULL)
285 FieldContainerTransitPtr tmpPtr =
286 getClassType().getPrototype()-> shallowCopy();
288 fc = dynamic_pointer_cast<EAGLWindow>(tmpPtr);
291 return fc;
294 EAGLWindow *EAGLWindowBase::createEmptyLocal(BitVector bFlags)
296 EAGLWindow *returnValue;
298 newPtr<EAGLWindow>(returnValue, bFlags);
300 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
302 return returnValue;
305 //! create an empty new instance of the class, do not copy the prototype
306 EAGLWindow *EAGLWindowBase::createEmpty(void)
308 EAGLWindow *returnValue;
310 newPtr<EAGLWindow>(returnValue, Thread::getCurrentLocalFlags());
312 returnValue->_pFieldFlags->_bNamespaceMask &=
313 ~Thread::getCurrentLocalFlags();
315 return returnValue;
319 FieldContainerTransitPtr EAGLWindowBase::shallowCopyLocal(
320 BitVector bFlags) const
322 EAGLWindow *tmpPtr;
324 newPtr(tmpPtr, dynamic_cast<const EAGLWindow *>(this), bFlags);
326 FieldContainerTransitPtr returnValue(tmpPtr);
328 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
330 return returnValue;
333 FieldContainerTransitPtr EAGLWindowBase::shallowCopyDependent(
334 BitVector bFlags) const
336 EAGLWindow *tmpPtr;
338 newPtr(tmpPtr, dynamic_cast<const EAGLWindow *>(this), ~bFlags);
340 FieldContainerTransitPtr returnValue(tmpPtr);
342 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
344 return returnValue;
347 FieldContainerTransitPtr EAGLWindowBase::shallowCopy(void) const
349 EAGLWindow *tmpPtr;
351 newPtr(tmpPtr,
352 dynamic_cast<const EAGLWindow *>(this),
353 Thread::getCurrentLocalFlags());
355 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
357 FieldContainerTransitPtr returnValue(tmpPtr);
359 return returnValue;
365 /*------------------------- constructors ----------------------------------*/
367 EAGLWindowBase::EAGLWindowBase(void) :
368 Inherited(),
369 _sfContext (EAGLContextP(0))
373 EAGLWindowBase::EAGLWindowBase(const EAGLWindowBase &source) :
374 Inherited(source),
375 _sfContext (source._sfContext )
380 /*-------------------------- destructors ----------------------------------*/
382 EAGLWindowBase::~EAGLWindowBase(void)
387 GetFieldHandlePtr EAGLWindowBase::getHandleContext (void) const
389 SFEAGLContextP::GetHandlePtr returnValue(
390 new SFEAGLContextP::GetHandle(
391 &_sfContext,
392 this->getType().getFieldDesc(ContextFieldId),
393 const_cast<EAGLWindowBase *>(this)));
395 return returnValue;
398 EditFieldHandlePtr EAGLWindowBase::editHandleContext (void)
400 SFEAGLContextP::EditHandlePtr returnValue(
401 new SFEAGLContextP::EditHandle(
402 &_sfContext,
403 this->getType().getFieldDesc(ContextFieldId),
404 this));
407 editSField(ContextFieldMask);
409 return returnValue;
413 #ifdef OSG_MT_CPTR_ASPECT
414 void EAGLWindowBase::execSyncV( FieldContainer &oFrom,
415 ConstFieldMaskArg whichField,
416 AspectOffsetStore &oOffsets,
417 ConstFieldMaskArg syncMode,
418 const UInt32 uiSyncInfo)
420 EAGLWindow *pThis = static_cast<EAGLWindow *>(this);
422 pThis->execSync(static_cast<EAGLWindow *>(&oFrom),
423 whichField,
424 oOffsets,
425 syncMode,
426 uiSyncInfo);
428 #endif
431 #ifdef OSG_MT_CPTR_ASPECT
432 FieldContainer *EAGLWindowBase::createAspectCopy(
433 const FieldContainer *pRefAspect) const
435 EAGLWindow *returnValue;
437 newAspectCopy(returnValue,
438 dynamic_cast<const EAGLWindow *>(pRefAspect),
439 dynamic_cast<const EAGLWindow *>(this));
441 return returnValue;
443 #endif
445 void EAGLWindowBase::resolveLinks(void)
447 Inherited::resolveLinks();
453 OSG_END_NAMESPACE