| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- #include "UIElement.h"
- UIElement::UIElement()
- : Framework::ReferenceCounter(),
- marginLeft(0),
- marginRight(0),
- marginTop(0),
- marginBottom(0),
- width(0),
- height(0)
- {}
- void UIElement::setId(const Framework::Text& id)
- {
- this->id = id;
- }
- const Framework::Text& UIElement::getId() const
- {
- return id;
- }
- void UIElement::setMarginLeft(const Framework::Text& marginLeft)
- {
- this->marginLeft = marginLeft;
- }
- const Framework::Text& UIElement::getMarginLeft() const
- {
- return marginLeft;
- }
- void UIElement::setMarginRight(const Framework::Text& marginRight)
- {
- this->marginRight = marginRight;
- }
- const Framework::Text& UIElement::getMarginRight() const
- {
- return marginRight;
- }
- void UIElement::setMarginTop(const Framework::Text& marginTop)
- {
- this->marginTop = marginTop;
- }
- const Framework::Text& UIElement::getMarginTop() const
- {
- return marginTop;
- }
- void UIElement::setMarginBottom(const Framework::Text& marginBottom)
- {
- this->marginBottom = marginBottom;
- }
- const Framework::Text& UIElement::getMarginBottom() const
- {
- return marginBottom;
- }
- void UIElement::setWidth(const Framework::Text& width)
- {
- this->width = width;
- }
- const Framework::Text& UIElement::getWidth() const
- {
- return width;
- }
- void UIElement::setHeight(const Framework::Text& height)
- {
- this->height = height;
- }
- const Framework::Text& UIElement::getHeight() const
- {
- return height;
- }
- void UIElement::setAlignLeft(const Framework::Text& alignLeft)
- {
- this->alignLeft = alignLeft;
- }
- const Framework::Text& UIElement::getAlignLeft() const
- {
- return alignLeft;
- }
- void UIElement::setAlignRight(const Framework::Text& alignRight)
- {
- this->alignRight = alignRight;
- }
- const Framework::Text& UIElement::getAlignRight() const
- {
- return alignRight;
- }
- void UIElement::setAlignTop(const Framework::Text& alignTop)
- {
- this->alignTop = alignTop;
- }
- const Framework::Text& UIElement::getAlignTop() const
- {
- return alignTop;
- }
- void UIElement::setAlignBottom(const Framework::Text& alignBottom)
- {
- this->alignBottom = alignBottom;
- }
- const Framework::Text& UIElement::getAlignBottom() const
- {
- return alignBottom;
- }
- void UIElement::setStyle(const Framework::Text& style)
- {
- this->style = style;
- }
- const Framework::Text& UIElement::getStyle() const
- {
- return style;
- }
- Framework::XML::Element* UIElement::toUIML(
- Framework::Either<Block*, Entity*> zTarget, Entity* zActor) const
- {
- Framework::XML::Element* result = new Framework::XML::Element();
- result->setAttribute("id", id);
- if (!marginLeft.istGleich("0"))
- {
- result->setAttribute("margin-left", marginLeft);
- }
- if (!marginRight.istGleich("0"))
- {
- result->setAttribute("margin-right", marginRight);
- }
- if (!marginTop.istGleich("0"))
- {
- result->setAttribute("margin-top", marginTop);
- }
- if (!marginBottom.istGleich("0"))
- {
- result->setAttribute("margin-bottom", marginBottom);
- }
- result->setAttribute("width", width);
- result->setAttribute("height", height);
- if (alignLeft.getLength() > 0)
- {
- result->setAttribute("align-left", alignLeft);
- }
- if (alignRight.getLength() > 0)
- {
- result->setAttribute("align-right", alignRight);
- }
- if (alignTop.getLength() > 0)
- {
- result->setAttribute("align-top", alignTop);
- }
- if (alignBottom.getLength() > 0)
- {
- result->setAttribute("align-bottom", alignBottom);
- }
- if (style.getLength() > 0)
- {
- result->setAttribute("style", style);
- }
- return result;
- }
- UIContainerElement::UIContainerElement()
- : UIElement()
- {}
- void UIContainerElement::addChild(UIElement* child)
- {
- children.add(child);
- }
- const Framework::RCArray<UIElement>& UIContainerElement::getChildren() const
- {
- return children;
- }
- Framework::XML::Element* UIContainerElement::toUIML(
- Framework::Either<Block*, Entity*> zTarget, Entity* zActor) const
- {
- Framework::XML::Element* result = UIElement::toUIML(zTarget, zActor);
- for (UIElement* child : children)
- {
- result->addChild(child->toUIML(zTarget, zActor));
- }
- return result;
- }
|