|
@@ -29,14 +29,16 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
{
|
|
|
int width = z.getBreite();
|
|
|
int height = z.getHeight();
|
|
|
+ if (element.hasAttribute("style"))
|
|
|
+ {
|
|
|
+ z.setStyle((__int64)element.getAttributeValue("style"));
|
|
|
+ }
|
|
|
if (element.hasAttribute("width"))
|
|
|
{
|
|
|
Text w = element.getAttributeValue("width");
|
|
|
if (!w.istGleich("auto"))
|
|
|
{
|
|
|
- width = (int)w;
|
|
|
- if (w.getText()[w.getLength() - 1] == '%')
|
|
|
- width = (int)((pWidth / 100.0) * width);
|
|
|
+ width = calculateSize(w, pWidth);
|
|
|
}
|
|
|
}
|
|
|
if (element.hasAttribute("height"))
|
|
@@ -44,9 +46,7 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
Text h = element.getAttributeValue("height");
|
|
|
if (!h.istGleich("auto"))
|
|
|
{
|
|
|
- height = (int)h;
|
|
|
- if (h.getText()[h.getLength() - 1] == '%')
|
|
|
- height = (int)((pHeight / 100.0) * height);
|
|
|
+ height = calculateSize(h, pHeight);
|
|
|
}
|
|
|
}
|
|
|
z.setSize(width, height);
|
|
@@ -75,10 +75,7 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
if (element.hasAttribute("margin-left"))
|
|
|
{
|
|
|
Text mt = element.getAttributeValue("margin-left");
|
|
|
- int m = (int)mt;
|
|
|
- if (mt.getText()[mt.getLength() - 1] == '%')
|
|
|
- m = (int)((pWidth / 100.0) * m);
|
|
|
- x += m;
|
|
|
+ x += calculateSize(mt, pWidth);
|
|
|
}
|
|
|
z.setX(x);
|
|
|
}
|
|
@@ -107,10 +104,7 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
if (element.hasAttribute("margin-right"))
|
|
|
{
|
|
|
Text mt = element.getAttributeValue("margin-right");
|
|
|
- int m = (int)mt;
|
|
|
- if (mt.getText()[mt.getLength() - 1] == '%')
|
|
|
- m = (int)((pWidth / 100.0) * m);
|
|
|
- x -= m;
|
|
|
+ x -= calculateSize(mt, pWidth);
|
|
|
}
|
|
|
z.setX(x);
|
|
|
}
|
|
@@ -139,10 +133,7 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
if (element.hasAttribute("margin-top"))
|
|
|
{
|
|
|
Text mt = element.getAttributeValue("margin-top");
|
|
|
- int m = (int)mt;
|
|
|
- if (mt.getText()[mt.getLength() - 1] == '%')
|
|
|
- m = (int)((pHeight / 100.0) * m);
|
|
|
- y += m;
|
|
|
+ y += calculateSize(mt, pHeight);
|
|
|
}
|
|
|
z.setY(y);
|
|
|
}
|
|
@@ -171,10 +162,7 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
if (element.hasAttribute("margin-bottom"))
|
|
|
{
|
|
|
Text mt = element.getAttributeValue("margin-bottom");
|
|
|
- int m = (int)mt;
|
|
|
- if (mt.getText()[mt.getLength() - 1] == '%')
|
|
|
- m = (int)((pHeight / 100.0) * m);
|
|
|
- y -= m;
|
|
|
+ y -= calculateSize(mt, pHeight);
|
|
|
}
|
|
|
z.setY(y);
|
|
|
}
|
|
@@ -183,16 +171,12 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
if (element.hasAttribute("x"))
|
|
|
{
|
|
|
Text xt = element.getAttributeValue("x");
|
|
|
- x = (int)xt;
|
|
|
- if (xt.getText()[xt.getLength() - 1] == '%')
|
|
|
- x = (int)((pWidth / 100.0) * x);
|
|
|
+ x = calculateSize(xt, pWidth);
|
|
|
}
|
|
|
if (element.hasAttribute("y"))
|
|
|
{
|
|
|
Text yt = element.getAttributeValue("y");
|
|
|
- y = (int)yt;
|
|
|
- if (yt.getText()[yt.getLength() - 1] == '%')
|
|
|
- y = (int)((pHeight / 100.0) * y);
|
|
|
+ y = calculateSize(yt, pHeight);
|
|
|
}
|
|
|
z.setPosition(x, y);
|
|
|
pWidth = z.getInnenBreite();
|
|
@@ -213,6 +197,90 @@ void UIMLElement::layout(XML::Element& element,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+int Framework::UIMLElement::calculateSize(Text attributeValue, int parentSize)
|
|
|
+{
|
|
|
+ attributeValue.removeWhitespaceAfter(0);
|
|
|
+ attributeValue.removeWhitespaceBefore(attributeValue.getLength());
|
|
|
+ if (attributeValue.hat('('))
|
|
|
+ {
|
|
|
+ int start = -1;
|
|
|
+ int len = attributeValue.getLength();
|
|
|
+ for (int i = 0; i < len; i++)
|
|
|
+ {
|
|
|
+ if (attributeValue.getText()[i] == '(') start = i;
|
|
|
+ if (attributeValue.getText()[i] == ')')
|
|
|
+ {
|
|
|
+ if (start < 0) return 0;
|
|
|
+ Text* part = attributeValue.getTeilText(start + 1, i);
|
|
|
+ int value = calculateSize(*part, parentSize);
|
|
|
+ part->release();
|
|
|
+ attributeValue.remove(start, i + 1);
|
|
|
+ attributeValue.insert(start, Text(value));
|
|
|
+ return calculateSize(attributeValue, parentSize);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (attributeValue.hat('*') || attributeValue.hat('/'))
|
|
|
+ {
|
|
|
+ int posD = attributeValue.positionVon('/');
|
|
|
+ int posM = attributeValue.positionVon('*');
|
|
|
+ if ((posD >= 0 && posD < posM) || posM < 0)
|
|
|
+ {
|
|
|
+ Text* firstPart = attributeValue.getTeilText(0, posD);
|
|
|
+ Text* secondPart = attributeValue.getTeilText(posD + 1);
|
|
|
+ int first = calculateSize(*firstPart, parentSize);
|
|
|
+ int second = calculateSize(*secondPart, parentSize);
|
|
|
+ firstPart->release();
|
|
|
+ secondPart->release();
|
|
|
+ return first / second;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Text* firstPart = attributeValue.getTeilText(0, posM);
|
|
|
+ Text* secondPart = attributeValue.getTeilText(posM + 1);
|
|
|
+ int first = calculateSize(*firstPart, parentSize);
|
|
|
+ int second = calculateSize(*secondPart, parentSize);
|
|
|
+ firstPart->release();
|
|
|
+ secondPart->release();
|
|
|
+ return first * second;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (attributeValue.hat('+') || attributeValue.hat('-'))
|
|
|
+ {
|
|
|
+ int posP = attributeValue.positionVon('+');
|
|
|
+ int posN = attributeValue.positionVon('-');
|
|
|
+ if ((posP >= 0 && posP < posN) || posN < 0)
|
|
|
+ {
|
|
|
+ Text* firstPart = attributeValue.getTeilText(0, posP);
|
|
|
+ Text* secondPart = attributeValue.getTeilText(posP + 1);
|
|
|
+ int first = calculateSize(*firstPart, parentSize);
|
|
|
+ int second = calculateSize(*secondPart, parentSize);
|
|
|
+ firstPart->release();
|
|
|
+ secondPart->release();
|
|
|
+ return first + second;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ Text* firstPart = attributeValue.getTeilText(0, posN);
|
|
|
+ Text* secondPart = attributeValue.getTeilText(posN + 1);
|
|
|
+ int first = calculateSize(*firstPart, parentSize);
|
|
|
+ int second = calculateSize(*secondPart, parentSize);
|
|
|
+ firstPart->release();
|
|
|
+ secondPart->release();
|
|
|
+ return first - second;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (attributeValue.hatAt(attributeValue.getLength() - 1, "%"))
|
|
|
+ {
|
|
|
+ return (int)((int)attributeValue * (parentSize / 100.0));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ return (int)attributeValue;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
UIMLContainer::UIMLContainer()
|
|
|
: UIMLElement()
|
|
|
{}
|
|
@@ -242,16 +310,7 @@ bool Framework::UIMLTextField::updateElement(
|
|
|
{
|
|
|
TextFeld* t = dynamic_cast<TextFeld*>(&z);
|
|
|
if (!t) return false;
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- t->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
TextFeld* tmp = generalFactory.getFactory().createTextFeld(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -268,20 +327,12 @@ void UIMLTextField::layout(XML::Element& element,
|
|
|
int pHeight,
|
|
|
UIMLContainer& generalLayouter)
|
|
|
{
|
|
|
- if (element.hasAttribute("text-align-horizontal"))
|
|
|
- z.setStyle(TextFeld::Style::HCenter,
|
|
|
- element.getAttributeValue("text-align-horizontal")
|
|
|
- .istGleich("center"));
|
|
|
- if (element.hasAttribute("text-align-vertical"))
|
|
|
- z.setStyle(TextFeld::Style::VCenter,
|
|
|
- element.getAttributeValue("text-align-vertical")
|
|
|
- .istGleich("center"));
|
|
|
+ TextFeld* tf = dynamic_cast<TextFeld*>(&z);
|
|
|
if (element.hasAttribute("font-size"))
|
|
|
- ((TextFeld*)&z)
|
|
|
- ->setSchriftSize(
|
|
|
- (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
- if (element.hasAttribute("disabled"))
|
|
|
- z.removeStyle(TextFeld::Style::Editierbar);
|
|
|
+ {
|
|
|
+ tf->setSchriftSize(
|
|
|
+ (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
+ }
|
|
|
((TextFeld*)&z)->setText(element.getText());
|
|
|
if (element.hasAttribute("width"))
|
|
|
{
|
|
@@ -299,7 +350,35 @@ void UIMLTextField::layout(XML::Element& element,
|
|
|
z.setHeight(((TextFeld*)&z)->getNeededHeight());
|
|
|
}
|
|
|
}
|
|
|
+ if (element.hasAttribute("text-color"))
|
|
|
+ {
|
|
|
+ tf->setSchriftFarbe((int)element.getAttributeValue("text-color"));
|
|
|
+ }
|
|
|
UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter);
|
|
|
+ if (element.hasAttribute("text-align-horizontal"))
|
|
|
+ z.setStyle(TextFeld::Style::HCenter,
|
|
|
+ element.getAttributeValue("text-align-horizontal")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("text-align-vertical"))
|
|
|
+ z.setStyle(TextFeld::Style::VCenter,
|
|
|
+ element.getAttributeValue("text-align-vertical")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("disabled"))
|
|
|
+ z.removeStyle(TextFeld::Style::Editierbar);
|
|
|
+ if (element.getAttributeValue("vScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::VScroll,
|
|
|
+ tf->getNeededHeight() > tf->getInnenHeight());
|
|
|
+ tf->setVertikalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateVScroll();
|
|
|
+ }
|
|
|
+ if (element.getAttributeValue("hScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::HScroll,
|
|
|
+ tf->getNeededWidth() > tf->getInnenBreite());
|
|
|
+ tf->setHorizontalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateHScroll();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
UIMLButton::UIMLButton()
|
|
@@ -325,16 +404,7 @@ bool Framework::UIMLButton::updateElement(
|
|
|
{
|
|
|
Knopf* k = dynamic_cast<Knopf*>(&z);
|
|
|
if (!k) return false;
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- k->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
Knopf* tmp = generalFactory.getFactory().createKnopf(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -381,16 +451,7 @@ bool Framework::UIMLCheck::updateElement(
|
|
|
{
|
|
|
KontrollKnopf* k = dynamic_cast<KontrollKnopf*>(&z);
|
|
|
if (!k) return false;
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- k->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
KontrollKnopf* tmp = generalFactory.getFactory().createKontrollKnopf(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -440,16 +501,7 @@ bool Framework::UIMLText::updateElement(
|
|
|
{
|
|
|
TextFeld* t = dynamic_cast<TextFeld*>(&z);
|
|
|
if (!t) return false;
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- t->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
TextFeld* tmp = generalFactory.getFactory().createTextFeld(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -466,27 +518,19 @@ void UIMLText::layout(XML::Element& element,
|
|
|
int pHeight,
|
|
|
UIMLContainer& generalLayouter)
|
|
|
{
|
|
|
- if (element.hasAttribute("text-align-horizontal"))
|
|
|
- z.setStyle(TextFeld::Style::HCenter,
|
|
|
- element.getAttributeValue("text-align-horizontal")
|
|
|
- .istGleich("center"));
|
|
|
- if (element.hasAttribute("text-align-vertical"))
|
|
|
- z.setStyle(TextFeld::Style::VCenter,
|
|
|
- element.getAttributeValue("text-align-vertical")
|
|
|
- .istGleich("center"));
|
|
|
+ TextFeld* tf = dynamic_cast<TextFeld*>(&z);
|
|
|
if (element.hasAttribute("font-size"))
|
|
|
- ((TextFeld*)&z)
|
|
|
- ->setSchriftSize(
|
|
|
- (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
- if (element.hasAttribute("disabled"))
|
|
|
- z.removeStyle(TextFeld::Style::Editierbar);
|
|
|
- ((TextFeld*)&z)->setText(element.getText());
|
|
|
+ {
|
|
|
+ tf->setSchriftSize(
|
|
|
+ (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
+ }
|
|
|
+ tf->setText(element.getText());
|
|
|
if (element.hasAttribute("width"))
|
|
|
{
|
|
|
Text w = element.getAttributeValue("width");
|
|
|
if (w.istGleich("auto"))
|
|
|
{
|
|
|
- z.setWidth(((TextFeld*)&z)->getNeededWidth());
|
|
|
+ z.setWidth(tf->getNeededWidth());
|
|
|
}
|
|
|
}
|
|
|
if (element.hasAttribute("height"))
|
|
@@ -494,10 +538,38 @@ void UIMLText::layout(XML::Element& element,
|
|
|
Text h = element.getAttributeValue("height");
|
|
|
if (h.istGleich("auto"))
|
|
|
{
|
|
|
- z.setHeight(((TextFeld*)&z)->getNeededHeight());
|
|
|
+ z.setHeight(tf->getNeededHeight());
|
|
|
}
|
|
|
}
|
|
|
+ if (element.hasAttribute("text-color"))
|
|
|
+ {
|
|
|
+ tf->setSchriftFarbe((int)element.getAttributeValue("text-color"));
|
|
|
+ }
|
|
|
UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter);
|
|
|
+ if (element.hasAttribute("text-align-horizontal"))
|
|
|
+ z.setStyle(TextFeld::Style::HCenter,
|
|
|
+ element.getAttributeValue("text-align-horizontal")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("text-align-vertical"))
|
|
|
+ z.setStyle(TextFeld::Style::VCenter,
|
|
|
+ element.getAttributeValue("text-align-vertical")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("disabled"))
|
|
|
+ z.removeStyle(TextFeld::Style::Editierbar);
|
|
|
+ if (element.getAttributeValue("vScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::VScroll,
|
|
|
+ tf->getNeededHeight() > tf->getInnenHeight());
|
|
|
+ tf->setVertikalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateVScroll();
|
|
|
+ }
|
|
|
+ if (element.getAttributeValue("hScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::HScroll,
|
|
|
+ tf->getNeededWidth() > tf->getInnenBreite());
|
|
|
+ tf->setHorizontalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateHScroll();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
UIMLTextArea::UIMLTextArea()
|
|
@@ -523,16 +595,7 @@ bool Framework::UIMLTextArea::updateElement(
|
|
|
{
|
|
|
TextFeld* t = dynamic_cast<TextFeld*>(&z);
|
|
|
if (!t) return false;
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- t->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
TextFeld* tmp = generalFactory.getFactory().createTextFeld(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -549,24 +612,16 @@ void UIMLTextArea::layout(XML::Element& element,
|
|
|
int pHeight,
|
|
|
UIMLContainer& generalLayouter)
|
|
|
{
|
|
|
- if (element.hasAttribute("text-align-horizontal"))
|
|
|
- z.setStyle(TextFeld::Style::HCenter,
|
|
|
- element.getAttributeValue("text-align-horizontal")
|
|
|
- .istGleich("center"));
|
|
|
- if (element.hasAttribute("text-align-vertical"))
|
|
|
- z.setStyle(TextFeld::Style::VCenter,
|
|
|
- element.getAttributeValue("text-align-vertical")
|
|
|
- .istGleich("center"));
|
|
|
+ TextFeld* tf = dynamic_cast<TextFeld*>(&z);
|
|
|
if (element.hasAttribute("font-size"))
|
|
|
- ((TextFeld*)&z)
|
|
|
- ->setSchriftSize(
|
|
|
- (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
+ {
|
|
|
+ tf->setSchriftSize(
|
|
|
+ (unsigned char)(int)element.getAttributeValue("font-size"));
|
|
|
+ }
|
|
|
if (element.hasAttribute("disabled"))
|
|
|
z.removeStyle(TextFeld::Style::Editierbar);
|
|
|
- ((TextFeld*)&z)->setText(element.getText());
|
|
|
- ((TextFeld*)&z)
|
|
|
- ->zTextRenderer()
|
|
|
- ->textFormatieren(((TextFeld*)&z)->zText(), z.getInnenBreite());
|
|
|
+ tf->setText(element.getText());
|
|
|
+ tf->zTextRenderer()->textFormatieren(tf->zText(), z.getInnenBreite());
|
|
|
if (element.hasAttribute("width"))
|
|
|
{
|
|
|
Text w = element.getAttributeValue("width");
|
|
@@ -583,7 +638,34 @@ void UIMLTextArea::layout(XML::Element& element,
|
|
|
z.setHeight(((TextFeld*)&z)->getNeededHeight());
|
|
|
}
|
|
|
}
|
|
|
+ if (element.hasAttribute("text-color"))
|
|
|
+ {
|
|
|
+ tf->setSchriftFarbe((int)element.getAttributeValue("text-color"));
|
|
|
+ }
|
|
|
UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter);
|
|
|
+ if (element.hasAttribute("text-align-horizontal"))
|
|
|
+ z.setStyle(TextFeld::Style::HCenter,
|
|
|
+ element.getAttributeValue("text-align-horizontal")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("text-align-vertical"))
|
|
|
+ z.setStyle(TextFeld::Style::VCenter,
|
|
|
+ element.getAttributeValue("text-align-vertical")
|
|
|
+ .istGleich("center"));
|
|
|
+ if (element.hasAttribute("font-size"))
|
|
|
+ if (element.getAttributeValue("vScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::VScroll,
|
|
|
+ tf->getNeededHeight() > tf->getInnenHeight());
|
|
|
+ tf->setVertikalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateVScroll();
|
|
|
+ }
|
|
|
+ if (element.getAttributeValue("hScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ tf->setStyle(TextFeld::Style::HScroll,
|
|
|
+ tf->getNeededWidth() > tf->getInnenBreite());
|
|
|
+ tf->setHorizontalKlickScroll(tf->getSchriftSize());
|
|
|
+ tf->updateHScroll();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
UIMLTable::UIMLTable()
|
|
@@ -670,16 +752,7 @@ DLLEXPORT bool Framework::UIMLTable::updateElement(
|
|
|
t->removeSpalte(i);
|
|
|
i--;
|
|
|
}
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- t->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
ObjTabelle* tmp = generalFactory.getFactory().createObjTabelle(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -770,16 +843,7 @@ bool Framework::UIMLFrame::updateElement(
|
|
|
}
|
|
|
if (z) f->setMemberIndex(z, index++);
|
|
|
}
|
|
|
- if (element.hasAttribute("style"))
|
|
|
- {
|
|
|
- Text style = element.getAttributeValue("style");
|
|
|
- if (!style.hatAt(0, "0x"))
|
|
|
- {
|
|
|
- style.insert(0, "0x");
|
|
|
- }
|
|
|
- f->setStyle((int)style);
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!element.hasAttribute("style"))
|
|
|
{
|
|
|
Fenster* tmp = generalFactory.getFactory().createFenster(
|
|
|
generalFactory.getFactory().initParam);
|
|
@@ -795,14 +859,89 @@ void UIMLFrame::layout(XML::Element& element,
|
|
|
int pHeight,
|
|
|
UIMLContainer& generalLayouter)
|
|
|
{
|
|
|
+ Fenster* f = dynamic_cast<Fenster*>(&z);
|
|
|
if (element.hasAttribute("title"))
|
|
|
- ((Fenster*)&z)->setTitel(element.getAttributeValue("title"));
|
|
|
+ f->setTitel(element.getAttributeValue("title"));
|
|
|
if (element.hasAttribute("title-height"))
|
|
|
- ((Fenster*)&z)
|
|
|
- ->zTTextFeld()
|
|
|
- ->setSize(((Fenster*)&z)->zTTextFeld()->getBreite(),
|
|
|
- (int)element.getAttributeValue("title-height"));
|
|
|
- UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter);
|
|
|
+ {
|
|
|
+ f->zTTextFeld()->setSize(f->zTTextFeld()->getBreite(),
|
|
|
+ (int)element.getAttributeValue("title-height"));
|
|
|
+ }
|
|
|
+ if (element.hasAttribute("title-font-size"))
|
|
|
+ {
|
|
|
+ f->zTTextFeld()->setSchriftSize(
|
|
|
+ (unsigned char)(int)element.getAttributeValue("title-font-size"));
|
|
|
+ }
|
|
|
+ if (element.hasAttribute("title-text-color"))
|
|
|
+ {
|
|
|
+ f->zTTextFeld()->setSchriftFarbe(
|
|
|
+ (int)element.getAttributeValue("title-text-color"));
|
|
|
+ }
|
|
|
+ if (element.hasAttribute("display"))
|
|
|
+ {
|
|
|
+ UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter); // calculate all sizes
|
|
|
+ if (element.getAttributeValue("display").istGleich("column"))
|
|
|
+ {
|
|
|
+ int gap = calculateSize(element.getAttributeValue("gap"), pHeight);
|
|
|
+ int y = 0;
|
|
|
+ for (Zeichnung* z : f->getMembers())
|
|
|
+ {
|
|
|
+ Text id = generalLayouter.getZeichnungId(*z);
|
|
|
+ auto child = element.selectChildsByAttribute("id", id);
|
|
|
+
|
|
|
+ if (child.exists())
|
|
|
+ {
|
|
|
+ if (!child.whereAttributeExists("align-left").exists()
|
|
|
+ && !child.whereAttributeExists("align-right").exists()
|
|
|
+ && !child.whereAttributeExists("align-top").exists()
|
|
|
+ && !child.whereAttributeExists("align-bottom").exists())
|
|
|
+ {
|
|
|
+ z->setY(y);
|
|
|
+ y += z->getHeight() + gap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (element.getAttributeValue("display").istGleich("row"))
|
|
|
+ {
|
|
|
+ int gap = calculateSize(element.getAttributeValue("gap"), pWidth);
|
|
|
+ int x = 0;
|
|
|
+ for (Zeichnung* z : f->getMembers())
|
|
|
+ {
|
|
|
+ Text id = generalLayouter.getZeichnungId(*z);
|
|
|
+ auto child = element.selectChildsByAttribute("id", id);
|
|
|
+
|
|
|
+ if (child.exists())
|
|
|
+ {
|
|
|
+ if (!child.whereAttributeExists("align-left").exists()
|
|
|
+ && !child.whereAttributeExists("align-right").exists()
|
|
|
+ && !child.whereAttributeExists("align-top").exists()
|
|
|
+ && !child.whereAttributeExists("align-bottom").exists())
|
|
|
+ {
|
|
|
+ z->setX(x);
|
|
|
+ x += z->getBreite() + gap;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ UIMLElement::layout(element, z, pWidth, pHeight, generalLayouter); // calculate all remaining positions
|
|
|
+ if (element.hasAttribute("font-size"))
|
|
|
+ if (element.getAttributeValue("vScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ f->setStyle(
|
|
|
+ Fenster::Style::VScroll,
|
|
|
+ f->getNeededChildHeight() > f->getInnenHeight());
|
|
|
+ f->setVSBScroll(10);
|
|
|
+ f->updateVScroll();
|
|
|
+ }
|
|
|
+ if (element.getAttributeValue("hScroll").istGleich("auto"))
|
|
|
+ {
|
|
|
+ f->setStyle(Fenster::Style::HScroll,
|
|
|
+ f->getNeededChildWidth() > f->getInnenBreite());
|
|
|
+ f->setHSBScroll(10);
|
|
|
+ f->updateHScroll();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// Erstellt eine UIML View
|