1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 /*****************************************************************************\
40 *****************************************************************************
42 ** This file is automatically generated. **
44 ** Any changes made to this file WILL be lost when it is **
45 ** regenerated, which can become necessary at any time. **
47 ** Do not change this file, changes should be done in the derived **
50 *****************************************************************************
51 \*****************************************************************************/
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)
72 /***************************************************************************\
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(
97 GLUTWindow::getClassType(),
101 OSG_FIELDTRAITS_GETTYPE_NS(GLUTWindow
*, nsOSG
)
103 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
107 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
111 /***************************************************************************\
112 * Field Description *
113 \***************************************************************************/
115 void GLUTWindowBase::classDescInserter(TypeObject
&oType
)
117 FieldDescriptionBase
*pDesc
= NULL
;
120 pDesc
= new SFInt32::Description(
121 SFInt32::getClassType(),
124 GlutIdFieldId
, GlutIdFieldMask
,
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(),
139 reinterpret_cast<PrototypeCreateF
>(&GLUTWindowBase::createEmptyLocal
),
140 GLUTWindow::initMethod
,
141 GLUTWindow::exitMethod
,
142 reinterpret_cast<InitalInsertDescFunc
>(&GLUTWindow::classDescInserter
),
145 "<?xml version=\"1.0\"?>\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"
158 " The class for GLUT-based windows. See \\ref PageWindowGLUT for a description.\n"
162 " cardinality=\"single\"\n"
163 " visibility=\"internal\"\n"
164 " defaultValue=\"0\"\n"
165 " access=\"public\"\n"
166 " fieldFlags=\"FClusterLocal\"\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)
180 const FieldContainerType
&GLUTWindowBase::getType(void) const
185 UInt32
GLUTWindowBase::getContainerSize(void) const
187 return sizeof(GLUTWindow
);
190 /*------------------------- decorator get ------------------------------*/
193 SFInt32
*GLUTWindowBase::editSFGlutId(void)
195 editSField(GlutIdFieldMask
);
200 const SFInt32
*GLUTWindowBase::getSFGlutId(void) const
210 /*------------------------------ access -----------------------------------*/
212 SizeT
GLUTWindowBase::getBinSize(ConstFieldMaskArg whichField
)
214 SizeT returnValue
= Inherited::getBinSize(whichField
);
216 if(FieldBits::NoField
!= (GlutIdFieldMask
& whichField
))
218 returnValue
+= _sfGlutId
.getBinSize();
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
);
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
);
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
);
295 GLUTWindow
*GLUTWindowBase::createEmptyLocal(BitVector bFlags
)
297 GLUTWindow
*returnValue
;
299 newPtr
<GLUTWindow
>(returnValue
, bFlags
);
301 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
320 FieldContainerTransitPtr
GLUTWindowBase::shallowCopyLocal(
321 BitVector bFlags
) const
325 newPtr(tmpPtr
, dynamic_cast<const GLUTWindow
*>(this), bFlags
);
327 FieldContainerTransitPtr
returnValue(tmpPtr
);
329 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
334 FieldContainerTransitPtr
GLUTWindowBase::shallowCopyDependent(
335 BitVector bFlags
) const
339 newPtr(tmpPtr
, dynamic_cast<const GLUTWindow
*>(this), ~bFlags
);
341 FieldContainerTransitPtr
returnValue(tmpPtr
);
343 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
348 FieldContainerTransitPtr
GLUTWindowBase::shallowCopy(void) const
353 dynamic_cast<const GLUTWindow
*>(this),
354 Thread::getCurrentLocalFlags());
356 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
358 FieldContainerTransitPtr
returnValue(tmpPtr
);
366 /*------------------------- constructors ----------------------------------*/
368 GLUTWindowBase::GLUTWindowBase(void) :
374 GLUTWindowBase::GLUTWindowBase(const GLUTWindowBase
&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(
393 this->getType().getFieldDesc(GlutIdFieldId
),
394 const_cast<GLUTWindowBase
*>(this)));
399 EditFieldHandlePtr
GLUTWindowBase::editHandleGlutId (void)
401 SFInt32::EditHandlePtr
returnValue(
402 new SFInt32::EditHandle(
404 this->getType().getFieldDesc(GlutIdFieldId
),
408 editSField(GlutIdFieldMask
);
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
),
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));
446 void GLUTWindowBase::resolveLinks(void)
448 Inherited::resolveLinks();