changed: gcc8 base update
[opensg.git] / Source / System / Window / Base / OSGSolidBackgroundBase.cpp
blobe5d7c7b66b6862c2226b6d728fe988084ad85503
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 SolidBackground!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #ifdef WIN32
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
59 #endif
61 #include "OSGConfig.h"
66 #include "OSGSolidBackgroundBase.h"
67 #include "OSGSolidBackground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::SolidBackground
78 A single colored background, see \ref PageSystemWindowBackgroundSolid for a
79 description.
81 The color of the background is given by the _sfColor field.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var Color3f SolidBackgroundBase::_sfColor
89 The background color.
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",
104 "BackgroundPtr",
105 SolidBackground::getClassType(),
106 nsOSG);
107 #endif
109 OSG_FIELDTRAITS_GETTYPE_NS(SolidBackground *, nsOSG)
111 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
112 SolidBackground *,
113 nsOSG)
116 /***************************************************************************\
117 * Field Description *
118 \***************************************************************************/
120 void SolidBackgroundBase::classDescInserter(TypeObject &oType)
122 FieldDescriptionBase *pDesc = NULL;
125 pDesc = new SFColor3f::Description(
126 SFColor3f::getClassType(),
127 "color",
128 "The background color.\n",
129 ColorFieldId, ColorFieldMask,
130 false,
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(),
139 "alpha",
140 "Alpha value (to allow transparent clears).\n",
141 AlphaFieldId, AlphaFieldMask,
142 false,
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(),
154 "NULL",
155 nsOSG, //Namespace
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)),
161 false,
163 "<?xml version=\"1.0\" ?>\n"
164 "\n"
165 "<FieldContainer\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"
174 " >\n"
175 " A single colored background, see \\ref PageSystemWindowBackgroundSolid for a\n"
176 " description.\n"
177 "\n"
178 " The color of the background is given by the _sfColor field.\n"
179 " <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"
185 "\t >\n"
186 "\tThe background color.\n"
187 " </Field>\n"
188 " <Field\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"
195 "\t >\n"
196 "\tAlpha value (to allow transparent clears).\n"
197 " </Field>\n"
198 "</FieldContainer>\n",
199 "A single colored background, see \\ref PageSystemWindowBackgroundSolid for a\n"
200 "description.\n"
201 "\n"
202 "The color of the background is given by the _sfColor field.\n"
205 /*------------------------------ get -----------------------------------*/
207 FieldContainerType &SolidBackgroundBase::getType(void)
209 return _type;
212 const FieldContainerType &SolidBackgroundBase::getType(void) const
214 return _type;
217 UInt32 SolidBackgroundBase::getContainerSize(void) const
219 return sizeof(SolidBackground);
222 /*------------------------- decorator get ------------------------------*/
225 SFColor3f *SolidBackgroundBase::editSFColor(void)
227 editSField(ColorFieldMask);
229 return &_sfColor;
232 const SFColor3f *SolidBackgroundBase::getSFColor(void) const
234 return &_sfColor;
238 SFReal32 *SolidBackgroundBase::editSFAlpha(void)
240 editSField(AlphaFieldMask);
242 return &_sfAlpha;
245 const SFReal32 *SolidBackgroundBase::getSFAlpha(void) const
247 return &_sfAlpha;
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();
270 return returnValue;
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);
318 return fc;
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);
334 return fc;
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);
350 return fc;
353 SolidBackground *SolidBackgroundBase::createEmptyLocal(BitVector bFlags)
355 SolidBackground *returnValue;
357 newPtr<SolidBackground>(returnValue, bFlags);
359 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
361 return returnValue;
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();
374 return returnValue;
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;
389 return returnValue;
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;
403 return returnValue;
406 FieldContainerTransitPtr SolidBackgroundBase::shallowCopy(void) const
408 SolidBackground *tmpPtr;
410 newPtr(tmpPtr,
411 dynamic_cast<const SolidBackground *>(this),
412 Thread::getCurrentLocalFlags());
414 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
416 FieldContainerTransitPtr returnValue(tmpPtr);
418 return returnValue;
424 /*------------------------- constructors ----------------------------------*/
426 SolidBackgroundBase::SolidBackgroundBase(void) :
427 Inherited(),
428 _sfColor (Color3f(0.f, 0.f, 0.f)),
429 _sfAlpha (Real32(1.f))
433 SolidBackgroundBase::SolidBackgroundBase(const SolidBackgroundBase &source) :
434 Inherited(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(
452 &_sfColor,
453 this->getType().getFieldDesc(ColorFieldId),
454 const_cast<SolidBackgroundBase *>(this)));
456 return returnValue;
459 EditFieldHandlePtr SolidBackgroundBase::editHandleColor (void)
461 SFColor3f::EditHandlePtr returnValue(
462 new SFColor3f::EditHandle(
463 &_sfColor,
464 this->getType().getFieldDesc(ColorFieldId),
465 this));
468 editSField(ColorFieldMask);
470 return returnValue;
473 GetFieldHandlePtr SolidBackgroundBase::getHandleAlpha (void) const
475 SFReal32::GetHandlePtr returnValue(
476 new SFReal32::GetHandle(
477 &_sfAlpha,
478 this->getType().getFieldDesc(AlphaFieldId),
479 const_cast<SolidBackgroundBase *>(this)));
481 return returnValue;
484 EditFieldHandlePtr SolidBackgroundBase::editHandleAlpha (void)
486 SFReal32::EditHandlePtr returnValue(
487 new SFReal32::EditHandle(
488 &_sfAlpha,
489 this->getType().getFieldDesc(AlphaFieldId),
490 this));
493 editSField(AlphaFieldMask);
495 return returnValue;
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),
509 whichField,
510 oOffsets,
511 syncMode,
512 uiSyncInfo);
514 #endif
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));
527 return returnValue;
529 #endif
531 void SolidBackgroundBase::resolveLinks(void)
533 Inherited::resolveLinks();
539 OSG_END_NAMESPACE