| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- #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(int marginLeft)
- {
- this->marginLeft = marginLeft;
- }
- int UIElement::getMarginLeft() const
- {
- return marginLeft;
- }
- void UIElement::setMarginRight(int marginRight)
- {
- this->marginRight = marginRight;
- }
- int UIElement::getMarginRight() const
- {
- return marginRight;
- }
- void UIElement::setMarginTop(int marginTop)
- {
- this->marginTop = marginTop;
- }
- int UIElement::getMarginTop() const
- {
- return marginTop;
- }
- void UIElement::setMarginBottom(int marginBottom)
- {
- this->marginBottom = marginBottom;
- }
- int UIElement::getMarginBottom() const
- {
- return marginBottom;
- }
- void UIElement::setWidth(int width)
- {
- this->width = width;
- }
- int UIElement::getWidth() const
- {
- return width;
- }
- void UIElement::setHeight(int height)
- {
- this->height = height;
- }
- int 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;
- }
- 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 != 0)
- {
- result->setAttribute("marginLeft", Framework::Text(marginLeft));
- }
- if (marginRight != 0)
- {
- result->setAttribute("marginRight", Framework::Text(marginRight));
- }
- if (marginTop != 0)
- {
- result->setAttribute("marginTop", Framework::Text(marginTop));
- }
- if (marginBottom != 0)
- {
- result->setAttribute("marginBottom", Framework::Text(marginBottom));
- }
- result->setAttribute("width", Framework::Text(width));
- result->setAttribute("height", Framework::Text(height));
- if (alignLeft.getLength() > 0)
- {
- result->setAttribute("alignLeft", alignLeft);
- }
- if (alignRight.getLength() > 0)
- {
- result->setAttribute("alignRight", alignRight);
- }
- if (alignTop.getLength() > 0)
- {
- result->setAttribute("alignTop", alignTop);
- }
- if (alignBottom.getLength() > 0)
- {
- result->setAttribute("alignBottom", alignBottom);
- }
- 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;
- }
|