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 **
50 *****************************************************************************
51 \*****************************************************************************/
56 #include "OSGConfig.h"
61 #include "OSGQT4WindowBase.h"
62 #include "OSGQT4Window.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::QT4Window
77 The class for QT windows.
79 Do *NOT* use this fcd to recreate the QTWindow code. The QT window is a hybrid
80 beast that derives from XWindow on Unix and WIN32Window on Windows, and as
81 such can't be recreated automatically.
84 /***************************************************************************\
85 * Field Documentation *
86 \***************************************************************************/
88 /*! \var OSGQGLWidgetP QT4WindowBase::_sfGlWidget
93 /***************************************************************************\
94 * FieldType/FieldTrait Instantiation *
95 \***************************************************************************/
97 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
98 PointerType FieldTraits
<QT4Window
*, nsOSG
>::_type(
101 QT4Window::getClassType(),
105 OSG_FIELDTRAITS_GETTYPE_NS(QT4Window
*, nsOSG
)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void QT4WindowBase::classDescInserter(TypeObject
&oType
)
121 FieldDescriptionBase
*pDesc
= NULL
;
124 pDesc
= new SFOSGQGLWidgetP::Description(
125 SFOSGQGLWidgetP::getClassType(),
128 GlWidgetFieldId
, GlWidgetFieldMask
,
130 (Field::SFDefaultFlags
| Field::FStdAccess
),
131 static_cast<FieldEditMethodSig
>(&QT4Window::editHandleGlWidget
),
132 static_cast<FieldGetMethodSig
>(&QT4Window::getHandleGlWidget
));
134 oType
.addInitialDesc(pDesc
);
138 QT4WindowBase::TypeObject
QT4WindowBase::_type(
139 QT4WindowBase::getClassname(),
140 Inherited::getClassname(),
143 reinterpret_cast<PrototypeCreateF
>(&QT4WindowBase::createEmptyLocal
),
144 QT4Window::initMethod
,
145 QT4Window::exitMethod
,
146 reinterpret_cast<InitalInsertDescFunc
>(&QT4Window::classDescInserter
),
149 "<?xml version=\"1.0\"?>\n"
152 " name=\"QT4Window\"\n"
153 " parent=\"NativeWindow\"\n"
154 " library=\"WindowQT4\"\n"
155 " pointerfieldtypes=\"both\"\n"
156 " structure=\"concrete\"\n"
157 " systemcomponent=\"true\"\n"
158 " parentsystemcomponent=\"true\"\n"
159 " realparent=\"Window\"\n"
160 " docGroupBase=\"GrpWindowQt4\"\n"
162 " The class for QT windows.\n"
164 " Do *NOT* use this fcd to recreate the QTWindow code. The QT window is a hybrid\n"
165 " beast that derives from XWindow on Unix and WIN32Window on Windows, and as\n"
166 " such can't be recreated automatically.\n"
168 " name=\"GlWidget\"\n"
169 " type=\"OSGQGLWidgetP\"\n"
170 " cardinality=\"single\"\n"
171 " visibility=\"internal\"\n"
172 " defaultValue=\"NULL\"\n"
173 " fieldHeader=\"OSGQT4WindowDataFields.h\"\n"
174 " access=\"public\"\n"
177 "</FieldContainer>\n",
178 "The class for QT windows.\n"
180 "Do *NOT* use this fcd to recreate the QTWindow code. The QT window is a hybrid\n"
181 "beast that derives from XWindow on Unix and WIN32Window on Windows, and as\n"
182 "such can't be recreated automatically.\n"
185 /*------------------------------ get -----------------------------------*/
187 FieldContainerType
&QT4WindowBase::getType(void)
192 const FieldContainerType
&QT4WindowBase::getType(void) const
197 UInt32
QT4WindowBase::getContainerSize(void) const
199 return sizeof(QT4Window
);
202 /*------------------------- decorator get ------------------------------*/
205 SFOSGQGLWidgetP
*QT4WindowBase::editSFGlWidget(void)
207 editSField(GlWidgetFieldMask
);
212 const SFOSGQGLWidgetP
*QT4WindowBase::getSFGlWidget(void) const
222 /*------------------------------ access -----------------------------------*/
224 SizeT
QT4WindowBase::getBinSize(ConstFieldMaskArg whichField
)
226 SizeT returnValue
= Inherited::getBinSize(whichField
);
228 if(FieldBits::NoField
!= (GlWidgetFieldMask
& whichField
))
230 returnValue
+= _sfGlWidget
.getBinSize();
236 void QT4WindowBase::copyToBin(BinaryDataHandler
&pMem
,
237 ConstFieldMaskArg whichField
)
239 Inherited::copyToBin(pMem
, whichField
);
241 if(FieldBits::NoField
!= (GlWidgetFieldMask
& whichField
))
243 _sfGlWidget
.copyToBin(pMem
);
247 void QT4WindowBase::copyFromBin(BinaryDataHandler
&pMem
,
248 ConstFieldMaskArg whichField
)
250 Inherited::copyFromBin(pMem
, whichField
);
252 if(FieldBits::NoField
!= (GlWidgetFieldMask
& whichField
))
254 editSField(GlWidgetFieldMask
);
255 _sfGlWidget
.copyFromBin(pMem
);
259 //! create a new instance of the class
260 QT4WindowTransitPtr
QT4WindowBase::createLocal(BitVector bFlags
)
262 QT4WindowTransitPtr fc
;
264 if(getClassType().getPrototype() != NULL
)
266 FieldContainerTransitPtr tmpPtr
=
267 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
269 fc
= dynamic_pointer_cast
<QT4Window
>(tmpPtr
);
275 //! create a new instance of the class, copy the container flags
276 QT4WindowTransitPtr
QT4WindowBase::createDependent(BitVector bFlags
)
278 QT4WindowTransitPtr fc
;
280 if(getClassType().getPrototype() != NULL
)
282 FieldContainerTransitPtr tmpPtr
=
283 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
285 fc
= dynamic_pointer_cast
<QT4Window
>(tmpPtr
);
291 //! create a new instance of the class
292 QT4WindowTransitPtr
QT4WindowBase::create(void)
294 QT4WindowTransitPtr fc
;
296 if(getClassType().getPrototype() != NULL
)
298 FieldContainerTransitPtr tmpPtr
=
299 getClassType().getPrototype()-> shallowCopy();
301 fc
= dynamic_pointer_cast
<QT4Window
>(tmpPtr
);
307 QT4Window
*QT4WindowBase::createEmptyLocal(BitVector bFlags
)
309 QT4Window
*returnValue
;
311 newPtr
<QT4Window
>(returnValue
, bFlags
);
313 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
318 //! create an empty new instance of the class, do not copy the prototype
319 QT4Window
*QT4WindowBase::createEmpty(void)
321 QT4Window
*returnValue
;
323 newPtr
<QT4Window
>(returnValue
, Thread::getCurrentLocalFlags());
325 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
326 ~Thread::getCurrentLocalFlags();
332 FieldContainerTransitPtr
QT4WindowBase::shallowCopyLocal(
333 BitVector bFlags
) const
337 newPtr(tmpPtr
, dynamic_cast<const QT4Window
*>(this), bFlags
);
339 FieldContainerTransitPtr
returnValue(tmpPtr
);
341 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
346 FieldContainerTransitPtr
QT4WindowBase::shallowCopyDependent(
347 BitVector bFlags
) const
351 newPtr(tmpPtr
, dynamic_cast<const QT4Window
*>(this), ~bFlags
);
353 FieldContainerTransitPtr
returnValue(tmpPtr
);
355 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
360 FieldContainerTransitPtr
QT4WindowBase::shallowCopy(void) const
365 dynamic_cast<const QT4Window
*>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr
returnValue(tmpPtr
);
378 /*------------------------- constructors ----------------------------------*/
380 QT4WindowBase::QT4WindowBase(void) :
382 _sfGlWidget (OSGQGLWidgetP(NULL
))
386 QT4WindowBase::QT4WindowBase(const QT4WindowBase
&source
) :
388 _sfGlWidget (source
._sfGlWidget
)
393 /*-------------------------- destructors ----------------------------------*/
395 QT4WindowBase::~QT4WindowBase(void)
400 GetFieldHandlePtr
QT4WindowBase::getHandleGlWidget (void) const
402 SFOSGQGLWidgetP::GetHandlePtr
returnValue(
403 new SFOSGQGLWidgetP::GetHandle(
405 this->getType().getFieldDesc(GlWidgetFieldId
),
406 const_cast<QT4WindowBase
*>(this)));
411 EditFieldHandlePtr
QT4WindowBase::editHandleGlWidget (void)
413 SFOSGQGLWidgetP::EditHandlePtr
returnValue(
414 new SFOSGQGLWidgetP::EditHandle(
416 this->getType().getFieldDesc(GlWidgetFieldId
),
420 editSField(GlWidgetFieldMask
);
426 #ifdef OSG_MT_CPTR_ASPECT
427 void QT4WindowBase::execSyncV( FieldContainer
&oFrom
,
428 ConstFieldMaskArg whichField
,
429 AspectOffsetStore
&oOffsets
,
430 ConstFieldMaskArg syncMode
,
431 const UInt32 uiSyncInfo
)
433 QT4Window
*pThis
= static_cast<QT4Window
*>(this);
435 pThis
->execSync(static_cast<QT4Window
*>(&oFrom
),
444 #ifdef OSG_MT_CPTR_ASPECT
445 FieldContainer
*QT4WindowBase::createAspectCopy(
446 const FieldContainer
*pRefAspect
) const
448 QT4Window
*returnValue
;
450 newAspectCopy(returnValue
,
451 dynamic_cast<const QT4Window
*>(pRefAspect
),
452 dynamic_cast<const QT4Window
*>(this));
458 void QT4WindowBase::resolveLinks(void)
460 Inherited::resolveLinks();