1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2006 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
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 CarbonWindow!
50 *****************************************************************************
51 \*****************************************************************************/
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)
72 /***************************************************************************\
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");
97 OSG_FIELDTRAITS_GETTYPE(CarbonWindow
*)
99 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
103 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
107 /***************************************************************************\
108 * Field Description *
109 \***************************************************************************/
111 void CarbonWindowBase::classDescInserter(TypeObject
&oType
)
113 FieldDescriptionBase
*pDesc
= NULL
;
116 pDesc
= new SFAGLContext::Description(
117 SFAGLContext::getClassType(),
120 ContextFieldId
, ContextFieldMask
,
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(),
135 reinterpret_cast<PrototypeCreateF
>(&CarbonWindowBase::createEmptyLocal
),
136 CarbonWindow::initMethod
,
137 CarbonWindow::exitMethod
,
138 reinterpret_cast<InitalInsertDescFunc
>(&CarbonWindow::classDescInserter
),
141 "<?xml version=\"1.0\"?>\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"
153 " The class for MacOS X Carbon windows.\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"
164 "</FieldContainer>\n",
165 "The class for MacOS X Carbon windows.\n"
168 /*------------------------------ get -----------------------------------*/
170 FieldContainerType
&CarbonWindowBase::getType(void)
175 const FieldContainerType
&CarbonWindowBase::getType(void) const
180 UInt32
CarbonWindowBase::getContainerSize(void) const
182 return sizeof(CarbonWindow
);
185 /*------------------------- decorator get ------------------------------*/
188 SFAGLContext
*CarbonWindowBase::editSFContext(void)
190 editSField(ContextFieldMask
);
195 const SFAGLContext
*CarbonWindowBase::getSFContext(void) const
205 /*------------------------------ access -----------------------------------*/
207 SizeT
CarbonWindowBase::getBinSize(ConstFieldMaskArg whichField
)
209 SizeT returnValue
= Inherited::getBinSize(whichField
);
211 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
213 returnValue
+= _sfContext
.getBinSize();
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
);
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
);
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
);
290 CarbonWindow
*CarbonWindowBase::createEmptyLocal(BitVector bFlags
)
292 CarbonWindow
*returnValue
;
294 newPtr
<CarbonWindow
>(returnValue
, bFlags
);
296 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
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();
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
;
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
;
343 FieldContainerTransitPtr
CarbonWindowBase::shallowCopy(void) const
345 CarbonWindow
*tmpPtr
;
348 dynamic_cast<const CarbonWindow
*>(this),
349 Thread::getCurrentLocalFlags());
351 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
361 /*------------------------- constructors ----------------------------------*/
363 CarbonWindowBase::CarbonWindowBase(void) :
365 _sfContext (AGLContext(0))
369 CarbonWindowBase::CarbonWindowBase(const CarbonWindowBase
&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(
388 this->getType().getFieldDesc(ContextFieldId
),
389 const_cast<CarbonWindowBase
*>(this)));
394 EditFieldHandlePtr
CarbonWindowBase::editHandleContext (void)
396 SFAGLContext::EditHandlePtr
returnValue(
397 new SFAGLContext::EditHandle(
399 this->getType().getFieldDesc(ContextFieldId
),
403 editSField(ContextFieldMask
);
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
),
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));
441 void CarbonWindowBase::resolveLinks(void)
443 Inherited::resolveLinks();