UIMLView.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. #include "UIMLView.h"
  2. #include "XML.h"
  3. #include "TextFeld.h"
  4. #include "Knopf.h"
  5. #include "Tabelle.h"
  6. #include "Fenster.h"
  7. #include "Schrift.h"
  8. #include "Bildschirm.h"
  9. #include "Rahmen.h"
  10. #include "Scroll.h"
  11. #include "Bild.h"
  12. using namespace Framework;
  13. // Erstellt eine UIML View
  14. UIMLView::UIMLView()
  15. : ZeichnungHintergrund()
  16. {
  17. style = Style::MEIgnoreInside | Style::MEIgnoreParentInside | Style::MEIgnoreSichtbar | Style::MEIgnoreVerarbeitet;
  18. members = new Trie< Zeichnung >();
  19. dom = 0;
  20. nextId = 0;
  21. memset( &init, 0, sizeof( UIInit ) );
  22. }
  23. // Erstellt eine UIML View zu einem UIML Text
  24. // uiml: Ein xml element gemät des ksg uiml standarts
  25. UIMLView::UIMLView( XML::Element *uiml, UIInit &init )
  26. : ZeichnungHintergrund()
  27. {
  28. this->init = init;
  29. members = new Trie< Zeichnung >();
  30. dom = 0;
  31. nextId = 0;
  32. setUIML( uiml );
  33. }
  34. // Erstellt eine UIML View zu einem UIML Text
  35. // uiml: Ein xml text gemät des ksg uiml standarts
  36. UIMLView::UIMLView( Text uiml, UIInit &init )
  37. {
  38. this->init = init;
  39. members = new Trie< Zeichnung >();
  40. dom = 0;
  41. setUIML( uiml );
  42. }
  43. UIMLView::~UIMLView()
  44. {
  45. if( dom )
  46. dom->release();
  47. members->release();
  48. }
  49. // Verarbeitet ein Maus Ereignis. Wird vom Framework automatisch aufgerufen.
  50. // me: Das Ereignis
  51. void UIMLView::doMausEreignis( MausEreignis &me, bool userRet )
  52. {
  53. if( dom )
  54. {
  55. bool insideParent = me.insideParent;
  56. if( !hatStyle( Style::Sichtbar ) || !me.insideParent || me.verarbeitet || me.mx < 0 || me.my < 0 || me.mx >= gr.x || me.my >= gr.y || !userRet )
  57. me.insideParent = 0;
  58. int rbr = 0;
  59. if( hatStyle( Style::Rahmen ) && rahmen )
  60. rbr = rahmen->getRBreite();
  61. me.mx -= rbr;
  62. me.my -= rbr;
  63. if( hatStyle( Style::VScroll ) && vertikalScrollBar )
  64. me.my += vertikalScrollBar->getScroll();
  65. if( hatStyle( Style::HScroll ) && horizontalScrollBar )
  66. me.mx += horizontalScrollBar->getScroll();
  67. if( dom )
  68. {
  69. for( auto i = dom->getChilds(); i; i++ )
  70. { // TODO render elements backwards
  71. Zeichnung *z = members->z( i->getAttributeValue( "id" ) );
  72. if( z )
  73. z->doPublicMausEreignis( me );
  74. }
  75. }
  76. me.mx += rbr;
  77. me.my += rbr;
  78. if( hatStyle( Style::VScroll ) && vertikalScrollBar )
  79. me.my -= vertikalScrollBar->getScroll();
  80. if( hatStyle( Style::HScroll ) && horizontalScrollBar )
  81. me.mx -= horizontalScrollBar->getScroll();
  82. if( !hatStyle( Style::Sichtbar ) || !me.insideParent || me.verarbeitet || me.mx < 0 || me.my < 0 || me.mx >= gr.x || me.my >= gr.y || !userRet )
  83. me.insideParent = insideParent;
  84. else
  85. me.verarbeitet = 1;
  86. }
  87. }
  88. void UIMLView::parseTable( Iterator<XML::Element *> childs, ObjTabelle * table )
  89. {
  90. for( auto i = childs; i; i++ )
  91. {
  92. Text id;
  93. if( i->hasAttribute( "id" ) )
  94. id = i->getAttributeValue( "id" );
  95. else
  96. {
  97. id = Text( "_" ) += nextId++;
  98. i->setAttribute( "id", id );
  99. }
  100. if( i->getName().istGleich( "tr" ) )
  101. {
  102. table->addZeile( id );
  103. Text line = id;
  104. int c = 1;
  105. for( auto j = i->getChilds(); j; j++ )
  106. {
  107. Zeichnung *z = parseElement( j._ );
  108. if( table->getSpaltenAnzahl() < c )
  109. table->addSpalte( Text( c - 1 ) );
  110. if( z )
  111. table->setZeichnungZ( (char *)Text( c - 1 ), (char *)line, z->getThis() );
  112. c++;
  113. }
  114. }
  115. }
  116. }
  117. void UIMLView::parseFrame( Iterator<XML::Element *> childs, Fenster * frame )
  118. {
  119. for( auto i = childs; i; i++ )
  120. {
  121. Zeichnung *z = parseElement( i._ );
  122. if( z )
  123. frame->addMember( z->getThis() );
  124. }
  125. }
  126. Zeichnung *UIMLView::parseElement( XML::Element * e )
  127. {
  128. Text id;
  129. if( e->hasAttribute( "id" ) )
  130. id = e->getAttributeValue( "id" );
  131. else
  132. {
  133. id = Text( "_" ) += nextId++;
  134. e->setAttribute( "id", id );
  135. }
  136. Zeichnung *z = members->z( id );
  137. if( !z )
  138. {
  139. // precompute attributes
  140. if( e->hasAttribute( "margin" ) )
  141. {
  142. Text m = e->getAttributeValue( "margin" );
  143. if( !e->hasAttribute( "margin-left" ) )
  144. e->setAttribute( "margin-left", m );
  145. if( !e->hasAttribute( "margin-top" ) )
  146. e->setAttribute( "margin-top", m );
  147. if( !e->hasAttribute( "margin-right" ) )
  148. e->setAttribute( "margin-right", m );
  149. if( !e->hasAttribute( "margin-bottom" ) )
  150. e->setAttribute( "margin-bottom", m );
  151. }
  152. if( e->hasAttribute( "class" ) )
  153. {
  154. Text c = e->getAttributeValue( "class" );
  155. while( 1 )
  156. {
  157. Text *t;
  158. if( c.hat( "," ) )
  159. t = c.getTeilText( 0, c.positionVon( ',' ) );
  160. else
  161. t = new Text( c );
  162. XML::Editor ce = dom->selectChildsByName( "class" ).whereAttributeEquals( "id", *t );
  163. for( auto i = ce.getIterator(); i; i++ )
  164. {
  165. for( auto j = i->getAttributeNames(), k = i->getAttributeValues(); j && k; j++, k++ )
  166. {
  167. if( !e->hasAttribute( j->getText() ) )
  168. e->setAttribute( j->getText(), i->getText() );
  169. }
  170. }
  171. t->release();
  172. if( c.hat( "," ) )
  173. c.remove( 0, c.positionVon( ',' + 1 ) );
  174. else
  175. break;
  176. }
  177. }
  178. if( e->hasAttribute( "text-align" ) )
  179. {
  180. if( !e->hasAttribute( "text-align-horizontal" ) )
  181. e->setAttribute( "text-align-horizontal", e->getAttributeValue( "text-align" ) );
  182. if( !e->hasAttribute( "text-align-vertical" ) )
  183. e->setAttribute( "text-align-vertical", e->getAttributeValue( "text-align" ) );
  184. }
  185. // create objects
  186. if( e->getName().istGleich( "textfield" ) ||
  187. e->getName().istGleich( "text" ) ||
  188. e->getName().istGleich( "textarea" ) )
  189. {
  190. TextFeld *t = init.createTextFeld( init.initParam );
  191. if( e->getName().istGleich( "textfield" ) )
  192. t->addStyle( TextFeld::Style::TextFeld );
  193. if( e->getName().istGleich( "text" ) )
  194. t->addStyle( TextFeld::Style::Text );
  195. if( e->getName().istGleich( "textarea" ) )
  196. t->addStyle( TextFeld::Style::TextGebiet );
  197. t->setText( e->getText() );
  198. if( e->hasAttribute( "font-size" ) )
  199. t->setSchriftSize( (unsigned char)(int)e->getAttributeValue( "font-size" ) );
  200. if( e->hasAttribute( "text-align-horizontal" ) )
  201. {
  202. if( e->getAttributeValue( "text-align-horizontal" ).istGleich( "center" ) )
  203. t->addStyle( TextFeld::Style::HCenter );
  204. }
  205. if( e->hasAttribute( "text-align-vertical" ) )
  206. {
  207. if( e->getAttributeValue( "text-align-vertical" ).istGleich( "center" ) )
  208. t->addStyle( TextFeld::Style::VCenter );
  209. }
  210. z = t;
  211. }
  212. if( e->getName().istGleich( "button" ) )
  213. {
  214. Knopf *k = init.createKnopf( init.initParam );
  215. k->setText( e->getText() );
  216. if( e->hasAttribute( "font-size" ) )
  217. k->setSchriftSize( (unsigned char)(int)e->getAttributeValue( "font-size" ) );
  218. z = k;
  219. }
  220. if( e->getName().istGleich( "check" ) )
  221. {
  222. KontrollKnopf *k = init.createKontrollKnopf( init.initParam );
  223. k->setText( e->getText() );
  224. k->setSText( e->getText() );
  225. k->setStyle( KontrollKnopf::Style::Selected, e->hasAttribute( "selected" ) );
  226. if( e->hasAttribute( "font-size" ) )
  227. k->setSSize( (unsigned char)(int)e->getAttributeValue( "font-size" ) );
  228. z = k;
  229. }
  230. if( e->getName().istGleich( "table" ) )
  231. {
  232. ObjTabelle *t = init.createObjTabelle( init.initParam );
  233. parseTable( e->getChilds(), t );
  234. if( e->hasAttribute( "scroll" ) )
  235. {
  236. if( e->getAttributeValue( "scroll" ).istGleich( "horizontal" ) )
  237. t->addStyle( ObjTabelle::Style::HScroll );
  238. if( e->getAttributeValue( "scroll" ).istGleich( "vertical" ) )
  239. t->addStyle( ObjTabelle::Style::VScroll );
  240. if( e->getAttributeValue( "scroll" ).istGleich( "both" ) )
  241. t->addStyle( ObjTabelle::Style::scroll );
  242. }
  243. z = t;
  244. }
  245. if( e->getName().istGleich( "frame" ) )
  246. {
  247. Fenster *f = init.createFenster( init.initParam );
  248. parseFrame( e->getChilds(), f );
  249. if( e->hasAttribute( "title" ) )
  250. f->setTitel( e->getAttributeValue( "title" ) );
  251. if( e->hasAttribute( "title-height" ) )
  252. f->zTTextFeld()->setSize( f->zTTextFeld()->getBreite(), e->getAttributeValue( "title-height" ) );
  253. z = f;
  254. }
  255. // add general attributes
  256. if( z && e->hasAttribute( "tooltip" ) )
  257. z->setToolTipText( e->getAttributeValue( "tooltip" ), init.initParam.bildschirm, init.initParam.schrift );
  258. if( z && e->hasAttribute( "style" ) )
  259. z->setStyle( (__int64)e->getAttributeValue( "style" ) );
  260. if( z && e->hasAttribute( "hidden" ) )
  261. z->removeStyle( Zeichnung::Style::Sichtbar );
  262. if( z && e->hasAttribute( "disabled" ) )
  263. z->removeStyle( Zeichnung::Style::Erlaubt );
  264. if( z )
  265. members->set( id, z );
  266. }
  267. return z;
  268. }
  269. void UIMLView::layout( XML::Element * e, int pWidth, int pHeight )
  270. {
  271. Text id = e->getAttributeValue( "id" );
  272. Zeichnung *z = members->z( id );
  273. if( z )
  274. {
  275. int width = z->getBreite();
  276. int height = z->getHeight();
  277. if( e->hasAttribute( "width" ) )
  278. {
  279. Text w = e->getAttributeValue( "width" );
  280. width = w;
  281. if( w.getText()[ w.getLength() - 1 ] == '%' )
  282. width = (int)( ( pWidth / 100.0 ) * width );
  283. }
  284. if( e->hasAttribute( "height" ) )
  285. {
  286. Text h = e->getAttributeValue( "height" );
  287. height = h;
  288. if( h.getText()[ h.getLength() - 1 ] == '%' )
  289. height = (int)( ( pHeight / 100.0 ) * height );
  290. }
  291. z->setSize( width, height );
  292. if( e->hasAttribute( "align-left" ) )
  293. {
  294. Text la = e->getAttributeValue( "align-left" );
  295. int x = 0;
  296. if( la.istGleich( "start" ) )
  297. x = 0;
  298. else if( la.istGleich( "end" ) )
  299. x = pWidth;
  300. else
  301. {
  302. XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", la );
  303. for( auto i = ed.getIterator(); i; i++ )
  304. layout( i, pWidth, pHeight );
  305. Zeichnung * laz = members->z( la );
  306. if( laz )
  307. x = laz->getX() + laz->getBreite();
  308. }
  309. if( e->hasAttribute( "margin-left" ) )
  310. {
  311. Text mt = e->getAttributeValue( "margin-left" );
  312. int m = mt;
  313. if( mt.getText()[ mt.getLength() - 1 ] == '%' )
  314. m = (int)( ( pWidth / 100.0 ) * m );
  315. x += m;
  316. }
  317. z->setX( x );
  318. }
  319. else if( e->hasAttribute( "align-right" ) )
  320. {
  321. Text ra = e->getAttributeValue( "align-right" );
  322. int x = 0;
  323. if( ra.istGleich( "start" ) )
  324. x = -z->getBreite();
  325. else if( ra.istGleich( "end" ) )
  326. x = pWidth - z->getBreite();
  327. else
  328. {
  329. XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ra );
  330. for( auto i = ed.getIterator(); i; i++ )
  331. layout( i, pWidth, pHeight );
  332. Zeichnung * raz = members->z( ra );
  333. if( raz )
  334. x = raz->getX() - z->getBreite();
  335. }
  336. if( e->hasAttribute( "margin-right" ) )
  337. {
  338. Text mt = e->getAttributeValue( "margin-right" );
  339. int m = mt;
  340. if( mt.getText()[ mt.getLength() - 1 ] == '%' )
  341. m = (int)( ( pWidth / 100.0 ) * m );
  342. x -= m;
  343. }
  344. z->setX( x );
  345. }
  346. if( e->hasAttribute( "align-top" ) )
  347. {
  348. Text ta = e->getAttributeValue( "align-top" );
  349. int y = 0;
  350. if( ta.istGleich( "start" ) )
  351. y = 0;
  352. else if( ta.istGleich( "end" ) )
  353. y = pHeight;
  354. else
  355. {
  356. XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ta );
  357. for( auto i = ed.getIterator(); i; i++ )
  358. layout( i, pWidth, pHeight );
  359. Zeichnung * taz = members->z( ta );
  360. if( taz )
  361. y = taz->getY() + taz->getHeight();
  362. }
  363. if( e->hasAttribute( "margin-top" ) )
  364. {
  365. Text mt = e->getAttributeValue( "margin-top" );
  366. int m = mt;
  367. if( mt.getText()[ mt.getLength() - 1 ] == '%' )
  368. m = (int)( ( pHeight / 100.0 ) * m );
  369. y += m;
  370. }
  371. z->setY( y );
  372. }
  373. else if( e->hasAttribute( "align-bottom" ) )
  374. {
  375. Text ba = e->getAttributeValue( "align-bottom" );
  376. int y = 0;
  377. if( ba.istGleich( "start" ) )
  378. y = -z->getHeight();
  379. else if( ba.istGleich( "end" ) )
  380. y = pHeight - z->getHeight();
  381. else
  382. {
  383. XML::Editor ed = e->zParent()->selectChildsByAttribute( "id", ba );
  384. for( auto i = ed.getIterator(); i; i++ )
  385. layout( i, pWidth, pHeight );
  386. Zeichnung * baz = members->z( ba );
  387. if( baz )
  388. y = baz->getY() - z->getHeight();
  389. }
  390. if( e->hasAttribute( "margin-bottom" ) )
  391. {
  392. Text mt = e->getAttributeValue( "margin-bottom" );
  393. int m = mt;
  394. if( mt.getText()[ mt.getLength() - 1 ] == '%' )
  395. m = (int)( ( pHeight / 100.0 ) * m );
  396. y -= m;
  397. }
  398. z->setY( y );
  399. }
  400. int x = z->getX();
  401. int y = z->getY();
  402. if( e->hasAttribute( "x" ) )
  403. {
  404. Text xt = e->getAttributeValue( "x" );
  405. x = xt;
  406. if( xt.getText()[ xt.getLength() - 1 ] == '%' )
  407. x = (int)( ( pWidth / 100.0 ) * x );
  408. }
  409. if( e->hasAttribute( "y" ) )
  410. {
  411. Text yt = e->getAttributeValue( "y" );
  412. y = yt;
  413. if( yt.getText()[ yt.getLength() - 1 ] == '%' )
  414. y = (int)( ( pHeight / 100.0 ) * y );
  415. }
  416. z->setPosition( x, y );
  417. if( e->getName().istGleich( "textarea" ) )
  418. {
  419. ( (TextFeld *)z )->zTextRenderer()->textFormatieren( ( (TextFeld *)z )->zText(), z->getInnenBreite() );
  420. }
  421. }
  422. if( z )
  423. {
  424. pWidth = z->getInnenBreite();
  425. pHeight = z->getInnenHeight();
  426. }
  427. // recursive layout
  428. for( auto i = e->getChilds(); i; i++ )
  429. layout( i, pWidth, pHeight );
  430. if( z )
  431. {
  432. if( e->getName().istGleich( "table" ) )
  433. {
  434. ObjTabelle *objT = (ObjTabelle *)z;
  435. if( objT->getZeilenAnzahl() > 0 )
  436. {
  437. if( e->hasAttribute( "line-height" ) )
  438. {
  439. int height = e->getAttributeValue( "line-height" );
  440. for( int i = 0; i < objT->getZeilenAnzahl(); i++ )
  441. objT->setZeilenHeight( i, height );
  442. }
  443. for( int i = 0; i < objT->getSpaltenAnzahl(); i++ )
  444. {
  445. if( objT->zZeichnung( i, 0 ) )
  446. objT->setSpaltenBreite( i, objT->zZeichnung( i, 0 )->getBreite() );
  447. }
  448. }
  449. }
  450. }
  451. }
  452. // setzt den inhalt der view
  453. // uiml: Ein xml element gemät des ksg uiml standarts
  454. void UIMLView::setUIML( XML::Element * uiml )
  455. {
  456. if( dom )
  457. dom->release();
  458. dom = uiml;
  459. members->leeren();
  460. nextId = 0;
  461. if( dom )
  462. {
  463. for( auto i = dom->getChilds(); i; i++ )
  464. {
  465. parseElement( i._ );
  466. }
  467. }
  468. }
  469. // setzt den inhalt der view
  470. // uiml: Ein xml text gemät des ksg uiml standarts
  471. void UIMLView::setUIML( Text uiml )
  472. {
  473. setUIML( new XML::Element( uiml ) );
  474. }
  475. // Gibt eine zeichnung zurück, welche in uiml eine bestimmte id hat
  476. // id: die id der Zeichnung
  477. Zeichnung *UIMLView::zZeichnung( Text id )
  478. {
  479. return members->z( id );
  480. }
  481. // aktualisiert größe und position aller Zeichnungen gemäß den spezifikationen in UIML
  482. void UIMLView::layout()
  483. {
  484. if( dom )
  485. {
  486. for( auto i = dom->getChilds(); i; i++ )
  487. {
  488. layout( i._, this->getInnenBreite(), this->getInnenHeight() );
  489. }
  490. }
  491. }
  492. // fügt ein element hinzu
  493. // uiml: Ein xml text gemät des KSG UIML standarts, welcher das neue Objekt darstellt
  494. Text UIMLView::addMember( Text uiml )
  495. {
  496. XML::Element *e = new XML::Element( uiml );
  497. if( parseElement( e ) )
  498. dom->addChildAtFront( e );
  499. return e->getAttributeValue( "id" );
  500. }
  501. // fügt ein element zu einem Elternelement hinzu (funktioniert momentan nur mit frame Objekten)
  502. // uiml: Ein xml text gemät des KSG UIML standarts, welcher das neue Objekt darstellt
  503. Text UIMLView::addMember( Text uiml, Text parentId )
  504. {
  505. XML::Element *e = new XML::Element( uiml );
  506. XML::Editor ed = dom->selectChildren();
  507. while( ed.getIterator() )
  508. {
  509. XML::Editor ed2 = ed.whereAttributeEquals( "id", parentId );
  510. if( ed2.getIterator() )
  511. {
  512. if( ed2.getIterator()->getName().istGleich( "frame" ) )
  513. {
  514. Zeichnung *z = parseElement( e );
  515. if( z )
  516. {
  517. ( (Fenster *)members->z( parentId ) )->addMember( z->getThis() );
  518. ed2.getIterator()->addChild( e );
  519. }
  520. return e->getAttributeValue( "id" );
  521. }
  522. }
  523. ed = ed.selectChildren();
  524. }
  525. e->release();
  526. return "";
  527. }
  528. // entfernt ein element
  529. // id: id des Elements
  530. void UIMLView::removeMember( Text id )
  531. {
  532. XML::Editor e = dom->selectChildsByAttribute( "id", id );
  533. e.remove();
  534. members->remove( id );
  535. }
  536. // Verarbeitet ein Tastatur Ereignis. Wird vom Framework automatisch aufgerufen
  537. // te: Das Ereignis
  538. void UIMLView::doTastaturEreignis( TastaturEreignis & te )
  539. {
  540. bool verarbeitet = te.verarbeitet;
  541. ZeichnungHintergrund::doTastaturEreignis( te );
  542. te.verarbeitet = verarbeitet;
  543. if( dom )
  544. {
  545. for( auto i = dom->getChilds(); i; i++ )
  546. { // TODO render elements backwards
  547. Zeichnung *z = members->z( i->getAttributeValue( "id" ) );
  548. if( z )
  549. z->doTastaturEreignis( te );
  550. }
  551. }
  552. }
  553. // Updated den Zeichenhintergrund
  554. // tickVal: Die vergangene Zeit in Sekunden, die seit dem Letzten Aufruf dieser Funktion verstrichen ist
  555. // return: 1, wenn das Bild neu gezeichnet werden muss. 0 sonnst
  556. bool UIMLView::tick( double tickVal )
  557. {
  558. if( dom )
  559. {
  560. for( auto i = dom->getChilds(); i; i++ )
  561. { // TODO render elements backwards
  562. Zeichnung *z = members->z( i->getAttributeValue( "id" ) );
  563. if( z )
  564. rend |= z->tick( tickVal );
  565. }
  566. }
  567. return ZeichnungHintergrund::tick( tickVal );
  568. }
  569. // Zeichnet den Hintergrund eines Zeichnunges nach rObj
  570. void UIMLView::render( Bild & rObj )
  571. {
  572. ZeichnungHintergrund::render( rObj );
  573. if( dom )
  574. {
  575. if( !rObj.setDrawOptions( pos.x + getRahmenBreite(), pos.y + getRahmenBreite(), gr.x + getRahmenBreite() * 2, gr.y + getRahmenBreite() * 2 ) )
  576. return;
  577. bool vSc = hatStyle( Style::VScroll ) && vertikalScrollBar;
  578. bool hSc = hatStyle( Style::HScroll ) && horizontalScrollBar;
  579. rObj.addScrollOffset( hSc ? horizontalScrollBar->getScroll() : 0, vSc ? vertikalScrollBar->getScroll() : 0 );
  580. for( int i = dom->getChildCount() - 1; i >= 0; i-- )
  581. { // TODO render elements backwards
  582. XML::Element *e = dom->zChild( i );
  583. Zeichnung *z = members->z( e->getAttributeValue( "id" ) );
  584. if( z )
  585. z->render( rObj );
  586. }
  587. rObj.releaseDrawOptions();
  588. }
  589. }
  590. // Gibt den Dom Tree ohne erhöhten reference counter zurück
  591. // Änderungen am Dom Tree sollten vermieden werden (nur änderungen von attributen einzelner elemente sind erlaubt)
  592. XML::Element *UIMLView::zDom() const
  593. {
  594. return dom;
  595. }
  596. // Gibt den Dom Tree zurück
  597. // Änderungen am Dom Tree sollten vermieden werden (nur änderungen von attributen einzelner elemente sind erlaubt)
  598. XML::Element *UIMLView::getDom() const
  599. {
  600. return dom ? dom->getThis() : 0;
  601. }