changed: auto add updateData callback to stages so that stagedata can be updated...
[opensg.git] / Source / WindowSystem / QT4 / OSGQT4WindowBase.cpp
blobcc23a15d99cc256b1ecafad44bef9b9bf631325b
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 QT4Window!
49 ** **
50 *****************************************************************************
51 \*****************************************************************************/
53 #include <cstdlib>
54 #include <cstdio>
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)
68 #endif
70 OSG_BEGIN_NAMESPACE
72 /***************************************************************************\
73 * Description *
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(
99 "QT4WindowPtr",
100 "WindowPtr",
101 QT4Window::getClassType(),
102 nsOSG);
103 #endif
105 OSG_FIELDTRAITS_GETTYPE_NS(QT4Window *, nsOSG)
107 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField,
108 QT4Window *,
109 nsOSG);
111 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField,
112 QT4Window *,
113 nsOSG);
115 /***************************************************************************\
116 * Field Description *
117 \***************************************************************************/
119 void QT4WindowBase::classDescInserter(TypeObject &oType)
121 FieldDescriptionBase *pDesc = NULL;
124 pDesc = new SFOSGQGLWidgetP::Description(
125 SFOSGQGLWidgetP::getClassType(),
126 "GlWidget",
128 GlWidgetFieldId, GlWidgetFieldMask,
129 true,
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(),
141 "NULL",
142 nsOSG, //Namespace
143 reinterpret_cast<PrototypeCreateF>(&QT4WindowBase::createEmptyLocal),
144 QT4Window::initMethod,
145 QT4Window::exitMethod,
146 reinterpret_cast<InitalInsertDescFunc>(&QT4Window::classDescInserter),
147 false,
149 "<?xml version=\"1.0\"?>\n"
150 "\n"
151 "<FieldContainer\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"
161 " >\n"
162 " The class for QT windows.\n"
163 " \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"
167 " <Field\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"
175 " >\n"
176 " </Field>\n"
177 "</FieldContainer>\n",
178 "The class for QT windows.\n"
179 "\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)
189 return _type;
192 const FieldContainerType &QT4WindowBase::getType(void) const
194 return _type;
197 UInt32 QT4WindowBase::getContainerSize(void) const
199 return sizeof(QT4Window);
202 /*------------------------- decorator get ------------------------------*/
205 SFOSGQGLWidgetP *QT4WindowBase::editSFGlWidget(void)
207 editSField(GlWidgetFieldMask);
209 return &_sfGlWidget;
212 const SFOSGQGLWidgetP *QT4WindowBase::getSFGlWidget(void) const
214 return &_sfGlWidget;
222 /*------------------------------ access -----------------------------------*/
224 SizeT QT4WindowBase::getBinSize(ConstFieldMaskArg whichField)
226 SizeT returnValue = Inherited::getBinSize(whichField);
228 if(FieldBits::NoField != (GlWidgetFieldMask & whichField))
230 returnValue += _sfGlWidget.getBinSize();
233 return returnValue;
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);
272 return fc;
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);
288 return fc;
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);
304 return fc;
307 QT4Window *QT4WindowBase::createEmptyLocal(BitVector bFlags)
309 QT4Window *returnValue;
311 newPtr<QT4Window>(returnValue, bFlags);
313 returnValue->_pFieldFlags->_bNamespaceMask &= ~bFlags;
315 return returnValue;
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();
328 return returnValue;
332 FieldContainerTransitPtr QT4WindowBase::shallowCopyLocal(
333 BitVector bFlags) const
335 QT4Window *tmpPtr;
337 newPtr(tmpPtr, dynamic_cast<const QT4Window *>(this), bFlags);
339 FieldContainerTransitPtr returnValue(tmpPtr);
341 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~bFlags;
343 return returnValue;
346 FieldContainerTransitPtr QT4WindowBase::shallowCopyDependent(
347 BitVector bFlags) const
349 QT4Window *tmpPtr;
351 newPtr(tmpPtr, dynamic_cast<const QT4Window *>(this), ~bFlags);
353 FieldContainerTransitPtr returnValue(tmpPtr);
355 tmpPtr->_pFieldFlags->_bNamespaceMask = bFlags;
357 return returnValue;
360 FieldContainerTransitPtr QT4WindowBase::shallowCopy(void) const
362 QT4Window *tmpPtr;
364 newPtr(tmpPtr,
365 dynamic_cast<const QT4Window *>(this),
366 Thread::getCurrentLocalFlags());
368 tmpPtr->_pFieldFlags->_bNamespaceMask &= ~Thread::getCurrentLocalFlags();
370 FieldContainerTransitPtr returnValue(tmpPtr);
372 return returnValue;
378 /*------------------------- constructors ----------------------------------*/
380 QT4WindowBase::QT4WindowBase(void) :
381 Inherited(),
382 _sfGlWidget (OSGQGLWidgetP(NULL))
386 QT4WindowBase::QT4WindowBase(const QT4WindowBase &source) :
387 Inherited(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(
404 &_sfGlWidget,
405 this->getType().getFieldDesc(GlWidgetFieldId),
406 const_cast<QT4WindowBase *>(this)));
408 return returnValue;
411 EditFieldHandlePtr QT4WindowBase::editHandleGlWidget (void)
413 SFOSGQGLWidgetP::EditHandlePtr returnValue(
414 new SFOSGQGLWidgetP::EditHandle(
415 &_sfGlWidget,
416 this->getType().getFieldDesc(GlWidgetFieldId),
417 this));
420 editSField(GlWidgetFieldMask);
422 return returnValue;
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),
436 whichField,
437 oOffsets,
438 syncMode,
439 uiSyncInfo);
441 #endif
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));
454 return returnValue;
456 #endif
458 void QT4WindowBase::resolveLinks(void)
460 Inherited::resolveLinks();
466 OSG_END_NAMESPACE