123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- #include "Rahmen.h"
- #include "Bild.h"
- #include "Punkt.h"
- #include "Scroll.h"
- #include "Text.h"
- #include "ToolTip.h"
- using namespace Framework;
- // Inhalt der Rahmen Klasse aus Rahmen.h
- // Konstruktor
- Rahmen::Rahmen()
- : Zeichnung(),
- br(1),
- farbe(0xFF000000),
- alpha(0),
- breaks(0)
- {}
- // Destruktor
- Rahmen::~Rahmen() {}
- // nicht constant
- void Rahmen::setRamenBreite(int br) // setzt die Breite des Rahmens
- {
- this->br = br;
- rend = 1;
- }
- // wenn dieser Flag gesetzt wird, wird der Rahmen gestrichelt gezeichnet
- // br: 1 -> gestrichelt, 0 -> durchgehend
- void Rahmen::setBreaks(bool br, int brOff, int brLength, int lineLength)
- {
- breaks = br;
- breakOffset = brOff;
- breakLength = brLength;
- this->lineLength = lineLength;
- rend = 1;
- }
- void Rahmen::setAlpha(
- bool a) // Legt fest, ob der Alphawert der Farbe berücksichtigt werden soll
- {
- alpha = a;
- rend = 1;
- }
- void Rahmen::setFarbe(int f) // Legt die Farbe des Rahmens fest
- {
- farbe = f;
- rend = 1;
- }
- int Rahmen::getFarbe() const // Gibt die Farbe des Ramens zurück
- {
- return farbe;
- }
- bool Rahmen::hatAlpha()
- const // Gibt zurück, ob der Alphawert der Farbe beachtet wird
- {
- return alpha;
- }
- int Rahmen::getRBreite() const // Gibt die Breite des Rahmens zurück
- {
- return br;
- }
- // Gibt 1 zurück, falls der Rahmen gestrichelt gezeichnet wird
- bool Rahmen::hasBreaks() const
- {
- return breaks;
- }
- // startpunkt des ersten linienabschnittes
- int Rahmen::getBreakOffset() const
- {
- return breakOffset;
- }
- // länge einer lücke
- int Rahmen::getBreakLength() const
- {
- return breakLength;
- }
- // länge einer linie
- int Rahmen::getLineLength() const
- {
- return lineLength;
- }
- // Inhalt der LRahmen Klasse aus Rahmen.h
- // Konstruktor
- LRahmen::LRahmen()
- : Rahmen()
- {}
- // Destruktor
- LRahmen::~LRahmen() {}
- void LRahmen::render(Bild& Obj) // Zeichnet den Rahmen in das RenderZeichnung
- {
- Zeichnung::render(Obj);
- int x = 0;
- int y = 0;
- int b = gr.x - 1;
- int h = gr.y - 1;
- if (!Obj.setDrawOptions(pos.x, pos.y, gr.x, gr.y)) return;
- if (!breaks)
- {
- if (alpha)
- {
- for (int i = 0; i < br; ++i)
- {
- Obj.drawLinieHAlpha(x + i + 1, y + i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieVAlpha(b - i, y + i + 1, gr.y - i * 2 - 2, farbe);
- Obj.drawLinieHAlpha(x + i + 1, h - i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieVAlpha(x + i, y + i, gr.y - i * 2, farbe);
- }
- }
- else
- {
- for (int i = 0; i < br; ++i)
- {
- Obj.drawLinieH(x + i + 1, y + i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieV(b - i, y + i + 1, gr.y - i * 2 - 2, farbe);
- Obj.drawLinieH(x + i + 1, h - i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieV(x + i, y + i, gr.y - i * 2, farbe);
- }
- }
- }
- else
- {
- if (alpha)
- {
- for (int i = 0; i < br; ++i)
- {
- for (int x = breakOffset; x < gr.x;
- x += lineLength + breakLength)
- Obj.drawLinieHAlpha(x + i + 1,
- y + i,
- lineLength
- - (x + i + 1 + lineLength > gr.x - i - 1
- ? gr.x - i - 1 - (x + i + 1 + lineLength)
- : 0),
- farbe);
- for (int x = gr.x - breakOffset - lineLength; x >= 0;
- x -= lineLength + breakLength)
- Obj.drawLinieHAlpha(MAX(x + i + 1, i + 1),
- h - i,
- lineLength
- - (x + i + 1 < i + 1 ? i + 1 - (x + i + 1) : 0),
- farbe);
- for (int y = breakOffset; y < gr.y;
- y += lineLength + breakLength)
- Obj.drawLinieVAlpha(b - i,
- y + i + 1,
- lineLength
- - (y + i + 1 + lineLength > gr.y - i - 1
- ? gr.y - i - 1 - (y + i + 1 + lineLength)
- : 0),
- farbe);
- for (int y = gr.y - breakOffset - lineLength; y >= 0;
- y -= lineLength + breakLength)
- Obj.drawLinieVAlpha(x + i,
- MAX(y + i, i),
- lineLength - (y + i < i ? i - (y + i) : 0),
- farbe);
- }
- }
- else
- {
- for (int i = 0; i < br; ++i)
- {
- for (int x = breakOffset; x < gr.x;
- x += lineLength + breakLength)
- Obj.drawLinieH(x + i + 1,
- y + i,
- lineLength
- - (x + i + 1 + lineLength > gr.x - i - 1
- ? gr.x - i - 1 - (x + i + 1 + lineLength)
- : 0),
- farbe);
- for (int x = gr.x - breakOffset - lineLength; x >= 0;
- x -= lineLength + breakLength)
- Obj.drawLinieH(MAX(x + i + 1, i + 1),
- h - i,
- lineLength
- - (x + i + 1 < i + 1 ? i + 1 - (x + i + 1) : 0),
- farbe);
- for (int y = breakOffset; y < gr.y;
- y += lineLength + breakLength)
- Obj.drawLinieV(b - i,
- y + i + 1,
- lineLength
- - (y + i + 1 + lineLength > gr.y - i - 1
- ? gr.y - i - 1 - (y + i + 1 + lineLength)
- : 0),
- farbe);
- for (int y = gr.y - breakOffset - lineLength; y >= 0;
- y -= lineLength + breakLength)
- Obj.drawLinieV(x + i,
- MAX(y + i, i),
- lineLength - (y + i < i ? i - (y + i) : 0),
- farbe);
- }
- }
- }
- Obj.releaseDrawOptions();
- }
- Zeichnung* LRahmen::dublizieren() const // Kopiert das Zeichnung
- {
- Rahmen* obj = new LRahmen();
- 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->setBreaks(breaks);
- obj->setAlpha(alpha);
- obj->setFarbe(farbe);
- obj->setRamenBreite(br);
- return obj;
- }
- // Inhalt der Rahmen3D Klasse aus Rahmen.h
- // Konstruktor
- Rahmen3D::Rahmen3D()
- : Rahmen()
- {
- alpha = 1;
- farbe = 0x70FFFFFF;
- br = 5;
- }
- // Destruktor
- Rahmen3D::~Rahmen3D() {}
- void Rahmen3D::render(Bild& Obj) // Zeichnet den Rahmen in das RenderZeichnung
- {
- Zeichnung::render(Obj);
- int x = 0;
- int y = 0;
- int b = gr.x - 1;
- int h = gr.y - 1;
- int fcomp = (farbe & 0xFF000000) | (~farbe & 0x00FFFFFF);
- if (!Obj.setDrawOptions(pos.x, pos.y, gr.x, gr.y)) return;
- if (!breaks)
- {
- if (alpha)
- {
- for (int i = 0; i < br; ++i)
- {
- Obj.drawLinieHAlpha(x + i + 1, y + i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieVAlpha(b - i, y + i + 1, gr.y - i * 2 - 2, farbe);
- Obj.drawLinieHAlpha(x + i + 1, h - i, gr.x - i * 2 - 1, fcomp);
- Obj.drawLinieVAlpha(x + i, y + i, gr.y - i * 2, fcomp);
- }
- }
- else
- {
- for (int i = 0; i < br; ++i)
- {
- Obj.drawLinieH(x + i + 1, y + i, gr.x - i * 2 - 1, farbe);
- Obj.drawLinieV(b - i, y + i + 1, gr.y - i * 2 - 2, farbe);
- Obj.drawLinieH(x + i + 1, h - i, gr.x - i * 2 - 1, fcomp);
- Obj.drawLinieV(x + i, y + i, gr.y - i * 2, fcomp);
- }
- }
- }
- else
- {
- if (alpha)
- {
- for (int i = 0; i < br; ++i)
- {
- for (int x = breakOffset; x < gr.x;
- x += lineLength + breakLength)
- Obj.drawLinieHAlpha(x + i + 1,
- y + i,
- lineLength
- - (x + i + 1 + lineLength > gr.x - i - 1
- ? gr.x - i - 1 - (x + i + 1 + lineLength)
- : 0),
- farbe);
- for (int x = gr.x - breakOffset - lineLength; x >= 0;
- x -= lineLength + breakLength)
- Obj.drawLinieHAlpha(MAX(x + i + 1, i + 1),
- h - i,
- lineLength
- - (x + i + 1 < i + 1 ? i + 1 - (x + i + 1) : 0),
- fcomp);
- for (int y = breakOffset; y < gr.y;
- y += lineLength + breakLength)
- Obj.drawLinieVAlpha(b - i,
- y + i + 1,
- lineLength
- - (y + i + 1 + lineLength > gr.y - i - 1
- ? gr.y - i - 1 - (y + i + 1 + lineLength)
- : 0),
- farbe);
- for (int y = gr.y - breakOffset - lineLength; y >= 0;
- y -= lineLength + breakLength)
- Obj.drawLinieVAlpha(x + i,
- MAX(y + i, i),
- lineLength - (y + i < i ? i - (y + i) : 0),
- fcomp);
- }
- }
- else
- {
- for (int i = 0; i < br; ++i)
- {
- for (int x = breakOffset; x < gr.x;
- x += lineLength + breakLength)
- Obj.drawLinieH(x + i + 1,
- y + i,
- lineLength
- - (x + i + 1 + lineLength > gr.x - i - 1
- ? gr.x - i - 1 - (x + i + 1 + lineLength)
- : 0),
- farbe);
- for (int x = gr.x - breakOffset - lineLength; x >= 0;
- x -= lineLength + breakLength)
- Obj.drawLinieH(MAX(x + i + 1, i + 1),
- h - i,
- lineLength
- - (x + i + 1 < i + 1 ? i + 1 - (x + i + 1) : 0),
- fcomp);
- for (int y = breakOffset; y < gr.y;
- y += lineLength + breakLength)
- Obj.drawLinieV(b - i,
- y + i + 1,
- lineLength
- - (y + i + 1 + lineLength > gr.y - i - 1
- ? gr.y - i - 1 - (y + i + 1 + lineLength)
- : 0),
- farbe);
- for (int y = gr.y - breakOffset - lineLength; y >= 0;
- y -= lineLength + breakLength)
- Obj.drawLinieV(x + i,
- MAX(y + i, i),
- lineLength - (y + i < i ? i - (y + i) : 0),
- fcomp);
- }
- }
- }
- Obj.releaseDrawOptions();
- }
- Zeichnung* Rahmen3D::dublizieren() const // Kopiert das Zeichnung
- {
- Rahmen* obj = new Rahmen3D();
- 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->setBreaks(breaks);
- obj->setAlpha(alpha);
- obj->setFarbe(farbe);
- obj->setRamenBreite(br);
- return obj;
- }
|