1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2000-2013 by the OpenSG Forum *
9 * contact: David Kabala (djkabala@gmail.com) *
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 **
48 ** class SimpleTextForeground!
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 "OSGSimpleTextForegroundBase.h"
67 #include "OSGSimpleTextForeground.h"
69 #include <boost/bind.hpp>
73 /***************************************************************************\
75 \***************************************************************************/
77 /*! \class OSG::SimpleTextForeground
78 OSG::SimpleTextForeground displays a simple list of text
79 lines. They are displayed using a compiled-in font that can use an arbitrary
80 color and that can be arbitrarily resized, with the size per line given in
83 The size and color used for all lines in _sfSize and _sfColor.
85 The color of the text can be overriden by using a special tag in the text
86 of the lines. \{\color=FF0000FF SomeText} will draw the SomeText with a
90 /***************************************************************************\
91 * Field Documentation *
92 \***************************************************************************/
94 /*! \var std::string SimpleTextForegroundBase::_mfLines
98 /*! \var Real32 SimpleTextForegroundBase::_sfSize
99 Height of a single line, in pixel.
102 /*! \var Color4f SimpleTextForegroundBase::_sfColor
106 /*! \var Color4f SimpleTextForegroundBase::_sfShadowColor
110 /*! \var Color4f SimpleTextForegroundBase::_sfBgColor
111 Color of the background.
114 /*! \var std::string SimpleTextForegroundBase::_sfFamily
115 The font family to be used, e.g. "SANS", default if unset.
118 /*! \var Vec2f SimpleTextForegroundBase::_sfShadowOffset
119 Offset of the shadow, in pixels.
122 /*! \var UInt8 SimpleTextForegroundBase::_sfHorizontalAlign
123 Simple form of layout management, defaults to SimpleTextForeground::Left.
126 /*! \var UInt8 SimpleTextForegroundBase::_sfVerticalAlign
127 Simple form of layout management, defaults to SimpleTextForeground::Top.
130 /*! \var Color4f SimpleTextForegroundBase::_sfBorderColor
134 /*! \var Vec2f SimpleTextForegroundBase::_sfBorderOffset
135 Offset of the border in pixels.
138 /*! \var Vec2f SimpleTextForegroundBase::_sfTextMargin
139 Text margin in pixels.
142 /*! \var bool SimpleTextForegroundBase::_sfTile
143 Should this foreground be tilable
147 /***************************************************************************\
148 * FieldType/FieldTrait Instantiation *
149 \***************************************************************************/
151 #if !defined(OSG_DO_DOC) || defined(OSG_DOC_DEV)
152 PointerType FieldTraits
<SimpleTextForeground
*, nsOSG
>::_type(
153 "SimpleTextForegroundPtr",
155 SimpleTextForeground::getClassType(),
159 OSG_FIELDTRAITS_GETTYPE_NS(SimpleTextForeground
*, nsOSG
)
161 OSG_EXPORT_PTR_SFIELD_FULL(PointerSField
,
162 SimpleTextForeground
*,
165 OSG_EXPORT_PTR_MFIELD_FULL(PointerMField
,
166 SimpleTextForeground
*,
169 /***************************************************************************\
170 * Field Description *
171 \***************************************************************************/
173 void SimpleTextForegroundBase::classDescInserter(TypeObject
&oType
)
175 FieldDescriptionBase
*pDesc
= NULL
;
178 pDesc
= new MFString::Description(
179 MFString::getClassType(),
181 "The lines of text.\n",
182 LinesFieldId
, LinesFieldMask
,
184 (Field::MFDefaultFlags
| Field::FStdAccess
),
185 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleLines
),
186 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleLines
));
188 oType
.addInitialDesc(pDesc
);
190 pDesc
= new SFReal32::Description(
191 SFReal32::getClassType(),
193 "Height of a single line, in pixel.\n",
194 SizeFieldId
, SizeFieldMask
,
196 (Field::SFDefaultFlags
| Field::FStdAccess
),
197 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleSize
),
198 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleSize
));
200 oType
.addInitialDesc(pDesc
);
202 pDesc
= new SFColor4f::Description(
203 SFColor4f::getClassType(),
205 "Color of the text.\n",
206 ColorFieldId
, ColorFieldMask
,
208 (Field::SFDefaultFlags
| Field::FStdAccess
),
209 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleColor
),
210 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleColor
));
212 oType
.addInitialDesc(pDesc
);
214 pDesc
= new SFColor4f::Description(
215 SFColor4f::getClassType(),
217 "Color of the shadow.\n",
218 ShadowColorFieldId
, ShadowColorFieldMask
,
220 (Field::SFDefaultFlags
| Field::FStdAccess
),
221 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleShadowColor
),
222 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleShadowColor
));
224 oType
.addInitialDesc(pDesc
);
226 pDesc
= new SFColor4f::Description(
227 SFColor4f::getClassType(),
229 "Color of the background.\n",
230 BgColorFieldId
, BgColorFieldMask
,
232 (Field::SFDefaultFlags
| Field::FStdAccess
),
233 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleBgColor
),
234 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleBgColor
));
236 oType
.addInitialDesc(pDesc
);
238 pDesc
= new SFString::Description(
239 SFString::getClassType(),
241 "The font family to be used, e.g. \"SANS\", default if unset.\n",
242 FamilyFieldId
, FamilyFieldMask
,
244 (Field::SFDefaultFlags
| Field::FStdAccess
),
245 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleFamily
),
246 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleFamily
));
248 oType
.addInitialDesc(pDesc
);
250 pDesc
= new SFVec2f::Description(
251 SFVec2f::getClassType(),
253 "Offset of the shadow, in pixels.\n",
254 ShadowOffsetFieldId
, ShadowOffsetFieldMask
,
256 (Field::SFDefaultFlags
| Field::FStdAccess
),
257 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleShadowOffset
),
258 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleShadowOffset
));
260 oType
.addInitialDesc(pDesc
);
262 pDesc
= new SFUInt8::Description(
263 SFUInt8::getClassType(),
265 "Simple form of layout management, defaults to SimpleTextForeground::Left.\n",
266 HorizontalAlignFieldId
, HorizontalAlignFieldMask
,
268 (Field::SFDefaultFlags
| Field::FStdAccess
),
269 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleHorizontalAlign
),
270 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleHorizontalAlign
));
272 oType
.addInitialDesc(pDesc
);
274 pDesc
= new SFUInt8::Description(
275 SFUInt8::getClassType(),
277 "Simple form of layout management, defaults to SimpleTextForeground::Top.\n",
278 VerticalAlignFieldId
, VerticalAlignFieldMask
,
280 (Field::SFDefaultFlags
| Field::FStdAccess
),
281 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleVerticalAlign
),
282 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleVerticalAlign
));
284 oType
.addInitialDesc(pDesc
);
286 pDesc
= new SFColor4f::Description(
287 SFColor4f::getClassType(),
289 "Color of the border.\n",
290 BorderColorFieldId
, BorderColorFieldMask
,
292 (Field::SFDefaultFlags
| Field::FStdAccess
),
293 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleBorderColor
),
294 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleBorderColor
));
296 oType
.addInitialDesc(pDesc
);
298 pDesc
= new SFVec2f::Description(
299 SFVec2f::getClassType(),
301 "Offset of the border in pixels.\n",
302 BorderOffsetFieldId
, BorderOffsetFieldMask
,
304 (Field::SFDefaultFlags
| Field::FStdAccess
),
305 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleBorderOffset
),
306 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleBorderOffset
));
308 oType
.addInitialDesc(pDesc
);
310 pDesc
= new SFVec2f::Description(
311 SFVec2f::getClassType(),
313 "Text margin in pixels.\n",
314 TextMarginFieldId
, TextMarginFieldMask
,
316 (Field::SFDefaultFlags
| Field::FStdAccess
),
317 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleTextMargin
),
318 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleTextMargin
));
320 oType
.addInitialDesc(pDesc
);
322 pDesc
= new SFBool::Description(
323 SFBool::getClassType(),
325 "Should this foreground be tilable\n",
326 TileFieldId
, TileFieldMask
,
328 (Field::SFDefaultFlags
| Field::FStdAccess
),
329 static_cast<FieldEditMethodSig
>(&SimpleTextForeground::editHandleTile
),
330 static_cast<FieldGetMethodSig
>(&SimpleTextForeground::getHandleTile
));
332 oType
.addInitialDesc(pDesc
);
336 SimpleTextForegroundBase::TypeObject
SimpleTextForegroundBase::_type(
337 SimpleTextForegroundBase::getClassname(),
338 Inherited::getClassname(),
341 reinterpret_cast<PrototypeCreateF
>(&SimpleTextForegroundBase::createEmptyLocal
),
342 reinterpret_cast<InitContainerF
>(&SimpleTextForeground::initMethod
),
343 reinterpret_cast<ExitContainerF
>(&SimpleTextForeground::exitMethod
),
344 reinterpret_cast<InitalInsertDescFunc
>(
345 reinterpret_cast<void *>(&SimpleTextForeground::classDescInserter
)),
348 "<?xml version=\"1.0\"?>\n"
351 " name=\"SimpleTextForeground\"\n"
352 " parent=\"Foreground\"\n"
353 " library=\"Window\"\n"
354 " pointerfieldtypes=\"both\"\n"
355 " structure=\"concrete\"\n"
356 " systemcomponent=\"true\"\n"
357 " parentsystemcomponent=\"true\"\n"
358 " decoratable=\"false\"\n"
359 " docGroupBase=\"GrpUtil\"\n"
360 " authors=\"David Kabala (djkabala@gmail.com)\"\n"
362 " OSG::SimpleTextForeground displays a simple list of text\n"
363 " lines. They are displayed using a compiled-in font that can use an arbitrary\n"
364 " color and that can be arbitrarily resized, with the size per line given in\n"
367 " The size and color used for all lines in _sfSize and _sfColor.\n"
369 " The color of the text can be overriden by using a special tag in the text \n"
370 " of the lines. \\{\\color=FF0000FF SomeText} will draw the SomeText with a\n"
374 " type=\"std::string\"\n"
375 " cardinality=\"multi\"\n"
376 " visibility=\"external\"\n"
377 " access=\"public\"\n"
379 " The lines of text.\n"
384 " cardinality=\"single\"\n"
385 " visibility=\"external\"\n"
386 " defaultValue=\"16\"\n"
387 " access=\"public\"\n"
389 " Height of a single line, in pixel.\n"
393 " type=\"Color4f\"\n"
394 " cardinality=\"single\"\n"
395 " visibility=\"external\"\n"
396 " defaultValue=\"1,1,1,1\"\n"
397 " access=\"public\"\n"
399 " Color of the text.\n"
402 " name=\"ShadowColor\"\n"
403 " type=\"Color4f\"\n"
404 " cardinality=\"single\"\n"
405 " visibility=\"external\"\n"
406 " defaultValue=\"0,0,0,1\"\n"
407 " access=\"public\"\n"
409 " Color of the shadow.\n"
412 " name=\"BgColor\"\n"
413 " type=\"Color4f\"\n"
414 " cardinality=\"single\"\n"
415 " visibility=\"external\"\n"
416 " defaultValue=\"0,0,0,0\"\n"
417 " access=\"public\"\n"
419 " Color of the background.\n"
423 " type=\"std::string\"\n"
424 " cardinality=\"single\"\n"
425 " visibility=\"external\"\n"
426 " access=\"public\"\n"
428 " The font family to be used, e.g. \"SANS\", default if unset.\n"
431 " name=\"ShadowOffset\"\n"
433 " cardinality=\"single\"\n"
434 " visibility=\"external\"\n"
435 " defaultValue=\"1,-1\"\n"
436 " access=\"public\"\n"
438 " Offset of the shadow, in pixels.\n"
441 " name=\"HorizontalAlign\"\n"
443 " cardinality=\"single\"\n"
444 " visibility=\"external\"\n"
445 " defaultValue=\"SimpleTextForeground::Left\"\n"
446 " access=\"public\"\n"
448 " Simple form of layout management, defaults to SimpleTextForeground::Left.\n"
451 " name=\"VerticalAlign\"\n"
453 " cardinality=\"single\"\n"
454 " visibility=\"external\"\n"
455 " defaultValue=\"SimpleTextForeground::Top\"\n"
456 " access=\"public\"\n"
458 " Simple form of layout management, defaults to SimpleTextForeground::Top.\n"
461 " name=\"BorderColor\"\n"
462 " type=\"Color4f\"\n"
463 " cardinality=\"single\"\n"
464 " visibility=\"external\"\n"
465 " defaultValue=\"0,0,0,0\"\n"
466 " access=\"public\"\n"
468 " Color of the border.\n"
471 " name=\"BorderOffset\"\n"
473 " cardinality=\"single\"\n"
474 " visibility=\"external\"\n"
475 " defaultValue=\"4,4\"\n"
476 " access=\"public\"\n"
478 " Offset of the border in pixels.\n"
481 " name=\"TextMargin\"\n"
483 " cardinality=\"single\"\n"
484 " visibility=\"external\"\n"
485 " defaultValue=\"0,0\"\n"
486 " access=\"public\"\n"
488 " Text margin in pixels.\n"
493 " category=\"data\"\n"
494 " cardinality=\"single\"\n"
495 " visibility=\"external\"\n"
496 " defaultValue=\"false\"\n"
497 " access=\"public\"\n"
499 " Should this foreground be tilable\n"
501 "</FieldContainer>\n",
502 "OSG::SimpleTextForeground displays a simple list of text\n"
503 "lines. They are displayed using a compiled-in font that can use an arbitrary\n"
504 "color and that can be arbitrarily resized, with the size per line given in\n"
507 "The size and color used for all lines in _sfSize and _sfColor.\n"
509 "The color of the text can be overriden by using a special tag in the text \n"
510 "of the lines. \\{\\color=FF0000FF SomeText} will draw the SomeText with a\n"
514 /*------------------------------ get -----------------------------------*/
516 FieldContainerType
&SimpleTextForegroundBase::getType(void)
521 const FieldContainerType
&SimpleTextForegroundBase::getType(void) const
526 UInt32
SimpleTextForegroundBase::getContainerSize(void) const
528 return sizeof(SimpleTextForeground
);
531 /*------------------------- decorator get ------------------------------*/
534 MFString
*SimpleTextForegroundBase::editMFLines(void)
536 editMField(LinesFieldMask
, _mfLines
);
541 const MFString
*SimpleTextForegroundBase::getMFLines(void) const
547 SFReal32
*SimpleTextForegroundBase::editSFSize(void)
549 editSField(SizeFieldMask
);
554 const SFReal32
*SimpleTextForegroundBase::getSFSize(void) const
560 SFColor4f
*SimpleTextForegroundBase::editSFColor(void)
562 editSField(ColorFieldMask
);
567 const SFColor4f
*SimpleTextForegroundBase::getSFColor(void) const
573 SFColor4f
*SimpleTextForegroundBase::editSFShadowColor(void)
575 editSField(ShadowColorFieldMask
);
577 return &_sfShadowColor
;
580 const SFColor4f
*SimpleTextForegroundBase::getSFShadowColor(void) const
582 return &_sfShadowColor
;
586 SFColor4f
*SimpleTextForegroundBase::editSFBgColor(void)
588 editSField(BgColorFieldMask
);
593 const SFColor4f
*SimpleTextForegroundBase::getSFBgColor(void) const
599 SFString
*SimpleTextForegroundBase::editSFFamily(void)
601 editSField(FamilyFieldMask
);
606 const SFString
*SimpleTextForegroundBase::getSFFamily(void) const
612 SFVec2f
*SimpleTextForegroundBase::editSFShadowOffset(void)
614 editSField(ShadowOffsetFieldMask
);
616 return &_sfShadowOffset
;
619 const SFVec2f
*SimpleTextForegroundBase::getSFShadowOffset(void) const
621 return &_sfShadowOffset
;
625 SFUInt8
*SimpleTextForegroundBase::editSFHorizontalAlign(void)
627 editSField(HorizontalAlignFieldMask
);
629 return &_sfHorizontalAlign
;
632 const SFUInt8
*SimpleTextForegroundBase::getSFHorizontalAlign(void) const
634 return &_sfHorizontalAlign
;
638 SFUInt8
*SimpleTextForegroundBase::editSFVerticalAlign(void)
640 editSField(VerticalAlignFieldMask
);
642 return &_sfVerticalAlign
;
645 const SFUInt8
*SimpleTextForegroundBase::getSFVerticalAlign(void) const
647 return &_sfVerticalAlign
;
651 SFColor4f
*SimpleTextForegroundBase::editSFBorderColor(void)
653 editSField(BorderColorFieldMask
);
655 return &_sfBorderColor
;
658 const SFColor4f
*SimpleTextForegroundBase::getSFBorderColor(void) const
660 return &_sfBorderColor
;
664 SFVec2f
*SimpleTextForegroundBase::editSFBorderOffset(void)
666 editSField(BorderOffsetFieldMask
);
668 return &_sfBorderOffset
;
671 const SFVec2f
*SimpleTextForegroundBase::getSFBorderOffset(void) const
673 return &_sfBorderOffset
;
677 SFVec2f
*SimpleTextForegroundBase::editSFTextMargin(void)
679 editSField(TextMarginFieldMask
);
681 return &_sfTextMargin
;
684 const SFVec2f
*SimpleTextForegroundBase::getSFTextMargin(void) const
686 return &_sfTextMargin
;
690 SFBool
*SimpleTextForegroundBase::editSFTile(void)
692 editSField(TileFieldMask
);
697 const SFBool
*SimpleTextForegroundBase::getSFTile(void) const
707 /*------------------------------ access -----------------------------------*/
709 SizeT
SimpleTextForegroundBase::getBinSize(ConstFieldMaskArg whichField
)
711 SizeT returnValue
= Inherited::getBinSize(whichField
);
713 if(FieldBits::NoField
!= (LinesFieldMask
& whichField
))
715 returnValue
+= _mfLines
.getBinSize();
717 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
719 returnValue
+= _sfSize
.getBinSize();
721 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
723 returnValue
+= _sfColor
.getBinSize();
725 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
727 returnValue
+= _sfShadowColor
.getBinSize();
729 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
731 returnValue
+= _sfBgColor
.getBinSize();
733 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
735 returnValue
+= _sfFamily
.getBinSize();
737 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
739 returnValue
+= _sfShadowOffset
.getBinSize();
741 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
743 returnValue
+= _sfHorizontalAlign
.getBinSize();
745 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
747 returnValue
+= _sfVerticalAlign
.getBinSize();
749 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
751 returnValue
+= _sfBorderColor
.getBinSize();
753 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
755 returnValue
+= _sfBorderOffset
.getBinSize();
757 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
759 returnValue
+= _sfTextMargin
.getBinSize();
761 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
763 returnValue
+= _sfTile
.getBinSize();
769 void SimpleTextForegroundBase::copyToBin(BinaryDataHandler
&pMem
,
770 ConstFieldMaskArg whichField
)
772 Inherited::copyToBin(pMem
, whichField
);
774 if(FieldBits::NoField
!= (LinesFieldMask
& whichField
))
776 _mfLines
.copyToBin(pMem
);
778 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
780 _sfSize
.copyToBin(pMem
);
782 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
784 _sfColor
.copyToBin(pMem
);
786 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
788 _sfShadowColor
.copyToBin(pMem
);
790 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
792 _sfBgColor
.copyToBin(pMem
);
794 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
796 _sfFamily
.copyToBin(pMem
);
798 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
800 _sfShadowOffset
.copyToBin(pMem
);
802 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
804 _sfHorizontalAlign
.copyToBin(pMem
);
806 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
808 _sfVerticalAlign
.copyToBin(pMem
);
810 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
812 _sfBorderColor
.copyToBin(pMem
);
814 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
816 _sfBorderOffset
.copyToBin(pMem
);
818 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
820 _sfTextMargin
.copyToBin(pMem
);
822 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
824 _sfTile
.copyToBin(pMem
);
828 void SimpleTextForegroundBase::copyFromBin(BinaryDataHandler
&pMem
,
829 ConstFieldMaskArg whichField
)
831 Inherited::copyFromBin(pMem
, whichField
);
833 if(FieldBits::NoField
!= (LinesFieldMask
& whichField
))
835 editMField(LinesFieldMask
, _mfLines
);
836 _mfLines
.copyFromBin(pMem
);
838 if(FieldBits::NoField
!= (SizeFieldMask
& whichField
))
840 editSField(SizeFieldMask
);
841 _sfSize
.copyFromBin(pMem
);
843 if(FieldBits::NoField
!= (ColorFieldMask
& whichField
))
845 editSField(ColorFieldMask
);
846 _sfColor
.copyFromBin(pMem
);
848 if(FieldBits::NoField
!= (ShadowColorFieldMask
& whichField
))
850 editSField(ShadowColorFieldMask
);
851 _sfShadowColor
.copyFromBin(pMem
);
853 if(FieldBits::NoField
!= (BgColorFieldMask
& whichField
))
855 editSField(BgColorFieldMask
);
856 _sfBgColor
.copyFromBin(pMem
);
858 if(FieldBits::NoField
!= (FamilyFieldMask
& whichField
))
860 editSField(FamilyFieldMask
);
861 _sfFamily
.copyFromBin(pMem
);
863 if(FieldBits::NoField
!= (ShadowOffsetFieldMask
& whichField
))
865 editSField(ShadowOffsetFieldMask
);
866 _sfShadowOffset
.copyFromBin(pMem
);
868 if(FieldBits::NoField
!= (HorizontalAlignFieldMask
& whichField
))
870 editSField(HorizontalAlignFieldMask
);
871 _sfHorizontalAlign
.copyFromBin(pMem
);
873 if(FieldBits::NoField
!= (VerticalAlignFieldMask
& whichField
))
875 editSField(VerticalAlignFieldMask
);
876 _sfVerticalAlign
.copyFromBin(pMem
);
878 if(FieldBits::NoField
!= (BorderColorFieldMask
& whichField
))
880 editSField(BorderColorFieldMask
);
881 _sfBorderColor
.copyFromBin(pMem
);
883 if(FieldBits::NoField
!= (BorderOffsetFieldMask
& whichField
))
885 editSField(BorderOffsetFieldMask
);
886 _sfBorderOffset
.copyFromBin(pMem
);
888 if(FieldBits::NoField
!= (TextMarginFieldMask
& whichField
))
890 editSField(TextMarginFieldMask
);
891 _sfTextMargin
.copyFromBin(pMem
);
893 if(FieldBits::NoField
!= (TileFieldMask
& whichField
))
895 editSField(TileFieldMask
);
896 _sfTile
.copyFromBin(pMem
);
900 //! create a new instance of the class
901 SimpleTextForegroundTransitPtr
SimpleTextForegroundBase::createLocal(BitVector bFlags
)
903 SimpleTextForegroundTransitPtr fc
;
905 if(getClassType().getPrototype() != NULL
)
907 FieldContainerTransitPtr tmpPtr
=
908 getClassType().getPrototype()-> shallowCopyLocal(bFlags
);
910 fc
= dynamic_pointer_cast
<SimpleTextForeground
>(tmpPtr
);
916 //! create a new instance of the class, copy the container flags
917 SimpleTextForegroundTransitPtr
SimpleTextForegroundBase::createDependent(BitVector bFlags
)
919 SimpleTextForegroundTransitPtr fc
;
921 if(getClassType().getPrototype() != NULL
)
923 FieldContainerTransitPtr tmpPtr
=
924 getClassType().getPrototype()-> shallowCopyDependent(bFlags
);
926 fc
= dynamic_pointer_cast
<SimpleTextForeground
>(tmpPtr
);
932 //! create a new instance of the class
933 SimpleTextForegroundTransitPtr
SimpleTextForegroundBase::create(void)
935 SimpleTextForegroundTransitPtr fc
;
937 if(getClassType().getPrototype() != NULL
)
939 FieldContainerTransitPtr tmpPtr
=
940 getClassType().getPrototype()-> shallowCopy();
942 fc
= dynamic_pointer_cast
<SimpleTextForeground
>(tmpPtr
);
948 SimpleTextForeground
*SimpleTextForegroundBase::createEmptyLocal(BitVector bFlags
)
950 SimpleTextForeground
*returnValue
;
952 newPtr
<SimpleTextForeground
>(returnValue
, bFlags
);
954 returnValue
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
959 //! create an empty new instance of the class, do not copy the prototype
960 SimpleTextForeground
*SimpleTextForegroundBase::createEmpty(void)
962 SimpleTextForeground
*returnValue
;
964 newPtr
<SimpleTextForeground
>(returnValue
, Thread::getCurrentLocalFlags());
966 returnValue
->_pFieldFlags
->_bNamespaceMask
&=
967 ~Thread::getCurrentLocalFlags();
973 FieldContainerTransitPtr
SimpleTextForegroundBase::shallowCopyLocal(
974 BitVector bFlags
) const
976 SimpleTextForeground
*tmpPtr
;
978 newPtr(tmpPtr
, dynamic_cast<const SimpleTextForeground
*>(this), bFlags
);
980 FieldContainerTransitPtr
returnValue(tmpPtr
);
982 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~bFlags
;
987 FieldContainerTransitPtr
SimpleTextForegroundBase::shallowCopyDependent(
988 BitVector bFlags
) const
990 SimpleTextForeground
*tmpPtr
;
992 newPtr(tmpPtr
, dynamic_cast<const SimpleTextForeground
*>(this), ~bFlags
);
994 FieldContainerTransitPtr
returnValue(tmpPtr
);
996 tmpPtr
->_pFieldFlags
->_bNamespaceMask
= bFlags
;
1001 FieldContainerTransitPtr
SimpleTextForegroundBase::shallowCopy(void) const
1003 SimpleTextForeground
*tmpPtr
;
1006 dynamic_cast<const SimpleTextForeground
*>(this),
1007 Thread::getCurrentLocalFlags());
1009 tmpPtr
->_pFieldFlags
->_bNamespaceMask
&= ~Thread::getCurrentLocalFlags();
1011 FieldContainerTransitPtr
returnValue(tmpPtr
);
1019 /*------------------------- constructors ----------------------------------*/
1021 SimpleTextForegroundBase::SimpleTextForegroundBase(void) :
1024 _sfSize (Real32(16)),
1025 _sfColor (Color4f(1,1,1,1)),
1026 _sfShadowColor (Color4f(0,0,0,1)),
1027 _sfBgColor (Color4f(0,0,0,0)),
1029 _sfShadowOffset (Vec2f(1,-1)),
1030 _sfHorizontalAlign (UInt8(SimpleTextForeground::Left
)),
1031 _sfVerticalAlign (UInt8(SimpleTextForeground::Top
)),
1032 _sfBorderColor (Color4f(0,0,0,0)),
1033 _sfBorderOffset (Vec2f(4,4)),
1034 _sfTextMargin (Vec2f(0,0)),
1035 _sfTile (bool(false))
1039 SimpleTextForegroundBase::SimpleTextForegroundBase(const SimpleTextForegroundBase
&source
) :
1041 _mfLines (source
._mfLines
),
1042 _sfSize (source
._sfSize
),
1043 _sfColor (source
._sfColor
),
1044 _sfShadowColor (source
._sfShadowColor
),
1045 _sfBgColor (source
._sfBgColor
),
1046 _sfFamily (source
._sfFamily
),
1047 _sfShadowOffset (source
._sfShadowOffset
),
1048 _sfHorizontalAlign (source
._sfHorizontalAlign
),
1049 _sfVerticalAlign (source
._sfVerticalAlign
),
1050 _sfBorderColor (source
._sfBorderColor
),
1051 _sfBorderOffset (source
._sfBorderOffset
),
1052 _sfTextMargin (source
._sfTextMargin
),
1053 _sfTile (source
._sfTile
)
1058 /*-------------------------- destructors ----------------------------------*/
1060 SimpleTextForegroundBase::~SimpleTextForegroundBase(void)
1065 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleLines (void) const
1067 MFString::GetHandlePtr
returnValue(
1068 new MFString::GetHandle(
1070 this->getType().getFieldDesc(LinesFieldId
),
1071 const_cast<SimpleTextForegroundBase
*>(this)));
1076 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleLines (void)
1078 MFString::EditHandlePtr
returnValue(
1079 new MFString::EditHandle(
1081 this->getType().getFieldDesc(LinesFieldId
),
1085 editMField(LinesFieldMask
, _mfLines
);
1090 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleSize (void) const
1092 SFReal32::GetHandlePtr
returnValue(
1093 new SFReal32::GetHandle(
1095 this->getType().getFieldDesc(SizeFieldId
),
1096 const_cast<SimpleTextForegroundBase
*>(this)));
1101 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleSize (void)
1103 SFReal32::EditHandlePtr
returnValue(
1104 new SFReal32::EditHandle(
1106 this->getType().getFieldDesc(SizeFieldId
),
1110 editSField(SizeFieldMask
);
1115 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleColor (void) const
1117 SFColor4f::GetHandlePtr
returnValue(
1118 new SFColor4f::GetHandle(
1120 this->getType().getFieldDesc(ColorFieldId
),
1121 const_cast<SimpleTextForegroundBase
*>(this)));
1126 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleColor (void)
1128 SFColor4f::EditHandlePtr
returnValue(
1129 new SFColor4f::EditHandle(
1131 this->getType().getFieldDesc(ColorFieldId
),
1135 editSField(ColorFieldMask
);
1140 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleShadowColor (void) const
1142 SFColor4f::GetHandlePtr
returnValue(
1143 new SFColor4f::GetHandle(
1145 this->getType().getFieldDesc(ShadowColorFieldId
),
1146 const_cast<SimpleTextForegroundBase
*>(this)));
1151 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleShadowColor (void)
1153 SFColor4f::EditHandlePtr
returnValue(
1154 new SFColor4f::EditHandle(
1156 this->getType().getFieldDesc(ShadowColorFieldId
),
1160 editSField(ShadowColorFieldMask
);
1165 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleBgColor (void) const
1167 SFColor4f::GetHandlePtr
returnValue(
1168 new SFColor4f::GetHandle(
1170 this->getType().getFieldDesc(BgColorFieldId
),
1171 const_cast<SimpleTextForegroundBase
*>(this)));
1176 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleBgColor (void)
1178 SFColor4f::EditHandlePtr
returnValue(
1179 new SFColor4f::EditHandle(
1181 this->getType().getFieldDesc(BgColorFieldId
),
1185 editSField(BgColorFieldMask
);
1190 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleFamily (void) const
1192 SFString::GetHandlePtr
returnValue(
1193 new SFString::GetHandle(
1195 this->getType().getFieldDesc(FamilyFieldId
),
1196 const_cast<SimpleTextForegroundBase
*>(this)));
1201 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleFamily (void)
1203 SFString::EditHandlePtr
returnValue(
1204 new SFString::EditHandle(
1206 this->getType().getFieldDesc(FamilyFieldId
),
1210 editSField(FamilyFieldMask
);
1215 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleShadowOffset (void) const
1217 SFVec2f::GetHandlePtr
returnValue(
1218 new SFVec2f::GetHandle(
1220 this->getType().getFieldDesc(ShadowOffsetFieldId
),
1221 const_cast<SimpleTextForegroundBase
*>(this)));
1226 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleShadowOffset (void)
1228 SFVec2f::EditHandlePtr
returnValue(
1229 new SFVec2f::EditHandle(
1231 this->getType().getFieldDesc(ShadowOffsetFieldId
),
1235 editSField(ShadowOffsetFieldMask
);
1240 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleHorizontalAlign (void) const
1242 SFUInt8::GetHandlePtr
returnValue(
1243 new SFUInt8::GetHandle(
1244 &_sfHorizontalAlign
,
1245 this->getType().getFieldDesc(HorizontalAlignFieldId
),
1246 const_cast<SimpleTextForegroundBase
*>(this)));
1251 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleHorizontalAlign(void)
1253 SFUInt8::EditHandlePtr
returnValue(
1254 new SFUInt8::EditHandle(
1255 &_sfHorizontalAlign
,
1256 this->getType().getFieldDesc(HorizontalAlignFieldId
),
1260 editSField(HorizontalAlignFieldMask
);
1265 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleVerticalAlign (void) const
1267 SFUInt8::GetHandlePtr
returnValue(
1268 new SFUInt8::GetHandle(
1270 this->getType().getFieldDesc(VerticalAlignFieldId
),
1271 const_cast<SimpleTextForegroundBase
*>(this)));
1276 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleVerticalAlign (void)
1278 SFUInt8::EditHandlePtr
returnValue(
1279 new SFUInt8::EditHandle(
1281 this->getType().getFieldDesc(VerticalAlignFieldId
),
1285 editSField(VerticalAlignFieldMask
);
1290 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleBorderColor (void) const
1292 SFColor4f::GetHandlePtr
returnValue(
1293 new SFColor4f::GetHandle(
1295 this->getType().getFieldDesc(BorderColorFieldId
),
1296 const_cast<SimpleTextForegroundBase
*>(this)));
1301 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleBorderColor (void)
1303 SFColor4f::EditHandlePtr
returnValue(
1304 new SFColor4f::EditHandle(
1306 this->getType().getFieldDesc(BorderColorFieldId
),
1310 editSField(BorderColorFieldMask
);
1315 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleBorderOffset (void) const
1317 SFVec2f::GetHandlePtr
returnValue(
1318 new SFVec2f::GetHandle(
1320 this->getType().getFieldDesc(BorderOffsetFieldId
),
1321 const_cast<SimpleTextForegroundBase
*>(this)));
1326 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleBorderOffset (void)
1328 SFVec2f::EditHandlePtr
returnValue(
1329 new SFVec2f::EditHandle(
1331 this->getType().getFieldDesc(BorderOffsetFieldId
),
1335 editSField(BorderOffsetFieldMask
);
1340 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleTextMargin (void) const
1342 SFVec2f::GetHandlePtr
returnValue(
1343 new SFVec2f::GetHandle(
1345 this->getType().getFieldDesc(TextMarginFieldId
),
1346 const_cast<SimpleTextForegroundBase
*>(this)));
1351 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleTextMargin (void)
1353 SFVec2f::EditHandlePtr
returnValue(
1354 new SFVec2f::EditHandle(
1356 this->getType().getFieldDesc(TextMarginFieldId
),
1360 editSField(TextMarginFieldMask
);
1365 GetFieldHandlePtr
SimpleTextForegroundBase::getHandleTile (void) const
1367 SFBool::GetHandlePtr
returnValue(
1368 new SFBool::GetHandle(
1370 this->getType().getFieldDesc(TileFieldId
),
1371 const_cast<SimpleTextForegroundBase
*>(this)));
1376 EditFieldHandlePtr
SimpleTextForegroundBase::editHandleTile (void)
1378 SFBool::EditHandlePtr
returnValue(
1379 new SFBool::EditHandle(
1381 this->getType().getFieldDesc(TileFieldId
),
1385 editSField(TileFieldMask
);
1391 #ifdef OSG_MT_CPTR_ASPECT
1392 void SimpleTextForegroundBase::execSyncV( FieldContainer
&oFrom
,
1393 ConstFieldMaskArg whichField
,
1394 AspectOffsetStore
&oOffsets
,
1395 ConstFieldMaskArg syncMode
,
1396 const UInt32 uiSyncInfo
)
1398 SimpleTextForeground
*pThis
= static_cast<SimpleTextForeground
*>(this);
1400 pThis
->execSync(static_cast<SimpleTextForeground
*>(&oFrom
),
1409 #ifdef OSG_MT_CPTR_ASPECT
1410 FieldContainer
*SimpleTextForegroundBase::createAspectCopy(
1411 const FieldContainer
*pRefAspect
) const
1413 SimpleTextForeground
*returnValue
;
1415 newAspectCopy(returnValue
,
1416 dynamic_cast<const SimpleTextForeground
*>(pRefAspect
),
1417 dynamic_cast<const SimpleTextForeground
*>(this));
1423 void SimpleTextForegroundBase::resolveLinks(void)
1425 Inherited::resolveLinks();
1427 #ifdef OSG_MT_CPTR_ASPECT
1428 AspectOffsetStore oOffsets
;
1430 _pAspectStore
->fillOffsetArray(oOffsets
, this);
1433 #ifdef OSG_MT_CPTR_ASPECT
1434 _mfLines
.terminateShare(Thread::getCurrentAspect(),