#include "SelectionBox.h" #include "AlphaField.h" #include "Image.h" #include "Button.h" #include "MouseEvent.h" #include "Border.h" #include "Font.h" #include "Scroll.h" #include "KeyboardEvent.h" #include "Text.h" #include "TextField.h" #include "ToolTip.h" using namespace Framework; // Contents of the AuswahlBox class from SelectionBox.h // Constructor AuswahlBox::AuswahlBox() : DrawableBackground(), textRd(0), msStyle(0), members(new RCArray()), ausfahren(new Knopf()), selBorder(new LBorder()), auswBgF(0xFF000000), auswBgB(0), auswAf(new AlphaFeld()), msSelBorder(0), msAuswBgF(0), msAuswBgB(0), msAuswAf(0), mouseBorder(new LBorder()), mausBgF(0xFF000000), mausBgB(0), mausAf(new AlphaFeld()), msMouseBorder(0), msMausBgF(0), msMausBgB(0), msMausAf(0), anzahl(0), auswahl(0), ausgeklappt(0), ausklappHeight(0), ausklapMaxHeight(200), eintragHeight(15), tickval(0), mausEintrag(0), scrollAnzeigen(0), eAkP(0), eAk(0) { vertikalScrollBar = new VScrollBar(); style = Style::Normal; rahmen = new LBorder(); rahmen->setFarbe(0xFFFFFFFF); rahmen->setRamenBreite(1); ausfahren->setStyle(Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::KlickBuffer); ausfahren->setKBFarbe(0xA0000000); ausfahren->setKBStrength(10); ausfahren->setSize(18, 18); ausfahren->setSchriftFarbe(0xFFFFFFFF); ausfahren->setText("\\/"); selBorder->setFarbe(0xFF00FF00); selBorder->setRamenBreite(1); auswAf->setFarbe(0xA000FF00); auswAf->setStrength(7); mouseBorder->setFarbe(0xFF00FF00); mouseBorder->setRamenBreite(1); mausAf->setFarbe(0x5000FF00); mausAf->setStrength(7); gr.x = 20; gr.y = 20; } // Destructor AuswahlBox::~AuswahlBox() { if (textRd) textRd->release(); if (msStyle) msStyle->release(); if (members) members->release(); if (ausfahren) ausfahren->release(); if (selBorder) selBorder->release(); if (auswBgB) auswBgB->release(); if (auswAf) auswAf->release(); if (msSelBorder) msSelBorder->release(); if (msAuswAf) msAuswAf->release(); if (msAuswBgB) msAuswBgB->release(); if (msAuswBgF) msAuswBgF->release(); if (mouseBorder) mouseBorder->release(); if (mausAf) mausAf->release(); if (mausBgB) mausBgB->release(); if (msMouseBorder) msMouseBorder->release(); if (msMausAf) msMausAf->release(); if (msMausBgB) msMausBgB->release(); if (msMausBgF) msMausBgF->release(); } void AuswahlBox::doMausEreignis(MausEreignis& me, bool userRet) // mouse events { if (hatStyleNicht(Style::Erlaubt) || hatStyleNicht(Style::Fokus) || me.verarbeitet) { ausgeklappt = 0; me.verarbeitet = 1; return; } if (!userRet) return; mausEintrag = -1; bool insideParent = me.insideParent; me.insideParent = me.mx >= 0 && me.mx < gr.x && me.my >= 0 && me.my < gr.y + ausklappHeight; bool vera = me.verarbeitet; if (ausfahren) { int tmpMx = me.mx; int tmpMy = me.my; if (me.mx >= 0 && me.my >= 0 && me.mx < gr.x && me.my < gr.y) me.mx = ausfahren->getX(), me.my = ausfahren->getY() + 1; ausfahren->doPublicMausEreignis(me); me.mx = tmpMx, me.my = tmpMy; } if (me.verarbeitet && !vera && me.id == ME_RLinks) { ausgeklappt = !ausgeklappt; if (ausgeklappt) mausEintrag = auswahl; if (scrollAnzeigen) scrollZuEintrag(mausEintrag); } if (hatStyle(Style::VScroll) && vertikalScrollBar && ausgeklappt && scrollAnzeigen) { int rbr = 0; if (rahmen && hatStyle(Style::Border)) rbr = rahmen->getRBreite(); if ((me.mx > gr.x - 15 - rbr && me.my > gr.y) || me.id == ME_UScroll || me.id == ME_DScroll) { vertikalScrollBar->doMausMessage(gr.x - rbr - 15, gr.y, 15, vertikalScrollBar->getScrollData()->anzeige, me); me.verarbeitet = 1; } } if (!me.verarbeitet) { int eintr = -1; int tmp = me.my - gr.y + (vertikalScrollBar ? vertikalScrollBar->getScroll() : 0); if (hatStyle(Style::MultiStyled)) { for (int i = 0; i < anzahl; ++i) { if (tmp > 0 && tmp < (members->z(i) ? members->z(i)->getHeight() : 0)) { eintr = i; break; } tmp -= members->z(i) ? members->z(i)->getHeight() : 0; } } else { for (int i = 0; i < anzahl; ++i) { if (tmp > 0 && tmp < eintragHeight) { eintr = i; break; } tmp -= eintragHeight; } } if (ausgeklappt && me.mx > 0 && me.mx < gr.x && me.my > gr.y && me.my < gr.y + ausklappHeight) { if (eintr >= 0) { if (me.id == ME_RLinks) { if (auswahl != eintr) rend = 1; auswahl = eintr; if (eAk) eAk(eAkP, this, 0, auswahl); } if (mausEintrag != eintr) rend = 1; mausEintrag = eintr; } } } me.verarbeitet = 1; me.insideParent = insideParent; } // non-constant void AuswahlBox::setEventParam(void* p) // set event parameter { eAkP = p; } void AuswahlBox::setEventAktion( std::function event) // set event action { this->eAk = event; } void AuswahlBox::setFontZ(Font* schrift) // set font { if (!this->textRd) textRd = new TextRenderer(schrift); else textRd->setFontZ(schrift); ausfahren->setFontZ(dynamic_cast(schrift->getThis())); rend = 1; } void AuswahlBox::setTextRendererZ(TextRenderer* textRd) { if (this->textRd) this->textRd->release(); this->textRd = textRd; } void AuswahlBox::addEintrag(const char* txt) // add entry { TextField* tf = new TextField(); if (textRd) tf->setFontZ(textRd->getFont()); tf->addStyle(TextField::Style::Sichtbar | TextField::Style::Center | TextField::Style::Border); tf->setText(txt); tf->setSchriftFarbe(0xFFFFFFFF); tf->setBorderColor(0xFFFFFFFF); tf->setSize(0, eintragHeight); members->add(tf, anzahl); ++anzahl; rend = 1; } void AuswahlBox::addEintrag(Text* txt) { TextField* tf = new TextField(); if (textRd) tf->setFontZ(textRd->getFont()); tf->addStyle(TextField::Style::Sichtbar | TextField::Style::Center | TextField::Style::Border); tf->setText(txt); tf->setSchriftFarbe(0xFFFFFFFF); tf->setBorderColor(0xFFFFFFFF); tf->setSize(0, eintragHeight); members->add(tf, anzahl); ++anzahl; rend = 1; } void AuswahlBox::addEintragZ(TextField* txt) { members->add(txt, anzahl); ++anzahl; rend = 1; } void AuswahlBox::setEintrag(int i, const char* txt) // set entry text { if (members->z(i)) members->z(i)->setText(txt); rend = 1; } void AuswahlBox::setEintrag(int i, Text* txt) { if (members->z(i)) members->z(i)->setText(txt); else txt->release(); rend = 1; } void AuswahlBox::setEintragZ(int i, TextField* txt) { if (i < anzahl) members->set(txt, i); else txt->release(); rend = 1; } void AuswahlBox::removeEintrag(int i) // remove entry { if (i < anzahl) { members->remove(i); if (msStyle) msStyle->remove(i); if (msSelBorder) msSelBorder->remove(i); if (msAuswBgF) msAuswBgF->remove(i); if (msAuswBgB) msAuswBgB->remove(i); if (msAuswAf) msAuswAf->remove(i); if (msMouseBorder) msMouseBorder->remove(i); if (msMausBgF) msMausBgF->remove(i); if (msMausBgB) msMausBgB->remove(i); if (msMausAf) msMausAf->remove(i); if (auswahl > i) --auswahl; if (mausEintrag > i) --mausEintrag; --anzahl; rend = 1; } } void AuswahlBox::setAusklappKnopfZ(Knopf* ausK) // set expand button { if (ausfahren) ausfahren->release(); ausfahren = ausK; rend = 1; } void AuswahlBox::setEntryBorderZ(int i, Border* rahmen) // set entry border { if (members->z(i)) members->z(i)->setBorderZ(rahmen); else rahmen->release(); rend = 1; } void AuswahlBox::setEintragRahmenFarbe(int i, int f) // set entry border color { if (members->z(i)) members->z(i)->setBorderColor(f); rend = 1; } void AuswahlBox::setEintragRahmenBreite( int i, int rbr) // set entry border width { if (members->z(i)) members->z(i)->setBorderWidth(rbr); rend = 1; } void AuswahlBox::setEintragHintergrundFarbe( int i, int f) // set entry background color { if (members->z(i)) members->z(i)->setHintergrundFarbe(f); rend = 1; } void AuswahlBox::setEintragHintergrundImageZ( int i, Image* bgB) // set entry background image { if (members->z(i)) members->z(i)->setHintergrundImageZ(bgB); else bgB->release(); rend = 1; } void AuswahlBox::setEintragHintergrundImage(int i, Image* bgB) { if (members->z(i)) members->z(i)->setHintergrundImage(bgB); else bgB->release(); rend = 1; } void AuswahlBox::setEintragAlphaFeldZ( int i, AlphaFeld* af) // set entry AlphaFeld { if (members->z(i)) members->z(i)->setAlphaFeldZ(af); rend = 1; } void AuswahlBox::setEintragAlphaFeldFarbe( int i, int afF) // set entry AlphaFeld color { if (members->z(i)) members->z(i)->setAlphaFeldFarbe(afF); rend = 1; } void AuswahlBox::setEintragAlphaFeldStrength( int i, int afSt) // set entry AlphaFeld strength { if (members->z(i)) members->z(i)->setAlphaFeldStrength(afSt); rend = 1; } void AuswahlBox::setSelBorderZ(Border* rahmen) // set selection border { if (selBorder) selBorder->release(); selBorder = rahmen; rend = 1; } void AuswahlBox::setAuswRahmenFarbe(int f) // set selection border color { if (!selBorder) selBorder = new LBorder(); selBorder->setFarbe(f); rend = 1; } void AuswahlBox::setAuswRahmenBreite(int rbr) // set selection border width { if (!selBorder) selBorder = new LBorder(); selBorder->setRamenBreite(rbr); rend = 1; } void AuswahlBox::setAuswHintergrundFarbe( int f) // set selection background color { auswBgF = f; rend = 1; } void AuswahlBox::setAuswHintergrundImageZ( Image* bgB) // set selection background image { if (auswBgB) auswBgB->release(); auswBgB = bgB; rend = 1; } void AuswahlBox::setAuswHintergrundImage(Image* bgB) { if (!auswBgB) auswBgB = new Image(); auswBgB->neuImage(bgB->getBreite(), bgB->getHeight(), 0); auswBgB->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); bgB->release(); rend = 1; } void AuswahlBox::setAuswAlphaFeldZ(AlphaFeld* af) // set selection AlphaFeld { if (auswAf) auswAf->release(); auswAf = af; rend = 1; } void AuswahlBox::setAuswAlphaFeldFarbe(int afF) // set selection AlphaFeld color { if (!auswAf) auswAf = new AlphaFeld(); auswAf->setFarbe(afF); rend = 1; } void AuswahlBox::setAuswAlphaFeldStrength( int afSt) // set selection AlphaFeld strength { if (!auswAf) auswAf = new AlphaFeld(); auswAf->setStrength(afSt); rend = 1; } void AuswahlBox::setMsSelBorderZ( int i, Border* rahmen) // set multistyle selection border { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { rahmen->release(); return; } if (!msSelBorder) msSelBorder = new RCArray(); msSelBorder->set(rahmen, i); rend = 1; } void AuswahlBox::setMsAuswRahmenFarbe( int i, int f) // set multistyle selection border color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msSelBorder) msSelBorder = new RCArray(); if (!msSelBorder->z(i)) msSelBorder->set(new LBorder(), i); msSelBorder->z(i)->setFarbe(f); rend = 1; } void AuswahlBox::setMsAuswRahmenBreite( int i, int rbr) // set multistyle selection width { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msSelBorder) msSelBorder = new RCArray(); if (!msSelBorder->z(i)) msSelBorder->set(new LBorder(), i); msSelBorder->z(i)->setRamenBreite(rbr); rend = 1; } void AuswahlBox::setMsAuswHintergrundFarbe( int i, int f) // set multistyle selection background color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msAuswBgF) msAuswBgF = new Array(); msAuswBgF->set(f, i); rend = 1; } void AuswahlBox::setMsAuswHintergrundImageZ( int i, Image* bgB) // set multistyle selection background image { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { bgB->release(); return; } if (!msAuswBgB) msAuswBgB = new RCArray(); msAuswBgB->set(bgB, i); rend = 1; } void AuswahlBox::setMsAuswHintergrundImage(int i, Image* bgB) { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { bgB->release(); return; } if (!msAuswBgB) msAuswBgB = new RCArray(); if (!msAuswBgB->z(i)) { Image* z = new Image; z->neuImage(bgB->getBreite(), bgB->getHeight(), 0); z->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); msAuswBgB->set(z, i); } else { msAuswBgB->z(i)->neuImage(bgB->getBreite(), bgB->getHeight(), 0); msAuswBgB->z(i)->drawImage( 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); } bgB->release(); rend = 1; } void AuswahlBox::setMsAuswAlphaFeldZ( int i, AlphaFeld* af) // set multistyle selection AlphaFeld { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { af->release(); return; } if (!msAuswAf) msAuswAf = new RCArray(); msAuswAf->set(af, i); rend = 1; } void AuswahlBox::setMsAuswAlphaFeldFarbe( int i, int afF) // set multistyle selection AlphaFeld color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msAuswAf) msAuswAf = new RCArray(); if (!msAuswAf->z(i)) msAuswAf->set(new AlphaFeld(), i); msAuswAf->z(i)->setFarbe(afF); rend = 1; } void AuswahlBox::setMsAuswAlphaFeldStrength( int i, int afSt) // set multistyle selection AlphaFeld strength { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msAuswAf) msAuswAf = new RCArray(); if (!msAuswAf->z(i)) msAuswAf->set(new AlphaFeld(), i); msAuswAf->z(i)->setStrength(afSt); rend = 1; } void AuswahlBox::setMouseBorderZ(Border* rahmen) // set mouse border { if (mouseBorder) mouseBorder->release(); mouseBorder = rahmen; rend = 1; } void AuswahlBox::setMausRahmenFarbe(int f) // set mouse border color { if (!mouseBorder) mouseBorder = new LBorder(); mouseBorder->setFarbe(f); rend = 1; } void AuswahlBox::setMausRahmenBreite(int rbr) // set mouse border width { if (!mouseBorder) mouseBorder = new LBorder(); mouseBorder->setRamenBreite(rbr); rend = 1; } void AuswahlBox::setMausHintergrundFarbe(int f) // set mouse background color { mausBgF = f; rend = 1; } void AuswahlBox::setMausHintergrundImageZ( Image* bgB) // set mouse background image { if (mausBgB) mausBgB->release(); mausBgB = bgB; rend = 1; } void AuswahlBox::setMausHintergrundImage(Image* bgB) { if (!mausBgB) mausBgB = new Image(); mausBgB->neuImage(bgB->getBreite(), bgB->getHeight(), 0); mausBgB->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); bgB->release(); rend = 1; } void AuswahlBox::setMausAlphaFeldZ(AlphaFeld* af) // set mouse AlphaFeld { if (mausAf) mausAf->release(); mausAf = af; rend = 1; } void AuswahlBox::setMausAlphaFeldFarbe(int afF) // set mouse AlphaFeld color { if (!mausAf) mausAf = new AlphaFeld(); mausAf->setFarbe(afF); rend = 1; } void AuswahlBox::setMausAlphaFeldStrength( int afSt) // set mouse AlphaFeld strength { if (!mausAf) mausAf = new AlphaFeld(); mausAf->setStrength(afSt); rend = 1; } void AuswahlBox::setMsMouseBorderZ( int i, Border* rahmen) // set multistyle mouse border { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { rahmen->release(); return; } if (!msMouseBorder) msMouseBorder = new RCArray(); msMouseBorder->set(rahmen, i); rend = 1; } void AuswahlBox::setMsMausRahmenFarbe( int i, int f) // set multistyle mouse border color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msMouseBorder) msMouseBorder = new RCArray(); if (!msMouseBorder->z(i)) msMouseBorder->set(new LBorder(), i); msMouseBorder->z(i)->setFarbe(f); rend = 1; } void AuswahlBox::setMsMausRahmenBreite( int i, int rbr) // set multistyle mouse border width { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msMouseBorder) msMouseBorder = new RCArray(); if (!msMouseBorder->z(i)) msMouseBorder->set(new LBorder(), i); msMouseBorder->z(i)->setRamenBreite(rbr); rend = 1; } void AuswahlBox::setMsMausHintergrundFarbe( int i, int f) // set multistyle mouse background color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msMausBgF) msMausBgF = new Array(); msMausBgF->set(f, i); rend = 1; } void AuswahlBox::setMsMausHintergrundImageZ( int i, Image* bgB) // set multistyle mouse background image { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { bgB->release(); return; } if (!msMausBgB) msMausBgB = new RCArray(); msMausBgB->set(bgB, i); rend = 1; } void AuswahlBox::setMsMausHintergrundImage(int i, Image* bgB) { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { bgB->release(); return; } if (!msMausBgB) msMausBgB = new RCArray(); if (!msMausBgB->z(i)) { Image* z = new Image; z->neuImage(bgB->getBreite(), bgB->getHeight(), 0); z->drawImage(0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); msMausBgB->set(z, i); } else { msMausBgB->z(i)->neuImage(bgB->getBreite(), bgB->getHeight(), 0); msMausBgB->z(i)->drawImage( 0, 0, bgB->getBreite(), bgB->getHeight(), *bgB); } bgB->release(); rend = 1; } void AuswahlBox::setMsMausAlphaFeldZ( int i, AlphaFeld* af) // set multistyle mouse AlphaFeld { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) { af->release(); return; } if (!msMausAf) msMausAf = new RCArray(); msMausAf->set(af, i); rend = 1; } void AuswahlBox::setMsMausAlphaFeldFarbe( int i, int afF) // set multistyle mouse AlphaFeld color { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msMausAf) msMausAf = new RCArray(); if (!msMausAf->z(i)) msMausAf->set(new AlphaFeld(), i); msMausAf->z(i)->setFarbe(afF); rend = 1; } void AuswahlBox::setMsMausAlphaFeldStrength( int i, int afSt) // set multistyle mouse AlphaFeld strength { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msMausAf) msMausAf = new RCArray(); if (!msMausAf->z(i)) msMausAf->set(new AlphaFeld(), i); msMausAf->z(i)->setStrength(afSt); rend = 1; } void AuswahlBox::setAuswahl(int i) // select entry { if (i < anzahl && i != auswahl) { auswahl = i; if (eAk) eAk(eAkP, this, 0, auswahl); rend = 1; } } void AuswahlBox::ausklappen() // expand list { ausgeklappt = 1; } void AuswahlBox::einklappen() // collapse list { ausgeklappt = 0; } void AuswahlBox::scrollZuEintrag(int i) // scroll list { if (hatStyle(Style::VScroll) && vertikalScrollBar && i < anzahl) { int scrollPos = 0; if (hatStyle(Style::MultiStyled)) { for (int j = 0; j < i; ++j) scrollPos += members->z(j) ? members->z(j)->getHeight() : 0; } else scrollPos += i * eintragHeight; vertikalScrollBar->scroll(scrollPos); rend = 1; } } void AuswahlBox::setMaxAuskappHeight( int maxHeight) // height of the list when expanded { ausklapMaxHeight = maxHeight; } void AuswahlBox::setEintragHeight(int height) // sets the height of the entries { eintragHeight = height; } void AuswahlBox::addMsStyle(int i, __int64 abStyle) // add multistyle style { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msStyle) msStyle = new Array<__int64>(); msStyle->set(msStyle->get(i) | abStyle, i); rend = 1; } void AuswahlBox::setMsStyle( int i, __int64 abStyle, bool add) // set multistyle style { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msStyle) msStyle = new Array<__int64>(); if (add) msStyle->set(msStyle->get(i) | abStyle, i); else msStyle->set(msStyle->get(i) & ~abStyle, i); rend = 1; } void AuswahlBox::setMsStyle(int i, __int64 abStyle) { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msStyle) msStyle = new Array<__int64>(); msStyle->set(abStyle, i); rend = 1; } void AuswahlBox::removeMsStyle( int i, __int64 abStyle) // remove multistyle style { if (hatStyleNicht(Style::MultiStyled) || i >= anzahl) return; if (!msStyle) msStyle = new Array<__int64>(); msStyle->set(msStyle->get(i) & ~abStyle, i); rend = 1; } bool AuswahlBox::tick(double tickVal) // tick { if (ausgeklappt && ausfahren && !ausfahren->zText()->istGleich("/\\")) { ausfahren->setText("/\\"); rend = 1; } else if (!ausgeklappt && ausfahren && !ausfahren->zText()->istGleich("\\/")) { ausfahren->setText("\\/"); rend = 1; } if (hatStyleNicht(Style::Sichtbar) || hatStyleNicht(Style::Erlaubt)) ausgeklappt = 0; rend |= ausfahren->tick(tickVal); this->tickval += tickVal * 300; int val = (int)this->tickval; if (val < 1) return DrawableBackground::tick(tickVal); this->tickval -= val; int maxHeight = rahmen ? rahmen->getRBreite() : 0; if (hatStyleNicht(Style::MultiStyled)) maxHeight += anzahl * eintragHeight; else for (int i = 0; i < anzahl; ++i) maxHeight += members->z(i) ? members->z(i)->getHeight() : 0; if (maxHeight > ausklapMaxHeight) { if (hatStyle(Style::VScroll) && vertikalScrollBar) { scrollAnzeigen = 1; vertikalScrollBar->update(maxHeight, ausklapMaxHeight); } maxHeight = ausklapMaxHeight; } else scrollAnzeigen = 0; if (ausgeklappt) { if (ausklappHeight < maxHeight) { ausklappHeight += val; if (ausklappHeight > maxHeight) ausklappHeight = maxHeight; rend = 1; } } else { if (ausklappHeight > 0) { ausklappHeight -= val; if (ausklappHeight < 0) ausklappHeight = 0; rend = 1; } } for (int i = 0; i < anzahl; ++i) { if (i != auswahl) rend |= members->z(i)->tick(tickVal); else members->z(i)->tick(tickVal); } return DrawableBackground::tick(tickVal); } void AuswahlBox::doTastaturEreignis(TastaturEreignis& te) // Keyboard { if (te.verarbeitet || hatStyleNicht(Style::Fokus) || hatStyleNicht(Style::Erlaubt)) return; if (te.id == TE_Release) { switch (te.virtualKey) { case T_Oben: if (auswahl > 0) --auswahl; else auswahl = anzahl - 1; if (eAk) eAk(eAkP, this, 0, auswahl); scrollZuEintrag(auswahl); rend = 1; break; case T_Unten: if (auswahl < anzahl - 1) ++auswahl; else auswahl = 0; if (eAk) eAk(eAkP, this, 0, auswahl); scrollZuEintrag(auswahl); rend = 1; break; } } if (te.verarbeitet && nTak) te.verarbeitet = nTak(ntakParam, this, te); } void AuswahlBox::render(Image& zRObj) // renders into zRObj { if (hatStyle(Style::Sichtbar)) { lockDrawable(); int br = gr.x; int hi = gr.y + ausklappHeight; if ((ausklappHeight && !zRObj.setDrawOptionsErzwingen(pos.x, pos.y, br, hi)) || (!ausklappHeight && !zRObj.setDrawOptions(pos.x, pos.y, br, hi))) { unlockDrawable(); return; } int rbr = 0; if (hatStyle(Style::Border) && rahmen) // Draw border { rahmen->setSize(br, hi); rahmen->render(zRObj); rbr = rahmen->getRBreite(); } if ((ausklappHeight && !zRObj.setDrawOptionsErzwingen( rbr, rbr, br - rbr * 2, hi - rbr * 2)) || (!ausklappHeight && !zRObj.setDrawOptions(rbr, rbr, br - rbr * 2, hi - rbr * 2))) { zRObj.releaseDrawOptions(); unlockDrawable(); return; } if (hatStyle(Style::Hintergrund)) { if (hatStyle(Style::HAlpha)) zRObj.alphaRegion(0, 0, br, hi, hintergrundFarbe); else zRObj.fillRegion(0, 0, br, hi, hintergrundFarbe); if (hatStyle(Style::HImage) && hintergrundImage) { if (hatStyle(Style::HAlpha)) zRObj.alphaImage(0, 0, br, hi, *hintergrundImage); else zRObj.drawImage(0, 0, br, hi, *hintergrundImage); } } if (hatStyle(Style::Buffered) && hintergrundFeld) { hintergrundFeld->setSize(br - rbr * 2, hi - rbr * 2); hintergrundFeld->render(zRObj); } if (ausfahren) // Draw expand button { ausfahren->setSize(gr.y - rbr * 2, gr.y - rbr * 2); ausfahren->setPosition(gr.x - rbr - ausfahren->getBreite(), rbr); ausfahren->render(zRObj); } if (members) // Draw selected text field { if (auswahl < 0) { auswahl = 0; if (eAk) eAk(eAkP, this, 0, auswahl); } if (auswahl >= anzahl) { auswahl = anzahl - 1; if (eAk) eAk(eAkP, this, 0, auswahl); } TextField* tf = auswahl >= 0 ? members->z(auswahl) : 0; if (tf) { AlphaFeld* tmpBuffer = 0; bool tmpB = 0; int tmpHFarbe = 0; bool tmpH = 0; Image* tmpHImage = 0; bool tmpHB = 0; bool tmpHAlpha = 0; Border* tmpBorder = 0; bool tmpR = 0; if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::AuswahlBuffer)) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ( dynamic_cast(auswAf->getThis())); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatStyle(Style::AuswahlBuffer)); } if (hatStyle(Style::AuswahlHintergrund)) { tmpH = tf->hatStyle(TextField::Style::Hintergrund); tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(auswBgF); tf->setStyle(TextField::Style::Hintergrund, hatStyle(Style::Hintergrund)); if (hatStyle(Style::AuswahlHImage)) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ( dynamic_cast(auswBgB->getThis())); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle( TextField::Style::HImage, hatStyle(Style::HImage)); } if (hatStyle(Style::AuswahlHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatStyle(Style::AuswahlHAlpha)); } } if (hatStyle(Style::SelectionBorder)) { tmpBorder = tf->getBorder(); tf->setBorderZ( dynamic_cast(selBorder->getThis())); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatStyle(Style::SelectionBorder)); } } else { if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ(msAuswAf->get(auswahl)); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatMsStyle(auswahl, Style::AuswahlBuffer)); } if (hatMsStyle(auswahl, Style::AuswahlHintergrund)) { tmpH = tf->hatStyle(Style::Hintergrund); tf->setStyle(TextField::Style::Hintergrund, hatMsStyle(auswahl, Style::AuswahlHintergrund)); if (msAuswBgF && msAuswBgF->hat(auswahl)) { tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(msAuswBgF->get(auswahl)); } if (hatMsStyle(auswahl, Style::AuswahlHImage) && msAuswBgB) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ(msAuswBgB->get(auswahl)); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle(TextField::Style::HImage, hatMsStyle(auswahl, Style::HImage)); } if (hatMsStyle(auswahl, Style::AuswahlHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatMsStyle(auswahl, Style::AuswahlHAlpha)); } } if (hatMsStyle(auswahl, Style::SelectionBorder) && msSelBorder) { tmpBorder = tf->getBorder(); tf->setBorderZ(msSelBorder->get(auswahl)); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatMsStyle(auswahl, Style::SelectionBorder)); } } int tmpHi = tf->getHeight(); tf->setPosition(0, 0); tf->setSize( gr.x - rbr * 2 - (ausfahren ? ausfahren->getBreite() : 0), gr.y - rbr * 2); tf->render(zRObj); tf->setSize(tf->getBreite(), tmpHi); if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::AuswahlBuffer)) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatStyle(Style::AuswahlHintergrund)) { tf->setHintergrundFarbe(tmpHFarbe); tf->setStyle(TextField::Style::Hintergrund, tmpH); if (hatStyle(Style::AuswahlHImage)) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatStyle(Style::AuswahlHAlpha)) tf->setStyle(TextField::Style::HAlpha, tmpHAlpha); } if (hatStyle(Style::SelectionBorder)) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } else { if (hatMsStyle(auswahl, Style::AuswahlBuffer) && msAuswAf) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatMsStyle(auswahl, Style::AuswahlHintergrund)) { tf->setStyle(TextField::Style::Hintergrund, tmpH); if (msAuswBgF && msAuswBgF->hat(auswahl)) tf->setHintergrundFarbe(tmpHFarbe); if (hatMsStyle(auswahl, Style::AuswahlHImage) && msAuswBgB) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatMsStyle(auswahl, Style::AuswahlHAlpha)) tf->setStyle(TextField::Style::HAlpha, tmpHAlpha); } if (hatMsStyle(auswahl, Style::SelectionBorder) && msSelBorder) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } } } bool vsb = hatStyle(Style::VScroll) && vertikalScrollBar; // Draw scroll bar if (auswahl >= anzahl) { auswahl = 0; if (eAk) eAk(eAkP, this, 0, auswahl); } if (members) { if (vsb && ausklappHeight) { br -= 15; vertikalScrollBar->getScrollData()->anzeige = ausklappHeight - rbr; vertikalScrollBar->render( br - rbr, gr.y, 15, ausklappHeight - rbr, zRObj); } if ((ausklappHeight && !zRObj.setDrawOptionsErzwingen( 0, gr.y, br - rbr, hi - rbr - gr.y)) || (!ausklappHeight && !zRObj.setDrawOptions( 0, gr.y, br - rbr, hi - rbr - gr.y))) { zRObj.releaseDrawOptions(); zRObj.releaseDrawOptions(); unlockDrawable(); return; } int maxHeight = 0; int dy = 0; if (vsb) dy -= vertikalScrollBar->getScroll(); int mdy = hi - rbr; anzahl = members->getEintragAnzahl(); for (int i = 0; i < anzahl; ++i) { TextField* tf = members->z(i); if (dy >= mdy && !vsb) break; tf->setPosition(0, dy); tf->setSize(br - rbr * 2, tf->getHeight()); maxHeight += tf->getHeight(); bool selected = auswahl == i; AlphaFeld* tmpBuffer = 0; bool tmpB = 0; int tmpHFarbe = 0; bool tmpH = 0; Image* tmpHImage = 0; bool tmpHB = 0; bool tmpHAlpha = 0; Border* tmpBorder = 0; bool tmpR = 0; if (selected) { if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::AuswahlBuffer)) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ( dynamic_cast(auswAf->getThis())); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatStyle(Style::AuswahlBuffer)); } if (hatStyle(Style::AuswahlHintergrund)) { tmpH = tf->hatStyle(TextField::Style::Hintergrund); tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(auswBgF); tf->setStyle(TextField::Style::Hintergrund, hatStyle(Style::Hintergrund)); if (hatStyle(Style::AuswahlHImage)) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ( dynamic_cast(auswBgB->getThis())); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle(TextField::Style::HImage, hatStyle(Style::HImage)); } if (hatStyle(Style::AuswahlHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatStyle(Style::AuswahlHAlpha)); } } if (hatStyle(Style::SelectionBorder)) { tmpBorder = tf->getBorder(); tf->setBorderZ( dynamic_cast(selBorder->getThis())); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatStyle(Style::SelectionBorder)); } } else { if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ(msAuswAf->get(i)); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatMsStyle(i, Style::AuswahlBuffer)); } if (hatMsStyle(i, Style::AuswahlHintergrund)) { tmpH = tf->hatStyle(Style::Hintergrund); tf->setStyle(TextField::Style::Hintergrund, hatMsStyle(i, Style::AuswahlHintergrund)); if (msAuswBgF && msAuswBgF->hat(i)) { tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(msAuswBgF->get(i)); } if (hatMsStyle(i, Style::AuswahlHImage) && msAuswBgB) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ(msAuswBgB->get(i)); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle(TextField::Style::HImage, hatMsStyle(i, Style::HImage)); } if (hatMsStyle(i, Style::AuswahlHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatMsStyle(i, Style::AuswahlHAlpha)); } } if (hatMsStyle(i, Style::SelectionBorder) && msSelBorder) { tmpBorder = tf->getBorder(); tf->setBorderZ(msSelBorder->get(i)); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatMsStyle(i, Style::SelectionBorder)); } } } else if (mausEintrag == i) { if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::MausBuffer)) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ( dynamic_cast(mausAf->getThis())); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatStyle(Style::MausBuffer)); } if (hatStyle(Style::MausHintergrund)) { tmpH = tf->hatStyle(TextField::Style::Hintergrund); tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(mausBgF); tf->setStyle(TextField::Style::Hintergrund, hatStyle(Style::Hintergrund)); if (hatStyle(Style::MausHImage)) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ( dynamic_cast(mausBgB->getThis())); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle(TextField::Style::HImage, hatStyle(Style::HImage)); } if (hatStyle(Style::MausHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatStyle(Style::MausHAlpha)); } } if (hatStyle(Style::MausRahmen)) { tmpBorder = tf->getBorder(); tf->setBorderZ( dynamic_cast(mouseBorder->getThis())); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatStyle(Style::MausRahmen)); } } else { if (hatMsStyle(i, Style::MausBuffer) && msAuswAf) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ(msMausAf->get(i)); tmpB = tf->hatStyle(TextField::Style::Buffered); tf->setStyle(TextField::Style::Buffered, hatMsStyle(i, Style::MausBuffer)); } if (hatMsStyle(i, Style::MausHintergrund)) { tmpH = tf->hatStyle(Style::Hintergrund); tf->setStyle(TextField::Style::Hintergrund, hatMsStyle(i, Style::MausHintergrund)); if (msMausBgF && msMausBgF->hat(i)) { tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe(msMausBgF->get(i)); } if (hatMsStyle(i, Style::MausHImage) && msMausBgB) { tmpHImage = tf->getHintergrundImage(); tf->setHintergrundImageZ(msMausBgB->get(i)); tmpHB = tf->hatStyle(TextField::Style::HImage); tf->setStyle(TextField::Style::HImage, hatMsStyle(i, Style::HImage)); } if (hatMsStyle(i, Style::MausHAlpha)) { tmpHAlpha = tf->hatStyle(TextField::Style::HAlpha); tf->setStyle(TextField::Style::HAlpha, hatMsStyle(i, Style::MausHAlpha)); } } if (hatMsStyle(i, Style::MausRahmen) && msMouseBorder) { tmpBorder = tf->getBorder(); tf->setBorderZ(msMouseBorder->get(i)); tmpR = tf->hatStyle(TextField::Style::Border); tf->setStyle(TextField::Style::Border, hatMsStyle(i, Style::MausRahmen)); } } } tf->render(zRObj); if (selected) { if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::AuswahlBuffer)) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatStyle(Style::AuswahlHintergrund)) { tf->setHintergrundFarbe(tmpHFarbe); tf->setStyle(TextField::Style::Hintergrund, tmpH); if (hatStyle(Style::AuswahlHImage)) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatStyle(Style::AuswahlHAlpha)) tf->setStyle( TextField::Style::HAlpha, tmpHAlpha); } if (hatStyle(Style::SelectionBorder)) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } else { if (hatMsStyle(i, Style::AuswahlBuffer) && msAuswAf) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatMsStyle(i, Style::AuswahlHintergrund)) { tf->setStyle(TextField::Style::Hintergrund, tmpH); if (msAuswBgF && msAuswBgF->hat(i)) tf->setHintergrundFarbe(tmpHFarbe); if (hatMsStyle(i, Style::AuswahlHImage) && msAuswBgB) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatMsStyle(i, Style::AuswahlHAlpha)) tf->setStyle( TextField::Style::HAlpha, tmpHAlpha); } if (hatMsStyle(i, Style::SelectionBorder) && msSelBorder) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } } else if (mausEintrag == i) { if (hatStyleNicht(Style::MultiStyled) || !msStyle) { if (hatStyle(Style::MausBuffer)) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatStyle(Style::MausHintergrund)) { tf->setHintergrundFarbe(tmpHFarbe); tf->setStyle(TextField::Style::Hintergrund, tmpH); if (hatStyle(Style::MausHImage)) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatStyle(Style::MausHAlpha)) tf->setStyle( TextField::Style::HAlpha, tmpHAlpha); } if (hatStyle(Style::MausRahmen)) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } else { if (hatMsStyle(i, Style::MausBuffer) && msAuswAf) { tf->setAlphaFeldZ(tmpBuffer); tf->setStyle(TextField::Style::Buffered, tmpB); } if (hatMsStyle(i, Style::MausHintergrund)) { tf->setStyle(TextField::Style::Hintergrund, tmpH); if (msAuswBgF && msAuswBgF->hat(i)) tf->setHintergrundFarbe(tmpHFarbe); if (hatMsStyle(i, Style::MausHImage) && msAuswBgB) { tf->setHintergrundImageZ(tmpHImage); tf->setStyle(TextField::Style::HImage, tmpHB); } if (hatMsStyle(i, Style::MausHAlpha)) tf->setStyle( TextField::Style::HAlpha, tmpHAlpha); } if (hatMsStyle(i, Style::MausRahmen) && msSelBorder) { tf->setBorderZ(tmpBorder); tf->setStyle(TextField::Style::Border, tmpR); } } } dy += tf->getHeight(); } if (vertikalScrollBar) vertikalScrollBar->getScrollData()->max = maxHeight; zRObj.releaseDrawOptions(); } zRObj.releaseDrawOptions(); zRObj.releaseDrawOptions(); unlockDrawable(); } } // constant int AuswahlBox::getEintragPos( const char* txt) const // returns the entry position { for (int i = 0; i < anzahl; ++i) if (members->z(i) && members->z(i)->zText()->istGleich(txt)) return i; return -1; } int AuswahlBox::getEintragPos(Text* txt) const { for (int i = 0; i < anzahl; ++i) { if (members->z(i) && members->z(i)->zText()->istGleich(txt->getText())) { txt->release(); return i; } } txt->release(); return -1; } Text* AuswahlBox::getEintragText(int i) const // returns the entry text { if (i >= anzahl) return 0; return members->z(i) ? members->z(i)->getText() : 0; } Text* AuswahlBox::zEintragText(int i) const { if (i >= anzahl) return 0; return members->z(i) ? members->z(i)->zText() : 0; } TextField* AuswahlBox::getEintrag(int i) const // returns the entry { if (i >= anzahl) return 0; return members->get(i); } TextField* AuswahlBox::zEintrag(int i) const { if (i >= anzahl) return 0; return members->z(i); } int AuswahlBox::getAuswahl() const // returns the position of the selected entry { return auswahl; } int AuswahlBox::getEintragAnzahl() const // returns the number of entries { return anzahl; } bool AuswahlBox::istAusgeklappt() const // checks if the list is expanded { return ausgeklappt; } int AuswahlBox::getMaxHeight() const // returns the maximum list height { if (!hatStyle(Style::MaxHeight)) return 0; return ausklapMaxHeight; } int AuswahlBox::getEintragHeight() const // returns the height of the entries { return eintragHeight; } Knopf* AuswahlBox::getAusklappKnopf() const // returns the expand/collapse button { if (hatStyle(Style::MultiStyled)) return 0; return ausfahren ? dynamic_cast(ausfahren->getThis()) : 0; } Knopf* AuswahlBox::zAusklappKnopf() const { if (hatStyle(Style::MultiStyled)) return 0; return ausfahren; } Border* AuswahlBox::getEntryBorder(int i) const // returns the entry border { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getBorder(); } Border* AuswahlBox::zEntryBorder(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->zBorder(); } int AuswahlBox::getEintragRahmenFarbe( int i) const // returns the entry border color { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getBorderColor(); } int AuswahlBox::getEintragRahmenBreite( int i) const // returns the entry border width { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getBorderWidth(); } AlphaFeld* AuswahlBox::getEintragAlphaFeld( int i) const // returns the entry AlphaFeld { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getAlphaFeld(); } AlphaFeld* AuswahlBox::zEintragAlphaFeld(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->zAlphaFeld(); } int AuswahlBox::getEintragAlphaFeldFarbe( int i) const // returns the entry AlphaFeld color { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getAlphaFeldFarbe(); } int AuswahlBox::getEintragAlphaFeldStrength( int i) const // returns the entry AlphaFeld strength { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getAlphaFeldStrength(); } int AuswahlBox::getEintragHintergrundFarbe( int i) const // returns the entry background color { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getHintergrundFarbe(); } Image* AuswahlBox::getEintragHintergrundImage( int i) const // returns the entry background image { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->getHintergrundImage(); } Image* AuswahlBox::zEintragHintergrundImage(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!members->z(i)) return 0; return members->z(i)->zHintergrundImage(); } Border* AuswahlBox::getSelBorder() const // returns the selection border { if (hatStyle(Style::MultiStyled)) return 0; return selBorder ? dynamic_cast(selBorder->getThis()) : 0; } Border* AuswahlBox::zSelBorder() const { if (hatStyle(Style::MultiStyled)) return 0; return selBorder; } int AuswahlBox::getAuswRahmenFarbe() const // returns the selection border color { if (hatStyle(Style::MultiStyled)) return 0; return selBorder ? selBorder->getFarbe() : 0; } int AuswahlBox::getAuswRahmenBreite() const // returns the selection border width { if (hatStyle(Style::MultiStyled)) return 0; return selBorder ? selBorder->getRBreite() : 0; } AlphaFeld* AuswahlBox::getAuswAlphaFeld() const // returns the selection AlphaFeld { if (hatStyle(Style::MultiStyled)) return 0; return auswAf ? dynamic_cast(auswAf->getThis()) : 0; } AlphaFeld* AuswahlBox::zAuswAlphaFeld() const { if (hatStyle(Style::MultiStyled)) return 0; return auswAf; } int AuswahlBox::getAuswAlphaFeldFarbe() const // returns the selection AlphaFeld color { if (hatStyle(Style::MultiStyled)) return 0; return auswAf ? auswAf->getFarbe() : 0; } int AuswahlBox::getAuswAlphaFeldStrength() const // returns the selection AlphaFeld strength { if (hatStyle(Style::MultiStyled)) return 0; return auswAf ? auswAf->getStrength() : 0; } int AuswahlBox::getAuswHintergrundFarbe() const // returns the selection background color { if (hatStyle(Style::MultiStyled)) return 0; return auswBgF; } Image* AuswahlBox::getAuswHintergrundImage() const // returns the selection background image { if (hatStyle(Style::MultiStyled)) return 0; return auswBgB ? dynamic_cast(auswBgB->getThis()) : 0; } Image* AuswahlBox::zAuswHintergrundImage() const { if (hatStyle(Style::MultiStyled)) return 0; return auswBgB; } Border* AuswahlBox::getMsSelBorder( int i) const // returns the multistyle selection border { if (!hatStyle(Style::MultiStyled)) return 0; if (!msSelBorder) return 0; return msSelBorder->z(i) ? dynamic_cast(msSelBorder->z(i)->getThis()) : 0; } Border* AuswahlBox::zMsSelBorder(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msSelBorder) return 0; return msSelBorder->z(i); } int AuswahlBox::getMsAuswRahmenFarbe( int i) const // returns the multistyle selection border color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msSelBorder) return 0; return msSelBorder->z(i) ? msSelBorder->z(i)->getFarbe() : 0; } int AuswahlBox::getMsAuswRahmenBreite( int i) const // returns the multistyle selection border width { if (!hatStyle(Style::MultiStyled)) return 0; if (!msSelBorder) return 0; return msSelBorder->z(i) ? msSelBorder->z(i)->getRBreite() : 0; } AlphaFeld* AuswahlBox::getMsAuswAlphaFeld( int i) const // returns the multistyle selection AlphaFeld { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswAf) return 0; return msAuswAf->z(i) ? dynamic_cast(msAuswAf->z(i)->getThis()) : 0; } AlphaFeld* AuswahlBox::zMsAuswAlphaFeld(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswAf) return 0; return msAuswAf->z(i); } int AuswahlBox::getMsAuswAlphaFeldFarbe( int i) const // returns the multistyle selection AlphaFeld color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswAf) return 0; return msAuswAf->z(i) ? msAuswAf->z(i)->getFarbe() : 0; } int AuswahlBox::getMsAuswAlphaFeldStrength( int i) const // returns the multistyle selection AlphaFeld strength { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswAf) return 0; return msAuswAf->z(i) ? msAuswAf->z(i)->getStrength() : 0; } int AuswahlBox::getMsAuswHintergrundFarbe( int i) const // returns the multistyle selection background color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswBgF || !msAuswBgF->hat(i)) return 0; return msAuswBgF->get(i); } Image* AuswahlBox::getMsAuswHintergrundImage( int i) const // returns the multistyle selection background image { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswBgB) return 0; return msAuswBgB->get(i); } Image* AuswahlBox::zMsAuswHintergrundImage(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msAuswBgB) return 0; return msAuswBgB->z(i); } Border* AuswahlBox::getMouseBorder() const // returns the mouse border { if (hatStyle(Style::MultiStyled)) return 0; return mouseBorder ? dynamic_cast(mouseBorder->getThis()) : 0; } Border* AuswahlBox::zMouseBorder() const { if (hatStyle(Style::MultiStyled)) return 0; return mouseBorder; } int AuswahlBox::getMausRahmenFarbe() const // returns the mouse border color { if (hatStyle(Style::MultiStyled)) return 0; return mouseBorder ? mouseBorder->getFarbe() : 0; } int AuswahlBox::getMausRahmenBreite() const // returns the mouse border width { if (hatStyle(Style::MultiStyled)) return 0; return mouseBorder ? mouseBorder->getRBreite() : 0; } AlphaFeld* AuswahlBox::getMausAlphaFeld() const // returns the mouse AlphaFeld { if (hatStyle(Style::MultiStyled)) return 0; return mausAf ? dynamic_cast(mausAf->getThis()) : 0; } AlphaFeld* AuswahlBox::zMausAlphaFeld() const { if (hatStyle(Style::MultiStyled)) return 0; return mausAf; } int AuswahlBox::getMausAlphaFeldFarbe() const // returns the mouse AlphaFeld color { if (hatStyle(Style::MultiStyled)) return 0; return mausAf ? mausAf->getFarbe() : 0; } int AuswahlBox::getMausAlphaFeldStrength() const // returns the mouse AlphaFeld strength { if (hatStyle(Style::MultiStyled)) return 0; return mausAf ? mausAf->getStrength() : 0; } int AuswahlBox::getMausHintergrundFarbe() const // returns the mouse background color { if (hatStyle(Style::MultiStyled)) return 0; return mausBgF; } Image* AuswahlBox::getMausHintergrundImage() const // returns the mouse background image { if (hatStyle(Style::MultiStyled)) return 0; return mausBgB ? dynamic_cast(mausBgB->getThis()) : 0; } Image* AuswahlBox::zMausHintergrundImage() const { if (hatStyle(Style::MultiStyled)) return 0; return mausBgB; } Border* AuswahlBox::getMsMouseBorder( int i) const // returns the multistyle mouse border { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMouseBorder) return 0; return msMouseBorder->get(i); } Border* AuswahlBox::zMsMouseBorder(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMouseBorder) return 0; return msMouseBorder->z(i); } int AuswahlBox::getMsMausRahmenFarbe( int i) const // returns the multistyle mouse border color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMouseBorder) return 0; return msMouseBorder->z(i) ? msMouseBorder->z(i)->getFarbe() : 0; } int AuswahlBox::getMsMausRahmenBreite( int i) const // returns the multistyle mouse border width { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMouseBorder) return 0; return msMouseBorder->z(i) ? msMouseBorder->z(i)->getRBreite() : 0; } AlphaFeld* AuswahlBox::getMsMausAlphaFeld( int i) const // returns the multistyle mouse AlphaFeld { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausAf) return 0; return msMausAf->get(i); } AlphaFeld* AuswahlBox::zMsMausAlphaFeld(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausAf) return 0; return msMausAf->z(i); } int AuswahlBox::getMsMausAlphaFeldFarbe( int i) const // returns the multistyle mouse AlphaFeld color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausAf) return 0; return msMausAf->z(i) ? msMausAf->z(i)->getFarbe() : 0; } int AuswahlBox::getMsMausAlphaFeldStrength( int i) const // returns the multistyle mouse AlphaFeld strength { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausAf) return 0; return msMausAf->z(i) ? msMausAf->z(i)->getStrength() : 0; } int AuswahlBox::getMsMausHintergrundFarbe( int i) const // returns the multistyle mouse background color { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausBgF || !msMausBgF->hat(i)) return 0; return msMausBgF->get(i); } Image* AuswahlBox::getMsMausHintergrundImage( int i) const // returns the multistyle mouse background image { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausBgB) return 0; return msMausBgB->get(i); } Image* AuswahlBox::zMsMausHintergrundImage(int i) const { if (!hatStyle(Style::MultiStyled)) return 0; if (!msMausBgB) return 0; return msMausBgB->z(i); } // Checks if a point is inside this object // x: the x coordinate of the point // y: the y coordinate of the point // return: 1 if the point is inside, 0 otherwise bool AuswahlBox::istPunktInnen(int x, int y) const { return x >= pos.x && x < pos.x + gr.x && y >= pos.y && y < pos.y + gr.y + ausklappHeight; } bool AuswahlBox::hatMsStyle( int i, __int64 abStyle) const // checks if multistyle style is present { if ((style | Style::MultiStyled) != style || !msStyle || !msStyle->hat(i)) return 0; return (msStyle->get(i) | abStyle) == msStyle->get(i); } bool AuswahlBox::hatMsStyleNicht( int i, __int64 abStyle) const // checks if multistyle style is not present { if ((style | Style::MultiStyled) != style || !msStyle || !msStyle->hat(i)) return 1; return (msStyle->get(i) | abStyle) != msStyle->get(i); } Drawable* AuswahlBox::dublizieren() const // Creates a copy of the drawing { AuswahlBox* obj = new AuswahlBox(); obj->setPosition(pos); obj->setSize(gr); obj->setMausEreignisParameter(makParam); obj->setTastaturEreignisParameter(takParam); obj->setMausEreignis(mak); obj->setTastaturEreignis(tak); if (toolTip) obj->setToolTipZ((ToolTip*)toolTip->dublizieren()); obj->setStyle(style); if (textRd) obj->setTextRendererZ(dynamic_cast(textRd->getThis())); if (rahmen) obj->setBorderZ((Border*)rahmen->dublizieren()); if (ausfahren) obj->setAusklappKnopfZ((Knopf*)ausfahren->dublizieren()); obj->setHintergrundFarbe(hintergrundFarbe); if (hintergrundImage) obj->setHintergrundImage( dynamic_cast(hintergrundImage->getThis())); if (hintergrundFeld) obj->setAlphaFeldZ((AlphaFeld*)hintergrundFeld->dublizieren()); if (selBorder) obj->setSelBorderZ((Border*)selBorder->dublizieren()); obj->setAuswHintergrundFarbe(auswBgF); if (auswBgB) obj->setAuswHintergrundImage(dynamic_cast(auswBgB->getThis())); if (auswAf) obj->setAuswAlphaFeldZ((AlphaFeld*)auswAf->dublizieren()); if (mouseBorder) obj->setMouseBorderZ((Border*)mouseBorder->dublizieren()); obj->setMausHintergrundFarbe(mausBgF); if (mausBgB) obj->setMausHintergrundImage(dynamic_cast(mausBgB->getThis())); if (mausAf) obj->setMausAlphaFeldZ((AlphaFeld*)mausAf->dublizieren()); obj->setMaxAuskappHeight(ausklapMaxHeight); obj->setEintragHeight(eintragHeight); for (int i = 0; i < anzahl; ++i) { if (members->z(i)) { obj->addEintrag("a"); obj->setEintragZ(i, (TextField*)members->z(i)->dublizieren()); if (msStyle && msStyle->hat(i)) obj->setMsStyle(i, msStyle->get(i)); if (msSelBorder && msSelBorder->z(i)) obj->setMsSelBorderZ( i, (Border*)msSelBorder->z(i)->dublizieren()); if (msAuswBgF && msAuswBgF->hat(i)) obj->setMsAuswHintergrundFarbe(i, msAuswBgF->get(i)); if (msAuswBgB && msAuswBgB->z(i)) obj->setMsAuswHintergrundImage(i, msAuswBgB->get(i)); if (msAuswAf && msAuswAf->z(i)) obj->setMsAuswAlphaFeldZ( i, (AlphaFeld*)msAuswAf->z(i)->dublizieren()); if (msMouseBorder && msMouseBorder->z(i)) obj->setMsMouseBorderZ( i, (Border*)msMouseBorder->z(i)->dublizieren()); if (msMausBgF && msMausBgF->hat(i)) obj->setMsMausHintergrundFarbe(i, msMausBgF->get(i)); if (msMausBgB && msMausBgB->z(i)) obj->setMsMausHintergrundImage(i, msMausBgB->get(i)); if (msMausAf && msMausAf->z(i)) obj->setMsMausAlphaFeldZ( i, (AlphaFeld*)msMausAf->z(i)->dublizieren()); } } obj->setAlphaFeldFarbe(auswahl); return obj; }