changed: gcc8 base update
[opensg.git] / Source / System / Window / Base / OSGForegroundBase.cpp
blobb3cfbbf4f0d7f429704b26ef7fa4caf45ebe6cd4
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 Foreground!
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 "OSGForegroundBase.h"
67 #include "OSGForeground.h"
69 #include <boost/bind.hpp>
71 OSG_BEGIN_NAMESPACE
73 /***************************************************************************\
74 * Description *
75 \***************************************************************************/
77 /*! \class OSG::Foreground
78 Foreground is the base class for all foreground rendering. See \ref
79 PageSystemWindowForegrounds for a description.
81 \ext
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.
87 \endext
90 /***************************************************************************\
91 * Field Documentation *
92 \***************************************************************************/
94 /*! \var bool ForegroundBase::_sfActive
95 Activate the grabber.
99 /***************************************************************************\
100 * FieldType/FieldTrait Instantiation *
101 \***************************************************************************/
103 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
104 PointerType FieldTraits<Foreground *, nsOSG>::_type(
105 "ForegroundPtr",
106 "AttachmentContainerPtr",
107 Foreground::getClassType(),
108 nsOSG);
109 #endif
111 OSG_FIELDTRAITS_GETTYPE_NS(Foreground *, nsOSG)
113 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
114 Foreground *,
115 nsOSG)
117 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
118 Foreground *,
119 nsOSG)
121 /***************************************************************************\
122 * Field Description *
123 \***************************************************************************/
125 void ForegroundBase::classDescInserter(TypeObject &oType)
127 FieldDescriptionBase *pDesc = NULL;
130 pDesc = new SFBool::Description(
131 SFBool::getClassType(),
132 "active",
133 "Activate the grabber.\n",
134 ActiveFieldId, ActiveFieldMask,
135 false,
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(),
147 "NULL",
148 nsOSG, //Namespace
149 NULL,
150 reinterpret_cast<InitContainerF>(&Foreground::initMethod),
151 reinterpret_cast<ExitContainerF>(&Foreground::exitMethod),
152 reinterpret_cast<InitalInsertDescFunc>(
153 reinterpret_cast<void *>(&Foreground::classDescInserter)),
154 false,
156 "<?xml version=\"1.0\"?>\n"
157 "\n"
158 "<FieldContainer\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"
167 " >\n"
168 "\n"
169 " Foreground is the base class for all foreground rendering. See \\ref\n"
170 " PageSystemWindowForegrounds for a description.\n"
171 "\n"
172 " \\ext\n"
173 "\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"
177 " \n"
178 " \\endext\n"
179 "\n"
180 " <Field\n"
181 "\t name=\"active\"\n"
182 "\t type=\"bool\"\n"
183 "\t cardinality=\"single\"\n"
184 "\t visibility=\"external\"\n"
185 "\t defaultValue=\"true\"\n"
186 "\t access=\"public\"\n"
187 "\t >\n"
188 "\tActivate the grabber.\n"
189 " </Field>\n"
190 "</FieldContainer>\n",
191 "Foreground is the base class for all foreground rendering. See \\ref\n"
192 "PageSystemWindowForegrounds for a description.\n"
193 "\n"
194 "\\ext\n"
195 "\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"
199 "\n"
200 "\\endext\n"
203 /*------------------------------ get -----------------------------------*/
205 FieldContainerType &ForegroundBase::getType(void)
207 return _type;
210 const FieldContainerType &ForegroundBase::getType(void) const
212 return _type;
215 UInt32 ForegroundBase::getContainerSize(void) const
217 return sizeof(Foreground);
220 /*------------------------- decorator get ------------------------------*/
223 SFBool *ForegroundBase::editSFActive(void)
225 editSField(ActiveFieldMask);
227 return &_sfActive;
230 const SFBool *ForegroundBase::getSFActive(void) const
232 return &_sfActive;
240 /*------------------------------ access -----------------------------------*/
242 SizeT ForegroundBase::getBinSize(ConstFieldMaskArg whichField)
244 SizeT returnValue = Inherited::getBinSize(whichField);
246 if(FieldBits::NoField != (ActiveFieldMask & whichField))
248 returnValue += _sfActive.getBinSize();
251 return returnValue;
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) :
283 Inherited(),
284 _sfActive (bool(true))
288 ForegroundBase::ForegroundBase(const ForegroundBase &source) :
289 Inherited(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(
306 &_sfActive,
307 this->getType().getFieldDesc(ActiveFieldId),
308 const_cast<ForegroundBase *>(this)));
310 return returnValue;
313 EditFieldHandlePtr ForegroundBase::editHandleActive (void)
315 SFBool::EditHandlePtr returnValue(
316 new SFBool::EditHandle(
317 &_sfActive,
318 this->getType().getFieldDesc(ActiveFieldId),
319 this));
322 editSField(ActiveFieldMask);
324 return returnValue;
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),
338 whichField,
339 oOffsets,
340 syncMode,
341 uiSyncInfo);
343 #endif
347 void ForegroundBase::resolveLinks(void)
349 Inherited::resolveLinks();
355 OSG_END_NAMESPACE