28 #ifndef ROCKETCOREELEMENT_H
29 #define ROCKETCOREELEMENT_H
50 class ElementInstancer;
51 class EventDispatcher;
53 class ElementBackground;
55 class ElementDecoration;
56 class ElementDefinition;
89 void SetClass(
const String& class_name,
bool activate);
96 bool IsClassSet(
const String& class_name)
const;
99 void SetClassNames(
const String& class_names);
102 String GetClassNames()
const;
111 const ElementDefinition* GetDefinition();
116 String GetAddress(
bool include_pseudo_classes =
false)
const;
122 void SetOffset(
const Vector2f& offset,
Element* offset_parent,
bool offset_fixed =
false);
136 void SetClientArea(
Box::Area client_area);
145 void SetContentBox(
const Vector2f& content_offset,
const Vector2f& content_box);
148 void SetBox(
const Box& box);
151 void AddBox(
const Box& box);
155 const Box& GetBox(
int index = 0);
162 virtual float GetBaseline()
const;
167 virtual bool GetIntrinsicDimensions(
Vector2f& dimensions);
172 virtual bool IsPointWithinElement(
const Vector2f& point);
179 float GetZIndex()
const;
183 FontFaceHandle* GetFontFaceHandle()
const;
188 bool SetProperty(
const String& name,
const String& value);
201 void RemoveProperty(
const String& name);
210 template <
typename T >
211 T GetProperty(
const String& name);
222 float ResolveProperty(
const String& name,
float base_value);
228 float ResolveProperty(
const Property *property,
float base_value);
231 void GetBorderWidthProperties(
const Property **border_top_width,
const Property **border_bottom_width,
const Property **border_left_width,
const Property **border_right_width);
237 void GetDimensionProperties(
const Property **width,
const Property **height);
240 void GetLocalDimensionProperties(
const Property **width,
const Property **height);
242 void GetOverflow(
int *overflow_x,
int *overflow_y);
253 const Property *GetLineHeightProperty();
257 int GetTextTransform();
259 const Property *GetVerticalAlignProperty();
273 void SetPseudoClass(
const String& pseudo_class,
bool activate);
280 bool IsPseudoClassSet(
const String& pseudo_class)
const;
293 template<
typename T >
297 void SetAttribute(
const String& name,
const T& value);
305 template<
typename T >
306 T GetAttribute(
const String& name,
const T& default_value)
const;
310 bool HasAttribute(
const String& name);
313 void RemoveAttribute(
const String& name);
322 template<
typename T >
323 bool IterateAttributes(
int& index,
String& name, T& value)
const;
326 int GetNumAttributes()
const;
357 const String& GetTagName()
const;
361 const String& GetId()
const;
364 void SetId(
const String&
id);
368 float GetAbsoluteLeft();
371 float GetAbsoluteTop();
376 float GetClientLeft();
380 float GetClientTop();
384 float GetClientWidth();
388 float GetClientHeight();
395 float GetOffsetLeft();
398 float GetOffsetTop();
401 float GetOffsetWidth();
404 float GetOffsetHeight();
408 float GetScrollLeft();
411 void SetScrollLeft(
float scroll_left);
414 float GetScrollTop();
417 void SetScrollTop(
float scroll_top);
420 float GetScrollWidth();
423 float GetScrollHeight();
427 ElementStyle* GetStyle();
435 Element* GetParentNode()
const;
439 Element* GetNextSibling()
const;
442 Element* GetPreviousSibling()
const;
446 Element* GetFirstChild()
const;
453 Element* GetChild(
int index)
const;
457 int GetNumChildren(
bool include_non_dom_elements =
false)
const;
461 virtual void GetInnerRML(
String& content)
const;
464 String GetInnerRML()
const;
467 void SetInnerRML(
const String& rml);
487 void AddEventListener(
const String& event,
EventListener* listener,
bool in_capture_phase =
false);
492 void RemoveEventListener(
const String& event,
EventListener* listener,
bool in_capture_phase =
false);
498 bool DispatchEvent(
const String& event,
const Dictionary& parameters,
bool interruptible =
false);
502 void ScrollIntoView(
bool align_with_top =
true);
507 void AppendChild(
Element* element,
bool dom_element =
true);
517 bool ReplaceChild(
Element* inserted_element,
Element* replaced_element);
521 bool RemoveChild(
Element* element);
524 bool HasChildNodes()
const;
544 EventDispatcher* GetEventDispatcher()
const;
549 ElementBackground* GetElementBackground()
const;
552 ElementBorder* GetElementBorder()
const;
555 ElementDecoration* GetElementDecoration()
const;
562 int GetClippingIgnoreDepth();
564 bool IsClippingEnabled();
576 virtual void ProcessEvent(
Event& event);
584 void ForceLocalStackingContext();
587 virtual void OnUpdate();
589 virtual void OnRender();
592 virtual void OnLayout();
603 virtual void OnChildAdd(
Element* child);
606 virtual void OnChildRemove(
Element* child);
609 virtual void DirtyLayout();
612 virtual bool IsLayoutDirty();
615 virtual void LockLayout(
bool lock);
618 virtual void DirtyFont();
622 virtual void GetRML(
String& content);
624 virtual void OnReferenceDeactivate();
627 void SetParent(
Element* parent);
629 void ReleaseDeletedElements();
635 void BuildLocalStackingContext();
636 void BuildStackingContext(
ElementList* stacking_context);
637 void DirtyStackingContext();
639 void DirtyStructure();
658 EventDispatcher* event_dispatcher;
662 ElementBackground* background;
664 ElementBorder* border;
666 ElementDecoration* decoration;
679 mutable bool offset_dirty;
685 typedef std::vector< Box > BoxList;
698 int num_non_dom_children;
704 bool local_stacking_context;
705 bool local_stacking_context_forced;
708 bool stacking_context_dirty;
711 FontFaceHandle* font_face_handle;
714 int clipping_ignore_depth;
715 bool clipping_enabled;
716 bool clipping_state_dirty;
719 friend class ElementStyle;
720 friend class LayoutEngine;
721 friend class LayoutInlineBox;
724 #include "Element.inl"
Definition: ElementDocument.h:55
ROCKETCORE_API RenderInterface * GetRenderInterface()
Definition: ScriptInterface.h:43
std::set< String > PseudoClassList
Definition: Types.h:91
uintptr_t DecoratorDataHandle
Definition: Types.h:87
Definition: Clipboard.h:33
Definition: StyleSheet.h:50
Definition: EventListener.h:46
Definition: PropertyDictionary.h:45
std::set< String > PropertyNameList
Definition: Types.h:92
ROCKETCORE_API Context * GetContext(const String &name)
ROCKETDEBUGGER_API bool IsVisible()
Definition: Dictionary.h:44
Definition: Property.h:43
Definition: ElementInstancer.h:54
Definition: Decorator.h:53
Definition: RenderInterface.h:48
std::vector< Element * > ElementList
Definition: Types.h:90
std::set< String > AttributeNameList
Definition: Types.h:93