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");
93 else if (str ==
"Right")
119 assert(
false &&
"Invalid horizontal alignment");
158 static const String& getDataTypeName()
160 static String type(
"VerticalAlignment");
171 else if (str ==
"Bottom")
197 assert(
false &&
"Invalid vertical alignment");
327 d_generator(generator),
352 inline Rectf getFresh(
bool skipAllPixelAlignment =
false)
const
356 if (!d_cacheValid && !skipAllPixelAlignment)
361 return CEGUI_CALL_MEMBER_FN(*d_element, d_generator)(skipAllPixelAlignment);
370 inline void invalidateCache()
const
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);
441 inline void setArea(
const UDim& xpos,
const UDim& ypos,
442 const UDim& width,
const UDim& height)
448 inline void setArea(
const URect& area)
450 setArea(area.d_min, area.
getSize());
489 setArea_impl(pos, d_area.getSize());
493 inline void setXPosition(
const UDim& pos)
495 setPosition(
UVector2(pos, getYPosition()));
499 inline void setYPosition(
const UDim& pos)
501 setPosition(
UVector2(getXPosition(), pos));
520 return d_area.getPosition();
524 inline const UDim& getXPosition()
const
526 return getPosition().d_x;
530 inline const UDim& getYPosition()
const
532 return getPosition().d_y;
559 return d_horizontalAlignment;
586 return d_verticalAlignment;
600 inline void setSize(
const USize& size)
602 setArea(d_area.getPosition(), size);
606 inline void setWidth(
const UDim& width)
608 setSize(
USize(width, getSize().d_height));
612 inline void setHeight(
const UDim& 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);
677 inline const USize& getMinSize()
const
701 void setMaxSize(
const USize& size);
716 inline const USize& getMaxSize()
const
755 void setAspectRatio(
const float ratio);
763 inline float getAspectRatio()
const
765 return d_aspectRatio;
789 void setPixelAligned(
const bool setting);
798 inline bool isPixelAligned()
const
800 return d_pixelAligned;
812 return getUnclippedOuterRect().get().d_min;
822 inline const Sizef& getPixelSize()
const
837 Sizef calculatePixelSize(
bool skipAllPixelAlignment =
false)
const;
848 Sizef getParentPixelSize(
bool skipAllPixelAlignment =
false)
const;
894 void addChild(
Element* element);
906 void removeChild(
Element* element);
921 inline Element* getChildElementAtIdx(
size_t idx)
const
923 return d_children[idx];
929 inline size_t getChildCount()
const
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);
974 inline bool isNonClient()
const
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;
1074 inline const CachedRectf& getChildContentArea(
const bool non_client =
false)
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);
1146 inline bool isInnerRectSizeChanged()
const
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_