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"
41# pragma warning(disable : 4251)
80 static const String& getDataTypeName()
82 static String type(
"HorizontalAlignment");
93 else if (str ==
"Right")
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;
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;
765 return d_aspectRatio;
800 return d_pixelAligned;
812 return getUnclippedOuterRect().get().d_min;
923 return d_children[idx];
931 return d_children.size();
994 return d_unclippedOuterRect;
1012 return d_unclippedInnerRect;
1030 return inner ? getUnclippedInnerRect() : getUnclippedOuterRect();
1076 return non_client ? getNonClientChildContentArea() : getClientChildContentArea();
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();
1185 void notifyChildrenOfSizeChange(
const bool non_client,
1343#if defined(_MSC_VER)
1344# pragma warning(pop)
Definition MemoryAllocatedObject.h:110
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition Element.h:211
Element * element
pointer to an Element object of relevance to the event.
Definition Element.h:218
A tiny wrapper to hide some of the dirty work of rect caching.
Definition Element.h:315
const Rectf & get() const
Retrieves cached Rectf or generated a fresh one and caches it.
Definition Element.h:336
void invalidateCache() const
Invalidates the cached Rectf causing it to be regenerated.
Definition Element.h:370
Rectf getFresh(bool skipAllPixelAlignment=false) const
Skips all caching and calls the generator.
Definition Element.h:352
A positioned and sized rectangular node in a tree graph.
Definition Element.h:246
static const String EventHorizontalAlignmentChanged
Definition Element.h:272
USize d_minSize
current minimum size for the element.
Definition Element.h:1312
virtual void setArea(const UVector2 &pos, const USize &size)
Set the Element area.
virtual void onChildRemoved(ElementEventArgs &e)
Handler called when a child element is removed from this element.
static const String EventSized
Definition Element.h:255
const CachedRectf & getUnclippedOuterRect() const
Return a Rect that describes the unclipped outer rect area of the Element.
Definition Element.h:992
HorizontalAlignment d_horizontalAlignment
Specifies the base for horizontal alignment.
Definition Element.h:1308
CachedRectf d_unclippedOuterRect
outer area rect in screen pixels
Definition Element.h:1327
const UVector2 & getPosition() const
Get the element's position.
Definition Element.h:518
void setRotation(const Quaternion &rotation)
sets rotation of this widget
static const String EventVerticalAlignmentChanged
Definition Element.h:278
void addElementProperties()
Add standard CEGUI::Element properties.
virtual void onMoved(ElementEventArgs &e)
Handler called when the element's position changes.
virtual Rectf getUnclippedInnerRect_impl(bool skipAllPixelAlignment) const
Default implementation of function to return Element's inner rect area.
bool isAncestor(const Element *element) const
Checks whether the specified Element is an ancestor of this Element.
virtual void onRotated(ElementEventArgs &e)
Handler called when the element's rotation is changed.
void setXPosition(const UDim &pos)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:493
void setAspectRatio(const float ratio)
Sets target aspect ratio.
void setSize(const USize &size)
Set the element's size.
Definition Element.h:600
void setAspectMode(const AspectMode mode)
Sets current aspect mode and recalculates the area rect.
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
bool isInnerRectSizeChanged() const
helper to return whether the inner rect size has changed
Definition Element.h:1146
static const String EventNamespace
Namespace for global events.
Definition Element.h:249
const UDim & getXPosition() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:524
URect d_area
This element objects area as defined by a URect.
Definition Element.h:1306
CachedRectf d_unclippedInnerRect
inner area rect in screen pixels
Definition Element.h:1329
Quaternion d_rotation
Rotation of this element (relative to the parent)
Definition Element.h:1324
virtual void setHorizontalAlignment(const HorizontalAlignment alignment)
Set the horizontal alignment.
const Sizef & getPixelSize() const
Return the element's size in pixels.
Definition Element.h:822
virtual void onNonClientChanged(ElementEventArgs &e)
Handler called when the element's non-client setting, affecting it's position and size relative to it...
USize getSize() const
Get the element's size.
Definition Element.h:628
virtual void addChild_impl(Element *element)
Add given element to child list at an appropriate position.
virtual void setParent(Element *parent)
Set the parent element for this element object.
const CachedRectf & getUnclippedRect(const bool inner) const
Return a Rect that describes the unclipped area covered by the Element.
Definition Element.h:1028
virtual void setVerticalAlignment(const VerticalAlignment alignment)
Set the vertical alignment.
size_t getChildCount() const
Returns number of child elements attached to this Element.
Definition Element.h:929
virtual void onParentSized(ElementEventArgs &e)
Handler called when this element's parent element has been resized. If this element is the root / GUI...
void setPosition(const UVector2 &pos)
Set the element's position.
Definition Element.h:487
const USize & getMinSize() const
Get the element's minimum size.
Definition Element.h:677
float getAspectRatio() const
Retrieves target aspect ratio.
Definition Element.h:763
bool isNonClient() const
Checks whether this element was set to be non client.
Definition Element.h:974
static const String EventNonClientChanged
Definition Element.h:305
virtual ~Element()
Destructor.
bool isChild(const Element *element) const
Checks whether given element is attached to this Element.
const USize & getMaxSize() const
Get the element's maximum size.
Definition Element.h:716
AspectMode getAspectMode() const
Retrieves currently used aspect mode.
Definition Element.h:737
virtual void onVerticalAlignmentChanged(ElementEventArgs &e)
Handler called when the vertical alignment setting for the element is changed.
virtual const CachedRectf & getClientChildContentArea() const
Return a Rect that is used by client child elements as content area.
VerticalAlignment getVerticalAlignment() const
Get the vertical alignment.
Definition Element.h:584
float d_aspectRatio
The target aspect ratio.
Definition Element.h:1318
ChildList d_children
The list of child element objects attached to this.
Definition Element.h:1298
bool isPixelAligned() const
Checks whether this Element is pixel aligned.
Definition Element.h:798
virtual const Sizef & getRootContainerSize() const
Return the size of the root container (such as screen size).
void setArea(const URect &area)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:448
static const String EventRotated
Definition Element.h:283
AspectMode d_aspectMode
How to satisfy current aspect ratio.
Definition Element.h:1316
void setMinSize(const USize &size)
Set the element's minimum size.
const URect & getArea() const
Return the element's area.
Definition Element.h:467
Element * getParentElement() const
Retrieves parent of this element.
Definition Element.h:414
void setYPosition(const UDim &pos)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:499
virtual void setArea_impl(const UVector2 &pos, const USize &size, bool topLeftSizing=false, bool fireEvents=true)
Implementation method to modify element area while correctly applying min / max size processing,...
VerticalAlignment d_verticalAlignment
Specifies the base for vertical alignment.
Definition Element.h:1310
const Quaternion & getRotation() const
retrieves rotation of this widget
Definition Element.h:869
virtual void removeChild_impl(Element *element)
Remove given element from child list.
static const String EventZOrderChanged
Definition Element.h:299
virtual void onChildAdded(ElementEventArgs &e)
Handler called when a child element is added to this element.
static const String EventChildRemoved
Definition Element.h:293
Sizef getParentPixelSize(bool skipAllPixelAlignment=false) const
Return the pixel size of the parent element.
void fireAreaChangeEvents(const bool moved, const bool sized)
helper to fire events based on changes to area rect
virtual void onHorizontalAlignmentChanged(ElementEventArgs &e)
Handler called when the horizontal alignment setting for the element is changed.
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
Sizef d_pixelSize
Current constrained pixel size of the element.
Definition Element.h:1322
void setHeight(const UDim &height)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:612
const UDim & getYPosition() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:530
static const String EventMoved
Definition Element.h:266
static const String EventChildAdded
Definition Element.h:288
bool d_pixelAligned
If true, the position and size are pixel aligned.
Definition Element.h:1320
void addChild(Element *element)
Add the specified Element as a child of this Element.
USize d_maxSize
current maximum size for the element.
Definition Element.h:1314
virtual void notifyScreenAreaChanged(bool recursive=true)
Inform the element and (optionally) all children that screen area has changed.
void setMaxSize(const USize &size)
Set the element's maximum size.
const CachedRectf & getUnclippedInnerRect() const
Return a Rect that describes the unclipped inner rect area of the Element.
Definition Element.h:1010
std::vector< Element *CEGUI_VECTOR_ALLOC(Element *)> ChildList
definition of type used for the list of attached child elements.
Definition Element.h:1295
UDim getWidth() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:634
Sizef calculatePixelSize(bool skipAllPixelAlignment=false) const
Calculates this element's pixel size.
void removeChild(Element *element)
Remove the Element Element's child list.
virtual void onSized(ElementEventArgs &e)
Handler called when the element's size changes.
virtual Rectf getUnclippedOuterRect_impl(bool skipAllPixelAlignment) const
Default implementation of function to return Element's outer rect area.
void setNonClient(const bool setting)
Set whether the Element is non-client.
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
HorizontalAlignment getHorizontalAlignment() const
Get the horizontal alignment.
Definition Element.h:557
Element * d_parent
Holds pointer to the parent element.
Definition Element.h:1300
void setArea(const UDim &xpos, const UDim &ypos, const UDim &width, const UDim &height)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:441
static const String EventParentSized
Definition Element.h:261
void setWidth(const UDim &width)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:606
void setPixelAligned(const bool setting)
Sets whether this Element is pixel aligned (both position and size, basically the 4 "corners").
virtual const CachedRectf & getNonClientChildContentArea() const
Return a Rect that is used by client child elements as content area.
UDim getHeight() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition Element.h:640
bool d_nonClient
true if element is in non-client (outside InnerRect) area of parent.
Definition Element.h:1303
Base class used as the argument to all subscribers Event object.
Definition EventArgs.h:51
Interface providing event signaling and handling.
Definition EventSet.h:167
Helper class used to convert various data types to and from the format expected in Property strings.
Definition PropertyHelper.h:84
Interface providing introspection capabilities.
Definition PropertySet.h:108
Class to represent rotation, avoids Gimbal lock.
Definition Quaternion.h:69
Size< T > getSize() const
return the size of the Rect area
Definition Rect.h:149
String class used within the GUI system.
Definition String.h:64
Dimension that has both a relative 'scale' portion and and absolute 'offset' portion.
Definition UDim.h:94
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1
HorizontalAlignment
Enumerated type used when specifying horizontal alignments for Element.
Definition Element.h:53
@ HA_LEFT
Definition Element.h:58
@ HA_RIGHT
Definition Element.h:68
@ HA_CENTRE
Definition Element.h:63
AspectMode
How aspect ratio should be maintained.
Definition Size.h:46
VerticalAlignment
Enumerated type used when specifying vertical alignments for Element.
Definition Element.h:131
@ VA_CENTRE
Definition Element.h:141
@ VA_BOTTOM
Definition Element.h:146
@ VA_TOP
Definition Element.h:136