#------------------------------------------------------------------------ # Compagny : 4Js # Developper : PM # Program : $PROJET/objects/label.obj # Date : 12.10.1995 # Title : Description de la classe Label #------------------------------------------------------------------------ #====================================================================== Class Label { inherit TextWidget global Default #vars : public geo_text "" public geo_bitmap "" public geo_width $Default(Label,Width) public geo_height 0 ;#$Default(Label,Height) public geo_bg $Default(Label,Bg) public geo_relief $Default(Label,Relief) public geo_expand 1 #----------------------------------------------------------------------- constructor {config} { # set geo_text $this } method refresh { } { set cmd "" ;# Creation de la commande adaptee a l'objet !!! lappend cmd $geo_widget configure lappend cmd -bg $geo_bg lappend cmd -foreground $geo_fg lappend cmd -borderwidth $geo_borderwidth lappend cmd -relief $geo_relief lappend cmd -bitmap $geo_bitmap if { $geo_width != 0} { lappend cmd -width $geo_width } if { $geo_height != 0} { lappend cmd -height $geo_height } lappend cmd -text $geo_text eval $cmd #lappend cmd -padx $geo_padx #lappend cmd -pady $geo_pady } # ----------------------------------------------------------------------- # Define_Label : # This function is very important for the class. It is the Tk- # -Implantation for the application, for this object. # The use of an intermediate string instead of calling the widget command # directly, is necessary because of the use of 'width', wich is not # systematique, and then inopportune # Parameters: name of object # Returns: full path of the created widget #........................................................................ method define { } { # puts "Label::define called" set cmd "" ;# Creation de la commande adaptee a l'objet !!! lappend cmd label ${geo_root}w$int_name lappend cmd -bg $geo_bg lappend cmd -foreground $geo_fg lappend cmd -borderwidth $geo_borderwidth lappend cmd -relief $geo_relief lappend cmd -bitmap $geo_bitmap if {$geo_width != 0} { lappend cmd -width $geo_width } if {$geo_height != 0} { lappend cmd -height $geo_height } lappend cmd -text $geo_text set geo_widget [ eval $cmd ] } } # ======================================================================