|
@@ -127,8 +127,15 @@ Zeichnung *UIMLView::parseElement( XML::Element *e )
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if( e->hasAttribute( "text-align" ) )
|
|
|
|
+ {
|
|
|
|
+ if( !e->hasAttribute( "text-align-horizontal" ) )
|
|
|
|
+ e->setAttribute( "text-align-horizontal", e->getAttributeValue( "text-align" ) );
|
|
|
|
+ if( !e->hasAttribute( "text-align-vertical" ) )
|
|
|
|
+ e->setAttribute( "text-align-vertical", e->getAttributeValue( "text-align" ) );
|
|
|
|
+ }
|
|
|
|
|
|
- if( e->getName().istGleich( "textfield" ) ||
|
|
+ if( e->getName().istGleich( "textfield" ) ||
|
|
e->getName().istGleich( "text" ) ||
|
|
e->getName().istGleich( "text" ) ||
|
|
e->getName().istGleich( "textarea" ) )
|
|
e->getName().istGleich( "textarea" ) )
|
|
{
|
|
{
|
|
@@ -142,6 +149,16 @@ Zeichnung *UIMLView::parseElement( XML::Element *e )
|
|
t->setText( e->getText() );
|
|
t->setText( e->getText() );
|
|
if( e->hasAttribute( "font-size" ) )
|
|
if( e->hasAttribute( "font-size" ) )
|
|
t->setSchriftSize( (int)e->getAttributeValue( "font-size" ) );
|
|
t->setSchriftSize( (int)e->getAttributeValue( "font-size" ) );
|
|
|
|
+ if( e->hasAttribute( "text-align-horizontal" ) )
|
|
|
|
+ {
|
|
|
|
+ if( e->getAttributeValue( "text-align-horizontal" ).istGleich( "center" ) )
|
|
|
|
+ t->addStyle( TextFeld::Style::HCenter );
|
|
|
|
+ }
|
|
|
|
+ if( e->hasAttribute( "text-align-vertical" ) )
|
|
|
|
+ {
|
|
|
|
+ if( e->getAttributeValue( "text-align-vertical" ).istGleich( "center" ) )
|
|
|
|
+ t->addStyle( TextFeld::Style::VCenter );
|
|
|
|
+ }
|
|
z = t;
|
|
z = t;
|
|
}
|
|
}
|
|
if( e->getName().istGleich( "button" ) )
|
|
if( e->getName().istGleich( "button" ) )
|
|
@@ -169,7 +186,7 @@ Zeichnung *UIMLView::parseElement( XML::Element *e )
|
|
return z;
|
|
return z;
|
|
}
|
|
}
|
|
|
|
|
|
-void UIMLView::layout( XML::Element *e )
|
|
+void UIMLView::layout( XML::Element *e, Zeichnung *parent )
|
|
{
|
|
{
|
|
Text id = e->getAttributeValue( "id" );
|
|
Text id = e->getAttributeValue( "id" );
|
|
Zeichnung *z = members->z( id );
|
|
Zeichnung *z = members->z( id );
|
|
@@ -182,14 +199,14 @@ void UIMLView::layout( XML::Element *e )
|
|
Text w = e->getAttributeValue( "width" );
|
|
Text w = e->getAttributeValue( "width" );
|
|
width = w;
|
|
width = w;
|
|
if( w.getText()[ w.getLength() - 1 ] == '%' )
|
|
if( w.getText()[ w.getLength() - 1 ] == '%' )
|
|
- width = ( getBreite() / 100 ) * width;
|
|
+ width = (int)( ( parent->getBreite() / 100.0 ) * width );
|
|
}
|
|
}
|
|
if( e->hasAttribute( "height" ) )
|
|
if( e->hasAttribute( "height" ) )
|
|
{
|
|
{
|
|
Text h = e->getAttributeValue( "height" );
|
|
Text h = e->getAttributeValue( "height" );
|
|
height = h;
|
|
height = h;
|
|
if( h.getText()[ h.getLength() - 1 ] == '%' )
|
|
if( h.getText()[ h.getLength() - 1 ] == '%' )
|
|
- height = ( getHeight() / 100 ) * height;
|
|
+ height = (int)( ( parent->getHeight() / 100.0 ) * height );
|
|
}
|
|
}
|
|
z->setSize( width, height );
|
|
z->setSize( width, height );
|
|
if( e->hasAttribute( "align-left" ) )
|
|
if( e->hasAttribute( "align-left" ) )
|
|
@@ -199,12 +216,12 @@ void UIMLView::layout( XML::Element *e )
|
|
if( la.istGleich( "start" ) )
|
|
if( la.istGleich( "start" ) )
|
|
x = 0;
|
|
x = 0;
|
|
else if( la.istGleich( "end" ) )
|
|
else if( la.istGleich( "end" ) )
|
|
- x = getBreite();
|
|
+ x = parent->getBreite();
|
|
else
|
|
else
|
|
{
|
|
{
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", la );
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", la );
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
- layout( i );
|
|
+ layout( i, parent );
|
|
Zeichnung *laz = members->z( la );
|
|
Zeichnung *laz = members->z( la );
|
|
if( laz )
|
|
if( laz )
|
|
x = laz->getX() + laz->getBreite();
|
|
x = laz->getX() + laz->getBreite();
|
|
@@ -214,7 +231,7 @@ void UIMLView::layout( XML::Element *e )
|
|
Text mt = e->getAttributeValue( "margin-left" );
|
|
Text mt = e->getAttributeValue( "margin-left" );
|
|
int m = mt;
|
|
int m = mt;
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
- m = ( getBreite() / 100 ) * m;
|
|
+ m = (int)( ( parent->getBreite() / 100.0 ) * m );
|
|
x += m;
|
|
x += m;
|
|
}
|
|
}
|
|
z->setX( x );
|
|
z->setX( x );
|
|
@@ -226,12 +243,12 @@ void UIMLView::layout( XML::Element *e )
|
|
if( ra.istGleich( "start" ) )
|
|
if( ra.istGleich( "start" ) )
|
|
x = -z->getBreite();
|
|
x = -z->getBreite();
|
|
else if( ra.istGleich( "end" ) )
|
|
else if( ra.istGleich( "end" ) )
|
|
- x = getBreite() - z->getBreite();
|
|
+ x = parent->getBreite() - z->getBreite();
|
|
else
|
|
else
|
|
{
|
|
{
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ra );
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ra );
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
- layout( i );
|
|
+ layout( i, parent );
|
|
Zeichnung *raz = members->z( ra );
|
|
Zeichnung *raz = members->z( ra );
|
|
if( raz )
|
|
if( raz )
|
|
x = raz->getX() - z->getBreite();
|
|
x = raz->getX() - z->getBreite();
|
|
@@ -241,7 +258,7 @@ void UIMLView::layout( XML::Element *e )
|
|
Text mt = e->getAttributeValue( "margin-right" );
|
|
Text mt = e->getAttributeValue( "margin-right" );
|
|
int m = mt;
|
|
int m = mt;
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
- m = ( getBreite() / 100 ) * m;
|
|
+ m = (int)( ( parent->getBreite() / 100.0 ) * m );
|
|
x -= m;
|
|
x -= m;
|
|
}
|
|
}
|
|
z->setX( x );
|
|
z->setX( x );
|
|
@@ -253,12 +270,12 @@ void UIMLView::layout( XML::Element *e )
|
|
if( ta.istGleich( "start" ) )
|
|
if( ta.istGleich( "start" ) )
|
|
y = 0;
|
|
y = 0;
|
|
else if( ta.istGleich( "end" ) )
|
|
else if( ta.istGleich( "end" ) )
|
|
- y = getHeight();
|
|
+ y = parent->getHeight();
|
|
else
|
|
else
|
|
{
|
|
{
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ta );
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ta );
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
- layout( i );
|
|
+ layout( i, parent );
|
|
Zeichnung *taz = members->z( ta );
|
|
Zeichnung *taz = members->z( ta );
|
|
if( taz )
|
|
if( taz )
|
|
y = taz->getY() + taz->getHeight();
|
|
y = taz->getY() + taz->getHeight();
|
|
@@ -268,7 +285,7 @@ void UIMLView::layout( XML::Element *e )
|
|
Text mt = e->getAttributeValue( "margin-top" );
|
|
Text mt = e->getAttributeValue( "margin-top" );
|
|
int m = mt;
|
|
int m = mt;
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
- m = ( getHeight() / 100 ) * m;
|
|
+ m = (int)( ( parent->getHeight() / 100.0 ) * m );
|
|
y += m;
|
|
y += m;
|
|
}
|
|
}
|
|
z->setY( y );
|
|
z->setY( y );
|
|
@@ -280,12 +297,12 @@ void UIMLView::layout( XML::Element *e )
|
|
if( ba.istGleich( "start" ) )
|
|
if( ba.istGleich( "start" ) )
|
|
y = -z->getHeight();
|
|
y = -z->getHeight();
|
|
else if( ba.istGleich( "end" ) )
|
|
else if( ba.istGleich( "end" ) )
|
|
- y = getHeight() - z->getHeight();
|
|
+ y = parent->getHeight() - z->getHeight();
|
|
else
|
|
else
|
|
{
|
|
{
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ba );
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ba );
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
- layout( i );
|
|
+ layout( i, parent );
|
|
Zeichnung *baz = members->z( ba );
|
|
Zeichnung *baz = members->z( ba );
|
|
if( baz )
|
|
if( baz )
|
|
y = baz->getY() - z->getHeight();
|
|
y = baz->getY() - z->getHeight();
|
|
@@ -295,7 +312,7 @@ void UIMLView::layout( XML::Element *e )
|
|
Text mt = e->getAttributeValue( "margin-bottom" );
|
|
Text mt = e->getAttributeValue( "margin-bottom" );
|
|
int m = mt;
|
|
int m = mt;
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
- m = ( getHeight() / 100 ) * m;
|
|
+ m = (int)( ( parent->getHeight() / 100.0 ) * m );
|
|
y -= m;
|
|
y -= m;
|
|
}
|
|
}
|
|
z->setY( y );
|
|
z->setY( y );
|
|
@@ -307,17 +324,35 @@ void UIMLView::layout( XML::Element *e )
|
|
Text xt = e->getAttributeValue( "x" );
|
|
Text xt = e->getAttributeValue( "x" );
|
|
x = xt;
|
|
x = xt;
|
|
if( xt.getText()[ xt.getLength() - 1 ] == '%' )
|
|
if( xt.getText()[ xt.getLength() - 1 ] == '%' )
|
|
- x = ( getBreite() / 100 ) * x;
|
|
+ x = (int)( ( parent->getBreite() / 100.0 ) * x );
|
|
}
|
|
}
|
|
if( e->hasAttribute( "y" ) )
|
|
if( e->hasAttribute( "y" ) )
|
|
{
|
|
{
|
|
Text yt = e->getAttributeValue( "y" );
|
|
Text yt = e->getAttributeValue( "y" );
|
|
y = yt;
|
|
y = yt;
|
|
if( yt.getText()[ yt.getLength() - 1 ] == '%' )
|
|
if( yt.getText()[ yt.getLength() - 1 ] == '%' )
|
|
- y = ( getHeight() / 100 ) * y;
|
|
+ y = (int)( ( parent->getHeight() / 100.0 ) * y );
|
|
}
|
|
}
|
|
z->setPosition( x, y );
|
|
z->setPosition( x, y );
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ for( auto i = e->getChilds(); i; i++ )
|
|
|
|
+ layout( i, z ? z : parent );
|
|
|
|
+ if( z )
|
|
|
|
+ {
|
|
|
|
+ if( e->getName().istGleich( "table" ) )
|
|
|
|
+ {
|
|
|
|
+ ObjTabelle *objT = (ObjTabelle*)z;
|
|
|
|
+ if( objT->getZeilenAnzahl() > 0 )
|
|
|
|
+ {
|
|
|
|
+ for( int i = 0; i < objT->getSpaltenAnzahl(); i++ )
|
|
|
|
+ {
|
|
|
|
+ if( objT->zZeichnung( i, 0 ) )
|
|
|
|
+ objT->setSpaltenBreite( i, objT->zZeichnung( i, 0 )->getBreite() );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -359,7 +394,7 @@ void UIMLView::layout()
|
|
{
|
|
{
|
|
for( auto i = dom->getChilds(); i; i++ )
|
|
for( auto i = dom->getChilds(); i; i++ )
|
|
{
|
|
{
|
|
- layout( i._ );
|
|
+ layout( i._, this );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|