changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / WindowSystem / Carbon / OSGCarbonWindowBase.cpp
blobde0084f4e570637199fb0bd4d91b866df89e896e
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 CarbonWindow!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
56 #include "OSGConfig.h"
61 #include "OSGCarbonWindowBase.h"
62 #include "OSGCarbonWindow.h"
64 #include <boost/bind.hpp>
66 #ifdef WIN32 // turn off 'this' : used in base member initializer list warning
67 #pragma warning(disable:4355)
68 #endif
70 OSG_BEGIN_NAMESPACE
72 /***************************************************************************\
73 * Description *
74 \***************************************************************************/
76 /*! \class OSG::CarbonWindow
77 The class for MacOS X Carbon windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var AGLContext CarbonWindowBase::_sfContext
89 /***************************************************************************\
90 * FieldType/FieldTrait Instantiation *
91 \***************************************************************************/
93 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
94 DataType FieldTraits<CarbonWindow *>::_type("CarbonWindowPtr", "WindowPtr");
95 #endif
97 OSG_FIELDTRAITS_GETTYPE(CarbonWindow *)
99 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
100 CarbonWindow *,
103 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
104 CarbonWindow *,
107 /***************************************************************************\
108 * Field Description *
109 \***************************************************************************/
111 void CarbonWindowBase::classDescInserter(TypeObject &oType)
113 FieldDescriptionBase *pDesc = NULL;
116 pDesc = new SFAGLContext::Description(
117 SFAGLContext::getClassType(),
118 "context",
120 ContextFieldId, ContextFieldMask,
121 true,
122 (Field::SFDefaultFlags | Field::FStdAccess),
123 static_cast<FieldEditMethodSig>(&CarbonWindow::editHandleContext),
124 static_cast<FieldGetMethodSig >(&CarbonWindow::getHandleContext));
126 oType.addInitialDesc(pDesc);
130 CarbonWindowBase::TypeObject CarbonWindowBase::_type(
131 CarbonWindowBase::getClassname(),
132 Inherited::getClassname(),
133 "NULL",
135 reinterpret_cast<PrototypeCreateF>(&CarbonWindowBase::createEmptyLocal),
136 CarbonWindow::initMethod,
137 CarbonWindow::exitMethod,
138 reinterpret_cast<InitalInsertDescFunc>(&CarbonWindow::classDescInserter),
139 false,
141 "<?xml version=\"1.0\"?>\n"
142 "\n"
143 "<FieldContainer\n"
144 " name=\"CarbonWindow\"\n"
145 " parent=\"Window\"\n"
146 " library=\"WindowCarbon\"\n"
147 " pointerfieldtypes=\"both\"\n"
148 " structure=\"concrete\"\n"
149 " systemcomponent=\"true\"\n"
150 " parentsystemcomponent=\"true\"\n"
151 " docGroupBase=\"GrpWindowCarbon\"\n"
152 " >\n"
153 " The class for MacOS X Carbon windows.\n"
154 " <Field\n"
155 "\t name=\"context\"\n"
156 "\t type=\"AGLContext\"\n"
157 "\t cardinality=\"single\"\n"
158 "\t visibility=\"internal\"\n"
159 "\t defaultValue=\"0\"\n"
160 "\t fieldHeader=\"OSGCarbonWindowDataFields.h\"\n"
161 "\t access=\"public\"\n"
162 "\t >\n"
163 " </Field>\n"
164 "</FieldContainer>\n",
165 "The class for MacOS X Carbon windows.\n"
168 /*------------------------------ get -----------------------------------*/
170 FieldContainerType &CarbonWindowBase::getType(void)
172 return _type;
175 const FieldContainerType &CarbonWindowBase::getType(void) const
177 return _type;
180 UInt32 CarbonWindowBase::getContainerSize(void) const
182 return sizeof(CarbonWindow);
185 /*------------------------- decorator get ------------------------------*/
188 SFAGLContext *CarbonWindowBase::editSFContext(void)
190 editSField(ContextFieldMask);
192 return &_sfContext;
195 const SFAGLContext *CarbonWindowBase::getSFContext(void) const
197 return &_sfContext;
205 /*------------------------------ access -----------------------------------*/
207 SizeT CarbonWindowBase::getBinSize(ConstFieldMaskArg whichField)
209 SizeT returnValue = Inherited::getBinSize(whichField);
211 if(FieldBits::NoField != (ContextFieldMask & whichField))
213 returnValue += _sfContext.getBinSize();
216 return returnValue;
219 void CarbonWindowBase::copyToBin(BinaryDataHandler &pMem,
220 ConstFieldMaskArg whichField)
222 Inherited::copyToBin(pMem, whichField);
224 if(FieldBits::NoField != (ContextFieldMask & whichField))
226 _sfContext.copyToBin(pMem);
230 void CarbonWindowBase::copyFromBin(BinaryDataHandler &pMem,
231 ConstFieldMaskArg whichField)
233 Inherited::copyFromBin(pMem, whichField);
235 if(FieldBits::NoField != (ContextFieldMask & whichField))
237 editSField(ContextFieldMask);
238 _sfContext.copyFromBin(pMem);
242 //! create a new instance of the class
243 CarbonWindowTransitPtr CarbonWindowBase::createLocal(BitVector bFlags)
245 CarbonWindowTransitPtr fc;
247 if(getClassType().getPrototype() != NULL)
249 FieldContainerTransitPtr tmpPtr =
250 getClassType().getPrototype()-> shallowCopyLocal(bFlags);
252 fc = dynamic_pointer_cast<CarbonWindow>(tmpPtr);
255 return fc;
258 //! create a new instance of the class, copy the container flags
259 CarbonWindowTransitPtr CarbonWindowBase::createDependent(BitVector bFlags)
261 CarbonWindowTransitPtr fc;
263 if(getClassType().getPrototype() != NULL)
265 FieldContainerTransitPtr tmpPtr =
266 getClassType().getPrototype()-> shallowCopyDependent(bFlags);
268 fc = dynamic_pointer_cast<CarbonWindow>(tmpPtr);
271 return fc;
274 //! create a new instance of the class
275 CarbonWindowTransitPtr CarbonWindowBase::create(void)
277 CarbonWindowTransitPtr fc;
279 if(getClassType().getPrototype() != NULL)
281 FieldContainerTransitPtr tmpPtr =
282 getClassType().getPrototype()-> shallowCopy();
284 fc = dynamic_pointer_cast<CarbonWindow>(tmpPtr);
287 return fc;
290 CarbonWindow *CarbonWindowBase::createEmptyLocal(BitVector bFlags)
292 CarbonWindow *returnValue;
294 newPtr<CarbonWindow>(returnValue, bFlags);
296 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
298 return returnValue;
301 //! create an empty new instance of the class, do not copy the prototype
302 CarbonWindow *CarbonWindowBase::createEmpty(void)
304 CarbonWindow *returnValue;
306 newPtr<CarbonWindow>(returnValue, Thread::getCurrentLocalFlags());
308 returnValue->_pFieldFlags->_bNamespaceMask &=
309 ~Thread::getCurrentLocalFlags();
311 return returnValue;
315 FieldContainerTransitPtr CarbonWindowBase::shallowCopyLocal(
316 BitVector bFlags) const
318 CarbonWindow *tmpPtr;
320 newPtr(tmpPtr, dynamic_cast<const CarbonWindow *>(this), bFlags);
322 FieldContainerTransitPtr returnValue(tmpPtr);
324 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
326 return returnValue;
329 FieldContainerTransitPtr CarbonWindowBase::shallowCopyDependent(
330 BitVector bFlags) const
332 CarbonWindow *tmpPtr;
334 newPtr(tmpPtr, dynamic_cast<const CarbonWindow *>(this), ~bFlags);
336 FieldContainerTransitPtr returnValue(tmpPtr);
338 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
340 return returnValue;
343 FieldContainerTransitPtr CarbonWindowBase::shallowCopy(void) const
345 CarbonWindow *tmpPtr;
347 newPtr(tmpPtr,
348 dynamic_cast<const CarbonWindow *>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 return returnValue;
361 /*------------------------- constructors ----------------------------------*/
363 CarbonWindowBase::CarbonWindowBase(void) :
364 Inherited(),
365 _sfContext (AGLContext(0))
369 CarbonWindowBase::CarbonWindowBase(const CarbonWindowBase &source) :
370 Inherited(source),
371 _sfContext (source._sfContext )
376 /*-------------------------- destructors ----------------------------------*/
378 CarbonWindowBase::~CarbonWindowBase(void)
383 GetFieldHandlePtr CarbonWindowBase::getHandleContext (void) const
385 SFAGLContext::GetHandlePtr returnValue(
386 new SFAGLContext::GetHandle(
387 &_sfContext,
388 this->getType().getFieldDesc(ContextFieldId),
389 const_cast<CarbonWindowBase *>(this)));
391 return returnValue;
394 EditFieldHandlePtr CarbonWindowBase::editHandleContext (void)
396 SFAGLContext::EditHandlePtr returnValue(
397 new SFAGLContext::EditHandle(
398 &_sfContext,
399 this->getType().getFieldDesc(ContextFieldId),
400 this));
403 editSField(ContextFieldMask);
405 return returnValue;
409 #ifdef OSG_MT_CPTR_ASPECT
410 void CarbonWindowBase::execSyncV( FieldContainer &oFrom,
411 ConstFieldMaskArg whichField,
412 AspectOffsetStore &oOffsets,
413 ConstFieldMaskArg syncMode,
414 const UInt32 uiSyncInfo)
416 CarbonWindow *pThis = static_cast<CarbonWindow *>(this);
418 pThis->execSync(static_cast<CarbonWindow *>(&oFrom),
419 whichField,
420 oOffsets,
421 syncMode,
422 uiSyncInfo);
424 #endif
427 #ifdef OSG_MT_CPTR_ASPECT
428 FieldContainer *CarbonWindowBase::createAspectCopy(
429 const FieldContainer *pRefAspect) const
431 CarbonWindow *returnValue;
433 newAspectCopy(returnValue,
434 dynamic_cast<const CarbonWindow *>(pRefAspect),
435 dynamic_cast<const CarbonWindow *>(this));
437 return returnValue;
439 #endif
441 void CarbonWindowBase::resolveLinks(void)
443 Inherited::resolveLinks();
449 OSG_END_NAMESPACE