1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, carsten_neumann@gmx.net *
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 \*****************************************************************************/
57 #pragma warning(disable: 4355) // turn off 'this' : used in base member initializer list warning
58 #pragma warning(disable: 4290) // disable exception specification warning
61 #include "OSGConfig.h"
66 #include "OSGXWindowBase.h"
67 #include "OSGXWindow.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::XWindow
78 The class for X-based windows. See \ref PageWindowX for a description.
81 /***************************************************************************\
82 * Field Documentation *
83 \***************************************************************************/
85 /*! \var DisplayP XWindowBase::_sfDisplay
89 /*! \var X11Window XWindowBase::_sfWindow
93 /*! \var GLXContext XWindowBase::_sfContext
97 /*! \var Int32 XWindowBase::_sfFbConfigId
102 /***************************************************************************\
103 * FieldType/FieldTrait Instantiation *
104 \***************************************************************************/
106 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
107 PointerType FieldTraits
<XWindow
*, nsOSG
>::_type(
110 XWindow::getClassType(),
114 OSG_FIELDTRAITS_GETTYPE_NS(XWindow
*, nsOSG
)
116 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
120 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
124 /***************************************************************************\
125 * Field Description *
126 \***************************************************************************/
128 void XWindowBase::classDescInserter(TypeObject
&oType
)
130 FieldDescriptionBase
*pDesc
= NULL
;
133 pDesc
= new SFDisplayP::Description(
134 SFDisplayP::getClassType(),
137 DisplayFieldId
, DisplayFieldMask
,
139 (Field::FClusterLocal
),
140 static_cast<FieldEditMethodSig
>(&XWindow::editHandleDisplay
),
141 static_cast<FieldGetMethodSig
>(&XWindow::getHandleDisplay
));
143 oType
.addInitialDesc(pDesc
);
145 pDesc
= new SFX11Window::Description(
146 SFX11Window::getClassType(),
149 WindowFieldId
, WindowFieldMask
,
151 (Field::FClusterLocal
),
152 static_cast<FieldEditMethodSig
>(&XWindow::editHandleWindow
),
153 static_cast<FieldGetMethodSig
>(&XWindow::getHandleWindow
));
155 oType
.addInitialDesc(pDesc
);
157 pDesc
= new SFGLXContext::Description(
158 SFGLXContext::getClassType(),
161 ContextFieldId
, ContextFieldMask
,
163 (Field::FClusterLocal
),
164 static_cast<FieldEditMethodSig
>(&XWindow::editHandleContext
),
165 static_cast<FieldGetMethodSig
>(&XWindow::getHandleContext
));
167 oType
.addInitialDesc(pDesc
);
169 pDesc
= new SFInt32::Description(
170 SFInt32::getClassType(),
173 FbConfigIdFieldId
, FbConfigIdFieldMask
,
175 (Field::FClusterLocal
),
176 static_cast<FieldEditMethodSig
>(&XWindow::editHandleFbConfigId
),
177 static_cast<FieldGetMethodSig
>(&XWindow::getHandleFbConfigId
));
179 oType
.addInitialDesc(pDesc
);
183 XWindowBase::TypeObject
XWindowBase::_type(
184 XWindowBase::getClassname(),
185 Inherited::getClassname(),
188 reinterpret_cast<PrototypeCreateF
>(&XWindowBase::createEmptyLocal
),
189 reinterpret_cast<InitContainerF
>(&XWindow::initMethod
),
190 reinterpret_cast<ExitContainerF
>(&XWindow::exitMethod
),
191 reinterpret_cast<InitalInsertDescFunc
>(
192 reinterpret_cast<void *>(&XWindow::classDescInserter
)),
195 "<?xml version=\"1.0\"?>\n"
198 " name=\"XWindow\"\n"
199 " parent=\"Window\"\n"
200 " library=\"WindowX\"\n"
201 " pointerfieldtypes=\"both\"\n"
202 " structure=\"concrete\"\n"
203 " systemcomponent=\"true\"\n"
204 " parentsystemcomponent=\"true\"\n"
205 " docGroupBase=\"GrpWindowX\"\n"
207 " The class for X-based windows. See \\ref PageWindowX for a description.\n"
209 " name=\"display\"\n"
210 " type=\"DisplayP\"\n"
211 " cardinality=\"single\"\n"
212 " visibility=\"internal\"\n"
213 " defaultValue=\"NULL\"\n"
214 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
215 " access=\"public\"\n"
216 " fieldFlags=\"FClusterLocal\"\n"
221 " type=\"X11Window\"\n"
222 " cardinality=\"single\"\n"
223 " visibility=\"internal\"\n"
224 " defaultValue=\"NULL\"\n"
225 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
226 " access=\"public\"\n"
227 " fieldFlags=\"FClusterLocal\"\n"
231 " name=\"context\"\n"
232 " type=\"GLXContext\"\n"
233 " cardinality=\"single\"\n"
234 " visibility=\"internal\"\n"
235 " defaultValue=\"NULL\"\n"
236 " fieldHeader=\"OSGXWindowDataFields.h\"\n"
237 " access=\"public\"\n"
238 " fieldFlags=\"FClusterLocal\"\n"
242 " name=\"fbConfigId\"\n"
244 " cardinality=\"single\"\n"
245 " visibility=\"internal\"\n"
246 " defaultValue=\"-1\"\n"
247 " access=\"public\"\n"
248 " fieldFlags=\"FClusterLocal\"\n"
251 "</FieldContainer>\n",
252 "The class for X-based windows. See \\ref PageWindowX for a description.\n"
255 /*------------------------------ get -----------------------------------*/
257 FieldContainerType
&XWindowBase::getType(void)
262 const FieldContainerType
&XWindowBase::getType(void) const
267 UInt32
XWindowBase::getContainerSize(void) const
269 return sizeof(XWindow
);
272 /*------------------------- decorator get ------------------------------*/
275 SFDisplayP
*XWindowBase::editSFDisplay(void)
277 editSField(DisplayFieldMask
);
282 const SFDisplayP
*XWindowBase::getSFDisplay(void) const
288 SFX11Window
*XWindowBase::editSFWindow(void)
290 editSField(WindowFieldMask
);
295 const SFX11Window
*XWindowBase::getSFWindow(void) const
301 SFGLXContext
*XWindowBase::editSFContext(void)
303 editSField(ContextFieldMask
);
308 const SFGLXContext
*XWindowBase::getSFContext(void) const
314 SFInt32
*XWindowBase::editSFFbConfigId(void)
316 editSField(FbConfigIdFieldMask
);
318 return &_sfFbConfigId
;
321 const SFInt32
*XWindowBase::getSFFbConfigId(void) const
323 return &_sfFbConfigId
;
331 /*------------------------------ access -----------------------------------*/
333 SizeT
XWindowBase::getBinSize(ConstFieldMaskArg whichField
)
335 SizeT returnValue
= Inherited::getBinSize(whichField
);
337 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
339 returnValue
+= _sfDisplay
.getBinSize();
341 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
343 returnValue
+= _sfWindow
.getBinSize();
345 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
347 returnValue
+= _sfContext
.getBinSize();
349 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
351 returnValue
+= _sfFbConfigId
.getBinSize();
357 void XWindowBase::copyToBin(BinaryDataHandler
&pMem
,
358 ConstFieldMaskArg whichField
)
360 Inherited::copyToBin(pMem
, whichField
);
362 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
364 _sfDisplay
.copyToBin(pMem
);
366 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
368 _sfWindow
.copyToBin(pMem
);
370 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
372 _sfContext
.copyToBin(pMem
);
374 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
376 _sfFbConfigId
.copyToBin(pMem
);
380 void XWindowBase::copyFromBin(BinaryDataHandler
&pMem
,
381 ConstFieldMaskArg whichField
)
383 Inherited::copyFromBin(pMem
, whichField
);
385 if(FieldBits::NoField
!= (DisplayFieldMask
& whichField
))
387 editSField(DisplayFieldMask
);
388 _sfDisplay
.copyFromBin(pMem
);
390 if(FieldBits::NoField
!= (WindowFieldMask
& whichField
))
392 editSField(WindowFieldMask
);
393 _sfWindow
.copyFromBin(pMem
);
395 if(FieldBits::NoField
!= (ContextFieldMask
& whichField
))
397 editSField(ContextFieldMask
);
398 _sfContext
.copyFromBin(pMem
);
400 if(FieldBits::NoField
!= (FbConfigIdFieldMask
& whichField
))
402 editSField(FbConfigIdFieldMask
);
403 _sfFbConfigId
.copyFromBin(pMem
);
407 //! create a new instance of the class
408 XWindowTransitPtr
XWindowBase::createLocal(BitVector bFlags
)
410 XWindowTransitPtr fc
;
412 if(getClassType().getPrototype() != NULL
)
414 FieldContainerTransitPtr tmpPtr
=
415 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
417 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
423 //! create a new instance of the class, copy the container flags
424 XWindowTransitPtr
XWindowBase::createDependent(BitVector bFlags
)
426 XWindowTransitPtr fc
;
428 if(getClassType().getPrototype() != NULL
)
430 FieldContainerTransitPtr tmpPtr
=
431 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
433 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
439 //! create a new instance of the class
440 XWindowTransitPtr
XWindowBase::create(void)
442 XWindowTransitPtr fc
;
444 if(getClassType().getPrototype() != NULL
)
446 FieldContainerTransitPtr tmpPtr
=
447 getClassType().getPrototype()-> shallowCopy();
449 fc
= dynamic_pointer_cast
<XWindow
>(tmpPtr
);
455 XWindow
*XWindowBase::createEmptyLocal(BitVector bFlags
)
457 XWindow
*returnValue
;
459 newPtr
<XWindow
>(returnValue
, bFlags
);
461 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
466 //! create an empty new instance of the class, do not copy the prototype
467 XWindow
*XWindowBase::createEmpty(void)
469 XWindow
*returnValue
;
471 newPtr
<XWindow
>(returnValue
, Thread::getCurrentLocalFlags());
473 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
474 ~Thread::getCurrentLocalFlags();
480 FieldContainerTransitPtr
XWindowBase::shallowCopyLocal(
481 BitVector bFlags
) const
485 newPtr(tmpPtr
, dynamic_cast<const XWindow
*>(this), bFlags
);
487 FieldContainerTransitPtr
returnValue(tmpPtr
);
489 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
494 FieldContainerTransitPtr
XWindowBase::shallowCopyDependent(
495 BitVector bFlags
) const
499 newPtr(tmpPtr
, dynamic_cast<const XWindow
*>(this), ~bFlags
);
501 FieldContainerTransitPtr
returnValue(tmpPtr
);
503 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
508 FieldContainerTransitPtr
XWindowBase::shallowCopy(void) const
513 dynamic_cast<const XWindow
*>(this),
514 Thread::getCurrentLocalFlags());
516 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
518 FieldContainerTransitPtr
returnValue(tmpPtr
);
526 /*------------------------- constructors ----------------------------------*/
528 XWindowBase::XWindowBase(void) :
530 _sfDisplay (DisplayP(NULL
)),
531 _sfWindow (X11Window(NULL
)),
532 _sfContext (GLXContext(NULL
)),
533 _sfFbConfigId (Int32(-1))
537 XWindowBase::XWindowBase(const XWindowBase
&source
) :
539 _sfDisplay (source
._sfDisplay
),
540 _sfWindow (source
._sfWindow
),
541 _sfContext (source
._sfContext
),
542 _sfFbConfigId (source
._sfFbConfigId
)
547 /*-------------------------- destructors ----------------------------------*/
549 XWindowBase::~XWindowBase(void)
554 GetFieldHandlePtr
XWindowBase::getHandleDisplay (void) const
556 SFDisplayP::GetHandlePtr
returnValue(
557 new SFDisplayP::GetHandle(
559 this->getType().getFieldDesc(DisplayFieldId
),
560 const_cast<XWindowBase
*>(this)));
565 EditFieldHandlePtr
XWindowBase::editHandleDisplay (void)
567 SFDisplayP::EditHandlePtr
returnValue(
568 new SFDisplayP::EditHandle(
570 this->getType().getFieldDesc(DisplayFieldId
),
574 editSField(DisplayFieldMask
);
579 GetFieldHandlePtr
XWindowBase::getHandleWindow (void) const
581 SFX11Window::GetHandlePtr
returnValue(
582 new SFX11Window::GetHandle(
584 this->getType().getFieldDesc(WindowFieldId
),
585 const_cast<XWindowBase
*>(this)));
590 EditFieldHandlePtr
XWindowBase::editHandleWindow (void)
592 SFX11Window::EditHandlePtr
returnValue(
593 new SFX11Window::EditHandle(
595 this->getType().getFieldDesc(WindowFieldId
),
599 editSField(WindowFieldMask
);
604 GetFieldHandlePtr
XWindowBase::getHandleContext (void) const
606 SFGLXContext::GetHandlePtr
returnValue(
607 new SFGLXContext::GetHandle(
609 this->getType().getFieldDesc(ContextFieldId
),
610 const_cast<XWindowBase
*>(this)));
615 EditFieldHandlePtr
XWindowBase::editHandleContext (void)
617 SFGLXContext::EditHandlePtr
returnValue(
618 new SFGLXContext::EditHandle(
620 this->getType().getFieldDesc(ContextFieldId
),
624 editSField(ContextFieldMask
);
629 GetFieldHandlePtr
XWindowBase::getHandleFbConfigId (void) const
631 SFInt32::GetHandlePtr
returnValue(
632 new SFInt32::GetHandle(
634 this->getType().getFieldDesc(FbConfigIdFieldId
),
635 const_cast<XWindowBase
*>(this)));
640 EditFieldHandlePtr
XWindowBase::editHandleFbConfigId (void)
642 SFInt32::EditHandlePtr
returnValue(
643 new SFInt32::EditHandle(
645 this->getType().getFieldDesc(FbConfigIdFieldId
),
649 editSField(FbConfigIdFieldMask
);
655 #ifdef OSG_MT_CPTR_ASPECT
656 void XWindowBase::execSyncV( FieldContainer
&oFrom
,
657 ConstFieldMaskArg whichField
,
658 AspectOffsetStore
&oOffsets
,
659 ConstFieldMaskArg syncMode
,
660 const UInt32 uiSyncInfo
)
662 XWindow
*pThis
= static_cast<XWindow
*>(this);
664 pThis
->execSync(static_cast<XWindow
*>(&oFrom
),
673 #ifdef OSG_MT_CPTR_ASPECT
674 FieldContainer
*XWindowBase::createAspectCopy(
675 const FieldContainer
*pRefAspect
) const
677 XWindow
*returnValue
;
679 newAspectCopy(returnValue
,
680 dynamic_cast<const XWindow
*>(pRefAspect
),
681 dynamic_cast<const XWindow
*>(this));
687 void XWindowBase::resolveLinks(void)
689 Inherited::resolveLinks();