changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / WindowSystem / GLUT / OSGGLUTWindowBase.cpp
blob62a07f0f1d7ccabad95443d2b9a42b2ca311bfc8
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 GLUTWindow!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #include "OSGConfig.h"
61 #include "OSGGLUTWindowBase.h"
62 #include "OSGGLUTWindow.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::GLUTWindow
77 The class for GLUT-based windows. See \ref PageWindowGLUT for a description.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var Int32 GLUTWindowBase::_sfGlutId
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 PointerType FieldTraits<GLUTWindow *, nsOSG>::_type(
95 "GLUTWindowPtr",
96 "WindowPtr",
97 GLUTWindow::getClassType(),
98 nsOSG);
99 #endif
101 OSG_FIELDTRAITS_GETTYPE_NS(GLUTWindow *, nsOSG)
103 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
104 GLUTWindow *,
105 nsOSG);
107 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
108 GLUTWindow *,
109 nsOSG);
111 /***************************************************************************\
112 * Field Description *
113 \***************************************************************************/
115 void GLUTWindowBase::classDescInserter(TypeObject &oType)
117 FieldDescriptionBase *pDesc = NULL;
120 pDesc = new SFInt32::Description(
121 SFInt32::getClassType(),
122 "glutId",
124 GlutIdFieldId, GlutIdFieldMask,
125 true,
126 (Field::FClusterLocal),
127 static_cast<FieldEditMethodSig>(&GLUTWindow::editHandleGlutId),
128 static_cast<FieldGetMethodSig >(&GLUTWindow::getHandleGlutId));
130 oType.addInitialDesc(pDesc);
134 GLUTWindowBase::TypeObject GLUTWindowBase::_type(
135 GLUTWindowBase::getClassname(),
136 Inherited::getClassname(),
137 "NULL",
138 nsOSG, //Namespace
139 reinterpret_cast<PrototypeCreateF>(&GLUTWindowBase::createEmptyLocal),
140 GLUTWindow::initMethod,
141 GLUTWindow::exitMethod,
142 reinterpret_cast<InitalInsertDescFunc>(&GLUTWindow::classDescInserter),
143 false,
145 "<?xml version=\"1.0\"?>\n"
146 "\n"
147 "<FieldContainer\n"
148 " name=\"GLUTWindow\"\n"
149 " parent=\"NativeWindow\"\n"
150 " library=\"WindowGLUT\"\n"
151 " pointerfieldtypes=\"both\"\n"
152 " structure=\"concrete\"\n"
153 " systemcomponent=\"true\"\n"
154 " parentsystemcomponent=\"true\"\n"
155 " realparent=\"Window\"\n"
156 " docGroupBase=\"GrpWindowGLUT\"\n"
157 " >\n"
158 " The class for GLUT-based windows. See \\ref PageWindowGLUT for a description.\n"
159 " <Field\n"
160 " name=\"glutId\"\n"
161 " type=\"Int32\"\n"
162 " cardinality=\"single\"\n"
163 " visibility=\"internal\"\n"
164 " defaultValue=\"0\"\n"
165 " access=\"public\"\n"
166 " fieldFlags=\"FClusterLocal\"\n"
167 " >\n"
168 " </Field>\n"
169 "</FieldContainer>\n",
170 "The class for GLUT-based windows. See \\ref PageWindowGLUT for a description.\n"
173 /*------------------------------ get -----------------------------------*/
175 FieldContainerType &GLUTWindowBase::getType(void)
177 return _type;
180 const FieldContainerType &GLUTWindowBase::getType(void) const
182 return _type;
185 UInt32 GLUTWindowBase::getContainerSize(void) const
187 return sizeof(GLUTWindow);
190 /*------------------------- decorator get ------------------------------*/
193 SFInt32 *GLUTWindowBase::editSFGlutId(void)
195 editSField(GlutIdFieldMask);
197 return &_sfGlutId;
200 const SFInt32 *GLUTWindowBase::getSFGlutId(void) const
202 return &_sfGlutId;
210 /*------------------------------ access -----------------------------------*/
212 SizeT GLUTWindowBase::getBinSize(ConstFieldMaskArg whichField)
214 SizeT returnValue = Inherited::getBinSize(whichField);
216 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
218 returnValue += _sfGlutId.getBinSize();
221 return returnValue;
224 void GLUTWindowBase::copyToBin(BinaryDataHandler &pMem,
225 ConstFieldMaskArg whichField)
227 Inherited::copyToBin(pMem, whichField);
229 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
231 _sfGlutId.copyToBin(pMem);
235 void GLUTWindowBase::copyFromBin(BinaryDataHandler &pMem,
236 ConstFieldMaskArg whichField)
238 Inherited::copyFromBin(pMem, whichField);
240 if(FieldBits::NoField != (GlutIdFieldMask & whichField))
242 editSField(GlutIdFieldMask);
243 _sfGlutId.copyFromBin(pMem);
247 //! create a new instance of the class
248 GLUTWindowTransitPtr GLUTWindowBase::createLocal(BitVector bFlags)
250 GLUTWindowTransitPtr fc;
252 if(getClassType().getPrototype() != NULL)
254 FieldContainerTransitPtr tmpPtr =
255 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
257 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
260 return fc;
263 //! create a new instance of the class, copy the container flags
264 GLUTWindowTransitPtr GLUTWindowBase::createDependent(BitVector bFlags)
266 GLUTWindowTransitPtr fc;
268 if(getClassType().getPrototype() != NULL)
270 FieldContainerTransitPtr tmpPtr =
271 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
273 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
276 return fc;
279 //! create a new instance of the class
280 GLUTWindowTransitPtr GLUTWindowBase::create(void)
282 GLUTWindowTransitPtr fc;
284 if(getClassType().getPrototype() != NULL)
286 FieldContainerTransitPtr tmpPtr =
287 getClassType().getPrototype()-> shallowCopy();
289 fc = dynamic_pointer_cast<GLUTWindow>(tmpPtr);
292 return fc;
295 GLUTWindow *GLUTWindowBase::createEmptyLocal(BitVector bFlags)
297 GLUTWindow *returnValue;
299 newPtr<GLUTWindow>(returnValue, bFlags);
301 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
303 return returnValue;
306 //! create an empty new instance of the class, do not copy the prototype
307 GLUTWindow *GLUTWindowBase::createEmpty(void)
309 GLUTWindow *returnValue;
311 newPtr<GLUTWindow>(returnValue, Thread::getCurrentLocalFlags());
313 returnValue->_pFieldFlags->_bNamespaceMask &=
314 ~Thread::getCurrentLocalFlags();
316 return returnValue;
320 FieldContainerTransitPtr GLUTWindowBase::shallowCopyLocal(
321 BitVector bFlags) const
323 GLUTWindow *tmpPtr;
325 newPtr(tmpPtr, dynamic_cast<const GLUTWindow *>(this), bFlags);
327 FieldContainerTransitPtr returnValue(tmpPtr);
329 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
331 return returnValue;
334 FieldContainerTransitPtr GLUTWindowBase::shallowCopyDependent(
335 BitVector bFlags) const
337 GLUTWindow *tmpPtr;
339 newPtr(tmpPtr, dynamic_cast<const GLUTWindow *>(this), ~bFlags);
341 FieldContainerTransitPtr returnValue(tmpPtr);
343 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
345 return returnValue;
348 FieldContainerTransitPtr GLUTWindowBase::shallowCopy(void) const
350 GLUTWindow *tmpPtr;
352 newPtr(tmpPtr,
353 dynamic_cast<const GLUTWindow *>(this),
354 Thread::getCurrentLocalFlags());
356 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
358 FieldContainerTransitPtr returnValue(tmpPtr);
360 return returnValue;
366 /*------------------------- constructors ----------------------------------*/
368 GLUTWindowBase::GLUTWindowBase(void) :
369 Inherited(),
370 _sfGlutId (Int32(0))
374 GLUTWindowBase::GLUTWindowBase(const GLUTWindowBase &source) :
375 Inherited(source),
376 _sfGlutId (source._sfGlutId )
381 /*-------------------------- destructors ----------------------------------*/
383 GLUTWindowBase::~GLUTWindowBase(void)
388 GetFieldHandlePtr GLUTWindowBase::getHandleGlutId (void) const
390 SFInt32::GetHandlePtr returnValue(
391 new SFInt32::GetHandle(
392 &_sfGlutId,
393 this->getType().getFieldDesc(GlutIdFieldId),
394 const_cast<GLUTWindowBase *>(this)));
396 return returnValue;
399 EditFieldHandlePtr GLUTWindowBase::editHandleGlutId (void)
401 SFInt32::EditHandlePtr returnValue(
402 new SFInt32::EditHandle(
403 &_sfGlutId,
404 this->getType().getFieldDesc(GlutIdFieldId),
405 this));
408 editSField(GlutIdFieldMask);
410 return returnValue;
414 #ifdef OSG_MT_CPTR_ASPECT
415 void GLUTWindowBase::execSyncV( FieldContainer &oFrom,
416 ConstFieldMaskArg whichField,
417 AspectOffsetStore &oOffsets,
418 ConstFieldMaskArg syncMode,
419 const UInt32 uiSyncInfo)
421 GLUTWindow *pThis = static_cast<GLUTWindow *>(this);
423 pThis->execSync(static_cast<GLUTWindow *>(&oFrom),
424 whichField,
425 oOffsets,
426 syncMode,
427 uiSyncInfo);
429 #endif
432 #ifdef OSG_MT_CPTR_ASPECT
433 FieldContainer *GLUTWindowBase::createAspectCopy(
434 const FieldContainer *pRefAspect) const
436 GLUTWindow *returnValue;
438 newAspectCopy(returnValue,
439 dynamic_cast<const GLUTWindow *>(pRefAspect),
440 dynamic_cast<const GLUTWindow *>(this));
442 return returnValue;
444 #endif
446 void GLUTWindowBase::resolveLinks(void)
448 Inherited::resolveLinks();
454 OSG_END_NAMESPACE