#include "Zeichnung.h" #include "AlphaFeld.h" #include "Bild.h" #include "Bildschirm.h" #include "Globals.h" #include "MausEreignis.h" #include "Rahmen.h" #include "Schrift.h" #include "Scroll.h" #include "TastaturEreignis.h" #include "Text.h" #include "TextFeld.h" #include "ToolTip.h" #include "UIInitialization.h" #ifdef WIN32 # include #endif using namespace Framework; // Contents of the Zeichnung class from Zeichnung.h // Constructor Zeichnung::Zeichnung() : ReferenceCounter(), pos(0, 0), gr(0, 0), makParam(0), takParam(0), mak(0), tak(0), nmakParam(0), ntakParam(0), nMak(0), nTak(0), mausIn(0), toolTip(0), style(0), rend(0), onNeedToolTip(0), toolTipRequested(0) {} // Destructor Zeichnung::~Zeichnung() { if (toolTip) toolTip->release(); } void Zeichnung::doMausEreignis(MausEreignis& me, bool userRet) { me.verarbeitet = userRet; } // non-constant void Zeichnung::setRender() { rend = 1; } void Zeichnung::setToolTipText( const char* txt, Bildschirm* zScreen, Schrift* zSchrift) { if (!txt) toolTip = (ToolTip*)toolTip->release(); else { if (!toolTip) { toolTip = new ToolTip(zScreen); toolTip->addStyle(ZeichnungHintergrund::Style::Hintergrund | ZeichnungHintergrund::Style::HAlpha | ZeichnungHintergrund::Style::Rahmen | ZeichnungHintergrund::Style::Sichtbar); toolTip->setHintergrundFarbe(0xA0000000); toolTip->setRahmenFarbe(0xFFFFFFFF); toolTip->setRahmenBreite(1); if (mausIn && toolTip) toolTip->setMausIn(1); } UIInit init = defaultUI(zSchrift, zScreen); TextFeld* t = init.createTextFeld(init.initParam); t->setText(txt); t->setSize(t->zTextRenderer()->getTextBreite(txt), t->zTextRenderer()->getTextHeight(txt)); toolTip->addMember(t); } toolTipRequested = 0; } // sets a function that creates a tooltip on first use // if one does not exist yet // initToolTip: the function void Zeichnung::setNeedToolTipEvent( std::function onNeedToolTip) { this->onNeedToolTip = onNeedToolTip; } // sets the tooltip // tt: the tooltip void Zeichnung::setToolTipZ(ToolTip* tt) { if (toolTip) toolTip->release(); toolTip = tt; if (mausIn && toolTip) toolTip->setMausIn(1); toolTipRequested = 0; } void Zeichnung::lockZeichnung() { cs.lock(); } void Zeichnung::unlockZeichnung() { cs.unlock(); } void Zeichnung::setMausEreignisParameter( void* p) // sets the mouse event parameter { makParam = p; } void Zeichnung::setTastaturEreignisParameter( void* p) // sets the keyboard event parameter { takParam = p; } void Zeichnung::setMausEreignis(MausAktion ak) // sets the mouse event { mak = ak; } void Framework::Zeichnung::addMausEreignis(MausAktion ak) { if (!mak) { mak = ak; } else { MausAktion old = mak; mak = [old, ak](void* p, void* o, MausEreignis me) { return old(p, o, me) && ak(p, o, me); }; } } void Zeichnung::setTastaturEreignis( TastaturAktion ak) // sets the keyboard event { tak = ak; } void Framework::Zeichnung::addTastaturEreignis(TastaturAktion ak) { if (!tak) { tak = ak; } else { TastaturAktion old = tak; tak = [old, ak](void* p, void* o, TastaturEreignis te) { return old(p, o, te) && ak(p, o, te); }; } } void Zeichnung::setNMausEreignisParameter( void* p) // sets the mouse event parameter { nmakParam = p; } void Zeichnung::setNTastaturEreignisParameter( void* p) // sets the keyboard event parameter { ntakParam = p; } void Zeichnung::setNMausEreignis(MausAktion ak) // sets the mouse event { nMak = ak; } void Zeichnung::setNTastaturEreignis( TastaturAktion ak) // sets the keyboard event { nTak = ak; } void Zeichnung::doPublicMausEreignis(MausEreignis& me) // calls Mak { bool lock = hatStyle(Style::MELockZeichnung); if (lock) lockZeichnung(); bool inside = istPunktInnen(me.mx, me.my); if (!me.insideParent || me.verarbeitet || !inside) { if (mausIn) { mausIn = 0; if (toolTip) toolTip->setMausIn(0); MausEreignis me2; me2.id = ME_Leaves; me2.mx = me.mx - pos.x; me2.my = me.my - pos.y; me2.verarbeitet = 0; me2.insideParent = me.insideParent; bool userRet = mak && mak(makParam, this, me2); doMausEreignis(me2, userRet); } } if (!inside && me.id == ME_PLinks) removeStyle(Style::Fokus); if ((me.verarbeitet && hatStyleNicht(Style::MEIgnoreVerarbeitet)) || (!inside && hatStyleNicht(Style::MEIgnoreInside)) || (hatStyleNicht(Style::Sichtbar) && hatStyleNicht(Style::MEIgnoreSichtbar))) { if (lock) unlockZeichnung(); return; } if (inside && me.id == ME_PLinks) addStyle(Style::Fokus); if (me.insideParent && !mausIn && me.id != ME_Leaves && inside && !me.verarbeitet && hatStyle(Style::Sichtbar)) { mausIn = 1; if (toolTip) toolTip->setMausIn(1); else if (onNeedToolTip && !toolTipRequested) { toolTipRequested = onNeedToolTip(this, Punkt(me.mx - pos.x, me.my - pos.y)); } MausEreignis me2; me2.id = ME_Betritt; me2.mx = me.mx - pos.x; me2.my = me.my - pos.y; me2.verarbeitet = 0; me2.insideParent = 1; bool userRet = mak && mak(makParam, this, me2); doMausEreignis(me2, userRet); } else if (me.insideParent && mausIn && me.id != ME_Leaves && inside && !me.verarbeitet && hatStyle(Style::Sichtbar) && !toolTip && onNeedToolTip && !toolTipRequested) { toolTipRequested = onNeedToolTip(this, Punkt(me.mx - pos.x, me.my - pos.y)); } Punkt old = Punkt(me.mx, me.my); me.mx -= pos.x, me.my -= pos.y; if (me.insideParent || hatStyle(Style::MEIgnoreParentInside)) { bool userRet = hatStyle(Style::Erlaubt) && (me.verarbeitet || !me.insideParent || (inside && mak && mak(makParam, this, me))); bool vera = me.verarbeitet; doMausEreignis(me, userRet); if (nMak && me.verarbeitet && !vera && hatStyle(Style::Erlaubt) && me.insideParent && inside) me.verarbeitet = nMak(nmakParam, this, me); } me.mx = old.x, me.my = old.y; if (lock) unlockZeichnung(); } void Zeichnung::doTastaturEreignis(TastaturEreignis& te) // calls Tak { if (te.verarbeitet) return; if (tak) te.verarbeitet |= tak(takParam, this, te); if (nTak && te.verarbeitet) te.verarbeitet = nTak(ntakParam, this, te); } void Zeichnung::setPosition(const Punkt& pos) // sets the position { lockZeichnung(); if (this->pos != pos) rend = 1; this->pos = pos; unlockZeichnung(); } void Zeichnung::setX(int xPos) { lockZeichnung(); if (pos.x != xPos) { rend = 1; pos.x = xPos; } unlockZeichnung(); } void Zeichnung::setY(int yPos) { lockZeichnung(); if (pos.y != yPos) { rend = 1; pos.y = yPos; } unlockZeichnung(); } void Zeichnung::setSize(const Punkt& gr) // sets the size { lockZeichnung(); if (this->gr != gr) rend = 1; this->gr = gr; unlockZeichnung(); } void Zeichnung::setPosition(int x, int y) // sets the position { setPosition(Punkt(x, y)); } void Zeichnung::setSize(int x, int y) // sets the size { setSize(Punkt(x, y)); } void Zeichnung::setWidth(int width) { lockZeichnung(); if (this->gr.x != width) rend = 1; gr.x = width; unlockZeichnung(); } void Zeichnung::setHeight(int height) { lockZeichnung(); if (this->gr.y != height) rend = 1; gr.y = height; unlockZeichnung(); } bool Zeichnung::tick(double tickval) { bool r = rend; rend = 0; return r; } void Zeichnung::setStyle(__int64 style) // sets the style of the text field { if (this->style != style) { this->style = style; rend = 1; } } void Zeichnung::setStyle(__int64 style, bool add_remove) { if (add_remove && (this->style | style) != this->style) { this->style |= style; rend = 1; } else if (!add_remove && (this->style & ~style) != this->style) { if (toolTip && (style | Style::Sichtbar) == style) toolTip->setMausIn(0); this->style &= ~style; rend = 1; } } void Zeichnung::addStyle(__int64 style) { if ((this->style | style) != this->style) { this->style |= style; rend = 1; } } void Zeichnung::removeStyle(__int64 style) { if ((this->style & ~style) != this->style) { if (toolTip && (style | Style::Sichtbar) == style) toolTip->setMausIn(0); this->style &= ~style; rend = 1; } } void Zeichnung::render(Bild& zRObj) { if (toolTip && (style | Style::Sichtbar) == style) toolTip->setZeichnen(); } // constant bool Zeichnung::hatMausEreignis() const // checks if Mak is set { return mak != 0; } bool Zeichnung::hatTastaturEreignis() const // checks if Tak is set { return tak != 0; } const Punkt& Zeichnung::getPosition() const // returns the position { return pos; } const Punkt& Zeichnung::getSize() const // returns the size { return gr; } int Zeichnung::getBreite() const // returns the width { return gr.x; } int Zeichnung::getHeight() const // returns the height { return gr.y; } // Returns the width of the interior area of the drawing in pixels int Zeichnung::getInnenBreite() const { return gr.x; } // Returns the height of the interior area of the drawing in pixels int Zeichnung::getInnenHeight() const { return gr.y; } int Zeichnung::getX() const // returns X { return pos.x; } int Zeichnung::getY() const // returns Y { return pos.y; } // Checks if a point is inside this object // p: the point // return: 1 if the point is inside, 0 otherwise bool Zeichnung::istPunktInnen(Punkt p) const { return istPunktInnen(p.x, p.y); } // 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 Zeichnung::istPunktInnen(int x, int y) const { return x >= pos.x && x <= pos.x + gr.x && y >= pos.y && y <= pos.y + gr.y; } ToolTip* Zeichnung::getToolTip() const // returns the ToolTip text { return dynamic_cast(toolTip->getThis()); } ToolTip* Zeichnung::zToolTip() const { return toolTip; } bool Zeichnung::hatStyle(__int64 style) const // checks if style is present { return (this->style | style) == this->style; } bool Zeichnung::hatStyleNicht( __int64 style) const // checks if style is not present { return (this->style | style) != this->style; } __int64 Framework::Zeichnung::getStyles() const { return style; } Zeichnung* Zeichnung::dublizieren() const // Creates a copy of the drawing { Zeichnung* obj = new Zeichnung(); 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()); return obj; } // Contents of the ZeichnungHintergrund class from Zeichnung.h // Constructor ZeichnungHintergrund::ZeichnungHintergrund() : Zeichnung() { hintergrundFarbe = 0xFF000000; rahmen = 0; hintergrundBild = 0; hintergrundFeld = 0; horizontalScrollBar = 0; vertikalScrollBar = 0; innenPosition.x = 0; innenPosition.y = 0; innenSize.x = 0; innenSize.y = 0; } // Destructor ZeichnungHintergrund::~ZeichnungHintergrund() { if (rahmen) rahmen->release(); if (hintergrundBild) hintergrundBild->release(); if (hintergrundFeld) hintergrundFeld->release(); if (horizontalScrollBar) horizontalScrollBar->release(); if (vertikalScrollBar) vertikalScrollBar->release(); } void ZeichnungHintergrund::doMausEreignis(MausEreignis& me, bool userRet) { if (userRet) { int rbr = 0; if (hatStyle(Style::Rahmen) && rahmen) rbr = rahmen->getRBreite(); bool vs = hatStyle(Style::VScroll) && vertikalScrollBar; bool hs = hatStyle(Style::HScroll) && horizontalScrollBar; if (vs) { if (hs) horizontalScrollBar->doMausMessage( rbr, gr.y - rbr - 15, gr.x - rbr * 2 - 15, 15, me); vertikalScrollBar->doMausMessage( gr.x - rbr - 15, rbr, 15, gr.y - rbr * 2, me); } else if (hs) horizontalScrollBar->doMausMessage( rbr, gr.y - rbr - 15, gr.x - rbr * 2, 15, me); } me.verarbeitet = userRet; } void ZeichnungHintergrund::setHintergrundBild( Bild* bild) // sets the background image { if (!hintergrundBild) hintergrundBild = new Bild(); hintergrundBild->neuBild(bild->getBreite(), bild->getHeight(), 0); int* buff1 = hintergrundBild->getBuffer(); int* buff2 = bild->getBuffer(); for (int i = 0; i < bild->getBreite() * bild->getHeight(); ++i) buff1[i] = buff2[i]; bild->release(); rend = 1; } void ZeichnungHintergrund::setHintergrundBildZ( Bild* bild) // sets a pointer to the background image { if (hintergrundBild != bild) { if (hintergrundBild) hintergrundBild->release(); hintergrundBild = bild; rend = 1; } } void ZeichnungHintergrund::setHintergrundFarbe( int fc) // sets the background color { if (hintergrundFarbe != fc) { hintergrundFarbe = fc; rend = 1; } } void ZeichnungHintergrund::setAlphaFeldZ( AlphaFeld* buff) // sets a pointer to the background buffer { if (hintergrundFeld != buff) { if (hintergrundFeld) hintergrundFeld->release(); hintergrundFeld = buff; rend = 1; } } void ZeichnungHintergrund::setAlphaFeldStrength( int st) // sets the strength of the background buffer { if (!hintergrundFeld) { hintergrundFeld = new AlphaFeld(); rend = 1; } if (hintergrundFeld->getStrength() != st) { hintergrundFeld->setStrength(st); rend = 1; } } void ZeichnungHintergrund::setAlphaFeldFarbe( int fc) // sets the color of the background buffer { if (!hintergrundFeld) { hintergrundFeld = new AlphaFeld(); rend = 1; } if (hintergrundFeld->getFarbe() != fc) { hintergrundFeld->setFarbe(fc); rend = 1; } } void ZeichnungHintergrund::setRahmenZ( Rahmen* ram) // sets a pointer to the border { if (rahmen != ram) { if (rahmen) rahmen->release(); rahmen = ram; rend = 1; } } void ZeichnungHintergrund::setRahmenBreite(int br) // sets the border width { if (!rahmen) { rahmen = new LRahmen(); rend = 1; } if (rahmen->getRBreite() != br) { rahmen->setRamenBreite(br); rend = 1; } } void ZeichnungHintergrund::setRahmenFarbe(int fc) // sets the border color { if (!rahmen) { rahmen = new LRahmen(); rend = 1; } if (rahmen->getFarbe() != fc) { rahmen->setFarbe(fc); rend = 1; } } void ZeichnungHintergrund::setVertikalKlickScroll( int ks) // sets the vertical scroll speed { if (!vertikalScrollBar) { vertikalScrollBar = new VScrollBar(); rend = 1; } if (vertikalScrollBar->getKlickScroll() != ks) { vertikalScrollBar->setKlickScroll(ks); rend = 1; } } void ZeichnungHintergrund::setVertikalScrollPos( int pos) // sets the vertical scroll position { if (!vertikalScrollBar) { vertikalScrollBar = new VScrollBar(); rend = 1; } if (vertikalScrollBar && vertikalScrollBar->getScroll() != pos) { vertikalScrollBar->scroll(pos); rend = 1; } } void ZeichnungHintergrund::setVertikalScrollFarbe( int f, int bgF) // sets the scroll color { if (!vertikalScrollBar) { vertikalScrollBar = new VScrollBar(); rend = 1; } if (vertikalScrollBar && (vertikalScrollBar->getFarbe() != f || vertikalScrollBar->getBgFarbe() != bgF)) { vertikalScrollBar->setFarbe(f); vertikalScrollBar->setBgFarbe(bgF, bgF != 0); rend = 1; } } void ZeichnungHintergrund::setHorizontalKlickScroll( int ks) // sets the horizontal scroll speed { if (!horizontalScrollBar) { horizontalScrollBar = new HScrollBar(); rend = 1; } if (horizontalScrollBar && horizontalScrollBar->getKlickScroll() != ks) { horizontalScrollBar->setKlickScroll(ks); rend = 1; } } void ZeichnungHintergrund::setHorizontalScrollPos( int pos) // sets the horizontal scroll position { if (!horizontalScrollBar) { horizontalScrollBar = new HScrollBar(); rend = 1; } if (horizontalScrollBar && horizontalScrollBar->getScroll() != pos) { horizontalScrollBar->scroll(pos); rend = 1; } } void ZeichnungHintergrund::setHorizontalScrollFarbe( int f, int bgF) // sets the scroll color { if (!horizontalScrollBar) { horizontalScrollBar = new HScrollBar(); rend = 1; } if (horizontalScrollBar && (horizontalScrollBar->getFarbe() != f || horizontalScrollBar->getBgFarbe() != bgF)) { horizontalScrollBar->setFarbe(f); horizontalScrollBar->setBgFarbe(bgF, bgF != 0); rend = 1; } } bool ZeichnungHintergrund::tick(double tickVal) { if (vertikalScrollBar && hatStyle(Style::VScroll)) rend |= vertikalScrollBar->getRend(); if (horizontalScrollBar && hatStyle(Style::HScroll)) rend |= horizontalScrollBar->getRend(); return Zeichnung::tick(tickVal); } void ZeichnungHintergrund::render(Bild& rObj) { innenPosition.x = pos.x; innenPosition.y = pos.y; innenSize.x = gr.x; innenSize.y = gr.y; if (hatStyleNicht(Style::Sichtbar)) return; lockZeichnung(); if (!rObj.setDrawOptions(pos.x, pos.y, gr.x, gr.y)) { unlockZeichnung(); return; } Zeichnung::render(rObj); int rbr = 0; if (hatStyle(Style::Rahmen) && rahmen) { rahmen->setSize(gr); rahmen->render(rObj); rbr = rahmen->getRBreite(); } innenPosition.x += rbr; innenPosition.y += rbr; innenSize.x -= rbr * 2; innenSize.y -= rbr * 2; if (!rObj.setDrawOptions(rbr, rbr, gr.x - rbr * 2, gr.y - rbr * 2)) { rObj.releaseDrawOptions(); unlockZeichnung(); return; } bool vs = vertikalScrollBar && hatStyle(Style::VScroll); bool hs = horizontalScrollBar && hatStyle(Style::HScroll); if (vs) { vertikalScrollBar->render( gr.x - rbr * 2 - 15, 0, 15, gr.y - rbr * 2, rObj); innenSize.x -= 15; if (hs) { horizontalScrollBar->render( 0, gr.y - rbr * 2 - 15, gr.x - rbr * 2 - 15, 15, rObj); innenSize.y -= 15; if (!rObj.setDrawOptions( 0, 0, gr.x - rbr * 2 - 15, gr.y - rbr * 2 - 15)) { rObj.releaseDrawOptions(); rObj.releaseDrawOptions(); unlockZeichnung(); return; } horizontalScrollBar->update( horizontalScrollBar->getScrollData()->max, innenSize.x); } else { if (!rObj.setDrawOptions(0, 0, gr.x - rbr * 2 - 15, gr.y - rbr * 2)) { rObj.releaseDrawOptions(); rObj.releaseDrawOptions(); unlockZeichnung(); return; } } vertikalScrollBar->update( vertikalScrollBar->getScrollData()->max, innenSize.y); } else if (hs) { horizontalScrollBar->render( rbr, gr.y - rbr * 2 - 15, gr.x - rbr * 2, 15, rObj); innenSize.y -= 15; if (!rObj.setDrawOptions(0, 0, gr.x - rbr * 2, gr.y - rbr * 2 - 15)) { rObj.releaseDrawOptions(); rObj.releaseDrawOptions(); unlockZeichnung(); return; } } if (hatStyle(Style::Hintergrund)) { if (hatStyle(Style::HAlpha)) rObj.alphaRegion( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, hintergrundFarbe); else rObj.fillRegion( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, hintergrundFarbe); if (hatStyle(Style::HBild) && hintergrundBild) { if (hatStyle(Style::HBildScale)) { if (hatStyle(Style::HAlpha)) rObj.alphaBildSkall( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild); else rObj.drawBildSkall( 0, 0, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild); } else { int x = (gr.x - rbr * 2 - hintergrundBild->getSize().x) / 2; int y = (gr.y - rbr * 2 - hintergrundBild->getSize().y) / 2; if (hatStyle(Style::HAlpha)) rObj.alphaBild( x, y, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild); else rObj.drawBild( x, y, gr.x - rbr * 2, gr.y - rbr * 2, *hintergrundBild); } } } if (hatStyle(Style::Buffered) && hintergrundFeld) { hintergrundFeld->setSize(gr.x - rbr * 2, gr.y - rbr * 2); hintergrundFeld->render(rObj); } if (vs || hs) rObj.releaseDrawOptions(); rObj.releaseDrawOptions(); rObj.releaseDrawOptions(); unlockZeichnung(); } // Returns the width of the interior area of the drawing in pixels int ZeichnungHintergrund::getInnenBreite() const { return getBreite() - 2 * getRahmenBreite(); } // Returns the height of the interior area of the drawing in pixels int ZeichnungHintergrund::getInnenHeight() const { return getHeight() - 2 * getRahmenBreite(); } Bild* ZeichnungHintergrund::getHintergrundBild() const // returns the background image { if (!hintergrundBild) return 0; return dynamic_cast(hintergrundBild->getThis()); } Bild* ZeichnungHintergrund::zHintergrundBild() const // returns the background image without increased reference counter { return hintergrundBild; } int ZeichnungHintergrund::getHintergrundFarbe() const // returns the background color { return hintergrundFarbe; } AlphaFeld* ZeichnungHintergrund::getAlphaFeld() const // returns the background buffer { if (!hintergrundFeld) return 0; return dynamic_cast(hintergrundFeld->getThis()); } AlphaFeld* ZeichnungHintergrund::zAlphaFeld() const // returns the background buffer without increased reference counter { return hintergrundFeld; } int ZeichnungHintergrund::getAlphaFeldStrength() const // returns the strength of the background buffer { if (!hintergrundFeld) return 0; return hintergrundFeld->getStrength(); } int ZeichnungHintergrund::getAlphaFeldFarbe() const // returns the color of the background buffer { return hintergrundFeld->getFarbe(); } Rahmen* ZeichnungHintergrund::getRahmen() const // returns the border { if (!rahmen) return 0; return dynamic_cast(rahmen->getThis()); } Rahmen* ZeichnungHintergrund::zRahmen() const // returns the border without increased reference counter { return rahmen; } int ZeichnungHintergrund::getRahmenBreite() const // returns the border width { if (!rahmen || hatStyleNicht(Style::Rahmen)) return 0; return rahmen->getRBreite(); } int ZeichnungHintergrund::getRahmenFarbe() const // returns the border color { return rahmen->getFarbe(); } int ZeichnungHintergrund::getVertikalKlickScroll() const { return vertikalScrollBar ? vertikalScrollBar->getKlickScroll() : 0; } int ZeichnungHintergrund::getVertikalScrollPos() const { return vertikalScrollBar ? vertikalScrollBar->getScroll() : 0; } int ZeichnungHintergrund::getVertikalScrollFarbe() const { return vertikalScrollBar ? vertikalScrollBar->getFarbe() : 0; } int ZeichnungHintergrund::getVertikalScrollHintergrund() const { return vertikalScrollBar ? vertikalScrollBar->getBgFarbe() : 0; } int ZeichnungHintergrund::getHorizontalKlickScroll() const { return horizontalScrollBar ? horizontalScrollBar->getKlickScroll() : 0; } int ZeichnungHintergrund::getHorizontalScrollPos() const { return horizontalScrollBar ? horizontalScrollBar->getScroll() : 0; } int ZeichnungHintergrund::getHorizontalScrollFarbe() const { return horizontalScrollBar ? horizontalScrollBar->getFarbe() : 0; } int ZeichnungHintergrund::getHorizontalScrollHintergrund() const { return horizontalScrollBar ? horizontalScrollBar->getBgFarbe() : 0; } Zeichnung* ZeichnungHintergrund::dublizieren() const // Creates a copy of the drawing { ZeichnungHintergrund* obj = new ZeichnungHintergrund(); 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); obj->setHintergrundFarbe(hintergrundFarbe); if (hintergrundFeld) obj->setAlphaFeldZ((AlphaFeld*)hintergrundFeld->dublizieren()); if (rahmen) obj->setRahmenZ((Rahmen*)rahmen->dublizieren()); if (hintergrundBild) obj->setHintergrundBild( dynamic_cast(hintergrundBild->getThis())); if (vertikalScrollBar) { obj->setVertikalKlickScroll(vertikalScrollBar->getKlickScroll()); obj->setVertikalScrollPos(vertikalScrollBar->getScroll()); obj->setVertikalScrollFarbe( vertikalScrollBar->getFarbe(), vertikalScrollBar->getBgFarbe()); } if (horizontalScrollBar) { obj->setHorizontalKlickScroll(horizontalScrollBar->getKlickScroll()); obj->setHorizontalScrollPos(horizontalScrollBar->getScroll()); obj->setHorizontalScrollFarbe( horizontalScrollBar->getFarbe(), horizontalScrollBar->getBgFarbe()); } return obj; }