31 #ifndef _CEGUIElement_h_
32 #define _CEGUIElement_h_
34 #include "CEGUI/Base.h"
35 #include "CEGUI/PropertySet.h"
36 #include "CEGUI/EventSet.h"
37 #include "CEGUI/EventArgs.h"
40 # pragma warning(push)
41 # pragma warning(disable : 4251)
80 static const String& getDataTypeName()
82 static String type(
"HorizontalAlignment");
87 static return_type fromString(
const String& str)
93 else if (str ==
"Right")
103 static string_return_type toString(pass_type val)
119 assert(
false &&
"Invalid horizontal alignment");
158 static const String& getDataTypeName()
160 static String type(
"VerticalAlignment");
165 static return_type fromString(
const String& str)
171 else if (str ==
"Bottom")
181 static string_return_type toString(pass_type val)
197 assert(
false &&
"Invalid vertical alignment");
327 d_generator(generator),
356 if (!d_cacheValid && !skipAllPixelAlignment)
361 return CEGUI_CALL_MEMBER_FN(*d_element, d_generator)(skipAllPixelAlignment);
372 d_cacheValid =
false;
375 inline bool isCacheValid()
const
380 inline void regenerateCache()
const
384 d_cachedData = CEGUI_CALL_MEMBER_FN(*d_element, d_generator)(
false);
390 Element
const* d_element;
391 const DataGenerator d_generator;
393 mutable Rectf d_cachedData;
394 mutable bool d_cacheValid;
438 virtual void setArea(
const UVector2& pos,
const USize& size);
442 const UDim& width,
const UDim& height)
450 setArea(area.d_min, area.
getSize());
489 setArea_impl(pos, d_area.getSize());
495 setPosition(
UVector2(pos, getYPosition()));
501 setPosition(
UVector2(getXPosition(), pos));
520 return d_area.getPosition();
526 return getPosition().d_x;
532 return getPosition().d_y;
559 return d_horizontalAlignment;
586 return d_verticalAlignment;
602 setArea(d_area.getPosition(), size);
608 setSize(
USize(width, getSize().d_height));
614 setSize(
USize(getSize().d_width, height));
630 return d_area.getSize();
636 return getSize().d_width;
642 return getSize().d_height;
662 void setMinSize(
const USize& size);
701 void setMaxSize(
const USize& size);
755 void setAspectRatio(
const float ratio);
765 return d_aspectRatio;
789 void setPixelAligned(
const bool setting);
800 return d_pixelAligned;
812 return getUnclippedOuterRect().get().d_min;
837 Sizef calculatePixelSize(
bool skipAllPixelAlignment =
false)
const;
848 Sizef getParentPixelSize(
bool skipAllPixelAlignment =
false)
const;
894 void addChild(
Element* element);
906 void removeChild(
Element* element);
923 return d_children[idx];
931 return d_children.size();
937 bool isChild(
const Element* element)
const;
952 bool isAncestor(
const Element* element)
const;
967 void setNonClient(
const bool setting);
994 return d_unclippedOuterRect;
1012 return d_unclippedInnerRect;
1030 return inner ? getUnclippedInnerRect() : getUnclippedOuterRect();
1041 virtual const CachedRectf& getClientChildContentArea()
const;
1051 virtual const CachedRectf& getNonClientChildContentArea()
const;
1076 return non_client ? getNonClientChildContentArea() : getClientChildContentArea();
1092 virtual void notifyScreenAreaChanged(
bool recursive =
true);
1103 virtual const Sizef& getRootContainerSize()
const;
1110 void addElementProperties();
1142 virtual void setArea_impl(
const UVector2& pos,
const USize& size,
1143 bool topLeftSizing =
false,
bool fireEvents =
true);
1148 const Sizef old_sz(d_unclippedInnerRect.get().getSize());
1149 d_unclippedInnerRect.invalidateCache();
1150 return old_sz != d_unclippedInnerRect.get().getSize();
1164 virtual void setParent(
Element* parent);
1170 virtual void addChild_impl(
Element* element);
1176 virtual void removeChild_impl(
Element* element);
1179 virtual Rectf getUnclippedOuterRect_impl(
bool skipAllPixelAlignment)
const;
1181 virtual Rectf getUnclippedInnerRect_impl(
bool skipAllPixelAlignment)
const;
1184 void fireAreaChangeEvents(
const bool moved,
const bool sized);
1185 void notifyChildrenOfSizeChange(
const bool non_client,
1343 #if defined(_MSC_VER)
1344 # pragma warning(pop)
1347 #endif // end of guard _CEGUIElement_h_
static const String EventVerticalAlignmentChanged
Definition: Element.h:278
void setSize(const USize &size)
Set the element's size.
Definition: Element.h:600
const URect & getArea() const
Return the element's area.
Definition: Element.h:467
bool d_pixelAligned
If true, the position and size are pixel aligned.
Definition: Element.h:1320
AspectMode
How aspect ratio should be maintained.
Definition: Size.h:45
VerticalAlignment d_verticalAlignment
Specifies the base for vertical alignment.
Definition: Element.h:1310
HorizontalAlignment getHorizontalAlignment() const
Get the horizontal alignment.
Definition: Element.h:557
const Quaternion & getRotation() const
retrieves rotation of this widget
Definition: Element.h:869
static const String EventParentSized
Definition: Element.h:261
Definition: MemoryAllocatedObject.h:109
bool d_nonClient
true if element is in non-client (outside InnerRect) area of parent.
Definition: Element.h:1303
static const String EventZOrderChanged
Definition: Element.h:299
URect d_area
This element objects area as defined by a URect.
Definition: Element.h:1306
Main namespace for Crazy Eddie's GUI Library.
Definition: arch_overview.dox:1
bool isPixelAligned() const
Checks whether this Element is pixel aligned.
Definition: Element.h:798
USize getSize() const
Get the element's size.
Definition: Element.h:628
A positioned and sized rectangular node in a tree graph.
Definition: Element.h:242
void setWidth(const UDim &width)
Definition: Element.h:606
Definition: Element.h:146
Quaternion d_rotation
Rotation of this element (relative to the parent)
Definition: Element.h:1324
static const String EventNamespace
Namespace for global events.
Definition: Element.h:249
Base class used as the argument to all subscribers Event object.
Definition: EventArgs.h:49
void setXPosition(const UDim &pos)
Definition: Element.h:493
Class that holds the size (width & height) of something.
Definition: ForwardRefs.h:112
ChildList d_children
The list of child element objects attached to this.
Definition: Element.h:1298
const CachedRectf & getUnclippedRect(const bool inner) const
Return a Rect that describes the unclipped area covered by the Element.
Definition: Element.h:1028
static const String EventRotated
Definition: Element.h:283
const CachedRectf & getChildContentArea(const bool non_client=false) const
Return a Rect that is used to position and size child elements.
Definition: Element.h:1074
Size< T > getSize() const
return the size of the Rect area
Definition: Rect.h:149
Interface providing introspection capabilities.
Definition: PropertySet.h:107
const Sizef & getPixelSize() const
Return the element's size in pixels.
Definition: Element.h:822
Rectf getFresh(bool skipAllPixelAlignment=false) const
Skips all caching and calls the generator.
Definition: Element.h:352
const CachedRectf & getUnclippedOuterRect() const
Return a Rect that describes the unclipped outer rect area of the Element.
Definition: Element.h:992
void setPosition(const UVector2 &pos)
Set the element's position.
Definition: Element.h:487
Definition: Element.h:136
const USize & getMinSize() const
Get the element's minimum size.
Definition: Element.h:677
USize d_maxSize
current maximum size for the element.
Definition: Element.h:1314
CachedRectf d_unclippedInnerRect
inner area rect in screen pixels
Definition: Element.h:1329
static const String EventSized
Definition: Element.h:255
UDim getWidth() const
Definition: Element.h:634
AspectMode getAspectMode() const
Retrieves currently used aspect mode.
Definition: Element.h:737
const UVector2 & getPosition() const
Get the element's position.
Definition: Element.h:518
AspectMode d_aspectMode
How to satisfy current aspect ratio.
Definition: Element.h:1316
USize d_minSize
current minimum size for the element.
Definition: Element.h:1312
static const String EventHorizontalAlignmentChanged
Definition: Element.h:272
bool isNonClient() const
Checks whether this element was set to be non client.
Definition: Element.h:974
const UDim & getXPosition() const
Definition: Element.h:524
static const String EventNonClientChanged
Definition: Element.h:305
const UDim & getYPosition() const
Definition: Element.h:530
Helper class used to convert various data types to and from the format expected in Property strings...
Definition: ForwardRefs.h:84
CachedRectf d_unclippedOuterRect
outer area rect in screen pixels
Definition: Element.h:1327
std::vector< Element *CEGUI_VECTOR_ALLOC(Element *)> ChildList
definition of type used for the list of attached child elements.
Definition: Element.h:1295
size_t getChildCount() const
Returns number of child elements attached to this Element.
Definition: Element.h:929
Definition: Element.h:141
Interface providing event signaling and handling.
Definition: EventSet.h:166
VerticalAlignment getVerticalAlignment() const
Get the vertical alignment.
Definition: Element.h:584
static const String EventChildRemoved
Definition: Element.h:293
const USize & getMaxSize() const
Get the element's maximum size.
Definition: Element.h:716
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition: Element.h:210
const Vector2f & getPixelPosition() const
Return the element's absolute (or screen, depending on the type of the element) position in pixels...
Definition: Element.h:810
UDim getHeight() const
Definition: Element.h:640
static const String EventChildAdded
Definition: Element.h:288
HorizontalAlignment d_horizontalAlignment
Specifies the base for horizontal alignment.
Definition: Element.h:1308
void setArea(const UDim &xpos, const UDim &ypos, const UDim &width, const UDim &height)
Definition: Element.h:441
A tiny wrapper to hide some of the dirty work of rect caching.
Definition: Element.h:314
bool isInnerRectSizeChanged() const
helper to return whether the inner rect size has changed
Definition: Element.h:1146
Element * element
pointer to an Element object of relevance to the event.
Definition: Element.h:218
Dimension that has both a relative 'scale' portion and and absolute 'offset' portion.
Definition: UDim.h:92
Class to represent rotation, avoids Gimbal lock.
Definition: Quaternion.h:67
float d_aspectRatio
The target aspect ratio.
Definition: Element.h:1318
void invalidateCache() const
Invalidates the cached Rectf causing it to be regenerated.
Definition: Element.h:370
float getAspectRatio() const
Retrieves target aspect ratio.
Definition: Element.h:763
Sizef d_pixelSize
Current constrained pixel size of the element.
Definition: Element.h:1322
void setArea(const URect &area)
Definition: Element.h:448
void setHeight(const UDim &height)
Definition: Element.h:612
VerticalAlignment
Enumerated type used when specifying vertical alignments for Element.
Definition: Element.h:130
void setYPosition(const UDim &pos)
Definition: Element.h:499
const CachedRectf & getUnclippedInnerRect() const
Return a Rect that describes the unclipped inner rect area of the Element.
Definition: Element.h:1010
Element * d_parent
Holds pointer to the parent element.
Definition: Element.h:1300
Element * getParentElement() const
Retrieves parent of this element.
Definition: Element.h:414
Element * getChildElementAtIdx(size_t idx) const
return a pointer to the child element that is attached to 'this' at the given index.
Definition: Element.h:921
HorizontalAlignment
Enumerated type used when specifying horizontal alignments for Element.
Definition: Element.h:52
static const String EventMoved
Definition: Element.h:266
String class used within the GUI system.
Definition: String.h:62