32 #ifndef _CEGUIElement_h_
33 #define _CEGUIElement_h_
35 #include "CEGUI/Base.h"
36 #include "CEGUI/PropertySet.h"
37 #include "CEGUI/EventSet.h"
38 #include "CEGUI/EventArgs.h"
41 # pragma warning(push)
42 # pragma warning(disable : 4251)
81 static const String& getDataTypeName()
83 static String type(
"HorizontalAlignment");
94 else if (str ==
"Right")
120 assert(
false &&
"Invalid horizontal alignment");
159 static const String& getDataTypeName()
161 static String type(
"VerticalAlignment");
172 else if (str ==
"Bottom")
198 assert(
false &&
"Invalid vertical alignment");
328 d_generator(generator),
353 inline Rectf getFresh(
bool skipAllPixelAlignment =
false)
const
357 if (!d_cacheValid && !skipAllPixelAlignment)
362 return CEGUI_CALL_MEMBER_FN(*d_element, d_generator)(skipAllPixelAlignment);
371 inline void invalidateCache()
const
373 d_cacheValid =
false;
376 inline bool isCacheValid()
const
381 inline void regenerateCache()
const
385 d_cachedData = CEGUI_CALL_MEMBER_FN(*d_element, d_generator)(
false);
391 Element
const* d_element;
392 const DataGenerator d_generator;
394 mutable Rectf d_cachedData;
395 mutable bool d_cacheValid;
439 virtual void setArea(
const UVector2& pos,
const USize& size);
442 inline void setArea(
const UDim& xpos,
const UDim& ypos,
443 const UDim& width,
const UDim& height)
449 inline void setArea(
const URect& area)
451 setArea(area.d_min, area.
getSize());
490 setArea_impl(pos, d_area.getSize());
494 inline void setXPosition(
const UDim& pos)
496 setPosition(
UVector2(pos, getYPosition()));
500 inline void setYPosition(
const UDim& pos)
502 setPosition(
UVector2(getXPosition(), pos));
521 return d_area.getPosition();
525 inline const UDim& getXPosition()
const
527 return getPosition().d_x;
531 inline const UDim& getYPosition()
const
533 return getPosition().d_y;
560 return d_horizontalAlignment;
587 return d_verticalAlignment;
601 inline void setSize(
const USize& size)
603 setArea(d_area.getPosition(), size);
607 inline void setWidth(
const UDim& width)
609 setSize(
USize(width, getSize().d_height));
613 inline void setHeight(
const UDim& height)
615 setSize(
USize(getSize().d_width, height));
631 return d_area.getSize();
637 return getSize().d_width;
643 return getSize().d_height;
663 void setMinSize(
const USize& size);
678 inline const USize& getMinSize()
const
702 void setMaxSize(
const USize& size);
717 inline const USize& getMaxSize()
const
756 void setAspectRatio(
const float ratio);
764 inline float getAspectRatio()
const
766 return d_aspectRatio;
790 void setPixelAligned(
const bool setting);
799 inline bool isPixelAligned()
const
801 return d_pixelAligned;
813 return getUnclippedOuterRect().get().d_min;
823 inline const Sizef& getPixelSize()
const
838 Sizef calculatePixelSize(
bool skipAllPixelAlignment =
false)
const;
849 Sizef getParentPixelSize(
bool skipAllPixelAlignment =
false)
const;
895 void addChild(
Element* element);
907 void removeChild(
Element* element);
922 inline Element* getChildElementAtIdx(
size_t idx)
const
924 return d_children[idx];
930 inline size_t getChildCount()
const
932 return d_children.size();
938 bool isChild(
const Element* element)
const;
953 bool isAncestor(
const Element* element)
const;
968 void setNonClient(
const bool setting);
975 inline bool isNonClient()
const
995 return d_unclippedOuterRect;
1013 return d_unclippedInnerRect;
1031 return inner ? getUnclippedInnerRect() : getUnclippedOuterRect();
1042 virtual const CachedRectf& getClientChildContentArea()
const;
1052 virtual const CachedRectf& getNonClientChildContentArea()
const;
1075 inline const CachedRectf& getChildContentArea(
const bool non_client =
false)
const
1077 return non_client ? getNonClientChildContentArea() : getClientChildContentArea();
1093 virtual void notifyScreenAreaChanged(
bool recursive =
true);
1104 virtual const Sizef& getRootContainerSize()
const;
1111 void addElementProperties();
1143 virtual void setArea_impl(
const UVector2& pos,
const USize& size,
1144 bool topLeftSizing =
false,
bool fireEvents =
true);
1147 inline bool isInnerRectSizeChanged()
const
1149 const Sizef old_sz(d_unclippedInnerRect.get().getSize());
1150 d_unclippedInnerRect.invalidateCache();
1151 return old_sz != d_unclippedInnerRect.get().getSize();
1165 virtual void setParent(
Element* parent);
1171 virtual void addChild_impl(
Element* element);
1177 virtual void removeChild_impl(
Element* element);
1180 virtual Rectf getUnclippedOuterRect_impl(
bool skipAllPixelAlignment)
const;
1182 virtual Rectf getUnclippedInnerRect_impl(
bool skipAllPixelAlignment)
const;
1185 void fireAreaChangeEvents(
const bool moved,
const bool sized);
1186 void notifyChildrenOfSizeChange(
const bool non_client,
1344 #if defined(_MSC_VER)
1345 # pragma warning(pop)
1348 #endif // end of guard _CEGUIElement_h_