Zeichnung.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  1. #include "Zeichnung.h"
  2. #include "MausEreignis.h"
  3. #include "TastaturEreignis.h"
  4. #include "Globals.h"
  5. #include "ToolTip.h"
  6. #include "Scroll.h"
  7. #include "Text.h"
  8. #include "Rahmen.h"
  9. #include "AlphaFeld.h"
  10. #include "Bild.h"
  11. #include "TextFeld.h"
  12. #ifdef WIN32
  13. #include <Windows.h>
  14. #endif
  15. using namespace Framework;
  16. // Inhalt der Zeichnung Klasse aus Zeichnung.h
  17. // Konstruktor
  18. Zeichnung::Zeichnung()
  19. : pos( 0, 0 ),
  20. gr( 0, 0 ),
  21. makParam( 0 ),
  22. takParam( 0 ),
  23. mak( 0 ),
  24. tak( 0 ),
  25. nmakParam( 0 ),
  26. ntakParam( 0 ),
  27. nMak( 0 ),
  28. nTak( 0 ),
  29. mausIn( 0 ),
  30. toolTip( 0 ),
  31. style( 0 ),
  32. rend( 0 ),
  33. ref( 1 )
  34. {}
  35. // Destruktor
  36. Zeichnung::~Zeichnung()
  37. {
  38. if( toolTip )
  39. toolTip->release();
  40. }
  41. // Übergibt einen Void Funktionspointer auf eine Aktion die einmalig vom Hauptthread ausgeführt werden soll. (Passiert nach dem Tick)
  42. void Zeichnung::postAction( std::function< void() > action )
  43. {
  44. actions.push( action );
  45. }
  46. // nicht constant
  47. void Zeichnung::setRender()
  48. {
  49. rend = 1;
  50. }
  51. void Zeichnung::setToolTipText( const char *txt, Bildschirm *zScreen )
  52. {
  53. if( !txt )
  54. toolTip = (ToolTip*)toolTip->release();
  55. else
  56. {
  57. if( !toolTip )
  58. toolTip = new ToolTip( zScreen );
  59. TextFeld *t = new TextFeld();
  60. t->setText( txt );
  61. toolTip->addMember( t );
  62. }
  63. }
  64. // legt den tooltip fest
  65. // tt: der tooltip
  66. void Zeichnung::setToolTipZ( ToolTip *tt )
  67. {
  68. if( toolTip )
  69. toolTip->release();
  70. toolTip = tt;
  71. }
  72. void Zeichnung::lockZeichnung()
  73. {
  74. cs.lock();
  75. }
  76. void Zeichnung::unlockZeichnung()
  77. {
  78. cs.unlock();
  79. }
  80. void Zeichnung::setMausEreignisParameter( void *p ) // setzt den Parameter vom Maus Ereignis
  81. {
  82. makParam = p;
  83. }
  84. void Zeichnung::setTastaturEreignisParameter( void *p ) // setzt den Parameter vom Tastatur Ereignis
  85. {
  86. takParam = p;
  87. }
  88. void Zeichnung::setMausEreignis( MausAktion ak ) // setzt das Maus Ereignis
  89. {
  90. mak = ak;
  91. }
  92. void Zeichnung::setTastaturEreignis( TastaturAktion ak ) // setzt das TastaturEreignis
  93. {
  94. tak = ak;
  95. }
  96. void Zeichnung::setNMausEreignisParameter( void *p ) // setzt den Parameter vom Maus Ereignis
  97. {
  98. nmakParam = p;
  99. }
  100. void Zeichnung::setNTastaturEreignisParameter( void *p ) // setzt den Parameter vom Tastatur Ereignis
  101. {
  102. ntakParam = p;
  103. }
  104. void Zeichnung::setNMausEreignis( MausAktion ak ) // setzt das Maus Ereignis
  105. {
  106. nMak = ak;
  107. }
  108. void Zeichnung::setNTastaturEreignis( TastaturAktion ak ) // setzt das TastaturEreignis
  109. {
  110. nTak = ak;
  111. }
  112. void Zeichnung::doMausEreignis( MausEreignis &me ) // ruft Mak auf
  113. {
  114. if( me.verarbeitet || ( !( me.mx >= pos.x && me.mx <= pos.x + gr.x && me.my >= pos.y && me.my <= pos.y + gr.y ) && me.id != ME_Leaves ) )
  115. {
  116. if( mausIn )
  117. {
  118. mausIn = 0;
  119. if( toolTip )
  120. toolTip->setMausIn( 0 );
  121. MausEreignis me2;
  122. me2.id = ME_Leaves;
  123. me2.mx = me.mx;
  124. me2.my = me.my;
  125. me2.verarbeitet = 0;
  126. doMausEreignis( me2 );
  127. }
  128. return;
  129. }
  130. if( !mausIn && me.id != ME_Leaves )
  131. {
  132. mausIn = 1;
  133. if( toolTip )
  134. toolTip->setMausIn( 1 );
  135. MausEreignis me2;
  136. me2.id = ME_Betritt;
  137. me2.mx = me.mx;
  138. me2.my = me.my;
  139. me2.verarbeitet = 0;
  140. doMausEreignis( me2 );
  141. }
  142. me.mx -= pos.x, me.my -= pos.y;
  143. if( mak )
  144. me.verarbeitet |= mak( makParam, this, me );
  145. if( nMak && me.verarbeitet )
  146. me.verarbeitet = nMak( nmakParam, this, me );
  147. me.mx += pos.x, me.my += pos.y;
  148. }
  149. void Zeichnung::doTastaturEreignis( TastaturEreignis &te ) // ruft Tak auf
  150. {
  151. if( te.verarbeitet )
  152. return;
  153. if( tak )
  154. te.verarbeitet |= tak( takParam, this, te );
  155. if( nTak && te.verarbeitet )
  156. te.verarbeitet = nTak( ntakParam, this, te );
  157. }
  158. void Zeichnung::setPosition( const Punkt &pos ) // setzt die position
  159. {
  160. lockZeichnung();
  161. if( this->pos != pos )
  162. rend = 1;
  163. this->pos = pos;
  164. unlockZeichnung();
  165. }
  166. void Zeichnung::setX( int xPos )
  167. {
  168. lockZeichnung();
  169. if( pos.x != xPos )
  170. {
  171. rend = 1;
  172. pos.x = xPos;
  173. }
  174. unlockZeichnung();
  175. }
  176. void Zeichnung::setY( int yPos )
  177. {
  178. lockZeichnung();
  179. if( pos.y != yPos )
  180. {
  181. rend = 1;
  182. pos.y = yPos;
  183. }
  184. unlockZeichnung();
  185. }
  186. void Zeichnung::setSize( const Punkt &gr ) // setzt die Größe
  187. {
  188. lockZeichnung();
  189. if( this->gr != gr )
  190. rend = 1;
  191. this->gr = gr;
  192. unlockZeichnung();
  193. }
  194. void Zeichnung::setPosition( int x, int y ) // setzt die position
  195. {
  196. setPosition( Punkt( x, y ) );
  197. }
  198. void Zeichnung::setSize( int x, int y ) // setzt die Größe
  199. {
  200. setSize( Punkt( x, y ) );
  201. }
  202. bool Zeichnung::tick( double tickval )
  203. {
  204. while( !actions.empty() )
  205. {
  206. actions.front()();
  207. actions.pop();
  208. }
  209. bool r = rend;
  210. rend = 0;
  211. return r;
  212. }
  213. void Zeichnung::setStyle( __int64 style ) // setzt den Style des Text Feldes
  214. {
  215. if( this->style != style )
  216. {
  217. this->style = style;
  218. rend = 1;
  219. }
  220. }
  221. void Zeichnung::setStyle( __int64 style, bool add_remove )
  222. {
  223. if( add_remove && ( this->style | style ) != this->style )
  224. {
  225. this->style |= style;
  226. rend = 1;
  227. }
  228. else if( !add_remove && ( this->style & ~style ) != this->style )
  229. {
  230. if( toolTip && ( style | Style::Sichtbar ) == style )
  231. toolTip->setMausIn( 0 );
  232. this->style &= ~style;
  233. rend = 1;
  234. }
  235. }
  236. void Zeichnung::addStyle( __int64 style )
  237. {
  238. if( ( this->style | style ) != this->style )
  239. {
  240. this->style |= style;
  241. rend = 1;
  242. }
  243. }
  244. void Zeichnung::removeStyle( __int64 style )
  245. {
  246. if( ( this->style & ~style ) != this->style )
  247. {
  248. if( toolTip && ( style | Style::Sichtbar ) == style )
  249. toolTip->setMausIn( 0 );
  250. this->style &= ~style;
  251. rend = 1;
  252. }
  253. }
  254. void Zeichnung::render( Bild &zRObj )
  255. {
  256. if( toolTip && ( style | Style::Sichtbar ) == style )
  257. toolTip->setZeichnen();
  258. }
  259. // constant
  260. bool Zeichnung::hatMausEreignis() const // prüft, ob Mak gesetzt ist
  261. {
  262. return mak != 0;
  263. }
  264. bool Zeichnung::hatTastaturEreignis() const // prüft, ob Tak gesetzt ist
  265. {
  266. return tak != 0;
  267. }
  268. const Punkt &Zeichnung::getPosition() const // gibt die Position zurück
  269. {
  270. return pos;
  271. }
  272. const Punkt &Zeichnung::getSize() const // gibt die Größe zurück
  273. {
  274. return gr;
  275. }
  276. int Zeichnung::getBreite() const // gibt die Breite zurück
  277. {
  278. return gr.x;
  279. }
  280. int Zeichnung::getHeight() const // gibt die Höhe zurück
  281. {
  282. return gr.y;
  283. }
  284. // Gibt die Breite des Innenraumes in der Zeichnung in Pixeln zurück
  285. int Zeichnung::getInnenBreite() const
  286. {
  287. return gr.x;
  288. }
  289. // Gibt die Höhe des Innenraumes in der Zeichnung in Pixeln zurück
  290. int Zeichnung::getInnenHeight() const
  291. {
  292. return gr.y;
  293. }
  294. int Zeichnung::getX() const // gibt X zurück
  295. {
  296. return pos.x;
  297. }
  298. int Zeichnung::getY() const // gibt Y zurück
  299. {
  300. return pos.y;
  301. }
  302. ToolTip *Zeichnung::getToolTip() const // gibt den ToolTip Text
  303. {
  304. return ( ToolTip*)toolTip->getThis();
  305. }
  306. ToolTip *Zeichnung::zToolTip() const
  307. {
  308. return toolTip;
  309. }
  310. bool Zeichnung::hatStyle( __int64 style ) const // prüft, ob style vorhanden
  311. {
  312. return ( this->style | style ) == this->style;
  313. }
  314. bool Zeichnung::hatStyleNicht( __int64 style ) const // prüft, ob style nicht vorhanden
  315. {
  316. return ( this->style | style ) != this->style;
  317. }
  318. Zeichnung *Zeichnung::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
  319. {
  320. Zeichnung *obj = new Zeichnung();
  321. obj->setPosition( pos );
  322. obj->setSize( gr );
  323. obj->setMausEreignisParameter( makParam );
  324. obj->setTastaturEreignisParameter( takParam );
  325. obj->setMausEreignis( mak );
  326. obj->setTastaturEreignis( tak );
  327. if( toolTip )
  328. obj->setToolTipZ( (ToolTip*)toolTip->dublizieren() );
  329. return obj;
  330. }
  331. Zeichnung *Zeichnung::getThis()
  332. {
  333. ref++;
  334. return this;
  335. }
  336. Zeichnung *Zeichnung::release()
  337. {
  338. if( !--ref )
  339. delete this;
  340. return 0;
  341. }
  342. // Inhalt der ZeichnungHintergrund Klasse aus Zeichnung.h
  343. // Konstruktor
  344. ZeichnungHintergrund::ZeichnungHintergrund()
  345. : Zeichnung()
  346. {
  347. hintergrundFarbe = 0xFF000000;
  348. rahmen = 0;
  349. hintergrundBild = 0;
  350. hintergrundFeld = 0;
  351. horizontalScrollBar = 0;
  352. vertikalScrollBar = 0;
  353. innenPosition.x = 0;
  354. innenPosition.y = 0;
  355. innenSize.x = 0;
  356. innenSize.y = 0;
  357. }
  358. // Destruktor
  359. ZeichnungHintergrund::~ZeichnungHintergrund()
  360. {
  361. if( rahmen )
  362. rahmen->release();
  363. if( hintergrundBild )
  364. hintergrundBild->release();
  365. if( hintergrundFeld )
  366. hintergrundFeld->release();
  367. if( horizontalScrollBar )
  368. horizontalScrollBar->release();
  369. if( vertikalScrollBar )
  370. vertikalScrollBar->release();
  371. }
  372. void ZeichnungHintergrund::setHintergrundBild( Bild *bild ) // setzt das Hintergrund Bild
  373. {
  374. if( !hintergrundBild )
  375. hintergrundBild = new Bild();
  376. hintergrundBild->neuBild( bild->getBreite(), bild->getHeight(), 0 );
  377. int *buff1 = hintergrundBild->getBuffer();
  378. int *buff2 = bild->getBuffer();
  379. for( int i = 0; i < bild->getBreite() * bild->getHeight(); ++i )
  380. buff1[ i ] = buff2[ i ];
  381. bild->release();
  382. rend = 1;
  383. }
  384. void ZeichnungHintergrund::setHintergrundBildZ( Bild *bild ) // setzt einen Zeiger zum Hintergrund Bild
  385. {
  386. if( hintergrundBild != bild )
  387. {
  388. if( hintergrundBild )
  389. hintergrundBild->release();
  390. hintergrundBild = bild;
  391. rend = 1;
  392. }
  393. }
  394. void ZeichnungHintergrund::setHintergrundFarbe( int fc ) // setzt die Hintergrundfarbe
  395. {
  396. if( hintergrundFarbe != fc )
  397. {
  398. hintergrundFarbe = fc;
  399. rend = 1;
  400. }
  401. }
  402. void ZeichnungHintergrund::setAlphaFeldZ( AlphaFeld *buff ) // setzt einen Zeiger zum Hintergrund Buffer
  403. {
  404. if( hintergrundFeld != buff )
  405. {
  406. if( hintergrundFeld )
  407. hintergrundFeld->release();
  408. hintergrundFeld = buff;
  409. rend = 1;
  410. }
  411. }
  412. void ZeichnungHintergrund::setAlphaFeldStrength( int st ) // setzt die Stärke des Hintergrund Buffers
  413. {
  414. if( !hintergrundFeld )
  415. {
  416. hintergrundFeld = new AlphaFeld();
  417. rend = 1;
  418. }
  419. if( hintergrundFeld->getStrength() != st )
  420. {
  421. hintergrundFeld->setStrength( st );
  422. rend = 1;
  423. }
  424. }
  425. void ZeichnungHintergrund::setAlphaFeldFarbe( int fc ) // setzt die Farbe des Hintergrund Buffers
  426. {
  427. if( !hintergrundFeld )
  428. {
  429. hintergrundFeld = new AlphaFeld();
  430. rend = 1;
  431. }
  432. if( hintergrundFeld->getFarbe() != fc )
  433. {
  434. hintergrundFeld->setFarbe( fc );
  435. rend = 1;
  436. }
  437. }
  438. void ZeichnungHintergrund::setRahmenZ( Rahmen *ram ) // setzt einen Zeiger zum Rahmen
  439. {
  440. if( rahmen != ram )
  441. {
  442. if( rahmen )
  443. rahmen->release();
  444. rahmen = ram;
  445. rend = 1;
  446. }
  447. }
  448. void ZeichnungHintergrund::setRahmenBreite( int br ) // setzt die Breite des Rahmens
  449. {
  450. if( !rahmen )
  451. {
  452. rahmen = new LRahmen();
  453. rend = 1;
  454. }
  455. if( rahmen->getRBreite() != br )
  456. {
  457. rahmen->setRamenBreite( br );
  458. rend = 1;
  459. }
  460. }
  461. void ZeichnungHintergrund::setRahmenFarbe( int fc ) // setzt die Farbe des Rahmens
  462. {
  463. if( !rahmen )
  464. {
  465. rahmen = new LRahmen();
  466. rend = 1;
  467. }
  468. if( rahmen->getFarbe() != fc )
  469. {
  470. rahmen->setFarbe( fc );
  471. rend = 1;
  472. }
  473. }
  474. void ZeichnungHintergrund::setVertikalKlickScroll( int ks ) // setzt die vertikale Scroll geschwindigkeit
  475. {
  476. if( !vertikalScrollBar )
  477. {
  478. vertikalScrollBar = new VScrollBar();
  479. rend = 1;
  480. }
  481. if( vertikalScrollBar->getKlickScroll() != ks )
  482. {
  483. vertikalScrollBar->setKlickScroll( ks );
  484. rend = 1;
  485. }
  486. }
  487. void ZeichnungHintergrund::setVertikalScrollPos( int pos ) // setzt die vertikale Scroll Position
  488. {
  489. if( !vertikalScrollBar )
  490. {
  491. vertikalScrollBar = new VScrollBar();
  492. rend = 1;
  493. }
  494. if( vertikalScrollBar && vertikalScrollBar->getScroll() != pos )
  495. {
  496. vertikalScrollBar->scroll( pos );
  497. rend = 1;
  498. }
  499. }
  500. void ZeichnungHintergrund::setVertikalScrollFarbe( int f, int bgF ) // setzt die scroll Farbe
  501. {
  502. if( !vertikalScrollBar )
  503. {
  504. vertikalScrollBar = new VScrollBar();
  505. rend = 1;
  506. }
  507. if( vertikalScrollBar && ( vertikalScrollBar->getFarbe() != f || vertikalScrollBar->getBgFarbe() != bgF ) )
  508. {
  509. vertikalScrollBar->setFarbe( f );
  510. vertikalScrollBar->setBgFarbe( bgF, bgF != 0 );
  511. rend = 1;
  512. }
  513. }
  514. void ZeichnungHintergrund::setHorizontalKlickScroll( int ks ) // setzt die horizontale Scroll geschwindigkeit
  515. {
  516. if( !horizontalScrollBar )
  517. {
  518. horizontalScrollBar = new HScrollBar();
  519. rend = 1;
  520. }
  521. if( horizontalScrollBar && horizontalScrollBar->getKlickScroll() != ks )
  522. {
  523. horizontalScrollBar->setKlickScroll( ks );
  524. rend = 1;
  525. }
  526. }
  527. void ZeichnungHintergrund::setHorizontalScrollPos( int pos ) // setzt die horizontale Scroll Position
  528. {
  529. if( !horizontalScrollBar )
  530. {
  531. horizontalScrollBar = new HScrollBar();
  532. rend = 1;
  533. }
  534. if( horizontalScrollBar && horizontalScrollBar->getScroll() != pos )
  535. {
  536. horizontalScrollBar->scroll( pos );
  537. rend = 1;
  538. }
  539. }
  540. void ZeichnungHintergrund::setHorizontalScrollFarbe( int f, int bgF ) // setzt die scroll Farbe
  541. {
  542. if( !horizontalScrollBar )
  543. {
  544. horizontalScrollBar = new HScrollBar();
  545. rend = 1;
  546. }
  547. if( horizontalScrollBar && ( horizontalScrollBar->getFarbe() != f || horizontalScrollBar->getBgFarbe() != bgF ) )
  548. {
  549. horizontalScrollBar->setFarbe( f );
  550. horizontalScrollBar->setBgFarbe( bgF, bgF != 0 );
  551. rend = 1;
  552. }
  553. }
  554. bool ZeichnungHintergrund::tick( double tickVal )
  555. {
  556. if( vertikalScrollBar && hatStyle( Style::VScroll ) )
  557. rend |= vertikalScrollBar->getRend();
  558. if( horizontalScrollBar && hatStyle( Style::HScroll ) )
  559. rend |= horizontalScrollBar->getRend();
  560. return Zeichnung::tick( tickVal );
  561. }
  562. void ZeichnungHintergrund::render( Bild &rObj )
  563. {
  564. innenPosition.x = pos.x;
  565. innenPosition.y = pos.y;
  566. innenSize.x = gr.x;
  567. innenSize.y = gr.y;
  568. if( hatStyleNicht( Style::Sichtbar ) )
  569. return;
  570. lockZeichnung();
  571. if( !rObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  572. {
  573. unlockZeichnung();
  574. return;
  575. }
  576. Zeichnung::render( rObj );
  577. int rbr = 0;
  578. if( hatStyle( Style::Rahmen ) && rahmen )
  579. {
  580. rahmen->setSize( gr );
  581. rahmen->render( rObj );
  582. rbr = rahmen->getRBreite();
  583. }
  584. innenPosition.x += rbr;
  585. innenPosition.y += rbr;
  586. innenSize.x -= rbr * 2;
  587. innenSize.y -= rbr * 2;
  588. if( !rObj.setDrawOptions( rbr, rbr, gr.x - rbr * 2, gr.y - rbr * 2 ) )
  589. {
  590. rObj.releaseDrawOptions();
  591. unlockZeichnung();
  592. return;
  593. }
  594. bool vs = vertikalScrollBar && hatStyle( Style::VScroll );
  595. bool hs = horizontalScrollBar && hatStyle( Style::HScroll );
  596. if( vs )
  597. {
  598. vertikalScrollBar->render( gr.x - rbr * 2 - 15, 0, 15, gr.y - rbr * 2, rObj );
  599. innenSize.x -= 15;
  600. if( hs )
  601. {
  602. horizontalScrollBar->render( 0, gr.y - rbr * 2 - 15, gr.x - rbr * 2 - 15, 15, rObj );
  603. innenSize.y -= 15;
  604. if( !rObj.setDrawOptions( 0, 0, gr.x - rbr * 2 - 15, gr.y - rbr * 2 - 15 ) )
  605. {
  606. rObj.releaseDrawOptions();
  607. rObj.releaseDrawOptions();
  608. unlockZeichnung();
  609. return;
  610. }
  611. horizontalScrollBar->update( horizontalScrollBar->getScrollData()->max, innenSize.x );
  612. }
  613. else
  614. {
  615. if( !rObj.setDrawOptions( 0, 0, gr.x - rbr * 2 - 15, gr.y - rbr * 2 ) )
  616. {
  617. rObj.releaseDrawOptions();
  618. rObj.releaseDrawOptions();
  619. unlockZeichnung();
  620. return;
  621. }
  622. }
  623. vertikalScrollBar->update( vertikalScrollBar->getScrollData()->max, innenSize.y );
  624. }
  625. else if( hs )
  626. {
  627. horizontalScrollBar->render( rbr, gr.y - rbr * 2 - 15, gr.x - rbr * 2, 15, rObj );
  628. innenSize.y -= 15;
  629. if( !rObj.setDrawOptions( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2 - 15 ) )
  630. {
  631. rObj.releaseDrawOptions();
  632. rObj.releaseDrawOptions();
  633. unlockZeichnung();
  634. return;
  635. }
  636. }
  637. if( hatStyle( Style::Hintergrund ) )
  638. {
  639. if( hatStyle( Style::HAlpha ) )
  640. rObj.alphaRegion( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, hintergrundFarbe );
  641. else
  642. rObj.fillRegion( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, hintergrundFarbe );
  643. if( hatStyle( Style::HBild ) && hintergrundBild )
  644. {
  645. if( hatStyle( Style::HAlpha ) )
  646. rObj.alphaBildSkall( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild );
  647. else
  648. rObj.drawBildSkall( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild );
  649. }
  650. }
  651. if( hatStyle( Style::Buffered ) && hintergrundFeld )
  652. {
  653. hintergrundFeld->setSize( gr.x - rbr * 2, gr.y - rbr * 2 );
  654. hintergrundFeld->render( rObj );
  655. }
  656. if( vs || hs )
  657. rObj.releaseDrawOptions();
  658. rObj.releaseDrawOptions();
  659. rObj.releaseDrawOptions();
  660. unlockZeichnung();
  661. }
  662. // Gibt die Breite des Innenraumes in der Zeichnung in Pixeln zurück
  663. int ZeichnungHintergrund::getInnenBreite() const
  664. {
  665. return getBreite() - 2 * getRahmenBreite();
  666. }
  667. // Gibt die Höhe des Innenraumes in der Zeichnung in Pixeln zurück
  668. int ZeichnungHintergrund::getInnenHeight() const
  669. {
  670. return getHeight() - 2 * getRahmenBreite();
  671. }
  672. Bild *ZeichnungHintergrund::getHintergrundBild() const // gibt getThis vom Hintergrund Bild zurück
  673. {
  674. if( !hintergrundBild )
  675. return 0;
  676. return hintergrundBild->getThis();
  677. }
  678. Bild *ZeichnungHintergrund::zHintergrundBild() const // gibt das Hintergrund Bild zurück
  679. {
  680. return hintergrundBild;
  681. }
  682. int ZeichnungHintergrund::getHintergrundFarbe() const // giebt getThis der Hintergrundfarbe zurück
  683. {
  684. return hintergrundFarbe;
  685. }
  686. AlphaFeld *ZeichnungHintergrund::getAlphaFeld() const // gibt getThir vom Hintergrund Buffer zurück
  687. {
  688. if( !hintergrundFeld )
  689. return 0;
  690. return (AlphaFeld*)hintergrundFeld->getThis();
  691. }
  692. AlphaFeld *ZeichnungHintergrund::zAlphaFeld() const // gibt den Hintergrund Buffer zurück
  693. {
  694. return hintergrundFeld;
  695. }
  696. int ZeichnungHintergrund::getAlphaFeldStrength() const // gibt die Stärke des Hintergrund Buffers zurück
  697. {
  698. if( !hintergrundFeld )
  699. return 0;
  700. return hintergrundFeld->getStrength();
  701. }
  702. int ZeichnungHintergrund::getAlphaFeldFarbe() const // gibt getThis von der Farbe des Hintergrund Buffers zurück
  703. {
  704. return hintergrundFeld->getFarbe();
  705. }
  706. Rahmen *ZeichnungHintergrund::getRahmen() const // gibt getThis des Rahmens zurück
  707. {
  708. if( !rahmen )
  709. return 0;
  710. return (Rahmen*)rahmen->getThis();
  711. }
  712. Rahmen *ZeichnungHintergrund::zRahmen() const // gibt den Rahmen zurück
  713. {
  714. return rahmen;
  715. }
  716. int ZeichnungHintergrund::getRahmenBreite() const // gibt die Breite des Rahmens zurück
  717. {
  718. if( !rahmen || hatStyleNicht( Style::Rahmen ) )
  719. return 0;
  720. return rahmen->getRBreite();
  721. }
  722. int ZeichnungHintergrund::getRahmenFarbe() const // gibt getThis der Farbe des Rahmens zurück
  723. {
  724. return rahmen->getFarbe();
  725. }
  726. int ZeichnungHintergrund::getVertikalKlickScroll() const
  727. {
  728. return vertikalScrollBar ? vertikalScrollBar->getKlickScroll() : 0;
  729. }
  730. int ZeichnungHintergrund::getVertikalScrollPos() const
  731. {
  732. return vertikalScrollBar ? vertikalScrollBar->getScroll() : 0;
  733. }
  734. int ZeichnungHintergrund::getVertikalScrollFarbe() const
  735. {
  736. return vertikalScrollBar ? vertikalScrollBar->getFarbe() : 0;
  737. }
  738. int ZeichnungHintergrund::getVertikalScrollHintergrund() const
  739. {
  740. return vertikalScrollBar ? vertikalScrollBar->getBgFarbe() : 0;
  741. }
  742. int ZeichnungHintergrund::getHorizontalKlickScroll() const
  743. {
  744. return horizontalScrollBar ? horizontalScrollBar->getKlickScroll() : 0;
  745. }
  746. int ZeichnungHintergrund::getHorizontalScrollPos() const
  747. {
  748. return horizontalScrollBar ? horizontalScrollBar->getScroll() : 0;
  749. }
  750. int ZeichnungHintergrund::getHorizontalScrollFarbe() const
  751. {
  752. return horizontalScrollBar ? horizontalScrollBar->getFarbe() : 0;
  753. }
  754. int ZeichnungHintergrund::getHorizontalScrollHintergrund() const
  755. {
  756. return horizontalScrollBar ? horizontalScrollBar->getBgFarbe() : 0;
  757. }
  758. Zeichnung *ZeichnungHintergrund::dublizieren() const // Erzeugt eine Kopie des Zeichnungs
  759. {
  760. ZeichnungHintergrund *obj = new ZeichnungHintergrund();
  761. obj->setPosition( pos );
  762. obj->setSize( gr );
  763. obj->setMausEreignisParameter( makParam );
  764. obj->setTastaturEreignisParameter( takParam );
  765. obj->setMausEreignis( mak );
  766. obj->setTastaturEreignis( tak );
  767. if( toolTip )
  768. obj->setToolTipZ( (ToolTip*)toolTip->dublizieren() );
  769. obj->setStyle( style );
  770. obj->setHintergrundFarbe( hintergrundFarbe );
  771. if( hintergrundFeld )
  772. obj->setAlphaFeldZ( (AlphaFeld*)hintergrundFeld->dublizieren() );
  773. if( rahmen )
  774. obj->setRahmenZ( (Rahmen*)rahmen->dublizieren() );
  775. if( hintergrundBild )
  776. obj->setHintergrundBild( hintergrundBild->getThis() );
  777. if( vertikalScrollBar )
  778. {
  779. obj->setVertikalKlickScroll( vertikalScrollBar->getKlickScroll() );
  780. obj->setVertikalScrollPos( vertikalScrollBar->getScroll() );
  781. obj->setVertikalScrollFarbe( vertikalScrollBar->getFarbe(), vertikalScrollBar->getBgFarbe() );
  782. }
  783. if( horizontalScrollBar )
  784. {
  785. obj->setHorizontalKlickScroll( horizontalScrollBar->getKlickScroll() );
  786. obj->setHorizontalScrollPos( horizontalScrollBar->getScroll() );
  787. obj->setHorizontalScrollFarbe( horizontalScrollBar->getFarbe(), horizontalScrollBar->getBgFarbe() );
  788. }
  789. return obj;
  790. }