|
|
@@ -14,33 +14,34 @@ class UIElement : public virtual Framework::ReferenceCounter
|
|
|
{
|
|
|
private:
|
|
|
Framework::Text id;
|
|
|
- int marginLeft;
|
|
|
- int marginRight;
|
|
|
- int marginTop;
|
|
|
- int marginBottom;
|
|
|
- int width;
|
|
|
- int height;
|
|
|
+ Framework::Text marginLeft;
|
|
|
+ Framework::Text marginRight;
|
|
|
+ Framework::Text marginTop;
|
|
|
+ Framework::Text marginBottom;
|
|
|
+ Framework::Text width;
|
|
|
+ Framework::Text height;
|
|
|
Framework::Text alignLeft;
|
|
|
Framework::Text alignRight;
|
|
|
Framework::Text alignTop;
|
|
|
Framework::Text alignBottom;
|
|
|
+ Framework::Text style;
|
|
|
|
|
|
public:
|
|
|
UIElement();
|
|
|
void setId(const Framework::Text& id);
|
|
|
const Framework::Text& getId() const;
|
|
|
- void setMarginLeft(int marginLeft);
|
|
|
- int getMarginLeft() const;
|
|
|
- void setMarginRight(int marginRight);
|
|
|
- int getMarginRight() const;
|
|
|
- void setMarginTop(int marginTop);
|
|
|
- int getMarginTop() const;
|
|
|
- void setMarginBottom(int marginBottom);
|
|
|
- int getMarginBottom() const;
|
|
|
- void setWidth(int width);
|
|
|
- int getWidth() const;
|
|
|
- void setHeight(int height);
|
|
|
- int getHeight() const;
|
|
|
+ void setMarginLeft(const Framework::Text& marginLeft);
|
|
|
+ const Framework::Text& getMarginLeft() const;
|
|
|
+ void setMarginRight(const Framework::Text& marginRight);
|
|
|
+ const Framework::Text& getMarginRight() const;
|
|
|
+ void setMarginTop(const Framework::Text& marginTop);
|
|
|
+ const Framework::Text& getMarginTop() const;
|
|
|
+ void setMarginBottom(const Framework::Text& marginBottom);
|
|
|
+ const Framework::Text& getMarginBottom() const;
|
|
|
+ void setWidth(const Framework::Text& width);
|
|
|
+ const Framework::Text& getWidth() const;
|
|
|
+ void setHeight(const Framework::Text& height);
|
|
|
+ const Framework::Text& getHeight() const;
|
|
|
void setAlignLeft(const Framework::Text& alignLeft);
|
|
|
const Framework::Text& getAlignLeft() const;
|
|
|
void setAlignRight(const Framework::Text& alignRight);
|
|
|
@@ -49,6 +50,8 @@ public:
|
|
|
const Framework::Text& getAlignTop() const;
|
|
|
void setAlignBottom(const Framework::Text& alignBottom);
|
|
|
const Framework::Text& getAlignBottom() const;
|
|
|
+ void setStyle(const Framework::Text& style);
|
|
|
+ const Framework::Text& getStyle() const;
|
|
|
virtual Framework::XML::Element* toUIML(
|
|
|
Framework::Either<Block*, Entity*> zTarget, Entity* zActor) const;
|
|
|
};
|
|
|
@@ -82,19 +85,43 @@ public:
|
|
|
->withRequiredNumber("marginLeft")
|
|
|
->withDefault(0.0)
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("marginLeft")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
->withRequiredNumber("marginRight")
|
|
|
->withDefault(0.0)
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("marginRight")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
->withRequiredNumber("marginTop")
|
|
|
->withDefault(0.0)
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("marginTop")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
->withRequiredNumber("marginBottom")
|
|
|
->withDefault(0.0)
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("marginBottom")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
->withRequiredNumber("width")
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("width")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
+ ->withRequiredString("width")
|
|
|
+ ->withExactMatch("auto")
|
|
|
+ ->finishString()
|
|
|
->withRequiredNumber("height")
|
|
|
->finishNumber()
|
|
|
+ ->withRequiredString("height")
|
|
|
+ ->whichEndsWithMatch("%")
|
|
|
+ ->finishString()
|
|
|
+ ->withRequiredString("height")
|
|
|
+ ->withExactMatch("auto")
|
|
|
+ ->finishString()
|
|
|
->withRequiredString("alignLeft")
|
|
|
->withDefault("")
|
|
|
->finishString()
|
|
|
@@ -106,6 +133,9 @@ public:
|
|
|
->finishString()
|
|
|
->withRequiredString("alignBottom")
|
|
|
->withDefault("")
|
|
|
+ ->finishString()
|
|
|
+ ->withRequiredString("style")
|
|
|
+ ->withDefault("")
|
|
|
->finishString();
|
|
|
}
|
|
|
|
|
|
@@ -113,17 +143,70 @@ public:
|
|
|
{
|
|
|
T* result = createElement(zJson);
|
|
|
result->setId(zJson->zValue("id")->asString()->getString());
|
|
|
- result->setMarginLeft(
|
|
|
- (int)zJson->zValue("marginLeft")->asNumber()->getNumber());
|
|
|
- result->setMarginRight(
|
|
|
- (int)zJson->zValue("marginRight")->asNumber()->getNumber());
|
|
|
- result->setMarginTop(
|
|
|
- (int)zJson->zValue("marginTop")->asNumber()->getNumber());
|
|
|
- result->setMarginBottom(
|
|
|
- (int)zJson->zValue("marginBottom")->asNumber()->getNumber());
|
|
|
- result->setWidth((int)zJson->zValue("width")->asNumber()->getNumber());
|
|
|
- result->setHeight(
|
|
|
- (int)zJson->zValue("height")->asNumber()->getNumber());
|
|
|
+ if (zJson->zValue("marginLeft")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setMarginLeft(
|
|
|
+ (int)zJson->zValue("marginLeft")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setMarginLeft(
|
|
|
+ zJson->zValue("marginLeft")->asString()->getString());
|
|
|
+ }
|
|
|
+ if (zJson->zValue("marginRight")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setMarginRight(
|
|
|
+ (int)zJson->zValue("marginRight")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setMarginRight(
|
|
|
+ zJson->zValue("marginRight")->asString()->getString());
|
|
|
+ }
|
|
|
+ if (zJson->zValue("marginTop")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setMarginTop(
|
|
|
+ (int)zJson->zValue("marginTop")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setMarginTop(
|
|
|
+ zJson->zValue("marginTop")->asString()->getString());
|
|
|
+ }
|
|
|
+ if (zJson->zValue("marginBottom")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setMarginBottom(
|
|
|
+ (int)zJson->zValue("marginBottom")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setMarginBottom(
|
|
|
+ zJson->zValue("marginBottom")->asString()->getString());
|
|
|
+ }
|
|
|
+ if (zJson->zValue("width")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setWidth(
|
|
|
+ (int)zJson->zValue("width")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setWidth(zJson->zValue("width")->asString()->getString());
|
|
|
+ }
|
|
|
+ if (zJson->zValue("height")->getType()
|
|
|
+ == Framework::AbstractType::NUMBER)
|
|
|
+ {
|
|
|
+ result->setHeight(
|
|
|
+ (int)zJson->zValue("height")->asNumber()->getNumber());
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ result->setHeight(zJson->zValue("height")->asString()->getString());
|
|
|
+ }
|
|
|
result->setAlignLeft(
|
|
|
zJson->zValue("alignLeft")->asString()->getString());
|
|
|
result->setAlignRight(
|
|
|
@@ -131,6 +214,7 @@ public:
|
|
|
result->setAlignTop(zJson->zValue("alignTop")->asString()->getString());
|
|
|
result->setAlignBottom(
|
|
|
zJson->zValue("alignBottom")->asString()->getString());
|
|
|
+ result->setStyle(zJson->zValue("style")->asString()->getString());
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
@@ -140,17 +224,17 @@ public:
|
|
|
result->addValue(
|
|
|
"id", new Framework::JSON::JSONString(zObject->getId()));
|
|
|
result->addValue("marginLeft",
|
|
|
- new Framework::JSON::JSONNumber(zObject->getMarginLeft()));
|
|
|
+ new Framework::JSON::JSONString(zObject->getMarginLeft()));
|
|
|
result->addValue("marginRight",
|
|
|
- new Framework::JSON::JSONNumber(zObject->getMarginRight()));
|
|
|
+ new Framework::JSON::JSONString(zObject->getMarginRight()));
|
|
|
result->addValue("marginTop",
|
|
|
- new Framework::JSON::JSONNumber(zObject->getMarginTop()));
|
|
|
+ new Framework::JSON::JSONString(zObject->getMarginTop()));
|
|
|
result->addValue("marginBottom",
|
|
|
- new Framework::JSON::JSONNumber(zObject->getMarginBottom()));
|
|
|
+ new Framework::JSON::JSONString(zObject->getMarginBottom()));
|
|
|
result->addValue(
|
|
|
- "width", new Framework::JSON::JSONNumber(zObject->getWidth()));
|
|
|
+ "width", new Framework::JSON::JSONString(zObject->getWidth()));
|
|
|
result->addValue(
|
|
|
- "height", new Framework::JSON::JSONNumber(zObject->getHeight()));
|
|
|
+ "height", new Framework::JSON::JSONString(zObject->getHeight()));
|
|
|
result->addValue("alignLeft",
|
|
|
new Framework::JSON::JSONString(zObject->getAlignLeft()));
|
|
|
result->addValue("alignRight",
|
|
|
@@ -159,6 +243,8 @@ public:
|
|
|
new Framework::JSON::JSONString(zObject->getAlignTop()));
|
|
|
result->addValue("alignBottom",
|
|
|
new Framework::JSON::JSONString(zObject->getAlignBottom()));
|
|
|
+ result->addValue(
|
|
|
+ "style", new Framework::JSON::JSONString(zObject->getStyle()));
|
|
|
return result;
|
|
|
}
|
|
|
|