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 "OSGWIN32WindowBase.h"
62 #include "OSGWIN32Window.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::WIN32Window
77 The class for WIN32 windows.
80 /***************************************************************************\
81 * Field Documentation *
82 \***************************************************************************/
84 /*! \var HWND WIN32WindowBase::_sfHwnd
88 /*! \var HDC WIN32WindowBase::_sfHdc
92 /*! \var HGLRC WIN32WindowBase::_sfHglrc
96 /*! \var Int32 WIN32WindowBase::_sfDummy0
97 This field only exists so that all platform window types have the same
99 Otherwise transmitting field masks across a cluster is not possible.
103 /***************************************************************************\
104 * FieldType/FieldTrait Instantiation *
105 \***************************************************************************/
107 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
108 PointerType FieldTraits
<WIN32Window
*, nsOSG
>::_type(
111 WIN32Window::getClassType(),
115 OSG_FIELDTRAITS_GETTYPE_NS(WIN32Window
*, nsOSG
)
117 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
121 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
125 /***************************************************************************\
126 * Field Description *
127 \***************************************************************************/
129 void WIN32WindowBase::classDescInserter(TypeObject
&oType
)
131 FieldDescriptionBase
*pDesc
= NULL
;
134 pDesc
= new SFHWND::Description(
135 SFHWND::getClassType(),
138 HwndFieldId
, HwndFieldMask
,
140 (Field::FClusterLocal
),
141 static_cast<FieldEditMethodSig
>(&WIN32Window::editHandleHwnd
),
142 static_cast<FieldGetMethodSig
>(&WIN32Window::getHandleHwnd
));
144 oType
.addInitialDesc(pDesc
);
146 pDesc
= new SFHDC::Description(
147 SFHDC::getClassType(),
150 HdcFieldId
, HdcFieldMask
,
152 (Field::FClusterLocal
),
153 static_cast<FieldEditMethodSig
>(&WIN32Window::editHandleHdc
),
154 static_cast<FieldGetMethodSig
>(&WIN32Window::getHandleHdc
));
156 oType
.addInitialDesc(pDesc
);
158 pDesc
= new SFHGLRC::Description(
159 SFHGLRC::getClassType(),
162 HglrcFieldId
, HglrcFieldMask
,
164 (Field::FClusterLocal
),
165 static_cast<FieldEditMethodSig
>(&WIN32Window::editHandleHglrc
),
166 static_cast<FieldGetMethodSig
>(&WIN32Window::getHandleHglrc
));
168 oType
.addInitialDesc(pDesc
);
170 pDesc
= new SFInt32::Description(
171 SFInt32::getClassType(),
173 "This field only exists so that all platform window types have the same\n"
174 "number of fields.\n"
175 "Otherwise transmitting field masks across a cluster is not possible.\n",
176 Dummy0FieldId
, Dummy0FieldMask
,
178 (Field::FClusterLocal
),
179 static_cast<FieldEditMethodSig
>(&WIN32Window::editHandleDummy0
),
180 static_cast<FieldGetMethodSig
>(&WIN32Window::getHandleDummy0
));
182 oType
.addInitialDesc(pDesc
);
186 WIN32WindowBase::TypeObject
WIN32WindowBase::_type(
187 WIN32WindowBase::getClassname(),
188 Inherited::getClassname(),
191 reinterpret_cast<PrototypeCreateF
>(&WIN32WindowBase::createEmptyLocal
),
192 WIN32Window::initMethod
,
193 WIN32Window::exitMethod
,
194 reinterpret_cast<InitalInsertDescFunc
>(&WIN32Window::classDescInserter
),
197 "<?xml version=\"1.0\"?>\n"
200 " name=\"WIN32Window\"\n"
201 " parent=\"Window\"\n"
202 " library=\"WindowWIN32\"\n"
203 " pointerfieldtypes=\"both\"\n"
204 " structure=\"concrete\"\n"
205 " systemcomponent=\"true\"\n"
206 " parentsystemcomponent=\"true\"\n"
207 " docGroupBase=\"GrpWindowWIN32\"\n"
209 " The class for WIN32 windows.\n"
213 " cardinality=\"single\"\n"
214 " visibility=\"internal\"\n"
215 " defaultValue=\"0\"\n"
216 " fieldHeader=\"OSGWIN32WindowDataFields.h\"\n"
217 " access=\"public\"\n"
218 " fieldFlags=\"FClusterLocal\"\n"
224 " cardinality=\"single\"\n"
225 " visibility=\"internal\"\n"
226 " defaultValue=\"0\"\n"
227 " fieldHeader=\"OSGWIN32WindowDataFields.h\"\n"
228 " access=\"public\"\n"
229 " fieldFlags=\"FClusterLocal\"\n"
235 " cardinality=\"single\"\n"
236 " visibility=\"internal\"\n"
237 " defaultValue=\"0\"\n"
238 " fieldHeader=\"OSGWIN32WindowDataFields.h\"\n"
239 " access=\"public\"\n"
240 " fieldFlags=\"FClusterLocal\"\n"
246 " category=\"data\"\n"
247 " cardinality=\"single\"\n"
248 " visibility=\"internal\"\n"
249 " defaultValue=\"0\"\n"
250 " access=\"public\"\n"
251 " fieldFlags=\"FClusterLocal\"\n"
253 " This field only exists so that all platform window types have the same\n"
254 " number of fields.\n"
255 " Otherwise transmitting field masks across a cluster is not possible.\n"
257 "</FieldContainer>\n",
258 "The class for WIN32 windows.\n"
261 /*------------------------------ get -----------------------------------*/
263 FieldContainerType
&WIN32WindowBase::getType(void)
268 const FieldContainerType
&WIN32WindowBase::getType(void) const
273 UInt32
WIN32WindowBase::getContainerSize(void) const
275 return sizeof(WIN32Window
);
278 /*------------------------- decorator get ------------------------------*/
281 SFHWND
*WIN32WindowBase::editSFHwnd(void)
283 editSField(HwndFieldMask
);
288 const SFHWND
*WIN32WindowBase::getSFHwnd(void) const
294 SFHDC
*WIN32WindowBase::editSFHdc(void)
296 editSField(HdcFieldMask
);
301 const SFHDC
*WIN32WindowBase::getSFHdc(void) const
307 SFHGLRC
*WIN32WindowBase::editSFHglrc(void)
309 editSField(HglrcFieldMask
);
314 const SFHGLRC
*WIN32WindowBase::getSFHglrc(void) const
320 SFInt32
*WIN32WindowBase::editSFDummy0(void)
322 editSField(Dummy0FieldMask
);
327 const SFInt32
*WIN32WindowBase::getSFDummy0(void) const
337 /*------------------------------ access -----------------------------------*/
339 SizeT
WIN32WindowBase::getBinSize(ConstFieldMaskArg whichField
)
341 SizeT returnValue
= Inherited::getBinSize(whichField
);
343 if(FieldBits::NoField
!= (HwndFieldMask
& whichField
))
345 returnValue
+= _sfHwnd
.getBinSize();
347 if(FieldBits::NoField
!= (HdcFieldMask
& whichField
))
349 returnValue
+= _sfHdc
.getBinSize();
351 if(FieldBits::NoField
!= (HglrcFieldMask
& whichField
))
353 returnValue
+= _sfHglrc
.getBinSize();
355 if(FieldBits::NoField
!= (Dummy0FieldMask
& whichField
))
357 returnValue
+= _sfDummy0
.getBinSize();
363 void WIN32WindowBase::copyToBin(BinaryDataHandler
&pMem
,
364 ConstFieldMaskArg whichField
)
366 Inherited::copyToBin(pMem
, whichField
);
368 if(FieldBits::NoField
!= (HwndFieldMask
& whichField
))
370 _sfHwnd
.copyToBin(pMem
);
372 if(FieldBits::NoField
!= (HdcFieldMask
& whichField
))
374 _sfHdc
.copyToBin(pMem
);
376 if(FieldBits::NoField
!= (HglrcFieldMask
& whichField
))
378 _sfHglrc
.copyToBin(pMem
);
380 if(FieldBits::NoField
!= (Dummy0FieldMask
& whichField
))
382 _sfDummy0
.copyToBin(pMem
);
386 void WIN32WindowBase::copyFromBin(BinaryDataHandler
&pMem
,
387 ConstFieldMaskArg whichField
)
389 Inherited::copyFromBin(pMem
, whichField
);
391 if(FieldBits::NoField
!= (HwndFieldMask
& whichField
))
393 editSField(HwndFieldMask
);
394 _sfHwnd
.copyFromBin(pMem
);
396 if(FieldBits::NoField
!= (HdcFieldMask
& whichField
))
398 editSField(HdcFieldMask
);
399 _sfHdc
.copyFromBin(pMem
);
401 if(FieldBits::NoField
!= (HglrcFieldMask
& whichField
))
403 editSField(HglrcFieldMask
);
404 _sfHglrc
.copyFromBin(pMem
);
406 if(FieldBits::NoField
!= (Dummy0FieldMask
& whichField
))
408 editSField(Dummy0FieldMask
);
409 _sfDummy0
.copyFromBin(pMem
);
413 //! create a new instance of the class
414 WIN32WindowTransitPtr
WIN32WindowBase::createLocal(BitVector bFlags
)
416 WIN32WindowTransitPtr fc
;
418 if(getClassType().getPrototype() != NULL
)
420 FieldContainerTransitPtr tmpPtr
=
421 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
423 fc
= dynamic_pointer_cast
<WIN32Window
>(tmpPtr
);
429 //! create a new instance of the class, copy the container flags
430 WIN32WindowTransitPtr
WIN32WindowBase::createDependent(BitVector bFlags
)
432 WIN32WindowTransitPtr fc
;
434 if(getClassType().getPrototype() != NULL
)
436 FieldContainerTransitPtr tmpPtr
=
437 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
439 fc
= dynamic_pointer_cast
<WIN32Window
>(tmpPtr
);
445 //! create a new instance of the class
446 WIN32WindowTransitPtr
WIN32WindowBase::create(void)
448 WIN32WindowTransitPtr fc
;
450 if(getClassType().getPrototype() != NULL
)
452 FieldContainerTransitPtr tmpPtr
=
453 getClassType().getPrototype()-> shallowCopy();
455 fc
= dynamic_pointer_cast
<WIN32Window
>(tmpPtr
);
461 WIN32Window
*WIN32WindowBase::createEmptyLocal(BitVector bFlags
)
463 WIN32Window
*returnValue
;
465 newPtr
<WIN32Window
>(returnValue
, bFlags
);
467 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
472 //! create an empty new instance of the class, do not copy the prototype
473 WIN32Window
*WIN32WindowBase::createEmpty(void)
475 WIN32Window
*returnValue
;
477 newPtr
<WIN32Window
>(returnValue
, Thread::getCurrentLocalFlags());
479 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
480 ~Thread::getCurrentLocalFlags();
486 FieldContainerTransitPtr
WIN32WindowBase::shallowCopyLocal(
487 BitVector bFlags
) const
491 newPtr(tmpPtr
, dynamic_cast<const WIN32Window
*>(this), bFlags
);
493 FieldContainerTransitPtr
returnValue(tmpPtr
);
495 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
500 FieldContainerTransitPtr
WIN32WindowBase::shallowCopyDependent(
501 BitVector bFlags
) const
505 newPtr(tmpPtr
, dynamic_cast<const WIN32Window
*>(this), ~bFlags
);
507 FieldContainerTransitPtr
returnValue(tmpPtr
);
509 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
514 FieldContainerTransitPtr
WIN32WindowBase::shallowCopy(void) const
519 dynamic_cast<const WIN32Window
*>(this),
520 Thread::getCurrentLocalFlags());
522 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
524 FieldContainerTransitPtr
returnValue(tmpPtr
);
532 /*------------------------- constructors ----------------------------------*/
534 WIN32WindowBase::WIN32WindowBase(void) :
543 WIN32WindowBase::WIN32WindowBase(const WIN32WindowBase
&source
) :
545 _sfHwnd (source
._sfHwnd
),
546 _sfHdc (source
._sfHdc
),
547 _sfHglrc (source
._sfHglrc
),
548 _sfDummy0 (source
._sfDummy0
)
553 /*-------------------------- destructors ----------------------------------*/
555 WIN32WindowBase::~WIN32WindowBase(void)
560 GetFieldHandlePtr
WIN32WindowBase::getHandleHwnd (void) const
562 SFHWND::GetHandlePtr
returnValue(
563 new SFHWND::GetHandle(
565 this->getType().getFieldDesc(HwndFieldId
),
566 const_cast<WIN32WindowBase
*>(this)));
571 EditFieldHandlePtr
WIN32WindowBase::editHandleHwnd (void)
573 SFHWND::EditHandlePtr
returnValue(
574 new SFHWND::EditHandle(
576 this->getType().getFieldDesc(HwndFieldId
),
580 editSField(HwndFieldMask
);
585 GetFieldHandlePtr
WIN32WindowBase::getHandleHdc (void) const
587 SFHDC::GetHandlePtr
returnValue(
588 new SFHDC::GetHandle(
590 this->getType().getFieldDesc(HdcFieldId
),
591 const_cast<WIN32WindowBase
*>(this)));
596 EditFieldHandlePtr
WIN32WindowBase::editHandleHdc (void)
598 SFHDC::EditHandlePtr
returnValue(
599 new SFHDC::EditHandle(
601 this->getType().getFieldDesc(HdcFieldId
),
605 editSField(HdcFieldMask
);
610 GetFieldHandlePtr
WIN32WindowBase::getHandleHglrc (void) const
612 SFHGLRC::GetHandlePtr
returnValue(
613 new SFHGLRC::GetHandle(
615 this->getType().getFieldDesc(HglrcFieldId
),
616 const_cast<WIN32WindowBase
*>(this)));
621 EditFieldHandlePtr
WIN32WindowBase::editHandleHglrc (void)
623 SFHGLRC::EditHandlePtr
returnValue(
624 new SFHGLRC::EditHandle(
626 this->getType().getFieldDesc(HglrcFieldId
),
630 editSField(HglrcFieldMask
);
635 GetFieldHandlePtr
WIN32WindowBase::getHandleDummy0 (void) const
637 SFInt32::GetHandlePtr
returnValue(
638 new SFInt32::GetHandle(
640 this->getType().getFieldDesc(Dummy0FieldId
),
641 const_cast<WIN32WindowBase
*>(this)));
646 EditFieldHandlePtr
WIN32WindowBase::editHandleDummy0 (void)
648 SFInt32::EditHandlePtr
returnValue(
649 new SFInt32::EditHandle(
651 this->getType().getFieldDesc(Dummy0FieldId
),
655 editSField(Dummy0FieldMask
);
661 #ifdef OSG_MT_CPTR_ASPECT
662 void WIN32WindowBase::execSyncV( FieldContainer
&oFrom
,
663 ConstFieldMaskArg whichField
,
664 AspectOffsetStore
&oOffsets
,
665 ConstFieldMaskArg syncMode
,
666 const UInt32 uiSyncInfo
)
668 WIN32Window
*pThis
= static_cast<WIN32Window
*>(this);
670 pThis
->execSync(static_cast<WIN32Window
*>(&oFrom
),
679 #ifdef OSG_MT_CPTR_ASPECT
680 FieldContainer
*WIN32WindowBase::createAspectCopy(
681 const FieldContainer
*pRefAspect
) const
683 WIN32Window
*returnValue
;
685 newAspectCopy(returnValue
,
686 dynamic_cast<const WIN32Window
*>(pRefAspect
),
687 dynamic_cast<const WIN32Window
*>(this));
693 void WIN32WindowBase::resolveLinks(void)
695 Inherited::resolveLinks();