SelectionBox.cpp 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091
  1. #include "SelectionBox.h"
  2. #include "AlphaField.h"
  3. #include "Image.h"
  4. #include "Button.h"
  5. #include "MouseEvent.h"
  6. #include "Border.h"
  7. #include "Font.h"
  8. #include "Scroll.h"
  9. #include "KeyboardEvent.h"
  10. #include "Text.h"
  11. #include "TextField.h"
  12. #include "ToolTip.h"
  13. using namespace Framework;
  14. // Contents of the AuswahlBox class from SelectionBox.h
  15. // Constructor
  16. AuswahlBox::AuswahlBox()
  17. : DrawableBackground(),
  18. textRd(0),
  19. msStyle(0),
  20. members(new RCArray<TextFeld>()),
  21. ausfahren(new Knopf()),
  22. auswRahmen(new LRahmen()),
  23. auswBgF(0xFF000000),
  24. auswBgB(0),
  25. auswAf(new AlphaFeld()),
  26. msAuswRahmen(0),
  27. msAuswBgF(0),
  28. msAuswBgB(0),
  29. msAuswAf(0),
  30. mausRahmen(new LRahmen()),
  31. mausBgF(0xFF000000),
  32. mausBgB(0),
  33. mausAf(new AlphaFeld()),
  34. msMausRahmen(0),
  35. msMausBgF(0),
  36. msMausBgB(0),
  37. msMausAf(0),
  38. anzahl(0),
  39. auswahl(0),
  40. ausgeklappt(0),
  41. ausklappHeight(0),
  42. ausklapMaxHeight(200),
  43. eintragHeight(15),
  44. tickval(0),
  45. mausEintrag(0),
  46. scrollAnzeigen(0),
  47. eAkP(0),
  48. eAk(0)
  49. {
  50. vertikalScrollBar = new VScrollBar();
  51. style = Style::Normal;
  52. rahmen = new LRahmen();
  53. rahmen->setFarbe(0xFFFFFFFF);
  54. rahmen->setRamenBreite(1);
  55. ausfahren->setStyle(Knopf::Style::Sichtbar | Knopf::Style::Erlaubt
  56. | Knopf::Style::KlickBuffer);
  57. ausfahren->setKBFarbe(0xA0000000);
  58. ausfahren->setKBStrength(10);
  59. ausfahren->setSize(18, 18);
  60. ausfahren->setSchriftFarbe(0xFFFFFFFF);
  61. ausfahren->setText("\\/");
  62. auswRahmen->setFarbe(0xFF00FF00);
  63. auswRahmen->setRamenBreite(1);
  64. auswAf->setFarbe(0xA000FF00);
  65. auswAf->setStrength(7);
  66. mausRahmen->setFarbe(0xFF00FF00);
  67. mausRahmen->setRamenBreite(1);
  68. mausAf->setFarbe(0x5000FF00);
  69. mausAf->setStrength(7);
  70. gr.x = 20;
  71. gr.y = 20;
  72. }
  73. // Destructor
  74. AuswahlBox::~AuswahlBox()
  75. {
  76. if (textRd) textRd->release();
  77. if (msStyle) msStyle->release();
  78. if (members) members->release();
  79. if (ausfahren) ausfahren->release();
  80. if (auswRahmen) auswRahmen->release();
  81. if (auswBgB) auswBgB->release();
  82. if (auswAf) auswAf->release();
  83. if (msAuswRahmen) msAuswRahmen->release();
  84. if (msAuswAf) msAuswAf->release();
  85. if (msAuswBgB) msAuswBgB->release();
  86. if (msAuswBgF) msAuswBgF->release();
  87. if (mausRahmen) mausRahmen->release();
  88. if (mausAf) mausAf->release();
  89. if (mausBgB) mausBgB->release();
  90. if (msMausRahmen) msMausRahmen->release();
  91. if (msMausAf) msMausAf->release();
  92. if (msMausBgB) msMausBgB->release();
  93. if (msMausBgF) msMausBgF->release();
  94. }
  95. void AuswahlBox::doMausEreignis(MausEreignis& me, bool userRet) // mouse events
  96. {
  97. if (hatStyleNicht(Style::Erlaubt) || hatStyleNicht(Style::Fokus)
  98. || me.verarbeitet)
  99. {
  100. ausgeklappt = 0;
  101. me.verarbeitet = 1;
  102. return;
  103. }
  104. if (!userRet) return;
  105. mausEintrag = -1;
  106. bool insideParent = me.insideParent;
  107. me.insideParent = me.mx >= 0 && me.mx < gr.x && me.my >= 0
  108. && me.my < gr.y + ausklappHeight;
  109. bool vera = me.verarbeitet;
  110. if (ausfahren)
  111. {
  112. int tmpMx = me.mx;
  113. int tmpMy = me.my;
  114. if (me.mx >= 0 && me.my >= 0 && me.mx < gr.x && me.my < gr.y)
  115. me.mx = ausfahren->getX(), me.my = ausfahren->getY() + 1;
  116. ausfahren->doPublicMausEreignis(me);
  117. me.mx = tmpMx, me.my = tmpMy;
  118. }
  119. if (me.verarbeitet && !vera && me.id == ME_RLinks)
  120. {
  121. ausgeklappt = !ausgeklappt;
  122. if (ausgeklappt) mausEintrag = auswahl;
  123. if (scrollAnzeigen) scrollZuEintrag(mausEintrag);
  124. }
  125. if (hatStyle(Style::VScroll) && vertikalScrollBar && ausgeklappt
  126. && scrollAnzeigen)
  127. {
  128. int rbr = 0;
  129. if (rahmen && hatStyle(Style::Rahmen)) rbr = rahmen->getRBreite();
  130. if ((me.mx > gr.x - 15 - rbr && me.my > gr.y) || me.id == ME_UScroll
  131. || me.id == ME_DScroll)
  132. {
  133. vertikalScrollBar->doMausMessage(gr.x - rbr - 15,
  134. gr.y,
  135. 15,
  136. vertikalScrollBar->getScrollData()->anzeige,
  137. me);
  138. me.verarbeitet = 1;
  139. }
  140. }
  141. if (!me.verarbeitet)
  142. {
  143. int eintr = -1;
  144. int tmp = me.my - gr.y
  145. + (vertikalScrollBar ? vertikalScrollBar->getScroll() : 0);
  146. if (hatStyle(Style::MultiStyled))
  147. {
  148. for (int i = 0; i < anzahl; ++i)
  149. {
  150. if (tmp > 0
  151. && tmp < (members->z(i) ? members->z(i)->getHeight() : 0))
  152. {
  153. eintr = i;
  154. break;
  155. }
  156. tmp -= members->z(i) ? members->z(i)->getHeight() : 0;
  157. }
  158. }
  159. else
  160. {
  161. for (int i = 0; i < anzahl; ++i)
  162. {
  163. if (tmp > 0 && tmp < eintragHeight)
  164. {
  165. eintr = i;
  166. break;
  167. }
  168. tmp -= eintragHeight;
  169. }
  170. }
  171. if (ausgeklappt && me.mx > 0 && me.mx < gr.x && me.my > gr.y
  172. && me.my < gr.y + ausklappHeight)
  173. {
  174. if (eintr >= 0)
  175. {
  176. if (me.id == ME_RLinks)
  177. {
  178. if (auswahl != eintr) rend = 1;
  179. auswahl = eintr;
  180. if (eAk) eAk(eAkP, this, 0, auswahl);
  181. }
  182. if (mausEintrag != eintr) rend = 1;
  183. mausEintrag = eintr;
  184. }
  185. }
  186. }
  187. me.verarbeitet = 1;
  188. me.insideParent = insideParent;
  189. }
  190. // non-constant
  191. void AuswahlBox::setEventParam(void* p) // set event parameter
  192. {
  193. eAkP = p;
  194. }
  195. void AuswahlBox::setEventAktion(
  196. std::function<void(void*, AuswahlBox*, int, int)> event) // set event action
  197. {
  198. this->eAk = event;
  199. }
  200. void AuswahlBox::setSchriftZ(Schrift* schrift) // set font
  201. {
  202. if (!this->textRd)
  203. textRd = new TextRenderer(schrift);
  204. else
  205. textRd->setSchriftZ(schrift);
  206. ausfahren->setSchriftZ(dynamic_cast<Schrift*>(schrift->getThis()));
  207. rend = 1;
  208. }
  209. void AuswahlBox::setTextRendererZ(TextRenderer* textRd)
  210. {
  211. if (this->textRd) this->textRd->release();
  212. this->textRd = textRd;
  213. }
  214. void AuswahlBox::addEintrag(const char* txt) // add entry
  215. {
  216. TextFeld* tf = new TextFeld();
  217. if (textRd) tf->setSchriftZ(textRd->getSchrift());
  218. tf->addStyle(TextFeld::Style::Sichtbar | TextFeld::Style::Center
  219. | TextFeld::Style::Rahmen);
  220. tf->setText(txt);
  221. tf->setSchriftFarbe(0xFFFFFFFF);
  222. tf->setRahmenFarbe(0xFFFFFFFF);
  223. tf->setSize(0, eintragHeight);
  224. members->add(tf, anzahl);
  225. ++anzahl;
  226. rend = 1;
  227. }
  228. void AuswahlBox::addEintrag(Text* txt)
  229. {
  230. TextFeld* tf = new TextFeld();
  231. if (textRd) tf->setSchriftZ(textRd->getSchrift());
  232. tf->addStyle(TextFeld::Style::Sichtbar | TextFeld::Style::Center
  233. | TextFeld::Style::Rahmen);
  234. tf->setText(txt);
  235. tf->setSchriftFarbe(0xFFFFFFFF);
  236. tf->setRahmenFarbe(0xFFFFFFFF);
  237. tf->setSize(0, eintragHeight);
  238. members->add(tf, anzahl);
  239. ++anzahl;
  240. rend = 1;
  241. }
  242. void AuswahlBox::addEintragZ(TextFeld* txt)
  243. {
  244. members->add(txt, anzahl);
  245. ++anzahl;
  246. rend = 1;
  247. }
  248. void AuswahlBox::setEintrag(int i, const char* txt) // set entry text
  249. {
  250. if (members->z(i)) members->z(i)->setText(txt);
  251. rend = 1;
  252. }
  253. void AuswahlBox::setEintrag(int i, Text* txt)
  254. {
  255. if (members->z(i))
  256. members->z(i)->setText(txt);
  257. else
  258. txt->release();
  259. rend = 1;
  260. }
  261. void AuswahlBox::setEintragZ(int i, TextFeld* txt)
  262. {
  263. if (i < anzahl)
  264. members->set(txt, i);
  265. else
  266. txt->release();
  267. rend = 1;
  268. }
  269. void AuswahlBox::removeEintrag(int i) // remove entry
  270. {
  271. if (i < anzahl)
  272. {
  273. members->remove(i);
  274. if (msStyle) msStyle->remove(i);
  275. if (msAuswRahmen) msAuswRahmen->remove(i);
  276. if (msAuswBgF) msAuswBgF->remove(i);
  277. if (msAuswBgB) msAuswBgB->remove(i);
  278. if (msAuswAf) msAuswAf->remove(i);
  279. if (msMausRahmen) msMausRahmen->remove(i);
  280. if (msMausBgF) msMausBgF->remove(i);
  281. if (msMausBgB) msMausBgB->remove(i);
  282. if (msMausAf) msMausAf->remove(i);
  283. if (auswahl > i) --auswahl;
  284. if (mausEintrag > i) --mausEintrag;
  285. --anzahl;
  286. rend = 1;
  287. }
  288. }
  289. void AuswahlBox::setAusklappKnopfZ(Knopf* ausK) // set expand button
  290. {
  291. if (ausfahren) ausfahren->release();
  292. ausfahren = ausK;
  293. rend = 1;
  294. }
  295. void AuswahlBox::setEintragRahmenZ(int i, Rahmen* rahmen) // set entry border
  296. {
  297. if (members->z(i))
  298. members->z(i)->setRahmenZ(rahmen);
  299. else
  300. rahmen->release();
  301. rend = 1;
  302. }
  303. void AuswahlBox::setEintragRahmenFarbe(int i, int f) // set entry border color
  304. {
  305. if (members->z(i)) members->z(i)->setRahmenFarbe(f);
  306. rend = 1;
  307. }
  308. void AuswahlBox::setEintragRahmenBreite(
  309. int i, int rbr) // set entry border width
  310. {
  311. if (members->z(i)) members->z(i)->setRahmenBreite(rbr);
  312. rend = 1;
  313. }
  314. void AuswahlBox::setEintragHintergrundFarbe(
  315. int i, int f) // set entry background color
  316. {
  317. if (members->z(i)) members->z(i)->setHintergrundFarbe(f);
  318. rend = 1;
  319. }
  320. void AuswahlBox::setEintragHintergrundBildZ(
  321. int i, Bild* bgB) // set entry background image
  322. {
  323. if (members->z(i))
  324. members->z(i)->setHintergrundBildZ(bgB);
  325. else
  326. bgB->release();
  327. rend = 1;
  328. }
  329. void AuswahlBox::setEintragHintergrundBild(int i, Bild* bgB)
  330. {
  331. if (members->z(i))
  332. members->z(i)->setHintergrundBild(bgB);
  333. else
  334. bgB->release();
  335. rend = 1;
  336. }
  337. void AuswahlBox::setEintragAlphaFeldZ(
  338. int i, AlphaFeld* af) // set entry AlphaFeld
  339. {
  340. if (members->z(i)) members->z(i)->setAlphaFeldZ(af);
  341. rend = 1;
  342. }
  343. void AuswahlBox::setEintragAlphaFeldFarbe(
  344. int i, int afF) // set entry AlphaFeld color
  345. {
  346. if (members->z(i)) members->z(i)->setAlphaFeldFarbe(afF);
  347. rend = 1;
  348. }
  349. void AuswahlBox::setEintragAlphaFeldStrength(
  350. int i, int afSt) // set entry AlphaFeld strength
  351. {
  352. if (members->z(i)) members->z(i)->setAlphaFeldStrength(afSt);
  353. rend = 1;
  354. }
  355. void AuswahlBox::setAuswRahmenZ(Rahmen* rahmen) // set selection border
  356. {
  357. if (auswRahmen) auswRahmen->release();
  358. auswRahmen = rahmen;
  359. rend = 1;
  360. }
  361. void AuswahlBox::setAuswRahmenFarbe(int f) // set selection border color
  362. {
  363. if (!auswRahmen) auswRahmen = new LRahmen();
  364. auswRahmen->setFarbe(f);
  365. rend = 1;
  366. }
  367. void AuswahlBox::setAuswRahmenBreite(int rbr) // set selection border width
  368. {
  369. if (!auswRahmen) auswRahmen = new LRahmen();
  370. auswRahmen->setRamenBreite(rbr);
  371. rend = 1;
  372. }
  373. void AuswahlBox::setAuswHintergrundFarbe(
  374. int f) // set selection background color
  375. {
  376. auswBgF = f;
  377. rend = 1;
  378. }
  379. void AuswahlBox::setAuswHintergrundBildZ(
  380. Bild* bgB) // set selection background image
  381. {
  382. if (auswBgB) auswBgB->release();
  383. auswBgB = bgB;
  384. rend = 1;
  385. }
  386. void AuswahlBox::setAuswHintergrundBild(Bild* bgB)
  387. {
  388. if (!auswBgB) auswBgB = new Bild();
  389. auswBgB->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  390. auswBgB->drawBild(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  391. bgB->release();
  392. rend = 1;
  393. }
  394. void AuswahlBox::setAuswAlphaFeldZ(AlphaFeld* af) // set selection AlphaFeld
  395. {
  396. if (auswAf) auswAf->release();
  397. auswAf = af;
  398. rend = 1;
  399. }
  400. void AuswahlBox::setAuswAlphaFeldFarbe(int afF) // set selection AlphaFeld color
  401. {
  402. if (!auswAf) auswAf = new AlphaFeld();
  403. auswAf->setFarbe(afF);
  404. rend = 1;
  405. }
  406. void AuswahlBox::setAuswAlphaFeldStrength(
  407. int afSt) // set selection AlphaFeld strength
  408. {
  409. if (!auswAf) auswAf = new AlphaFeld();
  410. auswAf->setStrength(afSt);
  411. rend = 1;
  412. }
  413. void AuswahlBox::setMsAuswRahmenZ(
  414. int i, Rahmen* rahmen) // set multistyle selection border
  415. {
  416. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  417. {
  418. rahmen->release();
  419. return;
  420. }
  421. if (!msAuswRahmen) msAuswRahmen = new RCArray<Rahmen>();
  422. msAuswRahmen->set(rahmen, i);
  423. rend = 1;
  424. }
  425. void AuswahlBox::setMsAuswRahmenFarbe(
  426. int i, int f) // set multistyle selection border color
  427. {
  428. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  429. if (!msAuswRahmen) msAuswRahmen = new RCArray<Rahmen>();
  430. if (!msAuswRahmen->z(i)) msAuswRahmen->set(new LRahmen(), i);
  431. msAuswRahmen->z(i)->setFarbe(f);
  432. rend = 1;
  433. }
  434. void AuswahlBox::setMsAuswRahmenBreite(
  435. int i, int rbr) // set multistyle selection width
  436. {
  437. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  438. if (!msAuswRahmen) msAuswRahmen = new RCArray<Rahmen>();
  439. if (!msAuswRahmen->z(i)) msAuswRahmen->set(new LRahmen(), i);
  440. msAuswRahmen->z(i)->setRamenBreite(rbr);
  441. rend = 1;
  442. }
  443. void AuswahlBox::setMsAuswHintergrundFarbe(
  444. int i, int f) // set multistyle selection background color
  445. {
  446. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  447. if (!msAuswBgF) msAuswBgF = new Array<int>();
  448. msAuswBgF->set(f, i);
  449. rend = 1;
  450. }
  451. void AuswahlBox::setMsAuswHintergrundBildZ(
  452. int i, Bild* bgB) // set multistyle selection background image
  453. {
  454. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  455. {
  456. bgB->release();
  457. return;
  458. }
  459. if (!msAuswBgB) msAuswBgB = new RCArray<Bild>();
  460. msAuswBgB->set(bgB, i);
  461. rend = 1;
  462. }
  463. void AuswahlBox::setMsAuswHintergrundBild(int i, Bild* bgB)
  464. {
  465. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  466. {
  467. bgB->release();
  468. return;
  469. }
  470. if (!msAuswBgB) msAuswBgB = new RCArray<Bild>();
  471. if (!msAuswBgB->z(i))
  472. {
  473. Bild* z = new Bild;
  474. z->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  475. z->drawBild(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  476. msAuswBgB->set(z, i);
  477. }
  478. else
  479. {
  480. msAuswBgB->z(i)->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  481. msAuswBgB->z(i)->drawBild(
  482. 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  483. }
  484. bgB->release();
  485. rend = 1;
  486. }
  487. void AuswahlBox::setMsAuswAlphaFeldZ(
  488. int i, AlphaFeld* af) // set multistyle selection AlphaFeld
  489. {
  490. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  491. {
  492. af->release();
  493. return;
  494. }
  495. if (!msAuswAf) msAuswAf = new RCArray<AlphaFeld>();
  496. msAuswAf->set(af, i);
  497. rend = 1;
  498. }
  499. void AuswahlBox::setMsAuswAlphaFeldFarbe(
  500. int i, int afF) // set multistyle selection AlphaFeld color
  501. {
  502. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  503. if (!msAuswAf) msAuswAf = new RCArray<AlphaFeld>();
  504. if (!msAuswAf->z(i)) msAuswAf->set(new AlphaFeld(), i);
  505. msAuswAf->z(i)->setFarbe(afF);
  506. rend = 1;
  507. }
  508. void AuswahlBox::setMsAuswAlphaFeldStrength(
  509. int i, int afSt) // set multistyle selection AlphaFeld strength
  510. {
  511. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  512. if (!msAuswAf) msAuswAf = new RCArray<AlphaFeld>();
  513. if (!msAuswAf->z(i)) msAuswAf->set(new AlphaFeld(), i);
  514. msAuswAf->z(i)->setStrength(afSt);
  515. rend = 1;
  516. }
  517. void AuswahlBox::setMausRahmenZ(Rahmen* rahmen) // set mouse border
  518. {
  519. if (mausRahmen) mausRahmen->release();
  520. mausRahmen = rahmen;
  521. rend = 1;
  522. }
  523. void AuswahlBox::setMausRahmenFarbe(int f) // set mouse border color
  524. {
  525. if (!mausRahmen) mausRahmen = new LRahmen();
  526. mausRahmen->setFarbe(f);
  527. rend = 1;
  528. }
  529. void AuswahlBox::setMausRahmenBreite(int rbr) // set mouse border width
  530. {
  531. if (!mausRahmen) mausRahmen = new LRahmen();
  532. mausRahmen->setRamenBreite(rbr);
  533. rend = 1;
  534. }
  535. void AuswahlBox::setMausHintergrundFarbe(int f) // set mouse background color
  536. {
  537. mausBgF = f;
  538. rend = 1;
  539. }
  540. void AuswahlBox::setMausHintergrundBildZ(
  541. Bild* bgB) // set mouse background image
  542. {
  543. if (mausBgB) mausBgB->release();
  544. mausBgB = bgB;
  545. rend = 1;
  546. }
  547. void AuswahlBox::setMausHintergrundBild(Bild* bgB)
  548. {
  549. if (!mausBgB) mausBgB = new Bild();
  550. mausBgB->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  551. mausBgB->drawBild(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  552. bgB->release();
  553. rend = 1;
  554. }
  555. void AuswahlBox::setMausAlphaFeldZ(AlphaFeld* af) // set mouse AlphaFeld
  556. {
  557. if (mausAf) mausAf->release();
  558. mausAf = af;
  559. rend = 1;
  560. }
  561. void AuswahlBox::setMausAlphaFeldFarbe(int afF) // set mouse AlphaFeld color
  562. {
  563. if (!mausAf) mausAf = new AlphaFeld();
  564. mausAf->setFarbe(afF);
  565. rend = 1;
  566. }
  567. void AuswahlBox::setMausAlphaFeldStrength(
  568. int afSt) // set mouse AlphaFeld strength
  569. {
  570. if (!mausAf) mausAf = new AlphaFeld();
  571. mausAf->setStrength(afSt);
  572. rend = 1;
  573. }
  574. void AuswahlBox::setMsMausRahmenZ(
  575. int i, Rahmen* rahmen) // set multistyle mouse border
  576. {
  577. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  578. {
  579. rahmen->release();
  580. return;
  581. }
  582. if (!msMausRahmen) msMausRahmen = new RCArray<Rahmen>();
  583. msMausRahmen->set(rahmen, i);
  584. rend = 1;
  585. }
  586. void AuswahlBox::setMsMausRahmenFarbe(
  587. int i, int f) // set multistyle mouse border color
  588. {
  589. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  590. if (!msMausRahmen) msMausRahmen = new RCArray<Rahmen>();
  591. if (!msMausRahmen->z(i)) msMausRahmen->set(new LRahmen(), i);
  592. msMausRahmen->z(i)->setFarbe(f);
  593. rend = 1;
  594. }
  595. void AuswahlBox::setMsMausRahmenBreite(
  596. int i, int rbr) // set multistyle mouse border width
  597. {
  598. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  599. if (!msMausRahmen) msMausRahmen = new RCArray<Rahmen>();
  600. if (!msMausRahmen->z(i)) msMausRahmen->set(new LRahmen(), i);
  601. msMausRahmen->z(i)->setRamenBreite(rbr);
  602. rend = 1;
  603. }
  604. void AuswahlBox::setMsMausHintergrundFarbe(
  605. int i, int f) // set multistyle mouse background color
  606. {
  607. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  608. if (!msMausBgF) msMausBgF = new Array<int>();
  609. msMausBgF->set(f, i);
  610. rend = 1;
  611. }
  612. void AuswahlBox::setMsMausHintergrundBildZ(
  613. int i, Bild* bgB) // set multistyle mouse background image
  614. {
  615. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  616. {
  617. bgB->release();
  618. return;
  619. }
  620. if (!msMausBgB) msMausBgB = new RCArray<Bild>();
  621. msMausBgB->set(bgB, i);
  622. rend = 1;
  623. }
  624. void AuswahlBox::setMsMausHintergrundBild(int i, Bild* bgB)
  625. {
  626. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  627. {
  628. bgB->release();
  629. return;
  630. }
  631. if (!msMausBgB) msMausBgB = new RCArray<Bild>();
  632. if (!msMausBgB->z(i))
  633. {
  634. Bild* z = new Bild;
  635. z->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  636. z->drawBild(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  637. msMausBgB->set(z, i);
  638. }
  639. else
  640. {
  641. msMausBgB->z(i)->neuBild(bgB->getBreite(), bgB->getHeight(), 0);
  642. msMausBgB->z(i)->drawBild(
  643. 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  644. }
  645. bgB->release();
  646. rend = 1;
  647. }
  648. void AuswahlBox::setMsMausAlphaFeldZ(
  649. int i, AlphaFeld* af) // set multistyle mouse AlphaFeld
  650. {
  651. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  652. {
  653. af->release();
  654. return;
  655. }
  656. if (!msMausAf) msMausAf = new RCArray<AlphaFeld>();
  657. msMausAf->set(af, i);
  658. rend = 1;
  659. }
  660. void AuswahlBox::setMsMausAlphaFeldFarbe(
  661. int i, int afF) // set multistyle mouse AlphaFeld color
  662. {
  663. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  664. if (!msMausAf) msMausAf = new RCArray<AlphaFeld>();
  665. if (!msMausAf->z(i)) msMausAf->set(new AlphaFeld(), i);
  666. msMausAf->z(i)->setFarbe(afF);
  667. rend = 1;
  668. }
  669. void AuswahlBox::setMsMausAlphaFeldStrength(
  670. int i, int afSt) // set multistyle mouse AlphaFeld strength
  671. {
  672. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  673. if (!msMausAf) msMausAf = new RCArray<AlphaFeld>();
  674. if (!msMausAf->z(i)) msMausAf->set(new AlphaFeld(), i);
  675. msMausAf->z(i)->setStrength(afSt);
  676. rend = 1;
  677. }
  678. void AuswahlBox::setAuswahl(int i) // select entry
  679. {
  680. if (i < anzahl && i != auswahl)
  681. {
  682. auswahl = i;
  683. if (eAk) eAk(eAkP, this, 0, auswahl);
  684. rend = 1;
  685. }
  686. }
  687. void AuswahlBox::ausklappen() // expand list
  688. {
  689. ausgeklappt = 1;
  690. }
  691. void AuswahlBox::einklappen() // collapse list
  692. {
  693. ausgeklappt = 0;
  694. }
  695. void AuswahlBox::scrollZuEintrag(int i) // scroll list
  696. {
  697. if (hatStyle(Style::VScroll) && vertikalScrollBar && i < anzahl)
  698. {
  699. int scrollPos = 0;
  700. if (hatStyle(Style::MultiStyled))
  701. {
  702. for (int j = 0; j < i; ++j)
  703. scrollPos += members->z(j) ? members->z(j)->getHeight() : 0;
  704. }
  705. else
  706. scrollPos += i * eintragHeight;
  707. vertikalScrollBar->scroll(scrollPos);
  708. rend = 1;
  709. }
  710. }
  711. void AuswahlBox::setMaxAuskappHeight(
  712. int maxHeight) // height of the list when expanded
  713. {
  714. ausklapMaxHeight = maxHeight;
  715. }
  716. void AuswahlBox::setEintragHeight(int height) // sets the height of the entries
  717. {
  718. eintragHeight = height;
  719. }
  720. void AuswahlBox::addMsStyle(int i, __int64 abStyle) // add multistyle style
  721. {
  722. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  723. if (!msStyle) msStyle = new Array<__int64>();
  724. msStyle->set(msStyle->get(i) | abStyle, i);
  725. rend = 1;
  726. }
  727. void AuswahlBox::setMsStyle(
  728. int i, __int64 abStyle, bool add) // set multistyle style
  729. {
  730. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  731. if (!msStyle) msStyle = new Array<__int64>();
  732. if (add)
  733. msStyle->set(msStyle->get(i) | abStyle, i);
  734. else
  735. msStyle->set(msStyle->get(i) & ~abStyle, i);
  736. rend = 1;
  737. }
  738. void AuswahlBox::setMsStyle(int i, __int64 abStyle)
  739. {
  740. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  741. if (!msStyle) msStyle = new Array<__int64>();
  742. msStyle->set(abStyle, i);
  743. rend = 1;
  744. }
  745. void AuswahlBox::removeMsStyle(
  746. int i, __int64 abStyle) // remove multistyle style
  747. {
  748. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  749. if (!msStyle) msStyle = new Array<__int64>();
  750. msStyle->set(msStyle->get(i) & ~abStyle, i);
  751. rend = 1;
  752. }
  753. bool AuswahlBox::tick(double tickVal) // tick
  754. {
  755. if (ausgeklappt && ausfahren && !ausfahren->zText()->istGleich("/\\"))
  756. {
  757. ausfahren->setText("/\\");
  758. rend = 1;
  759. }
  760. else if (!ausgeklappt && ausfahren && !ausfahren->zText()->istGleich("\\/"))
  761. {
  762. ausfahren->setText("\\/");
  763. rend = 1;
  764. }
  765. if (hatStyleNicht(Style::Sichtbar) || hatStyleNicht(Style::Erlaubt))
  766. ausgeklappt = 0;
  767. rend |= ausfahren->tick(tickVal);
  768. this->tickval += tickVal * 300;
  769. int val = (int)this->tickval;
  770. if (val < 1) return DrawableBackground::tick(tickVal);
  771. this->tickval -= val;
  772. int maxHeight = rahmen ? rahmen->getRBreite() : 0;
  773. if (hatStyleNicht(Style::MultiStyled))
  774. maxHeight += anzahl * eintragHeight;
  775. else
  776. for (int i = 0; i < anzahl; ++i)
  777. maxHeight += members->z(i) ? members->z(i)->getHeight() : 0;
  778. if (maxHeight > ausklapMaxHeight)
  779. {
  780. if (hatStyle(Style::VScroll) && vertikalScrollBar)
  781. {
  782. scrollAnzeigen = 1;
  783. vertikalScrollBar->update(maxHeight, ausklapMaxHeight);
  784. }
  785. maxHeight = ausklapMaxHeight;
  786. }
  787. else
  788. scrollAnzeigen = 0;
  789. if (ausgeklappt)
  790. {
  791. if (ausklappHeight < maxHeight)
  792. {
  793. ausklappHeight += val;
  794. if (ausklappHeight > maxHeight) ausklappHeight = maxHeight;
  795. rend = 1;
  796. }
  797. }
  798. else
  799. {
  800. if (ausklappHeight > 0)
  801. {
  802. ausklappHeight -= val;
  803. if (ausklappHeight < 0) ausklappHeight = 0;
  804. rend = 1;
  805. }
  806. }
  807. for (int i = 0; i < anzahl; ++i)
  808. {
  809. if (i != auswahl)
  810. rend |= members->z(i)->tick(tickVal);
  811. else
  812. members->z(i)->tick(tickVal);
  813. }
  814. return DrawableBackground::tick(tickVal);
  815. }
  816. void AuswahlBox::doTastaturEreignis(TastaturEreignis& te) // Keyboard
  817. {
  818. if (te.verarbeitet || hatStyleNicht(Style::Fokus)
  819. || hatStyleNicht(Style::Erlaubt))
  820. return;
  821. if (te.id == TE_Release)
  822. {
  823. switch (te.virtualKey)
  824. {
  825. case T_Oben:
  826. if (auswahl > 0)
  827. --auswahl;
  828. else
  829. auswahl = anzahl - 1;
  830. if (eAk) eAk(eAkP, this, 0, auswahl);
  831. scrollZuEintrag(auswahl);
  832. rend = 1;
  833. break;
  834. case T_Unten:
  835. if (auswahl < anzahl - 1)
  836. ++auswahl;
  837. else
  838. auswahl = 0;
  839. if (eAk) eAk(eAkP, this, 0, auswahl);
  840. scrollZuEintrag(auswahl);
  841. rend = 1;
  842. break;
  843. }
  844. }
  845. if (te.verarbeitet && nTak) te.verarbeitet = nTak(ntakParam, this, te);
  846. }
  847. void AuswahlBox::render(Bild& zRObj) // renders into zRObj
  848. {
  849. if (hatStyle(Style::Sichtbar))
  850. {
  851. lockDrawable();
  852. int br = gr.x;
  853. int hi = gr.y + ausklappHeight;
  854. if ((ausklappHeight
  855. && !zRObj.setDrawOptionsErzwingen(pos.x, pos.y, br, hi))
  856. || (!ausklappHeight && !zRObj.setDrawOptions(pos.x, pos.y, br, hi)))
  857. {
  858. unlockDrawable();
  859. return;
  860. }
  861. int rbr = 0;
  862. if (hatStyle(Style::Rahmen) && rahmen) // Draw border
  863. {
  864. rahmen->setSize(br, hi);
  865. rahmen->render(zRObj);
  866. rbr = rahmen->getRBreite();
  867. }
  868. if ((ausklappHeight
  869. && !zRObj.setDrawOptionsErzwingen(
  870. rbr, rbr, br - rbr * 2, hi - rbr * 2))
  871. || (!ausklappHeight
  872. && !zRObj.setDrawOptions(rbr, rbr, br - rbr * 2, hi - rbr * 2)))
  873. {
  874. zRObj.releaseDrawOptions();
  875. unlockDrawable();
  876. return;
  877. }
  878. if (hatStyle(Style::Hintergrund))
  879. {
  880. if (hatStyle(Style::HAlpha))
  881. zRObj.alphaRegion(0, 0, br, hi, hintergrundFarbe);
  882. else
  883. zRObj.fillRegion(0, 0, br, hi, hintergrundFarbe);
  884. if (hatStyle(Style::HBild) && hintergrundBild)
  885. {
  886. if (hatStyle(Style::HAlpha))
  887. zRObj.alphaBild(0, 0, br, hi, *hintergrundBild);
  888. else
  889. zRObj.drawBild(0, 0, br, hi, *hintergrundBild);
  890. }
  891. }
  892. if (hatStyle(Style::Buffered) && hintergrundFeld)
  893. {
  894. hintergrundFeld->setSize(br - rbr * 2, hi - rbr * 2);
  895. hintergrundFeld->render(zRObj);
  896. }
  897. if (ausfahren) // Draw expand button
  898. {
  899. ausfahren->setSize(gr.y - rbr * 2, gr.y - rbr * 2);
  900. ausfahren->setPosition(gr.x - rbr - ausfahren->getBreite(), rbr);
  901. ausfahren->render(zRObj);
  902. }
  903. if (members) // Draw selected text field
  904. {
  905. if (auswahl < 0)
  906. {
  907. auswahl = 0;
  908. if (eAk) eAk(eAkP, this, 0, auswahl);
  909. }
  910. if (auswahl >= anzahl)
  911. {
  912. auswahl = anzahl - 1;
  913. if (eAk) eAk(eAkP, this, 0, auswahl);
  914. }
  915. TextFeld* tf = auswahl >= 0 ? members->z(auswahl) : 0;
  916. if (tf)
  917. {
  918. AlphaFeld* tmpBuffer = 0;
  919. bool tmpB = 0;
  920. int tmpHFarbe = 0;
  921. bool tmpH = 0;
  922. Bild* tmpHBild = 0;
  923. bool tmpHB = 0;
  924. bool tmpHAlpha = 0;
  925. Rahmen* tmpRahmen = 0;
  926. bool tmpR = 0;
  927. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  928. {
  929. if (hatStyle(Style::AuswahlBuffer))
  930. {
  931. tmpBuffer = tf->getAlphaFeld();
  932. tf->setAlphaFeldZ(
  933. dynamic_cast<AlphaFeld*>(auswAf->getThis()));
  934. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  935. tf->setStyle(TextFeld::Style::Buffered,
  936. hatStyle(Style::AuswahlBuffer));
  937. }
  938. if (hatStyle(Style::AuswahlHintergrund))
  939. {
  940. tmpH = tf->hatStyle(TextFeld::Style::Hintergrund);
  941. tmpHFarbe = tf->getHintergrundFarbe();
  942. tf->setHintergrundFarbe(auswBgF);
  943. tf->setStyle(TextFeld::Style::Hintergrund,
  944. hatStyle(Style::Hintergrund));
  945. if (hatStyle(Style::AuswahlHBild))
  946. {
  947. tmpHBild = tf->getHintergrundBild();
  948. tf->setHintergrundBildZ(
  949. dynamic_cast<Bild*>(auswBgB->getThis()));
  950. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  951. tf->setStyle(
  952. TextFeld::Style::HBild, hatStyle(Style::HBild));
  953. }
  954. if (hatStyle(Style::AuswahlHAlpha))
  955. {
  956. tmpHAlpha = tf->hatStyle(TextFeld::Style::HAlpha);
  957. tf->setStyle(TextFeld::Style::HAlpha,
  958. hatStyle(Style::AuswahlHAlpha));
  959. }
  960. }
  961. if (hatStyle(Style::AuswahlRahmen))
  962. {
  963. tmpRahmen = tf->getRahmen();
  964. tf->setRahmenZ(
  965. dynamic_cast<Rahmen*>(auswRahmen->getThis()));
  966. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  967. tf->setStyle(TextFeld::Style::Rahmen,
  968. hatStyle(Style::AuswahlRahmen));
  969. }
  970. }
  971. else
  972. {
  973. if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf)
  974. {
  975. tmpBuffer = tf->getAlphaFeld();
  976. tf->setAlphaFeldZ(msAuswAf->get(auswahl));
  977. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  978. tf->setStyle(TextFeld::Style::Buffered,
  979. hatMsStyle(auswahl, Style::AuswahlBuffer));
  980. }
  981. if (hatMsStyle(auswahl, Style::AuswahlHintergrund))
  982. {
  983. tmpH = tf->hatStyle(Style::Hintergrund);
  984. tf->setStyle(TextFeld::Style::Hintergrund,
  985. hatMsStyle(auswahl, Style::AuswahlHintergrund));
  986. if (msAuswBgF && msAuswBgF->hat(auswahl))
  987. {
  988. tmpHFarbe = tf->getHintergrundFarbe();
  989. tf->setHintergrundFarbe(msAuswBgF->get(auswahl));
  990. }
  991. if (hatMsStyle(auswahl, Style::AuswahlHBild)
  992. && msAuswBgB)
  993. {
  994. tmpHBild = tf->getHintergrundBild();
  995. tf->setHintergrundBildZ(msAuswBgB->get(auswahl));
  996. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  997. tf->setStyle(TextFeld::Style::HBild,
  998. hatMsStyle(auswahl, Style::HBild));
  999. }
  1000. if (hatMsStyle(auswahl, Style::AuswahlHAlpha))
  1001. {
  1002. tmpHAlpha = tf->hatStyle(TextFeld::Style::HAlpha);
  1003. tf->setStyle(TextFeld::Style::HAlpha,
  1004. hatMsStyle(auswahl, Style::AuswahlHAlpha));
  1005. }
  1006. }
  1007. if (hatMsStyle(auswahl, Style::AuswahlRahmen)
  1008. && msAuswRahmen)
  1009. {
  1010. tmpRahmen = tf->getRahmen();
  1011. tf->setRahmenZ(msAuswRahmen->get(auswahl));
  1012. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  1013. tf->setStyle(TextFeld::Style::Rahmen,
  1014. hatMsStyle(auswahl, Style::AuswahlRahmen));
  1015. }
  1016. }
  1017. int tmpHi = tf->getHeight();
  1018. tf->setPosition(0, 0);
  1019. tf->setSize(
  1020. gr.x - rbr * 2 - (ausfahren ? ausfahren->getBreite() : 0),
  1021. gr.y - rbr * 2);
  1022. tf->render(zRObj);
  1023. tf->setSize(tf->getBreite(), tmpHi);
  1024. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  1025. {
  1026. if (hatStyle(Style::AuswahlBuffer))
  1027. {
  1028. tf->setAlphaFeldZ(tmpBuffer);
  1029. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1030. }
  1031. if (hatStyle(Style::AuswahlHintergrund))
  1032. {
  1033. tf->setHintergrundFarbe(tmpHFarbe);
  1034. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1035. if (hatStyle(Style::AuswahlHBild))
  1036. {
  1037. tf->setHintergrundBildZ(tmpHBild);
  1038. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1039. }
  1040. if (hatStyle(Style::AuswahlHAlpha))
  1041. tf->setStyle(TextFeld::Style::HAlpha, tmpHAlpha);
  1042. }
  1043. if (hatStyle(Style::AuswahlRahmen))
  1044. {
  1045. tf->setRahmenZ(tmpRahmen);
  1046. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1047. }
  1048. }
  1049. else
  1050. {
  1051. if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf)
  1052. {
  1053. tf->setAlphaFeldZ(tmpBuffer);
  1054. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1055. }
  1056. if (hatMsStyle(auswahl, Style::AuswahlHintergrund))
  1057. {
  1058. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1059. if (msAuswBgF && msAuswBgF->hat(auswahl))
  1060. tf->setHintergrundFarbe(tmpHFarbe);
  1061. if (hatMsStyle(auswahl, Style::AuswahlHBild)
  1062. && msAuswBgB)
  1063. {
  1064. tf->setHintergrundBildZ(tmpHBild);
  1065. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1066. }
  1067. if (hatMsStyle(auswahl, Style::AuswahlHAlpha))
  1068. tf->setStyle(TextFeld::Style::HAlpha, tmpHAlpha);
  1069. }
  1070. if (hatMsStyle(auswahl, Style::AuswahlRahmen)
  1071. && msAuswRahmen)
  1072. {
  1073. tf->setRahmenZ(tmpRahmen);
  1074. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1075. }
  1076. }
  1077. }
  1078. }
  1079. bool vsb
  1080. = hatStyle(Style::VScroll) && vertikalScrollBar; // Draw scroll bar
  1081. if (auswahl >= anzahl)
  1082. {
  1083. auswahl = 0;
  1084. if (eAk) eAk(eAkP, this, 0, auswahl);
  1085. }
  1086. if (members)
  1087. {
  1088. if (vsb && ausklappHeight)
  1089. {
  1090. br -= 15;
  1091. vertikalScrollBar->getScrollData()->anzeige
  1092. = ausklappHeight - rbr;
  1093. vertikalScrollBar->render(
  1094. br - rbr, gr.y, 15, ausklappHeight - rbr, zRObj);
  1095. }
  1096. if ((ausklappHeight
  1097. && !zRObj.setDrawOptionsErzwingen(
  1098. 0, gr.y, br - rbr, hi - rbr - gr.y))
  1099. || (!ausklappHeight
  1100. && !zRObj.setDrawOptions(
  1101. 0, gr.y, br - rbr, hi - rbr - gr.y)))
  1102. {
  1103. zRObj.releaseDrawOptions();
  1104. zRObj.releaseDrawOptions();
  1105. unlockDrawable();
  1106. return;
  1107. }
  1108. int maxHeight = 0;
  1109. int dy = 0;
  1110. if (vsb) dy -= vertikalScrollBar->getScroll();
  1111. int mdy = hi - rbr;
  1112. anzahl = members->getEintragAnzahl();
  1113. for (int i = 0; i < anzahl; ++i)
  1114. {
  1115. TextFeld* tf = members->z(i);
  1116. if (dy >= mdy && !vsb) break;
  1117. tf->setPosition(0, dy);
  1118. tf->setSize(br - rbr * 2, tf->getHeight());
  1119. maxHeight += tf->getHeight();
  1120. bool selected = auswahl == i;
  1121. AlphaFeld* tmpBuffer = 0;
  1122. bool tmpB = 0;
  1123. int tmpHFarbe = 0;
  1124. bool tmpH = 0;
  1125. Bild* tmpHBild = 0;
  1126. bool tmpHB = 0;
  1127. bool tmpHAlpha = 0;
  1128. Rahmen* tmpRahmen = 0;
  1129. bool tmpR = 0;
  1130. if (selected)
  1131. {
  1132. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  1133. {
  1134. if (hatStyle(Style::AuswahlBuffer))
  1135. {
  1136. tmpBuffer = tf->getAlphaFeld();
  1137. tf->setAlphaFeldZ(
  1138. dynamic_cast<AlphaFeld*>(auswAf->getThis()));
  1139. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  1140. tf->setStyle(TextFeld::Style::Buffered,
  1141. hatStyle(Style::AuswahlBuffer));
  1142. }
  1143. if (hatStyle(Style::AuswahlHintergrund))
  1144. {
  1145. tmpH = tf->hatStyle(TextFeld::Style::Hintergrund);
  1146. tmpHFarbe = tf->getHintergrundFarbe();
  1147. tf->setHintergrundFarbe(auswBgF);
  1148. tf->setStyle(TextFeld::Style::Hintergrund,
  1149. hatStyle(Style::Hintergrund));
  1150. if (hatStyle(Style::AuswahlHBild))
  1151. {
  1152. tmpHBild = tf->getHintergrundBild();
  1153. tf->setHintergrundBildZ(
  1154. dynamic_cast<Bild*>(auswBgB->getThis()));
  1155. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  1156. tf->setStyle(TextFeld::Style::HBild,
  1157. hatStyle(Style::HBild));
  1158. }
  1159. if (hatStyle(Style::AuswahlHAlpha))
  1160. {
  1161. tmpHAlpha
  1162. = tf->hatStyle(TextFeld::Style::HAlpha);
  1163. tf->setStyle(TextFeld::Style::HAlpha,
  1164. hatStyle(Style::AuswahlHAlpha));
  1165. }
  1166. }
  1167. if (hatStyle(Style::AuswahlRahmen))
  1168. {
  1169. tmpRahmen = tf->getRahmen();
  1170. tf->setRahmenZ(
  1171. dynamic_cast<Rahmen*>(auswRahmen->getThis()));
  1172. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  1173. tf->setStyle(TextFeld::Style::Rahmen,
  1174. hatStyle(Style::AuswahlRahmen));
  1175. }
  1176. }
  1177. else
  1178. {
  1179. if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf)
  1180. {
  1181. tmpBuffer = tf->getAlphaFeld();
  1182. tf->setAlphaFeldZ(msAuswAf->get(i));
  1183. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  1184. tf->setStyle(TextFeld::Style::Buffered,
  1185. hatMsStyle(i, Style::AuswahlBuffer));
  1186. }
  1187. if (hatMsStyle(i, Style::AuswahlHintergrund))
  1188. {
  1189. tmpH = tf->hatStyle(Style::Hintergrund);
  1190. tf->setStyle(TextFeld::Style::Hintergrund,
  1191. hatMsStyle(i, Style::AuswahlHintergrund));
  1192. if (msAuswBgF && msAuswBgF->hat(i))
  1193. {
  1194. tmpHFarbe = tf->getHintergrundFarbe();
  1195. tf->setHintergrundFarbe(msAuswBgF->get(i));
  1196. }
  1197. if (hatMsStyle(i, Style::AuswahlHBild) && msAuswBgB)
  1198. {
  1199. tmpHBild = tf->getHintergrundBild();
  1200. tf->setHintergrundBildZ(msAuswBgB->get(i));
  1201. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  1202. tf->setStyle(TextFeld::Style::HBild,
  1203. hatMsStyle(i, Style::HBild));
  1204. }
  1205. if (hatMsStyle(i, Style::AuswahlHAlpha))
  1206. {
  1207. tmpHAlpha
  1208. = tf->hatStyle(TextFeld::Style::HAlpha);
  1209. tf->setStyle(TextFeld::Style::HAlpha,
  1210. hatMsStyle(i, Style::AuswahlHAlpha));
  1211. }
  1212. }
  1213. if (hatMsStyle(i, Style::AuswahlRahmen) && msAuswRahmen)
  1214. {
  1215. tmpRahmen = tf->getRahmen();
  1216. tf->setRahmenZ(msAuswRahmen->get(i));
  1217. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  1218. tf->setStyle(TextFeld::Style::Rahmen,
  1219. hatMsStyle(i, Style::AuswahlRahmen));
  1220. }
  1221. }
  1222. }
  1223. else if (mausEintrag == i)
  1224. {
  1225. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  1226. {
  1227. if (hatStyle(Style::MausBuffer))
  1228. {
  1229. tmpBuffer = tf->getAlphaFeld();
  1230. tf->setAlphaFeldZ(
  1231. dynamic_cast<AlphaFeld*>(mausAf->getThis()));
  1232. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  1233. tf->setStyle(TextFeld::Style::Buffered,
  1234. hatStyle(Style::MausBuffer));
  1235. }
  1236. if (hatStyle(Style::MausHintergrund))
  1237. {
  1238. tmpH = tf->hatStyle(TextFeld::Style::Hintergrund);
  1239. tmpHFarbe = tf->getHintergrundFarbe();
  1240. tf->setHintergrundFarbe(mausBgF);
  1241. tf->setStyle(TextFeld::Style::Hintergrund,
  1242. hatStyle(Style::Hintergrund));
  1243. if (hatStyle(Style::MausHBild))
  1244. {
  1245. tmpHBild = tf->getHintergrundBild();
  1246. tf->setHintergrundBildZ(
  1247. dynamic_cast<Bild*>(mausBgB->getThis()));
  1248. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  1249. tf->setStyle(TextFeld::Style::HBild,
  1250. hatStyle(Style::HBild));
  1251. }
  1252. if (hatStyle(Style::MausHAlpha))
  1253. {
  1254. tmpHAlpha
  1255. = tf->hatStyle(TextFeld::Style::HAlpha);
  1256. tf->setStyle(TextFeld::Style::HAlpha,
  1257. hatStyle(Style::MausHAlpha));
  1258. }
  1259. }
  1260. if (hatStyle(Style::MausRahmen))
  1261. {
  1262. tmpRahmen = tf->getRahmen();
  1263. tf->setRahmenZ(
  1264. dynamic_cast<Rahmen*>(mausRahmen->getThis()));
  1265. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  1266. tf->setStyle(TextFeld::Style::Rahmen,
  1267. hatStyle(Style::MausRahmen));
  1268. }
  1269. }
  1270. else
  1271. {
  1272. if (hatMsStyle(i, Style::MausBuffer) && msAuswAf)
  1273. {
  1274. tmpBuffer = tf->getAlphaFeld();
  1275. tf->setAlphaFeldZ(msMausAf->get(i));
  1276. tmpB = tf->hatStyle(TextFeld::Style::Buffered);
  1277. tf->setStyle(TextFeld::Style::Buffered,
  1278. hatMsStyle(i, Style::MausBuffer));
  1279. }
  1280. if (hatMsStyle(i, Style::MausHintergrund))
  1281. {
  1282. tmpH = tf->hatStyle(Style::Hintergrund);
  1283. tf->setStyle(TextFeld::Style::Hintergrund,
  1284. hatMsStyle(i, Style::MausHintergrund));
  1285. if (msMausBgF && msMausBgF->hat(i))
  1286. {
  1287. tmpHFarbe = tf->getHintergrundFarbe();
  1288. tf->setHintergrundFarbe(msMausBgF->get(i));
  1289. }
  1290. if (hatMsStyle(i, Style::MausHBild) && msMausBgB)
  1291. {
  1292. tmpHBild = tf->getHintergrundBild();
  1293. tf->setHintergrundBildZ(msMausBgB->get(i));
  1294. tmpHB = tf->hatStyle(TextFeld::Style::HBild);
  1295. tf->setStyle(TextFeld::Style::HBild,
  1296. hatMsStyle(i, Style::HBild));
  1297. }
  1298. if (hatMsStyle(i, Style::MausHAlpha))
  1299. {
  1300. tmpHAlpha
  1301. = tf->hatStyle(TextFeld::Style::HAlpha);
  1302. tf->setStyle(TextFeld::Style::HAlpha,
  1303. hatMsStyle(i, Style::MausHAlpha));
  1304. }
  1305. }
  1306. if (hatMsStyle(i, Style::MausRahmen) && msMausRahmen)
  1307. {
  1308. tmpRahmen = tf->getRahmen();
  1309. tf->setRahmenZ(msMausRahmen->get(i));
  1310. tmpR = tf->hatStyle(TextFeld::Style::Rahmen);
  1311. tf->setStyle(TextFeld::Style::Rahmen,
  1312. hatMsStyle(i, Style::MausRahmen));
  1313. }
  1314. }
  1315. }
  1316. tf->render(zRObj);
  1317. if (selected)
  1318. {
  1319. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  1320. {
  1321. if (hatStyle(Style::AuswahlBuffer))
  1322. {
  1323. tf->setAlphaFeldZ(tmpBuffer);
  1324. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1325. }
  1326. if (hatStyle(Style::AuswahlHintergrund))
  1327. {
  1328. tf->setHintergrundFarbe(tmpHFarbe);
  1329. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1330. if (hatStyle(Style::AuswahlHBild))
  1331. {
  1332. tf->setHintergrundBildZ(tmpHBild);
  1333. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1334. }
  1335. if (hatStyle(Style::AuswahlHAlpha))
  1336. tf->setStyle(
  1337. TextFeld::Style::HAlpha, tmpHAlpha);
  1338. }
  1339. if (hatStyle(Style::AuswahlRahmen))
  1340. {
  1341. tf->setRahmenZ(tmpRahmen);
  1342. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1343. }
  1344. }
  1345. else
  1346. {
  1347. if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf)
  1348. {
  1349. tf->setAlphaFeldZ(tmpBuffer);
  1350. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1351. }
  1352. if (hatMsStyle(i, Style::AuswahlHintergrund))
  1353. {
  1354. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1355. if (msAuswBgF && msAuswBgF->hat(i))
  1356. tf->setHintergrundFarbe(tmpHFarbe);
  1357. if (hatMsStyle(i, Style::AuswahlHBild) && msAuswBgB)
  1358. {
  1359. tf->setHintergrundBildZ(tmpHBild);
  1360. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1361. }
  1362. if (hatMsStyle(i, Style::AuswahlHAlpha))
  1363. tf->setStyle(
  1364. TextFeld::Style::HAlpha, tmpHAlpha);
  1365. }
  1366. if (hatMsStyle(i, Style::AuswahlRahmen) && msAuswRahmen)
  1367. {
  1368. tf->setRahmenZ(tmpRahmen);
  1369. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1370. }
  1371. }
  1372. }
  1373. else if (mausEintrag == i)
  1374. {
  1375. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  1376. {
  1377. if (hatStyle(Style::MausBuffer))
  1378. {
  1379. tf->setAlphaFeldZ(tmpBuffer);
  1380. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1381. }
  1382. if (hatStyle(Style::MausHintergrund))
  1383. {
  1384. tf->setHintergrundFarbe(tmpHFarbe);
  1385. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1386. if (hatStyle(Style::MausHBild))
  1387. {
  1388. tf->setHintergrundBildZ(tmpHBild);
  1389. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1390. }
  1391. if (hatStyle(Style::MausHAlpha))
  1392. tf->setStyle(
  1393. TextFeld::Style::HAlpha, tmpHAlpha);
  1394. }
  1395. if (hatStyle(Style::MausRahmen))
  1396. {
  1397. tf->setRahmenZ(tmpRahmen);
  1398. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1399. }
  1400. }
  1401. else
  1402. {
  1403. if (hatMsStyle(i, Style::MausBuffer) && msAuswAf)
  1404. {
  1405. tf->setAlphaFeldZ(tmpBuffer);
  1406. tf->setStyle(TextFeld::Style::Buffered, tmpB);
  1407. }
  1408. if (hatMsStyle(i, Style::MausHintergrund))
  1409. {
  1410. tf->setStyle(TextFeld::Style::Hintergrund, tmpH);
  1411. if (msAuswBgF && msAuswBgF->hat(i))
  1412. tf->setHintergrundFarbe(tmpHFarbe);
  1413. if (hatMsStyle(i, Style::MausHBild) && msAuswBgB)
  1414. {
  1415. tf->setHintergrundBildZ(tmpHBild);
  1416. tf->setStyle(TextFeld::Style::HBild, tmpHB);
  1417. }
  1418. if (hatMsStyle(i, Style::MausHAlpha))
  1419. tf->setStyle(
  1420. TextFeld::Style::HAlpha, tmpHAlpha);
  1421. }
  1422. if (hatMsStyle(i, Style::MausRahmen) && msAuswRahmen)
  1423. {
  1424. tf->setRahmenZ(tmpRahmen);
  1425. tf->setStyle(TextFeld::Style::Rahmen, tmpR);
  1426. }
  1427. }
  1428. }
  1429. dy += tf->getHeight();
  1430. }
  1431. if (vertikalScrollBar)
  1432. vertikalScrollBar->getScrollData()->max = maxHeight;
  1433. zRObj.releaseDrawOptions();
  1434. }
  1435. zRObj.releaseDrawOptions();
  1436. zRObj.releaseDrawOptions();
  1437. unlockDrawable();
  1438. }
  1439. }
  1440. // constant
  1441. int AuswahlBox::getEintragPos(
  1442. const char* txt) const // returns the entry position
  1443. {
  1444. for (int i = 0; i < anzahl; ++i)
  1445. if (members->z(i) && members->z(i)->zText()->istGleich(txt)) return i;
  1446. return -1;
  1447. }
  1448. int AuswahlBox::getEintragPos(Text* txt) const
  1449. {
  1450. for (int i = 0; i < anzahl; ++i)
  1451. {
  1452. if (members->z(i) && members->z(i)->zText()->istGleich(txt->getText()))
  1453. {
  1454. txt->release();
  1455. return i;
  1456. }
  1457. }
  1458. txt->release();
  1459. return -1;
  1460. }
  1461. Text* AuswahlBox::getEintragText(int i) const // returns the entry text
  1462. {
  1463. if (i >= anzahl) return 0;
  1464. return members->z(i) ? members->z(i)->getText() : 0;
  1465. }
  1466. Text* AuswahlBox::zEintragText(int i) const
  1467. {
  1468. if (i >= anzahl) return 0;
  1469. return members->z(i) ? members->z(i)->zText() : 0;
  1470. }
  1471. TextFeld* AuswahlBox::getEintrag(int i) const // returns the entry
  1472. {
  1473. if (i >= anzahl) return 0;
  1474. return members->get(i);
  1475. }
  1476. TextFeld* AuswahlBox::zEintrag(int i) const
  1477. {
  1478. if (i >= anzahl) return 0;
  1479. return members->z(i);
  1480. }
  1481. int AuswahlBox::getAuswahl() const // returns the position of the selected entry
  1482. {
  1483. return auswahl;
  1484. }
  1485. int AuswahlBox::getEintragAnzahl() const // returns the number of entries
  1486. {
  1487. return anzahl;
  1488. }
  1489. bool AuswahlBox::istAusgeklappt() const // checks if the list is expanded
  1490. {
  1491. return ausgeklappt;
  1492. }
  1493. int AuswahlBox::getMaxHeight() const // returns the maximum list height
  1494. {
  1495. if (!hatStyle(Style::MaxHeight)) return 0;
  1496. return ausklapMaxHeight;
  1497. }
  1498. int AuswahlBox::getEintragHeight() const // returns the height of the entries
  1499. {
  1500. return eintragHeight;
  1501. }
  1502. Knopf*
  1503. AuswahlBox::getAusklappKnopf() const // returns the expand/collapse button
  1504. {
  1505. if (hatStyle(Style::MultiStyled)) return 0;
  1506. return ausfahren ? dynamic_cast<Knopf*>(ausfahren->getThis()) : 0;
  1507. }
  1508. Knopf* AuswahlBox::zAusklappKnopf() const
  1509. {
  1510. if (hatStyle(Style::MultiStyled)) return 0;
  1511. return ausfahren;
  1512. }
  1513. Rahmen* AuswahlBox::getEintragRahmen(int i) const // returns the entry border
  1514. {
  1515. if (!hatStyle(Style::MultiStyled)) return 0;
  1516. if (!members->z(i)) return 0;
  1517. return members->z(i)->getRahmen();
  1518. }
  1519. Rahmen* AuswahlBox::zEintragRahmen(int i) const
  1520. {
  1521. if (!hatStyle(Style::MultiStyled)) return 0;
  1522. if (!members->z(i)) return 0;
  1523. return members->z(i)->zRahmen();
  1524. }
  1525. int AuswahlBox::getEintragRahmenFarbe(
  1526. int i) const // returns the entry border color
  1527. {
  1528. if (!hatStyle(Style::MultiStyled)) return 0;
  1529. if (!members->z(i)) return 0;
  1530. return members->z(i)->getRahmenFarbe();
  1531. }
  1532. int AuswahlBox::getEintragRahmenBreite(
  1533. int i) const // returns the entry border width
  1534. {
  1535. if (!hatStyle(Style::MultiStyled)) return 0;
  1536. if (!members->z(i)) return 0;
  1537. return members->z(i)->getRahmenBreite();
  1538. }
  1539. AlphaFeld* AuswahlBox::getEintragAlphaFeld(
  1540. int i) const // returns the entry AlphaFeld
  1541. {
  1542. if (!hatStyle(Style::MultiStyled)) return 0;
  1543. if (!members->z(i)) return 0;
  1544. return members->z(i)->getAlphaFeld();
  1545. }
  1546. AlphaFeld* AuswahlBox::zEintragAlphaFeld(int i) const
  1547. {
  1548. if (!hatStyle(Style::MultiStyled)) return 0;
  1549. if (!members->z(i)) return 0;
  1550. return members->z(i)->zAlphaFeld();
  1551. }
  1552. int AuswahlBox::getEintragAlphaFeldFarbe(
  1553. int i) const // returns the entry AlphaFeld color
  1554. {
  1555. if (!hatStyle(Style::MultiStyled)) return 0;
  1556. if (!members->z(i)) return 0;
  1557. return members->z(i)->getAlphaFeldFarbe();
  1558. }
  1559. int AuswahlBox::getEintragAlphaFeldStrength(
  1560. int i) const // returns the entry AlphaFeld strength
  1561. {
  1562. if (!hatStyle(Style::MultiStyled)) return 0;
  1563. if (!members->z(i)) return 0;
  1564. return members->z(i)->getAlphaFeldStrength();
  1565. }
  1566. int AuswahlBox::getEintragHintergrundFarbe(
  1567. int i) const // returns the entry background color
  1568. {
  1569. if (!hatStyle(Style::MultiStyled)) return 0;
  1570. if (!members->z(i)) return 0;
  1571. return members->z(i)->getHintergrundFarbe();
  1572. }
  1573. Bild* AuswahlBox::getEintragHintergrundBild(
  1574. int i) const // returns the entry background image
  1575. {
  1576. if (!hatStyle(Style::MultiStyled)) return 0;
  1577. if (!members->z(i)) return 0;
  1578. return members->z(i)->getHintergrundBild();
  1579. }
  1580. Bild* AuswahlBox::zEintragHintergrundBild(int i) const
  1581. {
  1582. if (!hatStyle(Style::MultiStyled)) return 0;
  1583. if (!members->z(i)) return 0;
  1584. return members->z(i)->zHintergrundBild();
  1585. }
  1586. Rahmen* AuswahlBox::getAuswRahmen() const // returns the selection border
  1587. {
  1588. if (hatStyle(Style::MultiStyled)) return 0;
  1589. return auswRahmen ? dynamic_cast<Rahmen*>(auswRahmen->getThis()) : 0;
  1590. }
  1591. Rahmen* AuswahlBox::zAuswRahmen() const
  1592. {
  1593. if (hatStyle(Style::MultiStyled)) return 0;
  1594. return auswRahmen;
  1595. }
  1596. int AuswahlBox::getAuswRahmenFarbe() const // returns the selection border color
  1597. {
  1598. if (hatStyle(Style::MultiStyled)) return 0;
  1599. return auswRahmen ? auswRahmen->getFarbe() : 0;
  1600. }
  1601. int AuswahlBox::getAuswRahmenBreite()
  1602. const // returns the selection border width
  1603. {
  1604. if (hatStyle(Style::MultiStyled)) return 0;
  1605. return auswRahmen ? auswRahmen->getRBreite() : 0;
  1606. }
  1607. AlphaFeld*
  1608. AuswahlBox::getAuswAlphaFeld() const // returns the selection AlphaFeld
  1609. {
  1610. if (hatStyle(Style::MultiStyled)) return 0;
  1611. return auswAf ? dynamic_cast<AlphaFeld*>(auswAf->getThis()) : 0;
  1612. }
  1613. AlphaFeld* AuswahlBox::zAuswAlphaFeld() const
  1614. {
  1615. if (hatStyle(Style::MultiStyled)) return 0;
  1616. return auswAf;
  1617. }
  1618. int AuswahlBox::getAuswAlphaFeldFarbe()
  1619. const // returns the selection AlphaFeld color
  1620. {
  1621. if (hatStyle(Style::MultiStyled)) return 0;
  1622. return auswAf ? auswAf->getFarbe() : 0;
  1623. }
  1624. int AuswahlBox::getAuswAlphaFeldStrength()
  1625. const // returns the selection AlphaFeld strength
  1626. {
  1627. if (hatStyle(Style::MultiStyled)) return 0;
  1628. return auswAf ? auswAf->getStrength() : 0;
  1629. }
  1630. int AuswahlBox::getAuswHintergrundFarbe()
  1631. const // returns the selection background color
  1632. {
  1633. if (hatStyle(Style::MultiStyled)) return 0;
  1634. return auswBgF;
  1635. }
  1636. Bild* AuswahlBox::getAuswHintergrundBild()
  1637. const // returns the selection background image
  1638. {
  1639. if (hatStyle(Style::MultiStyled)) return 0;
  1640. return auswBgB ? dynamic_cast<Bild*>(auswBgB->getThis()) : 0;
  1641. }
  1642. Bild* AuswahlBox::zAuswHintergrundBild() const
  1643. {
  1644. if (hatStyle(Style::MultiStyled)) return 0;
  1645. return auswBgB;
  1646. }
  1647. Rahmen* AuswahlBox::getMsAuswRahmen(
  1648. int i) const // returns the multistyle selection border
  1649. {
  1650. if (!hatStyle(Style::MultiStyled)) return 0;
  1651. if (!msAuswRahmen) return 0;
  1652. return msAuswRahmen->z(i)
  1653. ? dynamic_cast<Rahmen*>(msAuswRahmen->z(i)->getThis())
  1654. : 0;
  1655. }
  1656. Rahmen* AuswahlBox::zMsAuswRahmen(int i) const
  1657. {
  1658. if (!hatStyle(Style::MultiStyled)) return 0;
  1659. if (!msAuswRahmen) return 0;
  1660. return msAuswRahmen->z(i);
  1661. }
  1662. int AuswahlBox::getMsAuswRahmenFarbe(
  1663. int i) const // returns the multistyle selection border color
  1664. {
  1665. if (!hatStyle(Style::MultiStyled)) return 0;
  1666. if (!msAuswRahmen) return 0;
  1667. return msAuswRahmen->z(i) ? msAuswRahmen->z(i)->getFarbe() : 0;
  1668. }
  1669. int AuswahlBox::getMsAuswRahmenBreite(
  1670. int i) const // returns the multistyle selection border width
  1671. {
  1672. if (!hatStyle(Style::MultiStyled)) return 0;
  1673. if (!msAuswRahmen) return 0;
  1674. return msAuswRahmen->z(i) ? msAuswRahmen->z(i)->getRBreite() : 0;
  1675. }
  1676. AlphaFeld* AuswahlBox::getMsAuswAlphaFeld(
  1677. int i) const // returns the multistyle selection AlphaFeld
  1678. {
  1679. if (!hatStyle(Style::MultiStyled)) return 0;
  1680. if (!msAuswAf) return 0;
  1681. return msAuswAf->z(i) ? dynamic_cast<AlphaFeld*>(msAuswAf->z(i)->getThis())
  1682. : 0;
  1683. }
  1684. AlphaFeld* AuswahlBox::zMsAuswAlphaFeld(int i) const
  1685. {
  1686. if (!hatStyle(Style::MultiStyled)) return 0;
  1687. if (!msAuswAf) return 0;
  1688. return msAuswAf->z(i);
  1689. }
  1690. int AuswahlBox::getMsAuswAlphaFeldFarbe(
  1691. int i) const // returns the multistyle selection AlphaFeld color
  1692. {
  1693. if (!hatStyle(Style::MultiStyled)) return 0;
  1694. if (!msAuswAf) return 0;
  1695. return msAuswAf->z(i) ? msAuswAf->z(i)->getFarbe() : 0;
  1696. }
  1697. int AuswahlBox::getMsAuswAlphaFeldStrength(
  1698. int i) const // returns the multistyle selection AlphaFeld strength
  1699. {
  1700. if (!hatStyle(Style::MultiStyled)) return 0;
  1701. if (!msAuswAf) return 0;
  1702. return msAuswAf->z(i) ? msAuswAf->z(i)->getStrength() : 0;
  1703. }
  1704. int AuswahlBox::getMsAuswHintergrundFarbe(
  1705. int i) const // returns the multistyle selection background color
  1706. {
  1707. if (!hatStyle(Style::MultiStyled)) return 0;
  1708. if (!msAuswBgF || !msAuswBgF->hat(i)) return 0;
  1709. return msAuswBgF->get(i);
  1710. }
  1711. Bild* AuswahlBox::getMsAuswHintergrundBild(
  1712. int i) const // returns the multistyle selection background image
  1713. {
  1714. if (!hatStyle(Style::MultiStyled)) return 0;
  1715. if (!msAuswBgB) return 0;
  1716. return msAuswBgB->get(i);
  1717. }
  1718. Bild* AuswahlBox::zMsAuswHintergrundBild(int i) const
  1719. {
  1720. if (!hatStyle(Style::MultiStyled)) return 0;
  1721. if (!msAuswBgB) return 0;
  1722. return msAuswBgB->z(i);
  1723. }
  1724. Rahmen* AuswahlBox::getMausRahmen() const // returns the mouse border
  1725. {
  1726. if (hatStyle(Style::MultiStyled)) return 0;
  1727. return mausRahmen ? dynamic_cast<Rahmen*>(mausRahmen->getThis()) : 0;
  1728. }
  1729. Rahmen* AuswahlBox::zMausRahmen() const
  1730. {
  1731. if (hatStyle(Style::MultiStyled)) return 0;
  1732. return mausRahmen;
  1733. }
  1734. int AuswahlBox::getMausRahmenFarbe() const // returns the mouse border color
  1735. {
  1736. if (hatStyle(Style::MultiStyled)) return 0;
  1737. return mausRahmen ? mausRahmen->getFarbe() : 0;
  1738. }
  1739. int AuswahlBox::getMausRahmenBreite() const // returns the mouse border width
  1740. {
  1741. if (hatStyle(Style::MultiStyled)) return 0;
  1742. return mausRahmen ? mausRahmen->getRBreite() : 0;
  1743. }
  1744. AlphaFeld* AuswahlBox::getMausAlphaFeld() const // returns the mouse AlphaFeld
  1745. {
  1746. if (hatStyle(Style::MultiStyled)) return 0;
  1747. return mausAf ? dynamic_cast<AlphaFeld*>(mausAf->getThis()) : 0;
  1748. }
  1749. AlphaFeld* AuswahlBox::zMausAlphaFeld() const
  1750. {
  1751. if (hatStyle(Style::MultiStyled)) return 0;
  1752. return mausAf;
  1753. }
  1754. int AuswahlBox::getMausAlphaFeldFarbe()
  1755. const // returns the mouse AlphaFeld color
  1756. {
  1757. if (hatStyle(Style::MultiStyled)) return 0;
  1758. return mausAf ? mausAf->getFarbe() : 0;
  1759. }
  1760. int AuswahlBox::getMausAlphaFeldStrength()
  1761. const // returns the mouse AlphaFeld strength
  1762. {
  1763. if (hatStyle(Style::MultiStyled)) return 0;
  1764. return mausAf ? mausAf->getStrength() : 0;
  1765. }
  1766. int AuswahlBox::getMausHintergrundFarbe()
  1767. const // returns the mouse background color
  1768. {
  1769. if (hatStyle(Style::MultiStyled)) return 0;
  1770. return mausBgF;
  1771. }
  1772. Bild* AuswahlBox::getMausHintergrundBild()
  1773. const // returns the mouse background image
  1774. {
  1775. if (hatStyle(Style::MultiStyled)) return 0;
  1776. return mausBgB ? dynamic_cast<Bild*>(mausBgB->getThis()) : 0;
  1777. }
  1778. Bild* AuswahlBox::zMausHintergrundBild() const
  1779. {
  1780. if (hatStyle(Style::MultiStyled)) return 0;
  1781. return mausBgB;
  1782. }
  1783. Rahmen* AuswahlBox::getMsMausRahmen(
  1784. int i) const // returns the multistyle mouse border
  1785. {
  1786. if (!hatStyle(Style::MultiStyled)) return 0;
  1787. if (!msMausRahmen) return 0;
  1788. return msMausRahmen->get(i);
  1789. }
  1790. Rahmen* AuswahlBox::zMsMausRahmen(int i) const
  1791. {
  1792. if (!hatStyle(Style::MultiStyled)) return 0;
  1793. if (!msMausRahmen) return 0;
  1794. return msMausRahmen->z(i);
  1795. }
  1796. int AuswahlBox::getMsMausRahmenFarbe(
  1797. int i) const // returns the multistyle mouse border color
  1798. {
  1799. if (!hatStyle(Style::MultiStyled)) return 0;
  1800. if (!msMausRahmen) return 0;
  1801. return msMausRahmen->z(i) ? msMausRahmen->z(i)->getFarbe() : 0;
  1802. }
  1803. int AuswahlBox::getMsMausRahmenBreite(
  1804. int i) const // returns the multistyle mouse border width
  1805. {
  1806. if (!hatStyle(Style::MultiStyled)) return 0;
  1807. if (!msMausRahmen) return 0;
  1808. return msMausRahmen->z(i) ? msMausRahmen->z(i)->getRBreite() : 0;
  1809. }
  1810. AlphaFeld* AuswahlBox::getMsMausAlphaFeld(
  1811. int i) const // returns the multistyle mouse AlphaFeld
  1812. {
  1813. if (!hatStyle(Style::MultiStyled)) return 0;
  1814. if (!msMausAf) return 0;
  1815. return msMausAf->get(i);
  1816. }
  1817. AlphaFeld* AuswahlBox::zMsMausAlphaFeld(int i) const
  1818. {
  1819. if (!hatStyle(Style::MultiStyled)) return 0;
  1820. if (!msMausAf) return 0;
  1821. return msMausAf->z(i);
  1822. }
  1823. int AuswahlBox::getMsMausAlphaFeldFarbe(
  1824. int i) const // returns the multistyle mouse AlphaFeld color
  1825. {
  1826. if (!hatStyle(Style::MultiStyled)) return 0;
  1827. if (!msMausAf) return 0;
  1828. return msMausAf->z(i) ? msMausAf->z(i)->getFarbe() : 0;
  1829. }
  1830. int AuswahlBox::getMsMausAlphaFeldStrength(
  1831. int i) const // returns the multistyle mouse AlphaFeld strength
  1832. {
  1833. if (!hatStyle(Style::MultiStyled)) return 0;
  1834. if (!msMausAf) return 0;
  1835. return msMausAf->z(i) ? msMausAf->z(i)->getStrength() : 0;
  1836. }
  1837. int AuswahlBox::getMsMausHintergrundFarbe(
  1838. int i) const // returns the multistyle mouse background color
  1839. {
  1840. if (!hatStyle(Style::MultiStyled)) return 0;
  1841. if (!msMausBgF || !msMausBgF->hat(i)) return 0;
  1842. return msMausBgF->get(i);
  1843. }
  1844. Bild* AuswahlBox::getMsMausHintergrundBild(
  1845. int i) const // returns the multistyle mouse background image
  1846. {
  1847. if (!hatStyle(Style::MultiStyled)) return 0;
  1848. if (!msMausBgB) return 0;
  1849. return msMausBgB->get(i);
  1850. }
  1851. Bild* AuswahlBox::zMsMausHintergrundBild(int i) const
  1852. {
  1853. if (!hatStyle(Style::MultiStyled)) return 0;
  1854. if (!msMausBgB) return 0;
  1855. return msMausBgB->z(i);
  1856. }
  1857. // Checks if a point is inside this object
  1858. // x: the x coordinate of the point
  1859. // y: the y coordinate of the point
  1860. // return: 1 if the point is inside, 0 otherwise
  1861. bool AuswahlBox::istPunktInnen(int x, int y) const
  1862. {
  1863. return x >= pos.x && x < pos.x + gr.x && y >= pos.y
  1864. && y < pos.y + gr.y + ausklappHeight;
  1865. }
  1866. bool AuswahlBox::hatMsStyle(
  1867. int i, __int64 abStyle) const // checks if multistyle style is present
  1868. {
  1869. if ((style | Style::MultiStyled) != style || !msStyle || !msStyle->hat(i))
  1870. return 0;
  1871. return (msStyle->get(i) | abStyle) == msStyle->get(i);
  1872. }
  1873. bool AuswahlBox::hatMsStyleNicht(
  1874. int i, __int64 abStyle) const // checks if multistyle style is not present
  1875. {
  1876. if ((style | Style::MultiStyled) != style || !msStyle || !msStyle->hat(i))
  1877. return 1;
  1878. return (msStyle->get(i) | abStyle) != msStyle->get(i);
  1879. }
  1880. Drawable* AuswahlBox::dublizieren() const // Creates a copy of the drawing
  1881. {
  1882. AuswahlBox* obj = new AuswahlBox();
  1883. obj->setPosition(pos);
  1884. obj->setSize(gr);
  1885. obj->setMausEreignisParameter(makParam);
  1886. obj->setTastaturEreignisParameter(takParam);
  1887. obj->setMausEreignis(mak);
  1888. obj->setTastaturEreignis(tak);
  1889. if (toolTip) obj->setToolTipZ((ToolTip*)toolTip->dublizieren());
  1890. obj->setStyle(style);
  1891. if (textRd)
  1892. obj->setTextRendererZ(dynamic_cast<TextRenderer*>(textRd->getThis()));
  1893. if (rahmen) obj->setRahmenZ((Rahmen*)rahmen->dublizieren());
  1894. if (ausfahren) obj->setAusklappKnopfZ((Knopf*)ausfahren->dublizieren());
  1895. obj->setHintergrundFarbe(hintergrundFarbe);
  1896. if (hintergrundBild)
  1897. obj->setHintergrundBild(
  1898. dynamic_cast<Bild*>(hintergrundBild->getThis()));
  1899. if (hintergrundFeld)
  1900. obj->setAlphaFeldZ((AlphaFeld*)hintergrundFeld->dublizieren());
  1901. if (auswRahmen) obj->setAuswRahmenZ((Rahmen*)auswRahmen->dublizieren());
  1902. obj->setAuswHintergrundFarbe(auswBgF);
  1903. if (auswBgB)
  1904. obj->setAuswHintergrundBild(dynamic_cast<Bild*>(auswBgB->getThis()));
  1905. if (auswAf) obj->setAuswAlphaFeldZ((AlphaFeld*)auswAf->dublizieren());
  1906. if (mausRahmen) obj->setMausRahmenZ((Rahmen*)mausRahmen->dublizieren());
  1907. obj->setMausHintergrundFarbe(mausBgF);
  1908. if (mausBgB)
  1909. obj->setMausHintergrundBild(dynamic_cast<Bild*>(mausBgB->getThis()));
  1910. if (mausAf) obj->setMausAlphaFeldZ((AlphaFeld*)mausAf->dublizieren());
  1911. obj->setMaxAuskappHeight(ausklapMaxHeight);
  1912. obj->setEintragHeight(eintragHeight);
  1913. for (int i = 0; i < anzahl; ++i)
  1914. {
  1915. if (members->z(i))
  1916. {
  1917. obj->addEintrag("a");
  1918. obj->setEintragZ(i, (TextFeld*)members->z(i)->dublizieren());
  1919. if (msStyle && msStyle->hat(i)) obj->setMsStyle(i, msStyle->get(i));
  1920. if (msAuswRahmen && msAuswRahmen->z(i))
  1921. obj->setMsAuswRahmenZ(
  1922. i, (Rahmen*)msAuswRahmen->z(i)->dublizieren());
  1923. if (msAuswBgF && msAuswBgF->hat(i))
  1924. obj->setMsAuswHintergrundFarbe(i, msAuswBgF->get(i));
  1925. if (msAuswBgB && msAuswBgB->z(i))
  1926. obj->setMsAuswHintergrundBild(i, msAuswBgB->get(i));
  1927. if (msAuswAf && msAuswAf->z(i))
  1928. obj->setMsAuswAlphaFeldZ(
  1929. i, (AlphaFeld*)msAuswAf->z(i)->dublizieren());
  1930. if (msMausRahmen && msMausRahmen->z(i))
  1931. obj->setMsMausRahmenZ(
  1932. i, (Rahmen*)msMausRahmen->z(i)->dublizieren());
  1933. if (msMausBgF && msMausBgF->hat(i))
  1934. obj->setMsMausHintergrundFarbe(i, msMausBgF->get(i));
  1935. if (msMausBgB && msMausBgB->z(i))
  1936. obj->setMsMausHintergrundBild(i, msMausBgB->get(i));
  1937. if (msMausAf && msMausAf->z(i))
  1938. obj->setMsMausAlphaFeldZ(
  1939. i, (AlphaFeld*)msMausAf->z(i)->dublizieren());
  1940. }
  1941. }
  1942. obj->setAlphaFeldFarbe(auswahl);
  1943. return obj;
  1944. }