/button superclass /str //nullstring def /active true def /busy false def /defaulted false def /abbreviated false def %begin postscript section /str persist %end postscript section %begin postscript section /abreviated persist %end postscript section %begin postscript section /active persist %end postscript section %begin postscript section /defaulted persist %end postscript section /fixedheight true def /h //OLButtonH def /minwidth { % -- float preferredwidth } def /preferredheight { % -- float abbreviated //OLButH //OLButtonH ifelse } def /preferredwidth { % -- float abbreviated //OLButW { gsave textfont setfont str DISize pop //OLButtonCapW2 add 10 add grestore dup /preferredwidth exch promote } ifelse } def /action { % -- [str DIString] /Action self Send } def /path { % -- abbreviated { 0 0 //OLButW //OLButH } { 0 0 w //OLButtonH } ifelse rectpath } def /PaintLabel { % any -- FG setcolor textfont setfont justification /Centered eq { //OLButtonCapW 4 add 2 w //OLButtonCapW2 sub 8 sub //OLButtonH 4 sub DIPaintCentered } { //OLButtonCapW 4 add 2 w //OLButtonCapW2 sub 8 sub //OLButtonH 4 sub DIPaintLeft } ifelse } def /PaintDefaultRing { % -- w OLButtonDefault } def /PaintButton { % boolean -- abbreviated {OLBut} { dup w OLButton str PaintLabel not { defaulted} false ifelse {PaintDefaultRing} if } ifelse active not { BG setcolor path OLStipple } if } def /OnSelect { % -- busy not {active} false ifelse { //OnSelect exec } if } def /setlabel { % any -- /preferredwidth unpromote /str exch promote abbreviated not { /Paint gexec } if } def /setabbreviated { % boolean -- abbreviated 1 index ne { /abbreviated exch softpromote damage } {pop} ifelse } def /setdefaultchoice { % boolean -- defaulted 1 index ne { /defaulted exch softpromote abbreviated not { /Paint gexec } if } {pop} ifelse } def /setvisualstate { % name -- setvisualstate$SwiTch0 exch 2 copy known not { pop /$deFaUlT } if get exec } def /setvisualstate$SwiTch0 4 dict dup begin /$deFaUlT {} def /Inactive { active true {busy} ifelse { /busy unpromote /active false promote /Paint gexec } if } def /Busy { active not true { busy not } ifelse { /busy true promote /active unpromote /Paint gexec } if } def /Active { active not true {busy} ifelse { /busy unpromote /active unpromote /Paint gexec } if } def end def