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 **
48 ** class SolidBackground!
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 "OSGSolidBackgroundBase.h"
67 #include "OSGSolidBackground.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::SolidBackground
78 A single colored background, see \ref PageSystemWindowBackgroundSolid for a
81 The color of the background is given by the _sfColor field.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var Color3f SolidBackgroundBase::_sfColor
92 /*! \var Real32 SolidBackgroundBase::_sfAlpha
93 Alpha value (to allow transparent clears).
97 /***************************************************************************\
98 * FieldType/FieldTrait Instantiation *
99 \***************************************************************************/
101 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
102 PointerType FieldTraits
<SolidBackground
*, nsOSG
>::_type(
103 "SolidBackgroundPtr",
105 SolidBackground::getClassType(),
109 OSG_FIELDTRAITS_GETTYPE_NS(SolidBackground
*, nsOSG
)
111 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void SolidBackgroundBase::classDescInserter(TypeObject
&oType
)
122 FieldDescriptionBase
*pDesc
= NULL
;
125 pDesc
= new SFColor3f::Description(
126 SFColor3f::getClassType(),
128 "The background color.\n",
129 ColorFieldId
, ColorFieldMask
,
131 (Field::SFDefaultFlags
| Field::FStdAccess
),
132 static_cast<FieldEditMethodSig
>(&SolidBackground::editHandleColor
),
133 static_cast<FieldGetMethodSig
>(&SolidBackground::getHandleColor
));
135 oType
.addInitialDesc(pDesc
);
137 pDesc
= new SFReal32::Description(
138 SFReal32::getClassType(),
140 "Alpha value (to allow transparent clears).\n",
141 AlphaFieldId
, AlphaFieldMask
,
143 (Field::SFDefaultFlags
| Field::FStdAccess
),
144 static_cast<FieldEditMethodSig
>(&SolidBackground::editHandleAlpha
),
145 static_cast<FieldGetMethodSig
>(&SolidBackground::getHandleAlpha
));
147 oType
.addInitialDesc(pDesc
);
151 SolidBackgroundBase::TypeObject
SolidBackgroundBase::_type(
152 SolidBackgroundBase::getClassname(),
153 Inherited::getClassname(),
156 reinterpret_cast<PrototypeCreateF
>(&SolidBackgroundBase::createEmptyLocal
),
157 reinterpret_cast<InitContainerF
>(&SolidBackground::initMethod
),
158 reinterpret_cast<ExitContainerF
>(&SolidBackground::exitMethod
),
159 reinterpret_cast<InitalInsertDescFunc
>(
160 reinterpret_cast<void *>(&SolidBackground::classDescInserter
)),
163 "<?xml version=\"1.0\" ?>\n"
166 " name=\"SolidBackground\"\n"
167 " parent=\"Background\"\n"
168 " library=\"System\"\n"
169 " structure=\"concrete\"\n"
170 " pointerfieldtypes=\"single\"\n"
171 " systemcomponent=\"true\"\n"
172 " parentsystemcomponent=\"true\"\n"
173 " docGroupBase=\"GrpWindowBackground\"\n"
175 " A single colored background, see \\ref PageSystemWindowBackgroundSolid for a\n"
178 " The color of the background is given by the _sfColor field.\n"
180 "\t name=\"color\"\n"
181 "\t type=\"Color3f\"\n"
182 "\t cardinality=\"single\"\n"
183 "\t visibility=\"external\"\n"
184 " defaultValue=\"0.f, 0.f, 0.f\"\n"
186 "\tThe background color.\n"
189 "\t name=\"alpha\"\n"
190 "\t type=\"Real32\"\n"
191 "\t cardinality=\"single\"\n"
192 "\t visibility=\"external\"\n"
193 "\t defaultValue=\"1.f\"\n"
194 "\t access=\"public\"\n"
196 "\tAlpha value (to allow transparent clears).\n"
198 "</FieldContainer>\n",
199 "A single colored background, see \\ref PageSystemWindowBackgroundSolid for a\n"
202 "The color of the background is given by the _sfColor field.\n"
205 /*------------------------------ get -----------------------------------*/
207 FieldContainerType
&SolidBackgroundBase::getType(void)
212 const FieldContainerType
&SolidBackgroundBase::getType(void) const
217 UInt32
SolidBackgroundBase::getContainerSize(void) const
219 return sizeof(SolidBackground
);
222 /*------------------------- decorator get ------------------------------*/
225 SFColor3f
*SolidBackgroundBase::editSFColor(void)
227 editSField(ColorFieldMask
);
232 const SFColor3f
*SolidBackgroundBase::getSFColor(void) const
238 SFReal32
*SolidBackgroundBase::editSFAlpha(void)
240 editSField(AlphaFieldMask
);
245 const SFReal32
*SolidBackgroundBase::getSFAlpha(void) const
255 /*------------------------------ access -----------------------------------*/
257 SizeT
SolidBackgroundBase::getBinSize(ConstFieldMaskArg whichField
)
259 SizeT returnValue
= Inherited::getBinSize(whichField
);
261 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
263 returnValue
+= _sfColor
.getBinSize();
265 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
267 returnValue
+= _sfAlpha
.getBinSize();
273 void SolidBackgroundBase::copyToBin(BinaryDataHandler
&pMem
,
274 ConstFieldMaskArg whichField
)
276 Inherited::copyToBin(pMem
, whichField
);
278 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
280 _sfColor
.copyToBin(pMem
);
282 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
284 _sfAlpha
.copyToBin(pMem
);
288 void SolidBackgroundBase::copyFromBin(BinaryDataHandler
&pMem
,
289 ConstFieldMaskArg whichField
)
291 Inherited::copyFromBin(pMem
, whichField
);
293 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
295 editSField(ColorFieldMask
);
296 _sfColor
.copyFromBin(pMem
);
298 if(FieldBits::NoField
!= (AlphaFieldMask
& whichField
))
300 editSField(AlphaFieldMask
);
301 _sfAlpha
.copyFromBin(pMem
);
305 //! create a new instance of the class
306 SolidBackgroundTransitPtr
SolidBackgroundBase::createLocal(BitVector bFlags
)
308 SolidBackgroundTransitPtr fc
;
310 if(getClassType().getPrototype() != NULL
)
312 FieldContainerTransitPtr tmpPtr
=
313 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
315 fc
= dynamic_pointer_cast
<SolidBackground
>(tmpPtr
);
321 //! create a new instance of the class, copy the container flags
322 SolidBackgroundTransitPtr
SolidBackgroundBase::createDependent(BitVector bFlags
)
324 SolidBackgroundTransitPtr fc
;
326 if(getClassType().getPrototype() != NULL
)
328 FieldContainerTransitPtr tmpPtr
=
329 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
331 fc
= dynamic_pointer_cast
<SolidBackground
>(tmpPtr
);
337 //! create a new instance of the class
338 SolidBackgroundTransitPtr
SolidBackgroundBase::create(void)
340 SolidBackgroundTransitPtr fc
;
342 if(getClassType().getPrototype() != NULL
)
344 FieldContainerTransitPtr tmpPtr
=
345 getClassType().getPrototype()-> shallowCopy();
347 fc
= dynamic_pointer_cast
<SolidBackground
>(tmpPtr
);
353 SolidBackground
*SolidBackgroundBase::createEmptyLocal(BitVector bFlags
)
355 SolidBackground
*returnValue
;
357 newPtr
<SolidBackground
>(returnValue
, bFlags
);
359 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
364 //! create an empty new instance of the class, do not copy the prototype
365 SolidBackground
*SolidBackgroundBase::createEmpty(void)
367 SolidBackground
*returnValue
;
369 newPtr
<SolidBackground
>(returnValue
, Thread::getCurrentLocalFlags());
371 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
372 ~Thread::getCurrentLocalFlags();
378 FieldContainerTransitPtr
SolidBackgroundBase::shallowCopyLocal(
379 BitVector bFlags
) const
381 SolidBackground
*tmpPtr
;
383 newPtr(tmpPtr
, dynamic_cast<const SolidBackground
*>(this), bFlags
);
385 FieldContainerTransitPtr
returnValue(tmpPtr
);
387 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
392 FieldContainerTransitPtr
SolidBackgroundBase::shallowCopyDependent(
393 BitVector bFlags
) const
395 SolidBackground
*tmpPtr
;
397 newPtr(tmpPtr
, dynamic_cast<const SolidBackground
*>(this), ~bFlags
);
399 FieldContainerTransitPtr
returnValue(tmpPtr
);
401 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
406 FieldContainerTransitPtr
SolidBackgroundBase::shallowCopy(void) const
408 SolidBackground
*tmpPtr
;
411 dynamic_cast<const SolidBackground
*>(this),
412 Thread::getCurrentLocalFlags());
414 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
416 FieldContainerTransitPtr
returnValue(tmpPtr
);
424 /*------------------------- constructors ----------------------------------*/
426 SolidBackgroundBase::SolidBackgroundBase(void) :
428 _sfColor (Color3f(0.f
, 0.f
, 0.f
)),
429 _sfAlpha (Real32(1.f
))
433 SolidBackgroundBase::SolidBackgroundBase(const SolidBackgroundBase
&source
) :
435 _sfColor (source
._sfColor
),
436 _sfAlpha (source
._sfAlpha
)
441 /*-------------------------- destructors ----------------------------------*/
443 SolidBackgroundBase::~SolidBackgroundBase(void)
448 GetFieldHandlePtr
SolidBackgroundBase::getHandleColor (void) const
450 SFColor3f::GetHandlePtr
returnValue(
451 new SFColor3f::GetHandle(
453 this->getType().getFieldDesc(ColorFieldId
),
454 const_cast<SolidBackgroundBase
*>(this)));
459 EditFieldHandlePtr
SolidBackgroundBase::editHandleColor (void)
461 SFColor3f::EditHandlePtr
returnValue(
462 new SFColor3f::EditHandle(
464 this->getType().getFieldDesc(ColorFieldId
),
468 editSField(ColorFieldMask
);
473 GetFieldHandlePtr
SolidBackgroundBase::getHandleAlpha (void) const
475 SFReal32::GetHandlePtr
returnValue(
476 new SFReal32::GetHandle(
478 this->getType().getFieldDesc(AlphaFieldId
),
479 const_cast<SolidBackgroundBase
*>(this)));
484 EditFieldHandlePtr
SolidBackgroundBase::editHandleAlpha (void)
486 SFReal32::EditHandlePtr
returnValue(
487 new SFReal32::EditHandle(
489 this->getType().getFieldDesc(AlphaFieldId
),
493 editSField(AlphaFieldMask
);
499 #ifdef OSG_MT_CPTR_ASPECT
500 void SolidBackgroundBase::execSyncV( FieldContainer
&oFrom
,
501 ConstFieldMaskArg whichField
,
502 AspectOffsetStore
&oOffsets
,
503 ConstFieldMaskArg syncMode
,
504 const UInt32 uiSyncInfo
)
506 SolidBackground
*pThis
= static_cast<SolidBackground
*>(this);
508 pThis
->execSync(static_cast<SolidBackground
*>(&oFrom
),
517 #ifdef OSG_MT_CPTR_ASPECT
518 FieldContainer
*SolidBackgroundBase::createAspectCopy(
519 const FieldContainer
*pRefAspect
) const
521 SolidBackground
*returnValue
;
523 newAspectCopy(returnValue
,
524 dynamic_cast<const SolidBackground
*>(pRefAspect
),
525 dynamic_cast<const SolidBackground
*>(this));
531 void SolidBackgroundBase::resolveLinks(void)
533 Inherited::resolveLinks();