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 "OSGXWindowBase.h"
62 #include "OSGXWindow.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::XWindow
77 The class for X-based windows. See \ref PageWindowX for a description.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var DisplayP XWindowBase::_sfDisplay
88 /*! \var X11Window XWindowBase::_sfWindow
92 /*! \var GLXContext XWindowBase::_sfContext
96 /*! \var Int32 XWindowBase::_sfFbConfigId
101 /***************************************************************************\
102 * FieldType/FieldTrait Instantiation *
103 \***************************************************************************/
105 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
106 PointerType FieldTraits
<XWindow
*, nsOSG
>::_type(
109 XWindow::getClassType(),
113 OSG_FIELDTRAITS_GETTYPE_NS(XWindow
*, nsOSG
)
115 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
119 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
123 /***************************************************************************\
124 * Field Description *
125 \***************************************************************************/
127 void XWindowBase::classDescInserter(TypeObject
&oType
)
129 FieldDescriptionBase
*pDesc
= NULL
;
132 pDesc
= new SFDisplayP::Description(
133 SFDisplayP::getClassType(),
136 DisplayFieldId
, DisplayFieldMask
,
138 (Field::FClusterLocal
),
139 static_cast<FieldEditMethodSig
>(&XWindow::editHandleDisplay
),
140 static_cast<FieldGetMethodSig
>(&XWindow::getHandleDisplay
));
142 oType
.addInitialDesc(pDesc
);
144 pDesc
= new SFX11Window::Description(
145 SFX11Window::getClassType(),
148 WindowFieldId
, WindowFieldMask
,
150 (Field::FClusterLocal
),
151 static_cast<FieldEditMethodSig
>(&XWindow::editHandleWindow
),
152 static_cast<FieldGetMethodSig
>(&XWindow::getHandleWindow
));
154 oType
.addInitialDesc(pDesc
);
156 pDesc
= new SFGLXContext::Description(
157 SFGLXContext::getClassType(),
160 ContextFieldId
, ContextFieldMask
,
162 (Field::FClusterLocal
),
163 static_cast<FieldEditMethodSig
>(&XWindow::editHandleContext
),
164 static_cast<FieldGetMethodSig
>(&XWindow::getHandleContext
));
166 oType
.addInitialDesc(pDesc
);
168 pDesc
= new SFInt32::Description(
169 SFInt32::getClassType(),
172 FbConfigIdFieldId
, FbConfigIdFieldMask
,
174 (Field::FClusterLocal
),
175 static_cast<FieldEditMethodSig
>(&XWindow::editHandleFbConfigId
),
176 static_cast<FieldGetMethodSig
>(&XWindow::getHandleFbConfigId
));
178 oType
.addInitialDesc(pDesc
);
182 XWindowBase::TypeObject
XWindowBase::_type(
183 XWindowBase::getClassname(),
184 Inherited::getClassname(),
187 reinterpret_cast<PrototypeCreateF
>(&XWindowBase::createEmptyLocal
),
190 reinterpret_cast<InitalInsertDescFunc
>(&XWindow::classDescInserter
),
193 "<?xml version=\"1.0\"?>\n"
196 " name=\"XWindow\"\n"
197 " parent=\"Window\"\n"
198 " library=\"WindowX\"\n"
199 " pointerfieldtypes=\"both\"\n"
200 " structure=\"concrete\"\n"
201 " systemcomponent=\"true\"\n"
202 " parentsystemcomponent=\"true\"\n"
203 " docGroupBase=\"GrpWindowX\"\n"
205 " The class for X-based windows. See \\ref PageWindowX for a description.\n"
207 " name=\"display\"\n"
208 " type=\"DisplayP\"\n"
209 " cardinality=\"single\"\n"
210 " visibility=\"internal\"\n"
211 " defaultValue=\"NULL\"\n"
212 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
213 " access=\"public\"\n"
214 " fieldFlags=\"FClusterLocal\"\n"
219 " type=\"X11Window\"\n"
220 " cardinality=\"single\"\n"
221 " visibility=\"internal\"\n"
222 " defaultValue=\"NULL\"\n"
223 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
224 " access=\"public\"\n"
225 " fieldFlags=\"FClusterLocal\"\n"
229 " name=\"context\"\n"
230 " type=\"GLXContext\"\n"
231 " cardinality=\"single\"\n"
232 " visibility=\"internal\"\n"
233 " defaultValue=\"NULL\"\n"
234 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
235 " access=\"public\"\n"
236 " fieldFlags=\"FClusterLocal\"\n"
240 " name=\"fbConfigId\"\n"
242 " cardinality=\"single\"\n"
243 " visibility=\"internal\"\n"
244 " defaultValue=\"-1\"\n"
245 " access=\"public\"\n"
246 " fieldFlags=\"FClusterLocal\"\n"
249 "</FieldContainer>\n",
250 "The class for X-based windows. See \\ref PageWindowX for a description.\n"
253 /*------------------------------ get -----------------------------------*/
255 FieldContainerType
&XWindowBase::getType(void)
260 const FieldContainerType
&XWindowBase::getType(void) const
265 UInt32
XWindowBase::getContainerSize(void) const
267 return sizeof(XWindow
);
270 /*------------------------- decorator get ------------------------------*/
273 SFDisplayP
*XWindowBase::editSFDisplay(void)
275 editSField(DisplayFieldMask
);
280 const SFDisplayP
*XWindowBase::getSFDisplay(void) const
286 SFX11Window
*XWindowBase::editSFWindow(void)
288 editSField(WindowFieldMask
);
293 const SFX11Window
*XWindowBase::getSFWindow(void) const
299 SFGLXContext
*XWindowBase::editSFContext(void)
301 editSField(ContextFieldMask
);
306 const SFGLXContext
*XWindowBase::getSFContext(void) const
312 SFInt32
*XWindowBase::editSFFbConfigId(void)
314 editSField(FbConfigIdFieldMask
);
316 return &_sfFbConfigId
;
319 const SFInt32
*XWindowBase::getSFFbConfigId(void) const
321 return &_sfFbConfigId
;
329 /*------------------------------ access -----------------------------------*/
331 SizeT
XWindowBase::getBinSize(ConstFieldMaskArg whichField
)
333 SizeT returnValue
= Inherited::getBinSize(whichField
);
335 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
337 returnValue
+= _sfDisplay
.getBinSize();
339 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
341 returnValue
+= _sfWindow
.getBinSize();
343 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
345 returnValue
+= _sfContext
.getBinSize();
347 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
349 returnValue
+= _sfFbConfigId
.getBinSize();
355 void XWindowBase::copyToBin(BinaryDataHandler
&pMem
,
356 ConstFieldMaskArg whichField
)
358 Inherited::copyToBin(pMem
, whichField
);
360 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
362 _sfDisplay
.copyToBin(pMem
);
364 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
366 _sfWindow
.copyToBin(pMem
);
368 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
370 _sfContext
.copyToBin(pMem
);
372 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
374 _sfFbConfigId
.copyToBin(pMem
);
378 void XWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
379 ConstFieldMaskArg whichField
)
381 Inherited::copyFromBin(pMem
, whichField
);
383 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
385 editSField(DisplayFieldMask
);
386 _sfDisplay
.copyFromBin(pMem
);
388 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
390 editSField(WindowFieldMask
);
391 _sfWindow
.copyFromBin(pMem
);
393 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
395 editSField(ContextFieldMask
);
396 _sfContext
.copyFromBin(pMem
);
398 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
400 editSField(FbConfigIdFieldMask
);
401 _sfFbConfigId
.copyFromBin(pMem
);
405 //! create a new instance of the class
406 XWindowTransitPtr
XWindowBase::createLocal(BitVector bFlags
)
408 XWindowTransitPtr fc
;
410 if(getClassType().getPrototype() != NULL
)
412 FieldContainerTransitPtr tmpPtr
=
413 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
415 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
421 //! create a new instance of the class, copy the container flags
422 XWindowTransitPtr
XWindowBase::createDependent(BitVector bFlags
)
424 XWindowTransitPtr fc
;
426 if(getClassType().getPrototype() != NULL
)
428 FieldContainerTransitPtr tmpPtr
=
429 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
431 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
437 //! create a new instance of the class
438 XWindowTransitPtr
XWindowBase::create(void)
440 XWindowTransitPtr fc
;
442 if(getClassType().getPrototype() != NULL
)
444 FieldContainerTransitPtr tmpPtr
=
445 getClassType().getPrototype()-> shallowCopy();
447 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
453 XWindow
*XWindowBase::createEmptyLocal(BitVector bFlags
)
455 XWindow
*returnValue
;
457 newPtr
<XWindow
>(returnValue
, bFlags
);
459 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
464 //! create an empty new instance of the class, do not copy the prototype
465 XWindow
*XWindowBase::createEmpty(void)
467 XWindow
*returnValue
;
469 newPtr
<XWindow
>(returnValue
, Thread::getCurrentLocalFlags());
471 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
472 ~Thread::getCurrentLocalFlags();
478 FieldContainerTransitPtr
XWindowBase::shallowCopyLocal(
479 BitVector bFlags
) const
483 newPtr(tmpPtr
, dynamic_cast<const XWindow
*>(this), bFlags
);
485 FieldContainerTransitPtr
returnValue(tmpPtr
);
487 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
492 FieldContainerTransitPtr
XWindowBase::shallowCopyDependent(
493 BitVector bFlags
) const
497 newPtr(tmpPtr
, dynamic_cast<const XWindow
*>(this), ~bFlags
);
499 FieldContainerTransitPtr
returnValue(tmpPtr
);
501 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
506 FieldContainerTransitPtr
XWindowBase::shallowCopy(void) const
511 dynamic_cast<const XWindow
*>(this),
512 Thread::getCurrentLocalFlags());
514 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
516 FieldContainerTransitPtr
returnValue(tmpPtr
);
524 /*------------------------- constructors ----------------------------------*/
526 XWindowBase::XWindowBase(void) :
528 _sfDisplay (DisplayP(NULL
)),
529 _sfWindow (X11Window(NULL
)),
530 _sfContext (GLXContext(NULL
)),
531 _sfFbConfigId (Int32(-1))
535 XWindowBase::XWindowBase(const XWindowBase
&source
) :
537 _sfDisplay (source
._sfDisplay
),
538 _sfWindow (source
._sfWindow
),
539 _sfContext (source
._sfContext
),
540 _sfFbConfigId (source
._sfFbConfigId
)
545 /*-------------------------- destructors ----------------------------------*/
547 XWindowBase::~XWindowBase(void)
552 GetFieldHandlePtr
XWindowBase::getHandleDisplay (void) const
554 SFDisplayP::GetHandlePtr
returnValue(
555 new SFDisplayP::GetHandle(
557 this->getType().getFieldDesc(DisplayFieldId
),
558 const_cast<XWindowBase
*>(this)));
563 EditFieldHandlePtr
XWindowBase::editHandleDisplay (void)
565 SFDisplayP::EditHandlePtr
returnValue(
566 new SFDisplayP::EditHandle(
568 this->getType().getFieldDesc(DisplayFieldId
),
572 editSField(DisplayFieldMask
);
577 GetFieldHandlePtr
XWindowBase::getHandleWindow (void) const
579 SFX11Window::GetHandlePtr
returnValue(
580 new SFX11Window::GetHandle(
582 this->getType().getFieldDesc(WindowFieldId
),
583 const_cast<XWindowBase
*>(this)));
588 EditFieldHandlePtr
XWindowBase::editHandleWindow (void)
590 SFX11Window::EditHandlePtr
returnValue(
591 new SFX11Window::EditHandle(
593 this->getType().getFieldDesc(WindowFieldId
),
597 editSField(WindowFieldMask
);
602 GetFieldHandlePtr
XWindowBase::getHandleContext (void) const
604 SFGLXContext::GetHandlePtr
returnValue(
605 new SFGLXContext::GetHandle(
607 this->getType().getFieldDesc(ContextFieldId
),
608 const_cast<XWindowBase
*>(this)));
613 EditFieldHandlePtr
XWindowBase::editHandleContext (void)
615 SFGLXContext::EditHandlePtr
returnValue(
616 new SFGLXContext::EditHandle(
618 this->getType().getFieldDesc(ContextFieldId
),
622 editSField(ContextFieldMask
);
627 GetFieldHandlePtr
XWindowBase::getHandleFbConfigId (void) const
629 SFInt32::GetHandlePtr
returnValue(
630 new SFInt32::GetHandle(
632 this->getType().getFieldDesc(FbConfigIdFieldId
),
633 const_cast<XWindowBase
*>(this)));
638 EditFieldHandlePtr
XWindowBase::editHandleFbConfigId (void)
640 SFInt32::EditHandlePtr
returnValue(
641 new SFInt32::EditHandle(
643 this->getType().getFieldDesc(FbConfigIdFieldId
),
647 editSField(FbConfigIdFieldMask
);
653 #ifdef OSG_MT_CPTR_ASPECT
654 void XWindowBase::execSyncV( FieldContainer
&oFrom
,
655 ConstFieldMaskArg whichField
,
656 AspectOffsetStore
&oOffsets
,
657 ConstFieldMaskArg syncMode
,
658 const UInt32 uiSyncInfo
)
660 XWindow
*pThis
= static_cast<XWindow
*>(this);
662 pThis
->execSync(static_cast<XWindow
*>(&oFrom
),
671 #ifdef OSG_MT_CPTR_ASPECT
672 FieldContainer
*XWindowBase::createAspectCopy(
673 const FieldContainer
*pRefAspect
) const
675 XWindow
*returnValue
;
677 newAspectCopy(returnValue
,
678 dynamic_cast<const XWindow
*>(pRefAspect
),
679 dynamic_cast<const XWindow
*>(this));
685 void XWindowBase::resolveLinks(void)
687 Inherited::resolveLinks();