ElementUtilities.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROCKETCOREELEMENTUTILITIES_H
00029 #define ROCKETCOREELEMENTUTILITIES_H
00030
00031 #include <Rocket/Core/Header.h>
00032 #include <Rocket/Core/Box.h>
00033 #include <Rocket/Core/WString.h>
00034 #include <Rocket/Core/Types.h>
00035
00036 namespace Rocket {
00037 namespace Core {
00038
00039 class Context;
00040 class FontFaceHandle;
00041 class RenderInterface;
00042
00049 class ROCKETCORE_API ElementUtilities
00050 {
00051 public:
00052 enum PositionAnchor
00053 {
00054 TOP = 1 << 0,
00055 BOTTOM = 1 << 1,
00056 LEFT = 1 << 2,
00057 RIGHT = 1 << 3,
00058
00059 TOP_LEFT = TOP | LEFT,
00060 TOP_RIGHT = TOP | RIGHT,
00061 BOTTOM_LEFT = BOTTOM | LEFT,
00062 BOTTOM_RIGHT = BOTTOM | RIGHT
00063 };
00064
00068 static Element* GetElementById(Element* root_element, const String& id);
00073 static void GetElementsByTagName(ElementList& elements, Element* root_element, const String& tag);
00074
00078 static FontFaceHandle* GetFontFaceHandle(Element* element);
00082 static int GetFontSize(Element* element);
00086 static int GetLineHeight(Element* element);
00091 static int GetStringWidth(Element* element, const WString& string);
00092
00095 static void BindEventAttributes(Element* element);
00096
00102 static bool GetClippingRegion(Vector2i& clip_origin, Vector2i& clip_dimensions, Element* element);
00107 static bool SetClippingRegion(Element* element, Context* context = NULL);
00110 static void PushClipCache(RenderInterface* render_interface);
00111
00116 static bool FormatElement(Element* element, const Vector2f& containing_block);
00117
00123 static void BuildBox(Box& box, const Vector2f& containing_block, Element* element, bool inline_element = false);
00124
00129 static bool PositionElement(Element* element, const Vector2f& offset);
00135 static bool PositionElement(Element* element, const Vector2f& offset, PositionAnchor anchor);
00136 };
00137
00138 }
00139 }
00140
00141 #endif