SelectionBox.cpp 69 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 SelectionBox class from SelectionBox.h
  15. // Constructor
  16. SelectionBox::SelectionBox()
  17. : DrawableBackground(),
  18. textRd(0),
  19. msStyle(0),
  20. members(new RCArray<TextField>()),
  21. ausfahren(new Button()),
  22. selBorder(new LBorder()),
  23. auswBgF(0xFF000000),
  24. auswBgB(0),
  25. auswAf(new AlphaField()),
  26. msSelBorder(0),
  27. msAuswBgF(0),
  28. msAuswBgB(0),
  29. msAuswAf(0),
  30. mouseBorder(new LBorder()),
  31. mausBgF(0xFF000000),
  32. mausBgB(0),
  33. mausAf(new AlphaField()),
  34. msMouseBorder(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 LBorder();
  53. rahmen->setFarbe(0xFFFFFFFF);
  54. rahmen->setRamenBreite(1);
  55. ausfahren->setStyle(Button::Style::Sichtbar | Button::Style::Erlaubt
  56. | Button::Style::KlickBuffer);
  57. ausfahren->setKBFarbe(0xA0000000);
  58. ausfahren->setKBStrength(10);
  59. ausfahren->setSize(18, 18);
  60. ausfahren->setSchriftFarbe(0xFFFFFFFF);
  61. ausfahren->setText("\\/");
  62. selBorder->setFarbe(0xFF00FF00);
  63. selBorder->setRamenBreite(1);
  64. auswAf->setFarbe(0xA000FF00);
  65. auswAf->setStrength(7);
  66. mouseBorder->setFarbe(0xFF00FF00);
  67. mouseBorder->setRamenBreite(1);
  68. mausAf->setFarbe(0x5000FF00);
  69. mausAf->setStrength(7);
  70. gr.x = 20;
  71. gr.y = 20;
  72. }
  73. // Destructor
  74. SelectionBox::~SelectionBox()
  75. {
  76. if (textRd) textRd->release();
  77. if (msStyle) msStyle->release();
  78. if (members) members->release();
  79. if (ausfahren) ausfahren->release();
  80. if (selBorder) selBorder->release();
  81. if (auswBgB) auswBgB->release();
  82. if (auswAf) auswAf->release();
  83. if (msSelBorder) msSelBorder->release();
  84. if (msAuswAf) msAuswAf->release();
  85. if (msAuswBgB) msAuswBgB->release();
  86. if (msAuswBgF) msAuswBgF->release();
  87. if (mouseBorder) mouseBorder->release();
  88. if (mausAf) mausAf->release();
  89. if (mausBgB) mausBgB->release();
  90. if (msMouseBorder) msMouseBorder->release();
  91. if (msMausAf) msMausAf->release();
  92. if (msMausBgB) msMausBgB->release();
  93. if (msMausBgF) msMausBgF->release();
  94. }
  95. void SelectionBox::doMouseEvent(MouseEvent& 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->doPublicMouseEvent(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::Border)) 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 SelectionBox::setEventParam(void* p) // set event parameter
  192. {
  193. eAkP = p;
  194. }
  195. void SelectionBox::setEventAktion(
  196. std::function<void(void*, SelectionBox*, int, int)> event) // set event action
  197. {
  198. this->eAk = event;
  199. }
  200. void SelectionBox::setFontZ(Font* schrift) // set font
  201. {
  202. if (!this->textRd)
  203. textRd = new TextRenderer(schrift);
  204. else
  205. textRd->setFontZ(schrift);
  206. ausfahren->setFontZ(dynamic_cast<Font*>(schrift->getThis()));
  207. rend = 1;
  208. }
  209. void SelectionBox::setTextRendererZ(TextRenderer* textRd)
  210. {
  211. if (this->textRd) this->textRd->release();
  212. this->textRd = textRd;
  213. }
  214. void SelectionBox::addEintrag(const char* txt) // add entry
  215. {
  216. TextField* tf = new TextField();
  217. if (textRd) tf->setFontZ(textRd->getFont());
  218. tf->addStyle(TextField::Style::Sichtbar | TextField::Style::Center
  219. | TextField::Style::Border);
  220. tf->setText(txt);
  221. tf->setSchriftFarbe(0xFFFFFFFF);
  222. tf->setBorderColor(0xFFFFFFFF);
  223. tf->setSize(0, eintragHeight);
  224. members->add(tf, anzahl);
  225. ++anzahl;
  226. rend = 1;
  227. }
  228. void SelectionBox::addEintrag(Text* txt)
  229. {
  230. TextField* tf = new TextField();
  231. if (textRd) tf->setFontZ(textRd->getFont());
  232. tf->addStyle(TextField::Style::Sichtbar | TextField::Style::Center
  233. | TextField::Style::Border);
  234. tf->setText(txt);
  235. tf->setSchriftFarbe(0xFFFFFFFF);
  236. tf->setBorderColor(0xFFFFFFFF);
  237. tf->setSize(0, eintragHeight);
  238. members->add(tf, anzahl);
  239. ++anzahl;
  240. rend = 1;
  241. }
  242. void SelectionBox::addEintragZ(TextField* txt)
  243. {
  244. members->add(txt, anzahl);
  245. ++anzahl;
  246. rend = 1;
  247. }
  248. void SelectionBox::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 SelectionBox::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 SelectionBox::setEintragZ(int i, TextField* txt)
  262. {
  263. if (i < anzahl)
  264. members->set(txt, i);
  265. else
  266. txt->release();
  267. rend = 1;
  268. }
  269. void SelectionBox::removeEintrag(int i) // remove entry
  270. {
  271. if (i < anzahl)
  272. {
  273. members->remove(i);
  274. if (msStyle) msStyle->remove(i);
  275. if (msSelBorder) msSelBorder->remove(i);
  276. if (msAuswBgF) msAuswBgF->remove(i);
  277. if (msAuswBgB) msAuswBgB->remove(i);
  278. if (msAuswAf) msAuswAf->remove(i);
  279. if (msMouseBorder) msMouseBorder->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 SelectionBox::setDropDownButtonZ(Button* ausK) // set expand button
  290. {
  291. if (ausfahren) ausfahren->release();
  292. ausfahren = ausK;
  293. rend = 1;
  294. }
  295. void SelectionBox::setEntryBorderZ(int i, Border* rahmen) // set entry border
  296. {
  297. if (members->z(i))
  298. members->z(i)->setBorderZ(rahmen);
  299. else
  300. rahmen->release();
  301. rend = 1;
  302. }
  303. void SelectionBox::setEintragRahmenFarbe(int i, int f) // set entry border color
  304. {
  305. if (members->z(i)) members->z(i)->setBorderColor(f);
  306. rend = 1;
  307. }
  308. void SelectionBox::setEintragRahmenBreite(
  309. int i, int rbr) // set entry border width
  310. {
  311. if (members->z(i)) members->z(i)->setBorderWidth(rbr);
  312. rend = 1;
  313. }
  314. void SelectionBox::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 SelectionBox::setEintragHintergrundImageZ(
  321. int i, Image* bgB) // set entry background image
  322. {
  323. if (members->z(i))
  324. members->z(i)->setHintergrundImageZ(bgB);
  325. else
  326. bgB->release();
  327. rend = 1;
  328. }
  329. void SelectionBox::setEintragHintergrundImage(int i, Image* bgB)
  330. {
  331. if (members->z(i))
  332. members->z(i)->setHintergrundImage(bgB);
  333. else
  334. bgB->release();
  335. rend = 1;
  336. }
  337. void SelectionBox::setEntryAlphaFieldZ(
  338. int i, AlphaField* af) // set entry AlphaField
  339. {
  340. if (members->z(i)) members->z(i)->setAlphaFieldZ(af);
  341. rend = 1;
  342. }
  343. void SelectionBox::setEintragAlphaFeldFarbe(
  344. int i, int afF) // set entry AlphaField color
  345. {
  346. if (members->z(i)) members->z(i)->setAlphaFieldColor(afF);
  347. rend = 1;
  348. }
  349. void SelectionBox::setEintragAlphaFeldStrength(
  350. int i, int afSt) // set entry AlphaField strength
  351. {
  352. if (members->z(i)) members->z(i)->setAlphaFieldStrength(afSt);
  353. rend = 1;
  354. }
  355. void SelectionBox::setSelBorderZ(Border* rahmen) // set selection border
  356. {
  357. if (selBorder) selBorder->release();
  358. selBorder = rahmen;
  359. rend = 1;
  360. }
  361. void SelectionBox::setAuswRahmenFarbe(int f) // set selection border color
  362. {
  363. if (!selBorder) selBorder = new LBorder();
  364. selBorder->setFarbe(f);
  365. rend = 1;
  366. }
  367. void SelectionBox::setAuswRahmenBreite(int rbr) // set selection border width
  368. {
  369. if (!selBorder) selBorder = new LBorder();
  370. selBorder->setRamenBreite(rbr);
  371. rend = 1;
  372. }
  373. void SelectionBox::setAuswHintergrundFarbe(
  374. int f) // set selection background color
  375. {
  376. auswBgF = f;
  377. rend = 1;
  378. }
  379. void SelectionBox::setAuswHintergrundImageZ(
  380. Image* bgB) // set selection background image
  381. {
  382. if (auswBgB) auswBgB->release();
  383. auswBgB = bgB;
  384. rend = 1;
  385. }
  386. void SelectionBox::setAuswHintergrundImage(Image* bgB)
  387. {
  388. if (!auswBgB) auswBgB = new Image();
  389. auswBgB->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  390. auswBgB->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  391. bgB->release();
  392. rend = 1;
  393. }
  394. void SelectionBox::setSelAlphaFieldZ(AlphaField* af) // set selection AlphaField
  395. {
  396. if (auswAf) auswAf->release();
  397. auswAf = af;
  398. rend = 1;
  399. }
  400. void SelectionBox::setSelAlphaFieldColor(int afF) // set selection AlphaField color
  401. {
  402. if (!auswAf) auswAf = new AlphaField();
  403. auswAf->setFarbe(afF);
  404. rend = 1;
  405. }
  406. void SelectionBox::setAuswAlphaFeldStrength(
  407. int afSt) // set selection AlphaField strength
  408. {
  409. if (!auswAf) auswAf = new AlphaField();
  410. auswAf->setStrength(afSt);
  411. rend = 1;
  412. }
  413. void SelectionBox::setMsSelBorderZ(
  414. int i, Border* rahmen) // set multistyle selection border
  415. {
  416. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  417. {
  418. rahmen->release();
  419. return;
  420. }
  421. if (!msSelBorder) msSelBorder = new RCArray<Border>();
  422. msSelBorder->set(rahmen, i);
  423. rend = 1;
  424. }
  425. void SelectionBox::setMsAuswRahmenFarbe(
  426. int i, int f) // set multistyle selection border color
  427. {
  428. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  429. if (!msSelBorder) msSelBorder = new RCArray<Border>();
  430. if (!msSelBorder->z(i)) msSelBorder->set(new LBorder(), i);
  431. msSelBorder->z(i)->setFarbe(f);
  432. rend = 1;
  433. }
  434. void SelectionBox::setMsAuswRahmenBreite(
  435. int i, int rbr) // set multistyle selection width
  436. {
  437. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  438. if (!msSelBorder) msSelBorder = new RCArray<Border>();
  439. if (!msSelBorder->z(i)) msSelBorder->set(new LBorder(), i);
  440. msSelBorder->z(i)->setRamenBreite(rbr);
  441. rend = 1;
  442. }
  443. void SelectionBox::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 SelectionBox::setMsAuswHintergrundImageZ(
  452. int i, Image* 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<Image>();
  460. msAuswBgB->set(bgB, i);
  461. rend = 1;
  462. }
  463. void SelectionBox::setMsAuswHintergrundImage(int i, Image* bgB)
  464. {
  465. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  466. {
  467. bgB->release();
  468. return;
  469. }
  470. if (!msAuswBgB) msAuswBgB = new RCArray<Image>();
  471. if (!msAuswBgB->z(i))
  472. {
  473. Image* z = new Image;
  474. z->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  475. z->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  476. msAuswBgB->set(z, i);
  477. }
  478. else
  479. {
  480. msAuswBgB->z(i)->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  481. msAuswBgB->z(i)->drawImage(
  482. 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  483. }
  484. bgB->release();
  485. rend = 1;
  486. }
  487. void SelectionBox::setMsSelAlphaFieldZ(
  488. int i, AlphaField* af) // set multistyle selection AlphaField
  489. {
  490. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  491. {
  492. af->release();
  493. return;
  494. }
  495. if (!msAuswAf) msAuswAf = new RCArray<AlphaField>();
  496. msAuswAf->set(af, i);
  497. rend = 1;
  498. }
  499. void SelectionBox::setMsAuswAlphaFeldFarbe(
  500. int i, int afF) // set multistyle selection AlphaField color
  501. {
  502. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  503. if (!msAuswAf) msAuswAf = new RCArray<AlphaField>();
  504. if (!msAuswAf->z(i)) msAuswAf->set(new AlphaField(), i);
  505. msAuswAf->z(i)->setFarbe(afF);
  506. rend = 1;
  507. }
  508. void SelectionBox::setMsAuswAlphaFeldStrength(
  509. int i, int afSt) // set multistyle selection AlphaField strength
  510. {
  511. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  512. if (!msAuswAf) msAuswAf = new RCArray<AlphaField>();
  513. if (!msAuswAf->z(i)) msAuswAf->set(new AlphaField(), i);
  514. msAuswAf->z(i)->setStrength(afSt);
  515. rend = 1;
  516. }
  517. void SelectionBox::setMouseBorderZ(Border* rahmen) // set mouse border
  518. {
  519. if (mouseBorder) mouseBorder->release();
  520. mouseBorder = rahmen;
  521. rend = 1;
  522. }
  523. void SelectionBox::setMausRahmenFarbe(int f) // set mouse border color
  524. {
  525. if (!mouseBorder) mouseBorder = new LBorder();
  526. mouseBorder->setFarbe(f);
  527. rend = 1;
  528. }
  529. void SelectionBox::setMausRahmenBreite(int rbr) // set mouse border width
  530. {
  531. if (!mouseBorder) mouseBorder = new LBorder();
  532. mouseBorder->setRamenBreite(rbr);
  533. rend = 1;
  534. }
  535. void SelectionBox::setMausHintergrundFarbe(int f) // set mouse background color
  536. {
  537. mausBgF = f;
  538. rend = 1;
  539. }
  540. void SelectionBox::setMausHintergrundImageZ(
  541. Image* bgB) // set mouse background image
  542. {
  543. if (mausBgB) mausBgB->release();
  544. mausBgB = bgB;
  545. rend = 1;
  546. }
  547. void SelectionBox::setMausHintergrundImage(Image* bgB)
  548. {
  549. if (!mausBgB) mausBgB = new Image();
  550. mausBgB->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  551. mausBgB->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  552. bgB->release();
  553. rend = 1;
  554. }
  555. void SelectionBox::setMouseAlphaFieldZ(AlphaField* af) // set mouse AlphaField
  556. {
  557. if (mausAf) mausAf->release();
  558. mausAf = af;
  559. rend = 1;
  560. }
  561. void SelectionBox::setMouseAlphaFieldColor(int afF) // set mouse AlphaField color
  562. {
  563. if (!mausAf) mausAf = new AlphaField();
  564. mausAf->setFarbe(afF);
  565. rend = 1;
  566. }
  567. void SelectionBox::setMausAlphaFeldStrength(
  568. int afSt) // set mouse AlphaField strength
  569. {
  570. if (!mausAf) mausAf = new AlphaField();
  571. mausAf->setStrength(afSt);
  572. rend = 1;
  573. }
  574. void SelectionBox::setMsMouseBorderZ(
  575. int i, Border* rahmen) // set multistyle mouse border
  576. {
  577. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  578. {
  579. rahmen->release();
  580. return;
  581. }
  582. if (!msMouseBorder) msMouseBorder = new RCArray<Border>();
  583. msMouseBorder->set(rahmen, i);
  584. rend = 1;
  585. }
  586. void SelectionBox::setMsMausRahmenFarbe(
  587. int i, int f) // set multistyle mouse border color
  588. {
  589. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  590. if (!msMouseBorder) msMouseBorder = new RCArray<Border>();
  591. if (!msMouseBorder->z(i)) msMouseBorder->set(new LBorder(), i);
  592. msMouseBorder->z(i)->setFarbe(f);
  593. rend = 1;
  594. }
  595. void SelectionBox::setMsMausRahmenBreite(
  596. int i, int rbr) // set multistyle mouse border width
  597. {
  598. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  599. if (!msMouseBorder) msMouseBorder = new RCArray<Border>();
  600. if (!msMouseBorder->z(i)) msMouseBorder->set(new LBorder(), i);
  601. msMouseBorder->z(i)->setRamenBreite(rbr);
  602. rend = 1;
  603. }
  604. void SelectionBox::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 SelectionBox::setMsMausHintergrundImageZ(
  613. int i, Image* 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<Image>();
  621. msMausBgB->set(bgB, i);
  622. rend = 1;
  623. }
  624. void SelectionBox::setMsMausHintergrundImage(int i, Image* bgB)
  625. {
  626. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  627. {
  628. bgB->release();
  629. return;
  630. }
  631. if (!msMausBgB) msMausBgB = new RCArray<Image>();
  632. if (!msMausBgB->z(i))
  633. {
  634. Image* z = new Image;
  635. z->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  636. z->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  637. msMausBgB->set(z, i);
  638. }
  639. else
  640. {
  641. msMausBgB->z(i)->neuImage(bgB->getBreite(), bgB->getHeight(), 0);
  642. msMausBgB->z(i)->drawImage(
  643. 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB);
  644. }
  645. bgB->release();
  646. rend = 1;
  647. }
  648. void SelectionBox::setMsMouseAlphaFieldZ(
  649. int i, AlphaField* af) // set multistyle mouse AlphaField
  650. {
  651. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl)
  652. {
  653. af->release();
  654. return;
  655. }
  656. if (!msMausAf) msMausAf = new RCArray<AlphaField>();
  657. msMausAf->set(af, i);
  658. rend = 1;
  659. }
  660. void SelectionBox::setMsMausAlphaFeldFarbe(
  661. int i, int afF) // set multistyle mouse AlphaField color
  662. {
  663. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  664. if (!msMausAf) msMausAf = new RCArray<AlphaField>();
  665. if (!msMausAf->z(i)) msMausAf->set(new AlphaField(), i);
  666. msMausAf->z(i)->setFarbe(afF);
  667. rend = 1;
  668. }
  669. void SelectionBox::setMsMausAlphaFeldStrength(
  670. int i, int afSt) // set multistyle mouse AlphaField strength
  671. {
  672. if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return;
  673. if (!msMausAf) msMausAf = new RCArray<AlphaField>();
  674. if (!msMausAf->z(i)) msMausAf->set(new AlphaField(), i);
  675. msMausAf->z(i)->setStrength(afSt);
  676. rend = 1;
  677. }
  678. void SelectionBox::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 SelectionBox::ausklappen() // expand list
  688. {
  689. ausgeklappt = 1;
  690. }
  691. void SelectionBox::einklappen() // collapse list
  692. {
  693. ausgeklappt = 0;
  694. }
  695. void SelectionBox::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 SelectionBox::setMaxAuskappHeight(
  712. int maxHeight) // height of the list when expanded
  713. {
  714. ausklapMaxHeight = maxHeight;
  715. }
  716. void SelectionBox::setEintragHeight(int height) // sets the height of the entries
  717. {
  718. eintragHeight = height;
  719. }
  720. void SelectionBox::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 SelectionBox::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 SelectionBox::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 SelectionBox::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 SelectionBox::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 SelectionBox::doKeyboardEvent(KeyboardEvent& 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 SelectionBox::render(Image& 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::Border) && 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::HImage) && hintergrundImage)
  885. {
  886. if (hatStyle(Style::HAlpha))
  887. zRObj.alphaImage(0, 0, br, hi, *hintergrundImage);
  888. else
  889. zRObj.drawImage(0, 0, br, hi, *hintergrundImage);
  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. TextField* tf = auswahl >= 0 ? members->z(auswahl) : 0;
  916. if (tf)
  917. {
  918. AlphaField* tmpBuffer = 0;
  919. bool tmpB = 0;
  920. int tmpHFarbe = 0;
  921. bool tmpH = 0;
  922. Image* tmpHImage = 0;
  923. bool tmpHB = 0;
  924. bool tmpHAlpha = 0;
  925. Border* tmpBorder = 0;
  926. bool tmpR = 0;
  927. if (hatStyleNicht(Style::MultiStyled) || !msStyle)
  928. {
  929. if (hatStyle(Style::AuswahlBuffer))
  930. {
  931. tmpBuffer = tf->getAlphaField();
  932. tf->setAlphaFieldZ(
  933. dynamic_cast<AlphaField*>(auswAf->getThis()));
  934. tmpB = tf->hatStyle(TextField::Style::Buffered);
  935. tf->setStyle(TextField::Style::Buffered,
  936. hatStyle(Style::AuswahlBuffer));
  937. }
  938. if (hatStyle(Style::AuswahlHintergrund))
  939. {
  940. tmpH = tf->hatStyle(TextField::Style::Hintergrund);
  941. tmpHFarbe = tf->getHintergrundFarbe();
  942. tf->setHintergrundFarbe(auswBgF);
  943. tf->setStyle(TextField::Style::Hintergrund,
  944. hatStyle(Style::Hintergrund));
  945. if (hatStyle(Style::AuswahlHImage))
  946. {
  947. tmpHImage = tf->getHintergrundImage();
  948. tf->setHintergrundImageZ(
  949. dynamic_cast<Image*>(auswBgB->getThis()));
  950. tmpHB = tf->hatStyle(TextField::Style::HImage);
  951. tf->setStyle(
  952. TextField::Style::HImage, hatStyle(Style::HImage));
  953. }
  954. if (hatStyle(Style::AuswahlHAlpha))
  955. {
  956. tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha);
  957. tf->setStyle(TextField::Style::HAlpha,
  958. hatStyle(Style::AuswahlHAlpha));
  959. }
  960. }
  961. if (hatStyle(Style::SelectionBorder))
  962. {
  963. tmpBorder = tf->getBorder();
  964. tf->setBorderZ(
  965. dynamic_cast<Border*>(selBorder->getThis()));
  966. tmpR = tf->hatStyle(TextField::Style::Border);
  967. tf->setStyle(TextField::Style::Border,
  968. hatStyle(Style::SelectionBorder));
  969. }
  970. }
  971. else
  972. {
  973. if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf)
  974. {
  975. tmpBuffer = tf->getAlphaField();
  976. tf->setAlphaFieldZ(msAuswAf->get(auswahl));
  977. tmpB = tf->hatStyle(TextField::Style::Buffered);
  978. tf->setStyle(TextField::Style::Buffered,
  979. hatMsStyle(auswahl, Style::AuswahlBuffer));
  980. }
  981. if (hatMsStyle(auswahl, Style::AuswahlHintergrund))
  982. {
  983. tmpH = tf->hatStyle(Style::Hintergrund);
  984. tf->setStyle(TextField::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::AuswahlHImage)
  992. && msAuswBgB)
  993. {
  994. tmpHImage = tf->getHintergrundImage();
  995. tf->setHintergrundImageZ(msAuswBgB->get(auswahl));
  996. tmpHB = tf->hatStyle(TextField::Style::HImage);
  997. tf->setStyle(TextField::Style::HImage,
  998. hatMsStyle(auswahl, Style::HImage));
  999. }
  1000. if (hatMsStyle(auswahl, Style::AuswahlHAlpha))
  1001. {
  1002. tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha);
  1003. tf->setStyle(TextField::Style::HAlpha,
  1004. hatMsStyle(auswahl, Style::AuswahlHAlpha));
  1005. }
  1006. }
  1007. if (hatMsStyle(auswahl, Style::SelectionBorder)
  1008. && msSelBorder)
  1009. {
  1010. tmpBorder = tf->getBorder();
  1011. tf->setBorderZ(msSelBorder->get(auswahl));
  1012. tmpR = tf->hatStyle(TextField::Style::Border);
  1013. tf->setStyle(TextField::Style::Border,
  1014. hatMsStyle(auswahl, Style::SelectionBorder));
  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->setAlphaFieldZ(tmpBuffer);
  1029. tf->setStyle(TextField::Style::Buffered, tmpB);
  1030. }
  1031. if (hatStyle(Style::AuswahlHintergrund))
  1032. {
  1033. tf->setHintergrundFarbe(tmpHFarbe);
  1034. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1035. if (hatStyle(Style::AuswahlHImage))
  1036. {
  1037. tf->setHintergrundImageZ(tmpHImage);
  1038. tf->setStyle(TextField::Style::HImage, tmpHB);
  1039. }
  1040. if (hatStyle(Style::AuswahlHAlpha))
  1041. tf->setStyle(TextField::Style::HAlpha, tmpHAlpha);
  1042. }
  1043. if (hatStyle(Style::SelectionBorder))
  1044. {
  1045. tf->setBorderZ(tmpBorder);
  1046. tf->setStyle(TextField::Style::Border, tmpR);
  1047. }
  1048. }
  1049. else
  1050. {
  1051. if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf)
  1052. {
  1053. tf->setAlphaFieldZ(tmpBuffer);
  1054. tf->setStyle(TextField::Style::Buffered, tmpB);
  1055. }
  1056. if (hatMsStyle(auswahl, Style::AuswahlHintergrund))
  1057. {
  1058. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1059. if (msAuswBgF && msAuswBgF->hat(auswahl))
  1060. tf->setHintergrundFarbe(tmpHFarbe);
  1061. if (hatMsStyle(auswahl, Style::AuswahlHImage)
  1062. && msAuswBgB)
  1063. {
  1064. tf->setHintergrundImageZ(tmpHImage);
  1065. tf->setStyle(TextField::Style::HImage, tmpHB);
  1066. }
  1067. if (hatMsStyle(auswahl, Style::AuswahlHAlpha))
  1068. tf->setStyle(TextField::Style::HAlpha, tmpHAlpha);
  1069. }
  1070. if (hatMsStyle(auswahl, Style::SelectionBorder)
  1071. && msSelBorder)
  1072. {
  1073. tf->setBorderZ(tmpBorder);
  1074. tf->setStyle(TextField::Style::Border, 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->getEntryCount();
  1113. for (int i = 0; i < anzahl; ++i)
  1114. {
  1115. TextField* 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. AlphaField* tmpBuffer = 0;
  1122. bool tmpB = 0;
  1123. int tmpHFarbe = 0;
  1124. bool tmpH = 0;
  1125. Image* tmpHImage = 0;
  1126. bool tmpHB = 0;
  1127. bool tmpHAlpha = 0;
  1128. Border* tmpBorder = 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->getAlphaField();
  1137. tf->setAlphaFieldZ(
  1138. dynamic_cast<AlphaField*>(auswAf->getThis()));
  1139. tmpB = tf->hatStyle(TextField::Style::Buffered);
  1140. tf->setStyle(TextField::Style::Buffered,
  1141. hatStyle(Style::AuswahlBuffer));
  1142. }
  1143. if (hatStyle(Style::AuswahlHintergrund))
  1144. {
  1145. tmpH = tf->hatStyle(TextField::Style::Hintergrund);
  1146. tmpHFarbe = tf->getHintergrundFarbe();
  1147. tf->setHintergrundFarbe(auswBgF);
  1148. tf->setStyle(TextField::Style::Hintergrund,
  1149. hatStyle(Style::Hintergrund));
  1150. if (hatStyle(Style::AuswahlHImage))
  1151. {
  1152. tmpHImage = tf->getHintergrundImage();
  1153. tf->setHintergrundImageZ(
  1154. dynamic_cast<Image*>(auswBgB->getThis()));
  1155. tmpHB = tf->hatStyle(TextField::Style::HImage);
  1156. tf->setStyle(TextField::Style::HImage,
  1157. hatStyle(Style::HImage));
  1158. }
  1159. if (hatStyle(Style::AuswahlHAlpha))
  1160. {
  1161. tmpHAlpha
  1162. = tf->hatStyle(TextField::Style::HAlpha);
  1163. tf->setStyle(TextField::Style::HAlpha,
  1164. hatStyle(Style::AuswahlHAlpha));
  1165. }
  1166. }
  1167. if (hatStyle(Style::SelectionBorder))
  1168. {
  1169. tmpBorder = tf->getBorder();
  1170. tf->setBorderZ(
  1171. dynamic_cast<Border*>(selBorder->getThis()));
  1172. tmpR = tf->hatStyle(TextField::Style::Border);
  1173. tf->setStyle(TextField::Style::Border,
  1174. hatStyle(Style::SelectionBorder));
  1175. }
  1176. }
  1177. else
  1178. {
  1179. if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf)
  1180. {
  1181. tmpBuffer = tf->getAlphaField();
  1182. tf->setAlphaFieldZ(msAuswAf->get(i));
  1183. tmpB = tf->hatStyle(TextField::Style::Buffered);
  1184. tf->setStyle(TextField::Style::Buffered,
  1185. hatMsStyle(i, Style::AuswahlBuffer));
  1186. }
  1187. if (hatMsStyle(i, Style::AuswahlHintergrund))
  1188. {
  1189. tmpH = tf->hatStyle(Style::Hintergrund);
  1190. tf->setStyle(TextField::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::AuswahlHImage) && msAuswBgB)
  1198. {
  1199. tmpHImage = tf->getHintergrundImage();
  1200. tf->setHintergrundImageZ(msAuswBgB->get(i));
  1201. tmpHB = tf->hatStyle(TextField::Style::HImage);
  1202. tf->setStyle(TextField::Style::HImage,
  1203. hatMsStyle(i, Style::HImage));
  1204. }
  1205. if (hatMsStyle(i, Style::AuswahlHAlpha))
  1206. {
  1207. tmpHAlpha
  1208. = tf->hatStyle(TextField::Style::HAlpha);
  1209. tf->setStyle(TextField::Style::HAlpha,
  1210. hatMsStyle(i, Style::AuswahlHAlpha));
  1211. }
  1212. }
  1213. if (hatMsStyle(i, Style::SelectionBorder) && msSelBorder)
  1214. {
  1215. tmpBorder = tf->getBorder();
  1216. tf->setBorderZ(msSelBorder->get(i));
  1217. tmpR = tf->hatStyle(TextField::Style::Border);
  1218. tf->setStyle(TextField::Style::Border,
  1219. hatMsStyle(i, Style::SelectionBorder));
  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->getAlphaField();
  1230. tf->setAlphaFieldZ(
  1231. dynamic_cast<AlphaField*>(mausAf->getThis()));
  1232. tmpB = tf->hatStyle(TextField::Style::Buffered);
  1233. tf->setStyle(TextField::Style::Buffered,
  1234. hatStyle(Style::MausBuffer));
  1235. }
  1236. if (hatStyle(Style::MausHintergrund))
  1237. {
  1238. tmpH = tf->hatStyle(TextField::Style::Hintergrund);
  1239. tmpHFarbe = tf->getHintergrundFarbe();
  1240. tf->setHintergrundFarbe(mausBgF);
  1241. tf->setStyle(TextField::Style::Hintergrund,
  1242. hatStyle(Style::Hintergrund));
  1243. if (hatStyle(Style::MausHImage))
  1244. {
  1245. tmpHImage = tf->getHintergrundImage();
  1246. tf->setHintergrundImageZ(
  1247. dynamic_cast<Image*>(mausBgB->getThis()));
  1248. tmpHB = tf->hatStyle(TextField::Style::HImage);
  1249. tf->setStyle(TextField::Style::HImage,
  1250. hatStyle(Style::HImage));
  1251. }
  1252. if (hatStyle(Style::MausHAlpha))
  1253. {
  1254. tmpHAlpha
  1255. = tf->hatStyle(TextField::Style::HAlpha);
  1256. tf->setStyle(TextField::Style::HAlpha,
  1257. hatStyle(Style::MausHAlpha));
  1258. }
  1259. }
  1260. if (hatStyle(Style::MausRahmen))
  1261. {
  1262. tmpBorder = tf->getBorder();
  1263. tf->setBorderZ(
  1264. dynamic_cast<Border*>(mouseBorder->getThis()));
  1265. tmpR = tf->hatStyle(TextField::Style::Border);
  1266. tf->setStyle(TextField::Style::Border,
  1267. hatStyle(Style::MausRahmen));
  1268. }
  1269. }
  1270. else
  1271. {
  1272. if (hatMsStyle(i, Style::MausBuffer) && msAuswAf)
  1273. {
  1274. tmpBuffer = tf->getAlphaField();
  1275. tf->setAlphaFieldZ(msMausAf->get(i));
  1276. tmpB = tf->hatStyle(TextField::Style::Buffered);
  1277. tf->setStyle(TextField::Style::Buffered,
  1278. hatMsStyle(i, Style::MausBuffer));
  1279. }
  1280. if (hatMsStyle(i, Style::MausHintergrund))
  1281. {
  1282. tmpH = tf->hatStyle(Style::Hintergrund);
  1283. tf->setStyle(TextField::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::MausHImage) && msMausBgB)
  1291. {
  1292. tmpHImage = tf->getHintergrundImage();
  1293. tf->setHintergrundImageZ(msMausBgB->get(i));
  1294. tmpHB = tf->hatStyle(TextField::Style::HImage);
  1295. tf->setStyle(TextField::Style::HImage,
  1296. hatMsStyle(i, Style::HImage));
  1297. }
  1298. if (hatMsStyle(i, Style::MausHAlpha))
  1299. {
  1300. tmpHAlpha
  1301. = tf->hatStyle(TextField::Style::HAlpha);
  1302. tf->setStyle(TextField::Style::HAlpha,
  1303. hatMsStyle(i, Style::MausHAlpha));
  1304. }
  1305. }
  1306. if (hatMsStyle(i, Style::MausRahmen) && msMouseBorder)
  1307. {
  1308. tmpBorder = tf->getBorder();
  1309. tf->setBorderZ(msMouseBorder->get(i));
  1310. tmpR = tf->hatStyle(TextField::Style::Border);
  1311. tf->setStyle(TextField::Style::Border,
  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->setAlphaFieldZ(tmpBuffer);
  1324. tf->setStyle(TextField::Style::Buffered, tmpB);
  1325. }
  1326. if (hatStyle(Style::AuswahlHintergrund))
  1327. {
  1328. tf->setHintergrundFarbe(tmpHFarbe);
  1329. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1330. if (hatStyle(Style::AuswahlHImage))
  1331. {
  1332. tf->setHintergrundImageZ(tmpHImage);
  1333. tf->setStyle(TextField::Style::HImage, tmpHB);
  1334. }
  1335. if (hatStyle(Style::AuswahlHAlpha))
  1336. tf->setStyle(
  1337. TextField::Style::HAlpha, tmpHAlpha);
  1338. }
  1339. if (hatStyle(Style::SelectionBorder))
  1340. {
  1341. tf->setBorderZ(tmpBorder);
  1342. tf->setStyle(TextField::Style::Border, tmpR);
  1343. }
  1344. }
  1345. else
  1346. {
  1347. if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf)
  1348. {
  1349. tf->setAlphaFieldZ(tmpBuffer);
  1350. tf->setStyle(TextField::Style::Buffered, tmpB);
  1351. }
  1352. if (hatMsStyle(i, Style::AuswahlHintergrund))
  1353. {
  1354. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1355. if (msAuswBgF && msAuswBgF->hat(i))
  1356. tf->setHintergrundFarbe(tmpHFarbe);
  1357. if (hatMsStyle(i, Style::AuswahlHImage) && msAuswBgB)
  1358. {
  1359. tf->setHintergrundImageZ(tmpHImage);
  1360. tf->setStyle(TextField::Style::HImage, tmpHB);
  1361. }
  1362. if (hatMsStyle(i, Style::AuswahlHAlpha))
  1363. tf->setStyle(
  1364. TextField::Style::HAlpha, tmpHAlpha);
  1365. }
  1366. if (hatMsStyle(i, Style::SelectionBorder) && msSelBorder)
  1367. {
  1368. tf->setBorderZ(tmpBorder);
  1369. tf->setStyle(TextField::Style::Border, 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->setAlphaFieldZ(tmpBuffer);
  1380. tf->setStyle(TextField::Style::Buffered, tmpB);
  1381. }
  1382. if (hatStyle(Style::MausHintergrund))
  1383. {
  1384. tf->setHintergrundFarbe(tmpHFarbe);
  1385. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1386. if (hatStyle(Style::MausHImage))
  1387. {
  1388. tf->setHintergrundImageZ(tmpHImage);
  1389. tf->setStyle(TextField::Style::HImage, tmpHB);
  1390. }
  1391. if (hatStyle(Style::MausHAlpha))
  1392. tf->setStyle(
  1393. TextField::Style::HAlpha, tmpHAlpha);
  1394. }
  1395. if (hatStyle(Style::MausRahmen))
  1396. {
  1397. tf->setBorderZ(tmpBorder);
  1398. tf->setStyle(TextField::Style::Border, tmpR);
  1399. }
  1400. }
  1401. else
  1402. {
  1403. if (hatMsStyle(i, Style::MausBuffer) && msAuswAf)
  1404. {
  1405. tf->setAlphaFieldZ(tmpBuffer);
  1406. tf->setStyle(TextField::Style::Buffered, tmpB);
  1407. }
  1408. if (hatMsStyle(i, Style::MausHintergrund))
  1409. {
  1410. tf->setStyle(TextField::Style::Hintergrund, tmpH);
  1411. if (msAuswBgF && msAuswBgF->hat(i))
  1412. tf->setHintergrundFarbe(tmpHFarbe);
  1413. if (hatMsStyle(i, Style::MausHImage) && msAuswBgB)
  1414. {
  1415. tf->setHintergrundImageZ(tmpHImage);
  1416. tf->setStyle(TextField::Style::HImage, tmpHB);
  1417. }
  1418. if (hatMsStyle(i, Style::MausHAlpha))
  1419. tf->setStyle(
  1420. TextField::Style::HAlpha, tmpHAlpha);
  1421. }
  1422. if (hatMsStyle(i, Style::MausRahmen) && msSelBorder)
  1423. {
  1424. tf->setBorderZ(tmpBorder);
  1425. tf->setStyle(TextField::Style::Border, 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 SelectionBox::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 SelectionBox::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* SelectionBox::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* SelectionBox::zEintragText(int i) const
  1467. {
  1468. if (i >= anzahl) return 0;
  1469. return members->z(i) ? members->z(i)->zText() : 0;
  1470. }
  1471. TextField* SelectionBox::getEintrag(int i) const // returns the entry
  1472. {
  1473. if (i >= anzahl) return 0;
  1474. return members->get(i);
  1475. }
  1476. TextField* SelectionBox::zEintrag(int i) const
  1477. {
  1478. if (i >= anzahl) return 0;
  1479. return members->z(i);
  1480. }
  1481. int SelectionBox::getAuswahl() const // returns the position of the selected entry
  1482. {
  1483. return auswahl;
  1484. }
  1485. int SelectionBox::getEntryCount() const // returns the number of entries
  1486. {
  1487. return anzahl;
  1488. }
  1489. bool SelectionBox::istAusgeklappt() const // checks if the list is expanded
  1490. {
  1491. return ausgeklappt;
  1492. }
  1493. int SelectionBox::getMaxHeight() const // returns the maximum list height
  1494. {
  1495. if (!hatStyle(Style::MaxHeight)) return 0;
  1496. return ausklapMaxHeight;
  1497. }
  1498. int SelectionBox::getEintragHeight() const // returns the height of the entries
  1499. {
  1500. return eintragHeight;
  1501. }
  1502. Button*
  1503. SelectionBox::getDropDownButton() const // returns the expand/collapse button
  1504. {
  1505. if (hatStyle(Style::MultiStyled)) return 0;
  1506. return ausfahren ? dynamic_cast<Button*>(ausfahren->getThis()) : 0;
  1507. }
  1508. Button* SelectionBox::zDropDownButton() const
  1509. {
  1510. if (hatStyle(Style::MultiStyled)) return 0;
  1511. return ausfahren;
  1512. }
  1513. Border* SelectionBox::getEntryBorder(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)->getBorder();
  1518. }
  1519. Border* SelectionBox::zEntryBorder(int i) const
  1520. {
  1521. if (!hatStyle(Style::MultiStyled)) return 0;
  1522. if (!members->z(i)) return 0;
  1523. return members->z(i)->zBorder();
  1524. }
  1525. int SelectionBox::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)->getBorderColor();
  1531. }
  1532. int SelectionBox::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)->getBorderWidth();
  1538. }
  1539. AlphaField* SelectionBox::getEntryAlphaField(
  1540. int i) const // returns the entry AlphaField
  1541. {
  1542. if (!hatStyle(Style::MultiStyled)) return 0;
  1543. if (!members->z(i)) return 0;
  1544. return members->z(i)->getAlphaField();
  1545. }
  1546. AlphaField* SelectionBox::zEntryAlphaField(int i) const
  1547. {
  1548. if (!hatStyle(Style::MultiStyled)) return 0;
  1549. if (!members->z(i)) return 0;
  1550. return members->z(i)->zAlphaField();
  1551. }
  1552. int SelectionBox::getEintragAlphaFeldFarbe(
  1553. int i) const // returns the entry AlphaField color
  1554. {
  1555. if (!hatStyle(Style::MultiStyled)) return 0;
  1556. if (!members->z(i)) return 0;
  1557. return members->z(i)->getAlphaFieldColor();
  1558. }
  1559. int SelectionBox::getEintragAlphaFeldStrength(
  1560. int i) const // returns the entry AlphaField strength
  1561. {
  1562. if (!hatStyle(Style::MultiStyled)) return 0;
  1563. if (!members->z(i)) return 0;
  1564. return members->z(i)->getAlphaFieldStrength();
  1565. }
  1566. int SelectionBox::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. Image* SelectionBox::getEintragHintergrundImage(
  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)->getHintergrundImage();
  1579. }
  1580. Image* SelectionBox::zEintragHintergrundImage(int i) const
  1581. {
  1582. if (!hatStyle(Style::MultiStyled)) return 0;
  1583. if (!members->z(i)) return 0;
  1584. return members->z(i)->zHintergrundImage();
  1585. }
  1586. Border* SelectionBox::getSelBorder() const // returns the selection border
  1587. {
  1588. if (hatStyle(Style::MultiStyled)) return 0;
  1589. return selBorder ? dynamic_cast<Border*>(selBorder->getThis()) : 0;
  1590. }
  1591. Border* SelectionBox::zSelBorder() const
  1592. {
  1593. if (hatStyle(Style::MultiStyled)) return 0;
  1594. return selBorder;
  1595. }
  1596. int SelectionBox::getAuswRahmenFarbe() const // returns the selection border color
  1597. {
  1598. if (hatStyle(Style::MultiStyled)) return 0;
  1599. return selBorder ? selBorder->getFarbe() : 0;
  1600. }
  1601. int SelectionBox::getAuswRahmenBreite()
  1602. const // returns the selection border width
  1603. {
  1604. if (hatStyle(Style::MultiStyled)) return 0;
  1605. return selBorder ? selBorder->getRBreite() : 0;
  1606. }
  1607. AlphaField*
  1608. SelectionBox::getSelAlphaField() const // returns the selection AlphaField
  1609. {
  1610. if (hatStyle(Style::MultiStyled)) return 0;
  1611. return auswAf ? dynamic_cast<AlphaField*>(auswAf->getThis()) : 0;
  1612. }
  1613. AlphaField* SelectionBox::zSelAlphaField() const
  1614. {
  1615. if (hatStyle(Style::MultiStyled)) return 0;
  1616. return auswAf;
  1617. }
  1618. int SelectionBox::getAuswAlphaFeldFarbe()
  1619. const // returns the selection AlphaField color
  1620. {
  1621. if (hatStyle(Style::MultiStyled)) return 0;
  1622. return auswAf ? auswAf->getFarbe() : 0;
  1623. }
  1624. int SelectionBox::getAuswAlphaFeldStrength()
  1625. const // returns the selection AlphaField strength
  1626. {
  1627. if (hatStyle(Style::MultiStyled)) return 0;
  1628. return auswAf ? auswAf->getStrength() : 0;
  1629. }
  1630. int SelectionBox::getAuswHintergrundFarbe()
  1631. const // returns the selection background color
  1632. {
  1633. if (hatStyle(Style::MultiStyled)) return 0;
  1634. return auswBgF;
  1635. }
  1636. Image* SelectionBox::getAuswHintergrundImage()
  1637. const // returns the selection background image
  1638. {
  1639. if (hatStyle(Style::MultiStyled)) return 0;
  1640. return auswBgB ? dynamic_cast<Image*>(auswBgB->getThis()) : 0;
  1641. }
  1642. Image* SelectionBox::zAuswHintergrundImage() const
  1643. {
  1644. if (hatStyle(Style::MultiStyled)) return 0;
  1645. return auswBgB;
  1646. }
  1647. Border* SelectionBox::getMsSelBorder(
  1648. int i) const // returns the multistyle selection border
  1649. {
  1650. if (!hatStyle(Style::MultiStyled)) return 0;
  1651. if (!msSelBorder) return 0;
  1652. return msSelBorder->z(i)
  1653. ? dynamic_cast<Border*>(msSelBorder->z(i)->getThis())
  1654. : 0;
  1655. }
  1656. Border* SelectionBox::zMsSelBorder(int i) const
  1657. {
  1658. if (!hatStyle(Style::MultiStyled)) return 0;
  1659. if (!msSelBorder) return 0;
  1660. return msSelBorder->z(i);
  1661. }
  1662. int SelectionBox::getMsAuswRahmenFarbe(
  1663. int i) const // returns the multistyle selection border color
  1664. {
  1665. if (!hatStyle(Style::MultiStyled)) return 0;
  1666. if (!msSelBorder) return 0;
  1667. return msSelBorder->z(i) ? msSelBorder->z(i)->getFarbe() : 0;
  1668. }
  1669. int SelectionBox::getMsAuswRahmenBreite(
  1670. int i) const // returns the multistyle selection border width
  1671. {
  1672. if (!hatStyle(Style::MultiStyled)) return 0;
  1673. if (!msSelBorder) return 0;
  1674. return msSelBorder->z(i) ? msSelBorder->z(i)->getRBreite() : 0;
  1675. }
  1676. AlphaField* SelectionBox::getMsSelAlphaField(
  1677. int i) const // returns the multistyle selection AlphaField
  1678. {
  1679. if (!hatStyle(Style::MultiStyled)) return 0;
  1680. if (!msAuswAf) return 0;
  1681. return msAuswAf->z(i) ? dynamic_cast<AlphaField*>(msAuswAf->z(i)->getThis())
  1682. : 0;
  1683. }
  1684. AlphaField* SelectionBox::zMsSelAlphaField(int i) const
  1685. {
  1686. if (!hatStyle(Style::MultiStyled)) return 0;
  1687. if (!msAuswAf) return 0;
  1688. return msAuswAf->z(i);
  1689. }
  1690. int SelectionBox::getMsAuswAlphaFeldFarbe(
  1691. int i) const // returns the multistyle selection AlphaField 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 SelectionBox::getMsAuswAlphaFeldStrength(
  1698. int i) const // returns the multistyle selection AlphaField 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 SelectionBox::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. Image* SelectionBox::getMsAuswHintergrundImage(
  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. Image* SelectionBox::zMsAuswHintergrundImage(int i) const
  1719. {
  1720. if (!hatStyle(Style::MultiStyled)) return 0;
  1721. if (!msAuswBgB) return 0;
  1722. return msAuswBgB->z(i);
  1723. }
  1724. Border* SelectionBox::getMouseBorder() const // returns the mouse border
  1725. {
  1726. if (hatStyle(Style::MultiStyled)) return 0;
  1727. return mouseBorder ? dynamic_cast<Border*>(mouseBorder->getThis()) : 0;
  1728. }
  1729. Border* SelectionBox::zMouseBorder() const
  1730. {
  1731. if (hatStyle(Style::MultiStyled)) return 0;
  1732. return mouseBorder;
  1733. }
  1734. int SelectionBox::getMausRahmenFarbe() const // returns the mouse border color
  1735. {
  1736. if (hatStyle(Style::MultiStyled)) return 0;
  1737. return mouseBorder ? mouseBorder->getFarbe() : 0;
  1738. }
  1739. int SelectionBox::getMausRahmenBreite() const // returns the mouse border width
  1740. {
  1741. if (hatStyle(Style::MultiStyled)) return 0;
  1742. return mouseBorder ? mouseBorder->getRBreite() : 0;
  1743. }
  1744. AlphaField* SelectionBox::getMouseAlphaField() const // returns the mouse AlphaField
  1745. {
  1746. if (hatStyle(Style::MultiStyled)) return 0;
  1747. return mausAf ? dynamic_cast<AlphaField*>(mausAf->getThis()) : 0;
  1748. }
  1749. AlphaField* SelectionBox::zMouseAlphaField() const
  1750. {
  1751. if (hatStyle(Style::MultiStyled)) return 0;
  1752. return mausAf;
  1753. }
  1754. int SelectionBox::getMausAlphaFeldFarbe()
  1755. const // returns the mouse AlphaField color
  1756. {
  1757. if (hatStyle(Style::MultiStyled)) return 0;
  1758. return mausAf ? mausAf->getFarbe() : 0;
  1759. }
  1760. int SelectionBox::getMausAlphaFeldStrength()
  1761. const // returns the mouse AlphaField strength
  1762. {
  1763. if (hatStyle(Style::MultiStyled)) return 0;
  1764. return mausAf ? mausAf->getStrength() : 0;
  1765. }
  1766. int SelectionBox::getMausHintergrundFarbe()
  1767. const // returns the mouse background color
  1768. {
  1769. if (hatStyle(Style::MultiStyled)) return 0;
  1770. return mausBgF;
  1771. }
  1772. Image* SelectionBox::getMausHintergrundImage()
  1773. const // returns the mouse background image
  1774. {
  1775. if (hatStyle(Style::MultiStyled)) return 0;
  1776. return mausBgB ? dynamic_cast<Image*>(mausBgB->getThis()) : 0;
  1777. }
  1778. Image* SelectionBox::zMausHintergrundImage() const
  1779. {
  1780. if (hatStyle(Style::MultiStyled)) return 0;
  1781. return mausBgB;
  1782. }
  1783. Border* SelectionBox::getMsMouseBorder(
  1784. int i) const // returns the multistyle mouse border
  1785. {
  1786. if (!hatStyle(Style::MultiStyled)) return 0;
  1787. if (!msMouseBorder) return 0;
  1788. return msMouseBorder->get(i);
  1789. }
  1790. Border* SelectionBox::zMsMouseBorder(int i) const
  1791. {
  1792. if (!hatStyle(Style::MultiStyled)) return 0;
  1793. if (!msMouseBorder) return 0;
  1794. return msMouseBorder->z(i);
  1795. }
  1796. int SelectionBox::getMsMausRahmenFarbe(
  1797. int i) const // returns the multistyle mouse border color
  1798. {
  1799. if (!hatStyle(Style::MultiStyled)) return 0;
  1800. if (!msMouseBorder) return 0;
  1801. return msMouseBorder->z(i) ? msMouseBorder->z(i)->getFarbe() : 0;
  1802. }
  1803. int SelectionBox::getMsMausRahmenBreite(
  1804. int i) const // returns the multistyle mouse border width
  1805. {
  1806. if (!hatStyle(Style::MultiStyled)) return 0;
  1807. if (!msMouseBorder) return 0;
  1808. return msMouseBorder->z(i) ? msMouseBorder->z(i)->getRBreite() : 0;
  1809. }
  1810. AlphaField* SelectionBox::getMsMouseAlphaField(
  1811. int i) const // returns the multistyle mouse AlphaField
  1812. {
  1813. if (!hatStyle(Style::MultiStyled)) return 0;
  1814. if (!msMausAf) return 0;
  1815. return msMausAf->get(i);
  1816. }
  1817. AlphaField* SelectionBox::zMsMouseAlphaField(int i) const
  1818. {
  1819. if (!hatStyle(Style::MultiStyled)) return 0;
  1820. if (!msMausAf) return 0;
  1821. return msMausAf->z(i);
  1822. }
  1823. int SelectionBox::getMsMausAlphaFeldFarbe(
  1824. int i) const // returns the multistyle mouse AlphaField 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 SelectionBox::getMsMausAlphaFeldStrength(
  1831. int i) const // returns the multistyle mouse AlphaField 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 SelectionBox::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. Image* SelectionBox::getMsMausHintergrundImage(
  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. Image* SelectionBox::zMsMausHintergrundImage(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 SelectionBox::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 SelectionBox::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 SelectionBox::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* SelectionBox::dublizieren() const // Creates a copy of the drawing
  1881. {
  1882. SelectionBox* obj = new SelectionBox();
  1883. obj->setPosition(pos);
  1884. obj->setSize(gr);
  1885. obj->setMouseEventParameter(makParam);
  1886. obj->setKeyboardEventParameter(takParam);
  1887. obj->setMouseEvent(mak);
  1888. obj->setKeyboardEvent(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->setBorderZ((Border*)rahmen->dublizieren());
  1894. if (ausfahren) obj->setDropDownButtonZ((Button*)ausfahren->dublizieren());
  1895. obj->setHintergrundFarbe(hintergrundFarbe);
  1896. if (hintergrundImage)
  1897. obj->setHintergrundImage(
  1898. dynamic_cast<Image*>(hintergrundImage->getThis()));
  1899. if (hintergrundFeld)
  1900. obj->setAlphaFieldZ((AlphaField*)hintergrundFeld->dublizieren());
  1901. if (selBorder) obj->setSelBorderZ((Border*)selBorder->dublizieren());
  1902. obj->setAuswHintergrundFarbe(auswBgF);
  1903. if (auswBgB)
  1904. obj->setAuswHintergrundImage(dynamic_cast<Image*>(auswBgB->getThis()));
  1905. if (auswAf) obj->setSelAlphaFieldZ((AlphaField*)auswAf->dublizieren());
  1906. if (mouseBorder) obj->setMouseBorderZ((Border*)mouseBorder->dublizieren());
  1907. obj->setMausHintergrundFarbe(mausBgF);
  1908. if (mausBgB)
  1909. obj->setMausHintergrundImage(dynamic_cast<Image*>(mausBgB->getThis()));
  1910. if (mausAf) obj->setMouseAlphaFieldZ((AlphaField*)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, (TextField*)members->z(i)->dublizieren());
  1919. if (msStyle && msStyle->hat(i)) obj->setMsStyle(i, msStyle->get(i));
  1920. if (msSelBorder && msSelBorder->z(i))
  1921. obj->setMsSelBorderZ(
  1922. i, (Border*)msSelBorder->z(i)->dublizieren());
  1923. if (msAuswBgF && msAuswBgF->hat(i))
  1924. obj->setMsAuswHintergrundFarbe(i, msAuswBgF->get(i));
  1925. if (msAuswBgB && msAuswBgB->z(i))
  1926. obj->setMsAuswHintergrundImage(i, msAuswBgB->get(i));
  1927. if (msAuswAf && msAuswAf->z(i))
  1928. obj->setMsSelAlphaFieldZ(
  1929. i, (AlphaField*)msAuswAf->z(i)->dublizieren());
  1930. if (msMouseBorder && msMouseBorder->z(i))
  1931. obj->setMsMouseBorderZ(
  1932. i, (Border*)msMouseBorder->z(i)->dublizieren());
  1933. if (msMausBgF && msMausBgF->hat(i))
  1934. obj->setMsMausHintergrundFarbe(i, msMausBgF->get(i));
  1935. if (msMausBgB && msMausBgB->z(i))
  1936. obj->setMsMausHintergrundImage(i, msMausBgB->get(i));
  1937. if (msMausAf && msMausAf->z(i))
  1938. obj->setMsMouseAlphaFieldZ(
  1939. i, (AlphaField*)msMausAf->z(i)->dublizieren());
  1940. }
  1941. }
  1942. obj->setAlphaFieldColor(auswahl);
  1943. return obj;
  1944. }