/usr/include/cegui-0.8.7/CEGUI/falagard/XMLHandler.h is in libcegui-mk2-dev 0.8.7-1.3+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | /***********************************************************************
created: Fri Jun 17 2005
author: Paul D Turner <paul@cegui.org.uk>
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2012 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIFalagard_xmlHandler_h_
#define _CEGUIFalagard_xmlHandler_h_
#include "../ChainedXMLHandler.h"
#include "./Dimensions.h"
#include "../Window.h"
#include <vector>
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
// forward refs
class WidgetLookManager;
class WidgetLookFeel;
class WidgetComponent;
class ImagerySection;
class StateImagery;
class LayerSpecification;
class SectionSpecification;
class ImageryComponent;
class ComponentArea;
class Dimension;
class TextComponent;
class NamedArea;
class FrameComponent;
class PropertyDefinitionBase;
class EventLinkDefinition;
/*!
\brief
Handler class used to parse look & feel XML files used by the Falagard system.
*/
class CEGUIEXPORT Falagard_xmlHandler : public ChainedXMLHandler
{
public:
/*!
\brief
Constructor for Falagard_xmlHandler objects
*/
Falagard_xmlHandler(WidgetLookManager* mgr);
/*!
\brief
Destructor for Falagard_xmlHandler objects
*/
~Falagard_xmlHandler();
//! Stores the native version, the only version we are supposed to load
static const String NativeVersion;
//! Default value for the "type" attribute of PropertyDefinition elements
static const String PropertyDefinitionHelpDefaultValue;
//! Default value for the "type" attribute of PropertyLinkDefinition elements
static const String PropertyLinkDefinitionHelpDefaultValue;
//! Default or unspecified value for the "dataType" attribute
static const String GenericDataType;
//! String value representing a parent link identifier
static const String ParentIdentifier;
/*************************************************************************
XML element and attribute name constants
*************************************************************************/
// element names
static const String FalagardElement; //!< Tag name for root Falagard elements.
static const String WidgetLookElement; //!< Tag name for WidgetLook elements.
static const String ChildElement; //!< Tag name for Child elements.
static const String ImagerySectionElement; //!< Tag name for ImagerySection elements.
static const String StateImageryElement; //!< Tag name for StateImagery elements.
static const String LayerElement; //!< Tag name for Layer elements.
static const String SectionElement; //!< Tag name for Section elements.
static const String ImageryComponentElement; //!< Tag name for ImageryComponent elements.
static const String TextComponentElement; //!< Tag name for TextComponent elements.
static const String FrameComponentElement; //!< Tag name for FrameComponent elements.
static const String AreaElement; //!< Tag name for Area elements.
static const String ImageElement; //!< Tag name for Image elements.
static const String ColoursElement; //!< Tag name for Colours elements.
static const String VertFormatElement; //!< Tag name for VertFormat elements.
static const String HorzFormatElement; //!< Tag name for HorzFormat elements.
static const String VertAlignmentElement; //!< Tag name for VertAlignment elements.
static const String HorzAlignmentElement; //!< Tag name for HorzAlignment elements.
static const String PropertyElement; //!< Tag name for Property elements.
static const String DimElement; //!< Tag name for dimension container elements.
static const String UnifiedDimElement; //!< Tag name for unified dimension elements.
static const String AbsoluteDimElement; //!< Tag name for absolute dimension elements.
static const String ImageDimElement; //!< Tag name for image dimension elements.
static const String ImagePropertyDimElement; //!< Tag name for image property dimension elements.
static const String WidgetDimElement; //!< Tag name for widget dimension elements.
static const String FontDimElement; //!< Tag name for font dimension elements.
static const String PropertyDimElement; //!< Tag name for property dimension elements.
static const String TextElement; //!< Tag name for text component text elements
static const String ColourPropertyElement; //!< Tag name for property colour elements (fetches cols from a colour property)
static const String ColourRectPropertyElement; //!< Tag name for property colour elements (fetches cols from a ColourRect property)
static const String NamedAreaElement; //!< Tag name for named area elements.
static const String PropertyDefinitionElement; //!< Tag name for property definition elements.
static const String PropertyLinkDefinitionElement; //!< Tag name for property link elements.
static const String PropertyLinkTargetElement; //!< Tag name for property link target elements.
static const String OperatorDimElement; //!< Tag name for dimension operator elements.
static const String VertFormatPropertyElement; //!< Tag name for element that specifies a vertical formatting property.
static const String HorzFormatPropertyElement; //!< Tag name for element that specifies a horizontal formatting property..
static const String AreaPropertyElement; //!< Tag name for element that specifies a URect property..
static const String ImagePropertyElement; //!< Tag name for element that specifies an Image property..
static const String TextPropertyElement; //!< Tag name for element that specifies an Text property.
static const String FontPropertyElement; //!< Tag name for element that specifies an Font property.
static const String ColourElement; //!< Tag name for Colour elements.
static const String EventLinkDefinitionElement; //!< Tag name for event link elements.
static const String EventLinkTargetElement; //!< Tag name for event link target elements.
//! Tag name for specifying a source named area for a component
static const String NamedAreaSourceElement;
//! Tag name for specifying event / action responses for Child components
static const String EventActionElement;
// attribute names
static const String VersionAttribute; //!< Attribute name that stores the version number of the Falagard element containing the WidgetLookFeels.
static const String TopLeftAttribute; //!< Attribute name that stores colour for top-left corner.
static const String TopRightAttribute; //!< Attribute name that stores colour for top-right corner.
static const String BottomLeftAttribute; //!< Attribute name that stores colour for bottom-left corner.
static const String BottomRightAttribute; //!< Attribute name that stores colour for bottom-right corner.
static const String TypeAttribute; //!< Attribute name that stores a type string.
static const String NameAttribute; //!< Attribute name that stores name string
static const String PriorityAttribute; //!< Attribute name that stores an integer priority.
static const String SectionNameAttribute; //!< Attribute name that stores an imagery section name.
static const String NameSuffixAttribute; //!< Attribute name that stores a widget name suffix.
static const String RendererAttribute; //!< Attribute name that stores the name of a window renderer factory.
static const String LookAttribute; //!< Attribute name that stores the name of a widget look.
static const String ScaleAttribute; //!< Attribute name that stores a UDim scale value.
static const String OffsetAttribute; //!< Attribute name that stores a UDim offset value.
static const String ValueAttribute; //!< Attribute name that stores a property value string.
static const String DimensionAttribute; //!< Attribute name that stores a dimension type.
static const String WidgetAttribute; //!< Attribute name that stores the name of a widget (suffix).
static const String StringAttribute; //!< Attribute name that stores a string of text.
static const String FontAttribute; //!< Attribute name that stores the name of a font.
static const String InitialValueAttribute; //!< Attribute name that stores the initial default value for a property definition.
static const String ClippedAttribute; //!< Attribute name that stores whether some component will be clipped.
static const String OperatorAttribute; //!< Attribute name that stores the name of an operator.
static const String PaddingAttribute; //!< Attribute name that stores some padding value..
static const String LayoutOnWriteAttribute; //!< Attribute name that stores whether to layout on write of a property.
static const String RedrawOnWriteAttribute; //!< Attribute name that stores whether to redraw on write of a property.
static const String TargetPropertyAttribute; //!< Attribute name that stores a name of a target property.
static const String ControlPropertyAttribute; //!< Attribute name that stores a name of a property to control rendering of a section.
static const String ColourAttribute; //!< Attribute name that stores colour for all corners.
static const String PropertyAttribute; //!< Attribute name that stores the name of a property.
static const String ControlValueAttribute; //!< Attribute name that stores a test value to control rendering of a section.
static const String ControlWidgetAttribute; //!< Attribute name that stores a widget identifier used to control rendering of a section.
//! Attribute name that stores a help string.
static const String HelpStringAttribute;
//! Attribute name that stores an Event name string.
static const String EventAttribute;
//! Attribute name that stores the name of an inherited WidgetLook
static const String InheritsAttribute;
//! Attribute name that stores auto-window preference
static const String AutoWindowAttribute;
//! Attribute name that stores name of event to fire for property defs
static const String FireEventAttribute;
//! Attribute name that stores the name of an action to be taken
static const String ActionAttribute;
//! Attribute name that stores some component enum value
static const String ComponentAttribute;
protected:
/*************************************************************************
ChainedXMLHandler base class overrides
*************************************************************************/
void elementStartLocal(const String& element,
const XMLAttributes& attributes);
void elementEndLocal(const String& element);
private:
/*************************************************************************
Typedefs
*************************************************************************/
//! Type for handlers of an opening xml element.
typedef void (Falagard_xmlHandler::*ElementStartHandler)(const XMLAttributes& attributes);
//! Type for handlers of a closing xml element.
typedef void (Falagard_xmlHandler::*ElementEndHandler)();
//! Map of handlers for opening xml elements.
typedef std::map<String, ElementStartHandler, StringFastLessCompare> ElementStartHandlerMap;
//! Map of handlers for closing xml elements.
typedef std::map<String, ElementEndHandler, StringFastLessCompare> ElementEndHandlerMap;
/*************************************************************************
helper methods
**************************************************************************/
static argb_t hexStringToARGB(const String& str);
/*************************************************************************
implementation methods
**************************************************************************/
void assignAreaDimension(Dimension& dim);
void assignColours(const ColourRect& colours);
/*!
\brief
Method that performs common handling for all *Dim elements.
*/
void doBaseDimStart(const BaseDim* dim);
/*!
\brief
Method that handles the opening Falagard XML element.
*/
void elementFalagardStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening WidgetLook XML element.
*/
void elementWidgetLookStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Child XML element.
*/
void elementChildStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ImagerySection XML element.
*/
void elementImagerySectionStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening StateImagery XML element.
*/
void elementStateImageryStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Layer XML element.
*/
void elementLayerStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Section XML element.
*/
void elementSectionStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ImageryComponent XML element.
*/
void elementImageryComponentStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening TextComponent XML element.
*/
void elementTextComponentStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening FrameComponent XML element.
*/
void elementFrameComponentStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Area XML element.
*/
void elementAreaStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Image XML element.
*/
void elementImageStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Colours XML element.
*/
void elementColoursStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening VertFormat XML element.
*/
void elementVertFormatStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening HorzFormat XML element.
*/
void elementHorzFormatStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening VertAlignment XML element.
*/
void elementVertAlignmentStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening HorzAlignment XML element.
*/
void elementHorzAlignmentStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Property XML element.
*/
void elementPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Dim XML element.
*/
void elementDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening UnifiedDim XML element.
*/
void elementUnifiedDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening AbsoluteDim XML element.
*/
void elementAbsoluteDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ImageDim XML element.
*/
void elementImageDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ImagePropertyDim XML element.
*/
void elementImagePropertyDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening WidgetDim XML element.
*/
void elementWidgetDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening FontDim XML element.
*/
void elementFontDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening PropertyDim XML element.
*/
void elementPropertyDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Text XML element.
*/
void elementTextStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ColourRectProperty XML element.
*/
void elementColourRectPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening NamedArea XML element.
*/
void elementNamedAreaStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening PropertyDefinition XML element.
*/
void elementPropertyDefinitionStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening PropertyLinkDefinition XML element.
*/
void elementPropertyLinkDefinitionStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening OperatorDim XML element.
*/
void elementOperatorDimStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening VertFormatProperty XML element.
*/
void elementVertFormatPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening HorzFormatProperty XML element.
*/
void elementHorzFormatPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening AreaProperty XML element.
*/
void elementAreaPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening ImageProperty XML element.
*/
void elementImagePropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening TextProperty XML element.
*/
void elementTextPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening FontProperty XML element.
*/
void elementFontPropertyStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the opening Colour XML element.
*/
void elementColourStart(const XMLAttributes& attributes);
//! Function to handle PropertyLinkTarget elements.
void elementPropertyLinkTargetStart(const XMLAttributes& attributes);
//! Function to handle AnimationDefinition elements
void elementAnimationDefinitionStart(const XMLAttributes& attributes);
//! Function to handle EventLinkDefinition elements.
void elementEventLinkDefinitionStart(const XMLAttributes& attributes);
//! Function to handle EventLinkTarget elements.
void elementEventLinkTargetStart(const XMLAttributes& attributes);
//! Function to handle NamedAreaSource elements.
void elementNamedAreaSourceStart(const XMLAttributes& attributes);
//! Function to handle EventAction elements.
void elementEventActionStart(const XMLAttributes& attributes);
/*!
\brief
Method that handles the closing Falagard XML element.
*/
void elementFalagardEnd();
/*!
\brief
Method that handles the closing WidgetLook XML element.
*/
void elementWidgetLookEnd();
/*!
\brief
Method that handles the closing Child XML element.
*/
void elementChildEnd();
/*!
\brief
Method that handles the closing ImagerySection XML element.
*/
void elementImagerySectionEnd();
/*!
\brief
Method that handles the closing StateImagery XML element.
*/
void elementStateImageryEnd();
/*!
\brief
Method that handles the closing Layer XML element.
*/
void elementLayerEnd();
/*!
\brief
Method that handles the closing Section XML element.
*/
void elementSectionEnd();
/*!
\brief
Method that handles the closing ImageryComponent XML element.
*/
void elementImageryComponentEnd();
/*!
\brief
Method that handles the closing TextComponent XML element.
*/
void elementTextComponentEnd();
/*!
\brief
Method that handles the closing FrameComponent XML element.
*/
void elementFrameComponentEnd();
/*!
\brief
Method that handles the closing Area XML element.
*/
void elementAreaEnd();
/*!
\brief
Method that handles the closing NamedArea XML element.
*/
void elementNamedAreaEnd();
/*!
\brief
Method that handles the closing XML for all *Dim elements.
*/
void elementAnyDimEnd();
//! Function to handle closing PropertyLinkDefinition XML element.
void elementPropertyLinkDefinitionEnd();
//! Function to handle closing EventLinkDefinition XML element.
void elementEventLinkDefinitionEnd();
/*!
\brief
Register a handler for the opening tag of an XML element
*/
void registerElementStartHandler(const String& element, ElementStartHandler handler);
/*!
\brief
Register a handler for the closing tag of an XML element
*/
void registerElementEndHandler(const String& element, ElementEndHandler handler);
//! helper to add an event link target as dictated by the input strings.
void processEventLinkTarget(const String& widget, const String& event);
/*************************************************************************
Implementation Data
*************************************************************************/
WidgetLookManager* d_manager;
// these are used to implement the handler without using a huge
// if / else if /else construct, we just register the element name, and
// handler member function, and everything else is done using those
// mappings.
ElementStartHandlerMap d_startHandlersMap;
ElementEndHandlerMap d_endHandlersMap;
// these hold pointers to various objects under construction.
WidgetLookFeel* d_widgetlook;
WidgetComponent* d_childcomponent;
ImagerySection* d_imagerysection;
StateImagery* d_stateimagery;
LayerSpecification* d_layer;
SectionSpecification* d_section;
ImageryComponent* d_imagerycomponent;
ComponentArea* d_area;
Dimension d_dimension;
TextComponent* d_textcomponent;
NamedArea* d_namedArea;
FrameComponent* d_framecomponent;
std::vector<BaseDim*
CEGUI_VECTOR_ALLOC(BaseDim*)> d_dimStack;
PropertyDefinitionBase* d_propertyLink;
EventLinkDefinition* d_eventLink;
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIFalagard_xmlHandler_h_
|