# -*-Perl-*- # dumb spacer # instances allowed: multiple package MGMmodule::spacer; use Tk; use vars qw($stack); # called once to initialize the module. The xpath here is a Class. sub module_init{ my$this=shift; my$toplevel=$this->{"toplevel"}; my$xclass=$this->{"xclass"}; $toplevel->optionAdd("$xclass.order", '99,199',20); $stack=$toplevel->optionGet("stack",""); $this; } # called to build an instance. The xpath here is a name path. sub module_instance{ my$this=shift; my$widget=$this->{"widget"}; my$toplevel=$this->{"toplevel"}; my$xpath=$this->{"xpath"}; $toplevel->optionAdd("$xpath.relief", 'sunken' ,21); $toplevel->optionAdd("$xpath.background",'#27536c' ,21); $toplevel->optionAdd("$xpath.borderwidth", 1 ,21); $toplevel->optionAdd("$xpath.thickness", 1 ,21); $toplevel->optionAdd("$xpath.scalewidadj", 20,21); $toplevel->optionAdd("$xpath.scalelenadj", 50,21); $toplevel->optionAdd("$xpath.scalejustify", 0,20); #centered $toplevel->optionAdd("$xpath.minx", 10,21); # safe $toplevel->optionAdd("$xpath.miny", 10,21); # safe $this->{"relief"}=$widget->optionGet("relief",''); my$border=$this->{"border"}=$widget->optionGet("borderwidth",''); my$thick=$this->{"thick"}=$widget->optionGet("thickness",''); $toplevel->optionAdd("$xpath.minx", $border*2+$thick,21); # safe $toplevel->optionAdd("$xpath.miny", $border*2+$thick,21); # safe $this; } sub module_run{ my$this=shift; my$width=$this->{"width"}; my$height=$this->{"height"}; my$toplevel=$this->{"toplevel"}; my$border=$this->{"border"}; my$thick=$this->{"thick"}; my$mainback=$toplevel->optionGet("background",""); my$widget=$toplevel->Frame(-class=>$this->{"name"}, Name=>$this->{"sequence"}, -width=>$width, -height=>$height, -borderwidth=>0, -highlightthickness=>0, -background=>$mainback); my$back=$widget->optionGet("background",""); if($stack eq 'vertical'){ my$pad=($height-$thick-$border*2)/2; $widget->Frame(-highlightthickness=>0, -borderwidth=>$border, -relief=>$this->{"relief"}, -width=>$width, -height=>$border*2+$thick, -background=>$back)->place('-x'=>0,'-y'=>$pad, -anchor=>'nw'); }else{ my$pad=($width-$thick-$border*2)/2; $widget->Frame(-highlightthickness=>0, -borderwidth=>$border, -relief=>$this->{"relief"}, -width=>$border*2+$thick, -height=>$height, -background=>$back)->place('-x'=>$pad,'-y'=>0, -anchor=>'nw'); } $widget; } bless {};