class KOMPLEX_KODIER_DEKORIERER inherit DEKORIERER redefine make, zeichne, verschiebe, is_text select make, zeichne, verschiebe end DEKORIERER rename make as d_make, zeichne as d_zeichne, verschiebe as d_verschiebe redefine is_text end creation make feature make(kompon:KOMPONENTE) is do d_make(kompon); set_name("Komplex-Kodier-Dekorierer"); set_color(red); setze_neue_koordinaten(komp.gib_x1r, komp.gib_y1r, komp.gib_x2r, komp.gib_y2r); if komp.is_text then text_kodieren(komp.gib_text); end; end; zeichne(dc:WEL_CLIENT_DC) is local text_komp:TEXT_KOMPONENTE; einfach:EINFACH_KODIER_DEKORIERER; hilftext:STRING; do hilftext:=clone(komp.gib_text); !!text_komp.make("test"); !!einfach.make(text_komp); if ((text_komp.same_type(komp))or(current.same_type(komp))or(einfach.same_type(komp))) then komp.set_text(text); end; d_zeichne(dc); if ((text_komp.same_type(komp))or(current.same_type(komp))or(einfach.same_type(komp))) then komp.set_text(hilftext); else rahmen_kodieren(dc); end; end; verschiebe(x1, y1:INTEGER) is do d_verschiebe(x1, y1); komplex_kodier_verschieben(x1, y1); end; is_text:BOOLEAN is do Result:=komp.is_text; end; feature {NONE} rahmen_kodieren (dc:WEL_CLIENT_DC) is local stift:WEL_PEN do !!stift.make_solid(1,komp_color); dc.select_pen(stift); dc.rectangle(x1r.rounded, y1r.rounded, x2r.rounded, y2r.rounded); stift.delete; end; text_kodieren (eingabe_text:STRING) is local hilftext:STRING; c:CHARACTER; i, hilfint:INTEGER; do from text:=clone(eingabe_text); hilftext:=""; i:=1; hilfint:=0; until i>text.count loop hilfint:=((text.item_code(i)-32+10)\\223)+32; c:=' '; c:=c+(hilfint-32); hilftext.append_character(c); i:=i+1; end; text:=clone(hilftext); end; komplex_kodier_verschieben(x1, y1:INTEGER) is do setze_neue_koordinaten(x1, y1, x1+(x2r-x1r).rounded,y1+(y2r-y1r).rounded); end; end -- class KOMPLEX_KODIER_DEKORIERER