1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
66 #include "OSGForegroundBase.h"
67 #include "OSGForeground.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::Foreground
78 Foreground is the base class for all foreground rendering. See \ref
79 PageSystemWindowForegrounds for a description.
83 To create a new Foreground the method that has be overridden is
84 draw(DrawActionBase * action, Viewport * port);. It can directly call OpenGL
85 commands, but should restore the state after it's done.
90 /***************************************************************************\
91 * Field Documentation *
92 \***************************************************************************/
94 /*! \var bool ForegroundBase::_sfActive
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits
<Foreground
*, nsOSG
>::_type(
106 "AttachmentContainerPtr",
107 Foreground::getClassType(),
111 OSG_FIELDTRAITS_GETTYPE_NS(Foreground
*, nsOSG
)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void ForegroundBase::classDescInserter(TypeObject
&oType
)
127 FieldDescriptionBase
*pDesc
= NULL
;
130 pDesc
= new SFBool::Description(
131 SFBool::getClassType(),
133 "Activate the grabber.\n",
134 ActiveFieldId
, ActiveFieldMask
,
136 (Field::SFDefaultFlags
| Field::FStdAccess
),
137 static_cast<FieldEditMethodSig
>(&Foreground::editHandleActive
),
138 static_cast<FieldGetMethodSig
>(&Foreground::getHandleActive
));
140 oType
.addInitialDesc(pDesc
);
144 ForegroundBase::TypeObject
ForegroundBase::_type(
145 ForegroundBase::getClassname(),
146 Inherited::getClassname(),
150 reinterpret_cast<InitContainerF
>(&Foreground::initMethod
),
151 reinterpret_cast<ExitContainerF
>(&Foreground::exitMethod
),
152 reinterpret_cast<InitalInsertDescFunc
>(
153 reinterpret_cast<void *>(&Foreground::classDescInserter
)),
156 "<?xml version=\"1.0\"?>\n"
159 " name=\"Foreground\"\n"
160 " parent=\"AttachmentContainer\"\n"
161 " library=\"System\"\n"
162 " pointerfieldtypes=\"both\"\n"
163 " structure=\"abstract\"\n"
164 " systemcomponent=\"true\"\n"
165 " parentsystemcomponent=\"true\"\n"
166 " docGroupBase=\"GrpSystemWindow\"\n"
169 " Foreground is the base class for all foreground rendering. See \\ref\n"
170 " PageSystemWindowForegrounds for a description.\n"
174 " To create a new Foreground the method that has be overridden is\n"
175 " draw(DrawActionBase * action, Viewport * port);. It can directly call OpenGL\n"
176 " commands, but should restore the state after it's done.\n"
181 "\t name=\"active\"\n"
183 "\t cardinality=\"single\"\n"
184 "\t visibility=\"external\"\n"
185 "\t defaultValue=\"true\"\n"
186 "\t access=\"public\"\n"
188 "\tActivate the grabber.\n"
190 "</FieldContainer>\n",
191 "Foreground is the base class for all foreground rendering. See \\ref\n"
192 "PageSystemWindowForegrounds for a description.\n"
196 "To create a new Foreground the method that has be overridden is\n"
197 "draw(DrawActionBase * action, Viewport * port);. It can directly call OpenGL\n"
198 "commands, but should restore the state after it's done.\n"
203 /*------------------------------ get -----------------------------------*/
205 FieldContainerType
&ForegroundBase::getType(void)
210 const FieldContainerType
&ForegroundBase::getType(void) const
215 UInt32
ForegroundBase::getContainerSize(void) const
217 return sizeof(Foreground
);
220 /*------------------------- decorator get ------------------------------*/
223 SFBool
*ForegroundBase::editSFActive(void)
225 editSField(ActiveFieldMask
);
230 const SFBool
*ForegroundBase::getSFActive(void) const
240 /*------------------------------ access -----------------------------------*/
242 SizeT
ForegroundBase::getBinSize(ConstFieldMaskArg whichField
)
244 SizeT returnValue
= Inherited::getBinSize(whichField
);
246 if(FieldBits::NoField
!= (ActiveFieldMask
& whichField
))
248 returnValue
+= _sfActive
.getBinSize();
254 void ForegroundBase::copyToBin(BinaryDataHandler
&pMem
,
255 ConstFieldMaskArg whichField
)
257 Inherited::copyToBin(pMem
, whichField
);
259 if(FieldBits::NoField
!= (ActiveFieldMask
& whichField
))
261 _sfActive
.copyToBin(pMem
);
265 void ForegroundBase::copyFromBin(BinaryDataHandler
&pMem
,
266 ConstFieldMaskArg whichField
)
268 Inherited::copyFromBin(pMem
, whichField
);
270 if(FieldBits::NoField
!= (ActiveFieldMask
& whichField
))
272 editSField(ActiveFieldMask
);
273 _sfActive
.copyFromBin(pMem
);
280 /*------------------------- constructors ----------------------------------*/
282 ForegroundBase::ForegroundBase(void) :
284 _sfActive (bool(true))
288 ForegroundBase::ForegroundBase(const ForegroundBase
&source
) :
290 _sfActive (source
._sfActive
)
295 /*-------------------------- destructors ----------------------------------*/
297 ForegroundBase::~ForegroundBase(void)
302 GetFieldHandlePtr
ForegroundBase::getHandleActive (void) const
304 SFBool::GetHandlePtr
returnValue(
305 new SFBool::GetHandle(
307 this->getType().getFieldDesc(ActiveFieldId
),
308 const_cast<ForegroundBase
*>(this)));
313 EditFieldHandlePtr
ForegroundBase::editHandleActive (void)
315 SFBool::EditHandlePtr
returnValue(
316 new SFBool::EditHandle(
318 this->getType().getFieldDesc(ActiveFieldId
),
322 editSField(ActiveFieldMask
);
328 #ifdef OSG_MT_CPTR_ASPECT
329 void ForegroundBase::execSyncV( FieldContainer
&oFrom
,
330 ConstFieldMaskArg whichField
,
331 AspectOffsetStore
&oOffsets
,
332 ConstFieldMaskArg syncMode
,
333 const UInt32 uiSyncInfo
)
335 Foreground
*pThis
= static_cast<Foreground
*>(this);
337 pThis
->execSync(static_cast<Foreground
*>(&oFrom
),
347 void ForegroundBase::resolveLinks(void)
349 Inherited::resolveLinks();