#include "Liste.h" #include "Array.h" #include "Rahmen.h" #include "Bild.h" #include "AlphaFeld.h" #include "TextFeld.h" #include "Text.h" #include "MausEreignis.h" #include "TastaturEreignis.h" #include "Scroll.h" #include "Globals.h" #include "Schrift.h" using namespace Framework; // Inhalt der AuswahlListe Klasse aus Liste.h // Konstruktor AuswahlListe::AuswahlListe() : ZeichnungHintergrund(), tfListe( 0 ), entries( 0 ), auswahl( -1 ), ahFarbe( 0xFF000000 ), ahBild( 0 ), aBuffer( 0 ), aRahmen( 0 ), styles( 0 ), ahFarbeListe( 0 ), ahBildListe( 0 ), aBufferListe( 0 ), aRahmenListe( 0 ), schrift( 0 ) { style = 0; this->setMausEreignis( _ret1ME ); this->setTastaturEreignis( _ret1TE ); } // Destruktor AuswahlListe::~AuswahlListe() { if( tfListe ) tfListe->release(); if( ahBild ) ahBild->release(); if( aBuffer ) aBuffer->release(); if( aRahmen ) aRahmen->release(); if( styles ) styles->release(); if( ahFarbeListe ) ahFarbeListe->release(); if( ahBildListe ) ahBildListe->release(); if( aBufferListe ) aBufferListe->release(); if( aRahmenListe ) aRahmenListe->release(); if( schrift ) schrift->release(); } void AuswahlListe::doMausEreignis( MausEreignis &me, bool userRet ) { if( !userRet || hatStyleNicht( Style::Erlaubt ) ) return; if( hatStyle( Style::VScroll ) && vertikalScrollBar ) { int rbr = 0; if( rahmen && hatStyle( Style::Rahmen ) ) rbr = rahmen->getRBreite(); if( ( ( me.mx > gr.x - 15 - rbr ) || me.id == ME_UScroll || me.id == ME_DScroll ) && me.id != ME_Betritt && me.id != ME_Leaves ) { vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me ); me.verarbeitet = 1; } } if( !me.verarbeitet && me.id == ME_RLinks ) { int eintr = getKlickEintrag( me.my ); if( eintr >= 0 ) { if( hatStyleNicht( Style::MultiSelect ) ) { auswahl = eintr; rend = 1; } else { bool shift = TastenStand[ T_Shift ]; bool strg = TastenStand[ T_Strg ]; if( strg ) { setMsStyle( eintr, Style::Selected, hatMsStyleNicht( eintr, Style::Selected ) ); auswahl = eintr; } else if( shift && auswahl != -1 ) { deSelect(); int beg = auswahl, end = eintr; if( beg > end ) { int tmp = end; end = beg; beg = tmp; } for( int i = beg; i <= end; ++i ) { addMsStyle( i, Style::Selected ); } } else { deSelect(); addMsStyle( eintr, Style::Selected ); auswahl = eintr; } } } else deSelect(); } me.verarbeitet = 1; } // nicht constant void AuswahlListe::update() // aktualisiert die Auswahl Liste { int rbr = 0; if( rahmen ) { rbr = rahmen->getRBreite(); rahmen->setPosition( 0, 0 ); rahmen->setSize( gr.x, gr.y ); } if( hintergrundFeld ) { hintergrundFeld->setPosition( rbr, rbr ); hintergrundFeld->setSize( gr.x - rbr * 2, gr.y - rbr * 2 ); } if( hatStyleNicht( Style::MultiStyled ) && tfListe ) { bool FeldRahmen = hatStyle( Style::FeldRahmen ); bool FeldHintergrund = hatStyle( Style::FeldHintergrund ); bool FeldHBild = hatStyle( Style::FeldHBild ); bool FeldHAlpha = hatStyle( Style::FeldHAlpha ); bool FeldBuffer = hatStyle( Style::FeldBuffer ); for( int i = 0; i < entries; ++i ) { TextFeld *tf = tfListe->z( i ); tf->setStyle( TextFeld::Style::Rahmen, FeldRahmen ); tf->setStyle( TextFeld::Style::Hintergrund, FeldHintergrund ); tf->setStyle( TextFeld::Style::HBild, FeldHBild ); tf->setStyle( TextFeld::Style::HAlpha, FeldHAlpha ); tf->setStyle( TextFeld::Style::Buffered, FeldBuffer ); if( schrift ) tf->setSchriftZ( (Schrift *)schrift->getThis() ); } } if( hatStyle( Style::MultiStyled ) && tfListe && styles ) { for( int i = 0; i < entries; ++i ) { TextFeld *tf = tfListe->z( i ); tf->setStyle( TextFeld::Style::Rahmen, hatMsStyle( i, Style::FeldRahmen ) ); tf->setStyle( TextFeld::Style::Hintergrund, hatMsStyle( i, Style::FeldHintergrund ) ); tf->setStyle( TextFeld::Style::HBild, hatMsStyle( i, Style::FeldHBild ) ); tf->setStyle( TextFeld::Style::HAlpha, hatMsStyle( i, Style::FeldHAlpha ) ); tf->setStyle( TextFeld::Style::Buffered, hatMsStyle( i, Style::FeldBuffer ) ); } } rend = 1; } void AuswahlListe::addEintrag( Text *txt ) // fügt einen Eintrag hinzu { TextFeld *tf = new TextFeld(); tf->setStyle( TextFeld::Style::Center | TextFeld::Style::Sichtbar | TextFeld::Style::Rahmen ); tf->setSchriftFarbe( 0xFFFFFFFF ); tf->setRahmenBreite( 1 ); tf->setRahmenFarbe( 0xFFFFFFFF ); tf->setTextZ( txt ); tf->setSize( 0, 20 ); addEintragZ( tf ); rend = 1; } void AuswahlListe::addEintrag( const char *txt ) { Text *tx = new Text( txt ); addEintrag( tx ); rend = 1; } void AuswahlListe::addEintragZ( TextFeld *tf ) { if( !tfListe ) tfListe = new RCArray< TextFeld >(); if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) ) tf->setSchriftZ( (Schrift *)schrift->getThis() ); tfListe->set( tf, entries ); ++entries; rend = 1; } void AuswahlListe::addEintrag( int pos, Text *txt ) // fügt einen Eintrag bei position pos ein { TextFeld *tf = new TextFeld(); tf->setStyle( TextFeld::Style::Center | TextFeld::Style::Sichtbar | TextFeld::Style::Rahmen ); tf->setSchriftFarbe( 0xFFFFFFFF ); tf->setRahmenBreite( 1 ); tf->setRahmenFarbe( 0xFFFFFFFF ); tf->setTextZ( txt ); tf->setSize( 0, 20 ); addEintragZ( pos, tf ); rend = 1; } void AuswahlListe::addEintrag( int pos, const char *txt ) { Text *tx = new Text( txt ); addEintrag( pos, tx ); rend = 1; } void AuswahlListe::addEintragZ( int pos, TextFeld *tf ) { if( !tfListe ) tfListe = new RCArray< TextFeld >(); if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) ) tf->setSchriftZ( (Schrift *)schrift->getThis() ); tfListe->add( tf, pos ); ++entries; rend = 1; } void AuswahlListe::setEintrag( int pos, Text *txt ) // ändert den pos - ten Eintrag { TextFeld *tf = 0; if( tfListe ) tf = tfListe->z( pos ); if( !tf ) { tf = new TextFeld(); tf->setStyle( TextFeld::Style::Center | TextFeld::Style::Sichtbar | TextFeld::Style::Rahmen ); tf->setSchriftFarbe( 0xFFFFFFFF ); tf->setRahmenFarbe( 0xFFFFFFFF ); tf->setRahmenBreite( 1 ); tf->setTextZ( txt ); tf->setSize( 0, 20 ); setEintragZ( pos, tf ); rend = 1; return; } tf->setTextZ( txt ); rend = 1; } void AuswahlListe::setEintrag( int pos, unsigned char *txt ) { Text *tx = new Text( (const char *)txt ); setEintrag( pos, tx ); rend = 1; } void AuswahlListe::setEintragZ( int pos, TextFeld *tf ) { if( !tfListe ) tfListe = new RCArray< TextFeld >(); if( schrift && ( !tf->zSchrift() || hatStyleNicht( Style::MultiStyled ) ) ) tf->setSchriftZ( (Schrift *)schrift->getThis() ); tfListe->set( tf, pos ); rend = 1; } void AuswahlListe::tauschEintragPos( int vpos, int npos ) // taucht den Eintrag vpos mit dem Eintrag npos { if( tfListe ) { tfListe->tausch( vpos, npos ); if( styles ) styles->tausch( vpos, npos ); if( ahFarbeListe ) ahFarbeListe->tausch( vpos, npos ); if( ahBildListe ) ahBildListe->tausch( vpos, npos ); if( aBufferListe ) aBufferListe->tausch( vpos, npos ); if( aRahmenListe ) aRahmenListe->tausch( vpos, npos ); rend = 1; } } void AuswahlListe::removeEintrag( int pos ) // löscht den Eintrag pos { tfListe->remove( pos ); --entries; rend = 1; } void AuswahlListe::setSchriftZ( Schrift *schrift ) // legt die Schrift der Einträge fest { if( this->schrift ) this->schrift->release(); this->schrift = schrift; rend = 1; } void AuswahlListe::setVScrollZuEintrag( int eintrag ) // scrollt zum Eintrag { if( vertikalScrollBar ) { if( eintrag < entries ) eintrag = entries - 1; int y = 0; for( int i = 0; i < eintrag; i++ ) y += tfListe->z( i ) ? tfListe->z( i )->getHeight() : 0; vertikalScrollBar->scroll( y ); } } void AuswahlListe::updateVScroll() // scrollt zur Curser Position oder nach Unten { if( vertikalScrollBar ) { int y = 0; for( int i = 0; i < entries; i++ ) y += tfListe->z( i ) ? tfListe->z( i )->getHeight() : 0; vertikalScrollBar->update( y, gr.y - ( ( rahmen && hatStyle( TextFeld::Style::Rahmen ) ) ? rahmen->getRBreite() : 0 ) ); } } void AuswahlListe::setALRZ( Rahmen *rahmen ) // setzt einen Zeiger zum Auswahl Rahmen (nur ohne MulitStyled) { if( aRahmen ) aRahmen->release(); aRahmen = rahmen; rend = 1; } void AuswahlListe::setALRBreite( int br ) // setzt die Breite des Auswahl Rahmens (nur ohne MultiStyled) { if( !aRahmen ) aRahmen = new LRahmen(); aRahmen->setRamenBreite( br ); rend = 1; } void AuswahlListe::setALRFarbe( int fc ) // setzt die Farbe des Auswahl Rahmens (nur ohne MultiStyled) { if( !aRahmen ) aRahmen = new LRahmen(); aRahmen->setFarbe( fc ); rend = 1; } void AuswahlListe::setAAFZ( AlphaFeld *buffer ) // setzt einen Zeiger zum Auswahl AlpaFeld (nur ohne MultiStyled) { if( aBuffer ) aBuffer->release(); aBuffer = buffer; rend = 1; } void AuswahlListe::setAAFStrength( int st ) // setzt die Stärke des Auswahl Hintergrund Buffers (nur ohne MultiStyled) { if( !aBuffer ) aBuffer = new AlphaFeld(); aBuffer->setStrength( st ); rend = 1; } void AuswahlListe::setAAFFarbe( int fc ) // setzt die Farbe des Auswahl Hintergrund Buffers (nur ohne MultiStyled) { if( !aBuffer ) aBuffer = new AlphaFeld(); aBuffer->setFarbe( fc ); rend = 1; } void AuswahlListe::setAHBild( Bild *bild ) // setzt das Auswahl Hintergrund Bild (nur ohne MultiStyled) { if( !ahBild ) ahBild = new Bild(); ahBild->neuBild( bild->getBreite(), bild->getHeight(), 0 ); int *buff1 = ahBild->getBuffer(); int *buff2 = bild->getBuffer(); for( int i = 0; i < bild->getBreite() * bild->getHeight(); ++i ) buff1[ i ] = buff2[ i ]; bild->release(); rend = 1; } void AuswahlListe::setAHFarbe( int f ) // setzt einen Zeiger zur Auswahl Hintergrund Farbe (nur ohne MultiStyled) { ahFarbe = f; rend = 1; } void AuswahlListe::setAHBildZ( Bild *b ) // setzt einen Zeiger zum Hintergrund Bild (nur ohne MultiStyled) { if( ahBild ) ahBild->release(); ahBild = b; rend = 1; } void AuswahlListe::setALRZ( int pos, Rahmen *rahmen ) // setzt einen Zeiger zum Auswahl Rahmen (nur mit MulitStyled) { if( !aRahmenListe ) aRahmenListe = new RCArray< Rahmen >(); aRahmenListe->set( rahmen, pos ); rend = 1; } void AuswahlListe::setALRBreite( int pos, int br ) // setzt die Breite des Auswahl Rahmens (nur mit MultiStyled) { if( !aRahmenListe ) aRahmenListe = new RCArray< Rahmen >(); if( !aRahmenListe->z( pos ) ) aRahmenListe->set( new LRahmen(), pos ); aRahmenListe->z( pos )->setRamenBreite( br ); rend = 1; } void AuswahlListe::setALRFarbe( int pos, int fc ) // setzt die Farbe des Auswahl Rahmens (nur mit MultiStyled) { if( !aRahmenListe ) aRahmenListe = new RCArray< Rahmen >(); if( !aRahmenListe->z( pos ) ) aRahmenListe->set( new LRahmen(), pos ); aRahmenListe->z( pos )->setFarbe( fc ); rend = 1; } void AuswahlListe::setAAFZ( int pos, AlphaFeld *buffer ) // setzt einen Zeiger zum Auswahl AlpaFeld (nur mit MultiStyled) { if( !aBufferListe ) aBufferListe = new RCArray< AlphaFeld >(); aBufferListe->set( buffer, pos ); rend = 1; } void AuswahlListe::setAAFStrength( int pos, int st ) // setzt die Stärke des Auswahl Hintergrund Buffers (nur mit MultiStyled) { if( !aBufferListe ) aBufferListe = new RCArray< AlphaFeld >(); if( !aBufferListe->z( pos ) ) aBufferListe->set( new AlphaFeld(), pos ); aBufferListe->z( pos )->setStrength( st ); rend = 1; } void AuswahlListe::setAAFFarbe( int pos, int fc ) // setzt die Farbe des Auswahl Hintergrund Buffers (nur mit MultiStyled) { if( !aBufferListe ) aBufferListe = new RCArray< AlphaFeld >(); if( !aBufferListe->z( pos ) ) aBufferListe->set( new AlphaFeld(), pos ); aBufferListe->z( pos )->setFarbe( fc ); rend = 1; } void AuswahlListe::setAHBild( int pos, Bild *bild ) // setzt das Auswahl Hintergrund Bild (nur mit MultiStyled) { if( ahBildListe ) ahBildListe = new RCArray< Bild >(); if( !ahBildListe->z( pos ) ) ahBildListe->set( new Bild(), pos ); ahBildListe->z( pos )->neuBild( bild->getBreite(), bild->getHeight(), 0 ); int *buff1 = ahBildListe->z( pos )->getBuffer(); int *buff2 = bild->getBuffer(); for( int i = 0; i < bild->getBreite() * bild->getHeight(); ++i ) buff1[ i ] = buff2[ i ]; bild->release(); rend = 1; } void AuswahlListe::setAHFarbe( int pos, int f ) // setzt einen Zeiger zur Auswahl Hintergrund Farbe (nur miz MultiStyled) { if( ahFarbeListe ) ahFarbeListe = new Array< int >(); ahFarbeListe->set( f, pos ); rend = 1; } void AuswahlListe::setAHBildZ( int pos, Bild *b ) // setzt einen Zeiger zum Hintergrund Bild (nur mit MultiStyled) { if( ahBildListe ) ahBildListe = new RCArray< Bild >(); ahBildListe->set( b, pos ); rend = 1; } void AuswahlListe::setMsStyle( int pos, __int64 style ) // setzt den Style des Eintrags (nur mit MultiStyled) { if( !styles ) styles = new Array< __int64 >(); styles->set( style, pos ); rend = 1; } void AuswahlListe::setMsStyle( int pos, __int64 style, bool add_remove ) { if( !styles ) styles = new Array< __int64 >(); if( add_remove ) styles->set( styles->get( pos ) | style, pos ); else styles->set( styles->get( pos ) & ~style, pos ); rend = 1; } void AuswahlListe::addMsStyle( int pos, __int64 style ) { if( !styles ) styles = new Array< __int64 >(); styles->set( styles->get( pos ) | style, pos ); rend = 1; } void AuswahlListe::removeMsStyle( int pos, __int64 style ) { if( !styles ) styles = new Array< __int64 >(); styles->set( styles->get( pos ) & ~style, pos ); rend = 1; } void AuswahlListe::doTastaturEreignis( TastaturEreignis &te ) { bool ntakc = !te.verarbeitet; if( hatStyleNicht( Style::Fokus ) || !tak || te.verarbeitet ) return; getThis(); if( tak( takParam, this, te ) ) { if( te.id == TE_Press ) { if( hatStyleNicht( Style::MultiSelect ) ) { switch( te.taste ) { case T_Unten: ++auswahl; if( auswahl > entries ) auswahl = entries; rend = 1; break; case T_Oben: --auswahl; if( auswahl < -1 ) auswahl = -1; rend = 1; break; } } else { switch( te.taste ) { case T_Unten: deSelect(); ++auswahl; if( auswahl > entries ) auswahl = entries; if( auswahl >= 0 ) addMsStyle( auswahl, Style::Selected ); rend = 1; break; case T_Oben: deSelect(); --auswahl; if( auswahl < -1 ) auswahl = -1; if( auswahl >= 0 ) addMsStyle( auswahl, Style::Selected ); rend = 1; break; } } } te.verarbeitet = 1; } if( ntakc && te.verarbeitet && nTak ) te.verarbeitet = nTak( ntakParam, this, te ); release(); } void AuswahlListe::render( Bild &zRObj ) // zeichnet nach zRObj { if( !hatStyle( Style::Sichtbar ) ) return; removeStyle( Style::HScroll ); ZeichnungHintergrund::render( zRObj ); lockZeichnung(); if( !zRObj.setDrawOptions( innenPosition, innenSize ) ) { unlockZeichnung(); return; } int rbr = 0; if( rahmen && hatStyle( Style::Rahmen ) ) rbr = rahmen->getRBreite(); if( tfListe ) { entries = tfListe->getEintragAnzahl(); int maxHeight = 0; int dx = 0, dy = 0; if( vertikalScrollBar && hatStyle( Style::VScroll ) ) dy -= vertikalScrollBar->getScroll(); int mdy = innenSize.y + rbr; for( int i = 0; i < entries; ++i ) { TextFeld *tf = tfListe->z( i ); if( dy + tf->getHeight() > mdy && !( vertikalScrollBar && hatStyle( Style::VScroll ) ) ) break; tf->setPosition( dx, dy ); tf->setSize( innenSize.x, tf->getHeight() ); maxHeight += tf->getHeight(); bool selected = 0; if( hatStyle( Style::MultiSelect ) && styles ) selected = hatMsStyle( i, Style::Selected ); else selected = auswahl == i; AlphaFeld *tmpBuffer = 0; bool tmpB = 0; int tmpHFarbe = 0; bool tmpH = 0; Bild *tmpHBild = 0; bool tmpHB = 0; bool tmpHAlpha = 0; Rahmen *tmpRahmen = 0; bool tmpR = 0; if( selected ) { if( hatStyleNicht( Style::MultiStyled ) || !styles ) { if( hatStyle( Style::AuswahlBuffer ) && aBuffer ) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ( (AlphaFeld *)aBuffer->getThis() ); tmpB = tf->hatStyle( TextFeld::Style::Buffered ); tf->setStyle( TextFeld::Style::Buffered, hatStyle( Style::AuswahlBuffer ) ); } if( hatStyle( Style::AuswahlHintergrund ) ) { tmpH = tf->hatStyle( TextFeld::Style::Hintergrund ); tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe( ahFarbe ); tf->setStyle( TextFeld::Style::Hintergrund, hatStyle( Style::Hintergrund ) ); if( hatStyle( Style::AuswahlHBild ) && ahBild ) { tmpHBild = tf->getHintergrundBild(); tf->setHintergrundBildZ( (Bild *)ahBild->getThis() ); tmpHB = tf->hatStyle( TextFeld::Style::HBild ); tf->setStyle( TextFeld::Style::HBild, hatStyle( Style::HBild ) ); } if( hatStyle( Style::AuswahlHAlpha ) ) { tmpHAlpha = tf->hatStyle( TextFeld::Style::HAlpha ); tf->setStyle( TextFeld::Style::HAlpha, hatStyle( Style::AuswahlHAlpha ) ); } } if( hatStyle( Style::AuswahlRahmen ) && aRahmen ) { tmpRahmen = tf->getRahmen(); tf->setRahmenZ( (Rahmen *)aRahmen->getThis() ); tmpR = tf->hatStyle( TextFeld::Style::Rahmen ); tf->setStyle( TextFeld::Style::Rahmen, hatStyle( Style::AuswahlRahmen ) ); } } else { if( hatMsStyle( i, Style::AuswahlBuffer ) && aBufferListe ) { tmpBuffer = tf->getAlphaFeld(); tf->setAlphaFeldZ( aBufferListe->get( i ) ); tmpB = tf->hatStyle( TextFeld::Style::Buffered ); tf->setStyle( TextFeld::Style::Buffered, hatMsStyle( i, Style::AuswahlBuffer ) ); } if( hatMsStyle( i, Style::AuswahlHintergrund ) ) { tmpH = tf->hatStyle( Style::Hintergrund ); tf->setStyle( TextFeld::Style::Hintergrund, hatMsStyle( i, Style::AuswahlHintergrund ) ); if( ahFarbeListe && ahFarbeListe->hat( i ) ) { tmpHFarbe = tf->getHintergrundFarbe(); tf->setHintergrundFarbe( ahFarbeListe->get( i ) ); } if( hatMsStyle( i, Style::AuswahlHBild ) && ahBildListe ) { tmpHBild = tf->getHintergrundBild(); tf->setHintergrundBildZ( ahBildListe->get( i ) ); tmpHB = tf->hatStyle( TextFeld::Style::HBild ); tf->setStyle( TextFeld::Style::HBild, hatMsStyle( i, Style::HBild ) ); } if( hatMsStyle( i, Style::AuswahlHAlpha ) ) { tmpHAlpha = tf->hatStyle( TextFeld::Style::HAlpha ); tf->setStyle( TextFeld::Style::HAlpha, hatMsStyle( i, Style::AuswahlHAlpha ) ); } } if( hatMsStyle( i, Style::AuswahlRahmen ) && aRahmenListe ) { tmpRahmen = tf->getRahmen(); tf->setRahmenZ( aRahmenListe->get( i ) ); tmpR = tf->hatStyle( TextFeld::Style::Rahmen ); tf->setStyle( TextFeld::Style::Rahmen, hatMsStyle( i, Style::AuswahlRahmen ) ); } } } tf->render( zRObj ); if( selected ) { if( hatStyleNicht( Style::MultiStyled ) || !styles ) { if( hatStyle( Style::AuswahlBuffer ) ) { tf->setAlphaFeldZ( tmpBuffer ); tf->setStyle( TextFeld::Style::Buffered, tmpB ); } if( hatStyle( Style::AuswahlHintergrund ) ) { tf->setHintergrundFarbe( tmpHFarbe ); tf->setStyle( TextFeld::Style::Hintergrund, tmpH ); if( hatStyle( Style::AuswahlHBild ) ) { tf->setHintergrundBildZ( tmpHBild ); tf->setStyle( TextFeld::Style::HBild, tmpHB ); } if( hatStyle( Style::AuswahlHAlpha ) ) tf->setStyle( TextFeld::Style::HAlpha, tmpHAlpha ); } if( hatStyle( Style::AuswahlRahmen ) ) { tf->setRahmenZ( tmpRahmen ); tf->setStyle( TextFeld::Style::Rahmen, tmpR ); } } else { if( hatMsStyle( i, Style::AuswahlBuffer ) && aBufferListe ) { tf->setAlphaFeldZ( tmpBuffer ); tf->setStyle( TextFeld::Style::Buffered, tmpB ); } if( hatMsStyle( i, Style::AuswahlHintergrund ) ) { tf->setStyle( TextFeld::Style::Hintergrund, tmpH ); if( ahFarbeListe && ahFarbeListe->hat( i ) ) tf->setHintergrundFarbe( tmpHFarbe ); if( hatMsStyle( i, Style::AuswahlHBild ) && ahBildListe ) { tf->setHintergrundBildZ( tmpHBild ); tf->setStyle( TextFeld::Style::HBild, tmpHB ); } if( hatMsStyle( i, Style::AuswahlHAlpha ) ) tf->setStyle( TextFeld::Style::HAlpha, tmpHAlpha ); } if( hatMsStyle( i, Style::AuswahlRahmen ) && aRahmenListe ) { tf->setRahmenZ( tmpRahmen ); tf->setStyle( TextFeld::Style::Rahmen, tmpR ); } } } dy += tf->getHeight(); } if( vertikalScrollBar ) vertikalScrollBar->getScrollData()->max = maxHeight; } zRObj.releaseDrawOptions(); unlockZeichnung(); } int AuswahlListe::getKlickEintrag( int my ) { if( !tfListe ) return -1; entries = tfListe->getEintragAnzahl(); int y = 0; if( hatStyle( Style::VScroll ) && vertikalScrollBar ) y -= vertikalScrollBar->getScroll(); for( int i = 0; i < entries; ++i ) { y += tfListe->z( i )->getHeight(); if( y > my ) return i; } return -1; } void AuswahlListe::setAuswahl( int ausw ) // setzt die Auswahl { if( hatStyleNicht( Style::MultiSelect ) ) auswahl = ausw; else if( styles ) { for( int i = 0; i < entries; ++i ) removeMsStyle( i, Style::Selected ); addMsStyle( ausw, Style::Selected ); } } void AuswahlListe::deSelect() { if( hatStyleNicht( Style::MultiSelect ) ) auswahl = -1; else if( styles ) { for( int i = 0; i < entries; ++i ) { removeMsStyle( i, Style::Selected ); } } } // constant int AuswahlListe::getEintragAnzahl() const // gibt die Anzahl der Einträge zurück { return entries; } int AuswahlListe::getAuswahl() const // gibt den ersten ausgewählten Eintrag zurück { return auswahl; } int AuswahlListe::getEintragPos( Text *eintragText ) // gibt die Position des eintrages mit dem entsprechenden Textes zurück { for( int i = 0; i < entries; ++i ) { if( tfListe->z( i )->zText()->istGleich( eintragText->getText() ) ) { eintragText->release(); return i; } } return -1; } TextFeld *AuswahlListe::getEintrag( int pos ) const // gibt den pos- ten Eintrag zurück { if( !tfListe ) return 0; TextFeld *ret = (TextFeld *)tfListe->get( pos ); if( ret ) return (TextFeld *)ret->getThis(); return 0; } TextFeld *AuswahlListe::zEintrag( int pos ) const { if( !tfListe ) return 0; return (TextFeld *)tfListe->z( pos ); } Rahmen *AuswahlListe::getARahmen() const // gibt den Auswahl Rahmen zurück (ohne MultiStyled) { if( aRahmen ) return (Rahmen *)aRahmen->getThis(); return 0; } Rahmen *AuswahlListe::zARahmen() const { return aRahmen; } int AuswahlListe::getAHFarbe() const // gibt die Auswahl Hintergrund Farbe zurück (ohne MultiStyled) { return ahFarbe; } Bild *AuswahlListe::getAHBild() const // gibt das Auswahl Hintergrund Bild zurück (ohne MultiStyled) { if( ahBild ) return (Bild *)ahBild->getThis(); return 0; } Bild *AuswahlListe::zAHBild() const { return ahBild; } AlphaFeld *AuswahlListe::getABuffer() const // gibt den Auswahl Buffer zurück (ohne MultiStyled) { if( aBuffer ) return (AlphaFeld *)aBuffer->getThis(); return 0; } AlphaFeld *AuswahlListe::zABuffer() const { return aBuffer; } Rahmen *AuswahlListe::getARahmen( int pos ) const // gibt den Auswahl Rahmen zurück (mit MultiStyled) { Rahmen *ret = 0; if( aRahmenListe ) ret = (Rahmen *)aRahmenListe->get( pos ); if( ret ) return (Rahmen *)ret->getThis(); return 0; } Rahmen *AuswahlListe::zARahmen( int pos ) const { Rahmen *ret = 0; if( aRahmenListe ) ret = (Rahmen *)aRahmenListe->z( pos ); return ret; } int AuswahlListe::getAHFarbe( int pos ) const // gibt die Auswahl Hintergrund Farbe zurück (mit MultiStyled) { if( ahFarbeListe && ahFarbeListe->hat( pos ) ) return ahFarbeListe->get( pos ); return 0; } Bild *AuswahlListe::getAHBild( int pos ) const // gibt das Auswahl Hintergrund Bild zurück (mit MultiStyled) { Bild *ret = 0; if( ahBildListe ) ret = (Bild *)ahBildListe->get( pos ); if( ret ) return (Bild *)ret->getThis(); return 0; } Bild *AuswahlListe::zAHBild( int pos ) const { Bild *ret = 0; if( ahBildListe ) ret = (Bild *)ahBildListe->z( pos ); return ret; } AlphaFeld *AuswahlListe::getABuffer( int pos ) const // gibt den Auswahl Buffer zurück (mit MultiStyled) { AlphaFeld *ret = 0; if( aBufferListe ) ret = (AlphaFeld *)aBufferListe->get( pos ); if( ret ) return (AlphaFeld *)ret->getThis(); return 0; } AlphaFeld *AuswahlListe::zABuffer( int pos ) const { AlphaFeld *ret = 0; if( aBufferListe ) ret = (AlphaFeld *)aBufferListe->z( pos ); return ret; } bool AuswahlListe::hatMsStyle( int pos, __int64 style ) const // prüft ob style vorhanden (mit MultiStyled) { __int64 st = 0; if( styles ) st = styles->get( pos ); return ( st | style ) == st; } bool AuswahlListe::hatMsStyleNicht( int pos, __int64 style ) const // prüft obt style nicht vorhanden (mit MultiStyled) { __int64 st = 0; if( styles ) st = styles->get( pos ); return ( st | style ) != st; }