|
@@ -147,131 +147,152 @@ Zeichnung *UIMLView::parseElement( XML::Element *e )
|
|
|
|
|
|
void UIMLView::layout( XML::Element *e )
|
|
|
{
|
|
|
- if( e->hasAttribute( "width" ) )
|
|
|
+ Text id = e->getAttributeValue( "id" );
|
|
|
+ Zeichnung *z = members->z( id );
|
|
|
+ if( z )
|
|
|
{
|
|
|
- Text id = e->getAttributeValue( "id" );
|
|
|
- Zeichnung *z = members->z( id );
|
|
|
- if( z )
|
|
|
+ int width = z->getBreite();
|
|
|
+ int height = z->getHeight();
|
|
|
+ if( e->hasAttribute( "width" ) )
|
|
|
{
|
|
|
- int width = z->getBreite();
|
|
|
- int height = z->getHeight();
|
|
|
- if( e->hasAttribute( "width" ) )
|
|
|
- {
|
|
|
- Text w = e->getAttributeValue( "width" );
|
|
|
- width = w;
|
|
|
- if( w.getText()[ w.getLength() - 1 ] == '%' )
|
|
|
- width = ( getBreite() / 100 ) * width;
|
|
|
- }
|
|
|
- if( e->hasAttribute( "height" ) )
|
|
|
- {
|
|
|
- Text h = e->getAttributeValue( "height" );
|
|
|
- height = h;
|
|
|
- if( h.getText()[ h.getLength() - 1 ] == '%' )
|
|
|
- height = ( getHeight() / 100 ) * height;
|
|
|
- }
|
|
|
- z->setSize( width, height );
|
|
|
- if( e->hasAttribute( "align-left" ) )
|
|
|
+ Text w = e->getAttributeValue( "width" );
|
|
|
+ width = w;
|
|
|
+ if( w.getText()[ w.getLength() - 1 ] == '%' )
|
|
|
+ width = ( getBreite() / 100 ) * width;
|
|
|
+ }
|
|
|
+ if( e->hasAttribute( "height" ) )
|
|
|
+ {
|
|
|
+ Text h = e->getAttributeValue( "height" );
|
|
|
+ height = h;
|
|
|
+ if( h.getText()[ h.getLength() - 1 ] == '%' )
|
|
|
+ height = ( getHeight() / 100 ) * height;
|
|
|
+ }
|
|
|
+ z->setSize( width, height );
|
|
|
+ if( e->hasAttribute( "align-left" ) )
|
|
|
+ {
|
|
|
+ Text la = e->getAttributeValue( "align-left" );
|
|
|
+ int x;
|
|
|
+ if( la.istGleich( "start" ) )
|
|
|
+ x = 0;
|
|
|
+ else if( la.istGleich( "end" ) )
|
|
|
+ x = getBreite();
|
|
|
+ else
|
|
|
{
|
|
|
- Text la = e->getAttributeValue( "align-left" );
|
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", la );
|
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
|
layout( i );
|
|
|
Zeichnung *laz = members->z( la );
|
|
|
if( laz )
|
|
|
- {
|
|
|
- int x = laz->getX() + laz->getBreite();
|
|
|
- if( e->hasAttribute( "margin-left" ) )
|
|
|
- {
|
|
|
- Text mt = e->getAttributeValue( "margin-left" );
|
|
|
- int m = mt;
|
|
|
- if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
- m = ( getBreite() / 100 ) * m;
|
|
|
- x += m;
|
|
|
- }
|
|
|
- z->setX( x );
|
|
|
- }
|
|
|
+ x = laz->getX() + laz->getBreite();
|
|
|
}
|
|
|
- else if( e->hasAttribute( "align-right" ) )
|
|
|
+ if( e->hasAttribute( "margin-left" ) )
|
|
|
+ {
|
|
|
+ Text mt = e->getAttributeValue( "margin-left" );
|
|
|
+ int m = mt;
|
|
|
+ if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
+ m = ( getBreite() / 100 ) * m;
|
|
|
+ x += m;
|
|
|
+ }
|
|
|
+ z->setX( x );
|
|
|
+ }
|
|
|
+ else if( e->hasAttribute( "align-right" ) )
|
|
|
+ {
|
|
|
+ Text ra = e->getAttributeValue( "align-right" );
|
|
|
+ int x;
|
|
|
+ if( ra.istGleich( "start" ) )
|
|
|
+ x = -z->getBreite();
|
|
|
+ else if( ra.istGleich( "end" ) )
|
|
|
+ x = getBreite() - z->getBreite();
|
|
|
+ else
|
|
|
{
|
|
|
- Text ra = e->getAttributeValue( "align-right" );
|
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ra );
|
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
|
layout( i );
|
|
|
Zeichnung *raz = members->z( ra );
|
|
|
if( raz )
|
|
|
- {
|
|
|
- int x = raz->getX() - z->getBreite();
|
|
|
- if( e->hasAttribute( "margin-left" ) )
|
|
|
- {
|
|
|
- Text mt = e->getAttributeValue( "margin-right" );
|
|
|
- int m = mt;
|
|
|
- if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
- m = ( getBreite() / 100 ) * m;
|
|
|
- x -= m;
|
|
|
- }
|
|
|
- z->setX( x );
|
|
|
- }
|
|
|
+ x = raz->getX() - z->getBreite();
|
|
|
}
|
|
|
- if( e->hasAttribute( "align-top" ) )
|
|
|
+ if( e->hasAttribute( "margin-right" ) )
|
|
|
+ {
|
|
|
+ Text mt = e->getAttributeValue( "margin-right" );
|
|
|
+ int m = mt;
|
|
|
+ if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
+ m = ( getBreite() / 100 ) * m;
|
|
|
+ x -= m;
|
|
|
+ }
|
|
|
+ z->setX( x );
|
|
|
+ }
|
|
|
+ if( e->hasAttribute( "align-top" ) )
|
|
|
+ {
|
|
|
+ Text ta = e->getAttributeValue( "align-top" );
|
|
|
+ int y;
|
|
|
+ if( ta.istGleich( "start" ) )
|
|
|
+ y = 0;
|
|
|
+ else if( ta.istGleich( "end" ) )
|
|
|
+ y = getHeight();
|
|
|
+ else
|
|
|
{
|
|
|
- Text ta = e->getAttributeValue( "align-top" );
|
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ta );
|
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
|
layout( i );
|
|
|
Zeichnung *taz = members->z( ta );
|
|
|
if( taz )
|
|
|
- {
|
|
|
- int y = taz->getY() + taz->getHeight();
|
|
|
- if( e->hasAttribute( "margin-top" ) )
|
|
|
- {
|
|
|
- Text mt = e->getAttributeValue( "margin-top" );
|
|
|
- int m = mt;
|
|
|
- if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
- m = ( getHeight() / 100 ) * m;
|
|
|
- y += m;
|
|
|
- }
|
|
|
- z->setY( y );
|
|
|
- }
|
|
|
+ y = taz->getY() + taz->getHeight();
|
|
|
}
|
|
|
- else if( e->hasAttribute( "align-bottom" ) )
|
|
|
+ if( e->hasAttribute( "margin-top" ) )
|
|
|
+ {
|
|
|
+ Text mt = e->getAttributeValue( "margin-top" );
|
|
|
+ int m = mt;
|
|
|
+ if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
+ m = ( getHeight() / 100 ) * m;
|
|
|
+ y += m;
|
|
|
+ }
|
|
|
+ z->setY( y );
|
|
|
+ }
|
|
|
+ else if( e->hasAttribute( "align-bottom" ) )
|
|
|
+ {
|
|
|
+ Text ba = e->getAttributeValue( "align-bottom" );
|
|
|
+ int y;
|
|
|
+ if( ba.istGleich( "start" ) )
|
|
|
+ y = -z->getHeight();
|
|
|
+ else if( ba.istGleich( "end" ) )
|
|
|
+ y = getHeight() - z->getHeight();
|
|
|
+ else
|
|
|
{
|
|
|
- Text ba = e->getAttributeValue( "align-bottom" );
|
|
|
XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ba );
|
|
|
for( auto i = ed.getIterator(); i; i++ )
|
|
|
layout( i );
|
|
|
Zeichnung *baz = members->z( ba );
|
|
|
if( baz )
|
|
|
- {
|
|
|
- int y = baz->getY() - z->getHeight();
|
|
|
- if( e->hasAttribute( "margin-bottom" ) )
|
|
|
- {
|
|
|
- Text mt = e->getAttributeValue( "margin-bottom" );
|
|
|
- int m = mt;
|
|
|
- if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
- m = ( getHeight() / 100 ) * m;
|
|
|
- y -= m;
|
|
|
- }
|
|
|
- z->setY( y );
|
|
|
- }
|
|
|
+ y = baz->getY() - z->getHeight();
|
|
|
}
|
|
|
- int x = z->getX();
|
|
|
- int y = z->getY();
|
|
|
- if( e->hasAttribute( "x" ) )
|
|
|
+ if( e->hasAttribute( "margin-bottom" ) )
|
|
|
{
|
|
|
- Text xt = e->getAttributeValue( "x" );
|
|
|
- x = xt;
|
|
|
- if( xt.getText()[ xt.getLength() - 1 ] == '%' )
|
|
|
- x = ( getBreite() / 100 ) * x;
|
|
|
+ Text mt = e->getAttributeValue( "margin-bottom" );
|
|
|
+ int m = mt;
|
|
|
+ if( mt.getText()[ mt.getLength() - 1 ] == '%' )
|
|
|
+ m = ( getHeight() / 100 ) * m;
|
|
|
+ y -= m;
|
|
|
}
|
|
|
- if( e->hasAttribute( "y" ) )
|
|
|
- {
|
|
|
- Text yt = e->getAttributeValue( "y" );
|
|
|
- y = yt;
|
|
|
- if( yt.getText()[ yt.getLength() - 1 ] == '%' )
|
|
|
- y = ( getHeight() / 100 ) * y;
|
|
|
- }
|
|
|
- z->setPosition( x, y );
|
|
|
+ z->setY( y );
|
|
|
+ }
|
|
|
+ int x = z->getX();
|
|
|
+ int y = z->getY();
|
|
|
+ if( e->hasAttribute( "x" ) )
|
|
|
+ {
|
|
|
+ Text xt = e->getAttributeValue( "x" );
|
|
|
+ x = xt;
|
|
|
+ if( xt.getText()[ xt.getLength() - 1 ] == '%' )
|
|
|
+ x = ( getBreite() / 100 ) * x;
|
|
|
+ }
|
|
|
+ if( e->hasAttribute( "y" ) )
|
|
|
+ {
|
|
|
+ Text yt = e->getAttributeValue( "y" );
|
|
|
+ y = yt;
|
|
|
+ if( yt.getText()[ yt.getLength() - 1 ] == '%' )
|
|
|
+ y = ( getHeight() / 100 ) * y;
|
|
|
}
|
|
|
+ z->setPosition( x, y );
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -297,7 +318,6 @@ void UIMLView::setUIML( XML::Element *uiml )
|
|
|
|
|
|
void UIMLView::setUIML( Text uiml )
|
|
|
{
|
|
|
- uiml.toLowerCase();
|
|
|
setUIML( new XML::Element( uiml ) );
|
|
|
}
|
|
|
|
|
@@ -329,6 +349,7 @@ void UIMLView::doMausEreignis( MausEreignis &me )
|
|
|
me.verarbeitet = verarbeitet;
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
{
|
|
|
+
|
|
|
if( i._ )
|
|
|
{
|
|
|
i->doMausEreignis( me );
|
|
@@ -345,6 +366,7 @@ void UIMLView::doTastaturEreignis( TastaturEreignis &te )
|
|
|
te.verarbeitet = verarbeitet;
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
{
|
|
|
+
|
|
|
if( i._ )
|
|
|
{
|
|
|
i->doTastaturEreignis( te );
|
|
@@ -359,6 +381,7 @@ bool UIMLView::tick( double tickVal )
|
|
|
{
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
{
|
|
|
+
|
|
|
if( i._ )
|
|
|
{
|
|
|
rend |= i->tick( tickVal );
|
|
@@ -373,6 +396,7 @@ void UIMLView::render( Bild &rObj )
|
|
|
ZeichnungHintergrund::render( rObj );
|
|
|
for( auto i = members->getIterator(); i; i++ )
|
|
|
{
|
|
|
+
|
|
|
if( i._ )
|
|
|
{
|
|
|
i->render( rObj );
|