#------------------------------------------------------------------------ # Compagny : 4Js # Developper : PM # Program : $PROJET/objects/menur.obj # Date : 04.07.1995 # Last modif. : 15.10.1995 # Title : Description d'un objet menu #------------------------------------------------------------------------ # Explications : # #====================================================================== # Rmenu : # Recursiv class of menu. # Parameters: geotype : toplevel or frame # lifetype : "permanent" if menu stays set, even after one # choose; or not. #...................................................................... Class Rmenu { inherit Frame global Default #vars : public geo_width 0 public geo_height 0 public geo_expand 1 public geo_int_expand 1 public geo_orientation "horizontal" # public geo_font $Default(Res,Menu_Font) #application vars : # public int_geotype $geotype ;# no more needed public int_invalid_size 0 ;# 0 if no public int_lifetype "permanent" ;# permanent or not public int_soons "members" public int_members "" ;# list of command button constructor { config } {} destructor { # puts "Rmenu::destructor, come in for $this" } method config {config} {} #----------------------------------------------------------------------- # Define_Rmenu : # This function defines a one-level menu. # Parameters: name of object # Returns: the list of objects defined. #........................................................................ method define { } { global Default #puts "Define_Rmenu:" Frame::define foreach entity $int_members { $entity config -int_geoman "pack_it" \ -int_parent $this \ -geo_expand $geo_int_expand \ -geo_padx $geo_int_padx \ -geo_pady $geo_int_pady if {$int_invalid_size == 0 } { if {[$entity getPub -geo_bitmap] == "" } { $entity config -geo_width $Default(Button,TWidth) \ -geo_height $Default(Button,THeight) } else { $entity config -geo_width $Default(Button,BWidth) \ -geo_height $Default(Button,BHeight) } } else { $entity config -geo_width 0 \ -geo_height 0 } if { $int_lifetype != "permanent" } { # See what is best... $entity config \ -int_command_bef "$this delete" # -int_command_bef "$this destroy" # -int_command_bef "$this clear" } if { $geo_orientation == "horizontal" } { $entity config -geo_attach "left" \ -geo_fill "none" } else { $entity config -geo_attach "top" \ -geo_fill "x" } } } #----------------------------------------------------------------------- # Add_Member_Rmenu : # This function adds a new menu point to the chose # Parameters: name of object # Returns: nothing, but work well. #........................................................................ method add_member { member label methode } { global Default Button $member \ -int_command $methode \ -geo_text $label lappend int_members $member # puts "Rmenu: received label $label" } #----------------------------------------------------------------------- # Refresh_Rmenu : # This function defines a one-level menu. # Not used because is the same as Define_Rmenu # Parameters: name of object # Returns: the list of objects defined. #........................................................................ method refresh { } { global Default Frame::refresh foreach entity $int_members { $entity config -int_geoman "pack_it" \ -int_parent $this \ -geo_expand $geo_int_expand \ -geo_padx $geo_int_padx \ -geo_pady $geo_int_pady if {$int_invalid_size == 0 } { if {[$entity getPub -geo_bitmap] == "" } { $entity config -geo_width $Default(Button,TWidth) \ -geo_height $Default(Button,THeight) } else { $entity config -geo_width $Default(Button,BWidth) \ -geo_height $Default(Button,BHeight) } } else { $entity config -geo_width 0 \ -geo_height 0 } if { $int_lifetype != "permanent" } { # See what is best... $entity config \ -int_command_bef "$this delete" # -int_command_bef "$this destroy" # -int_command_bef "$this clear" } if { $geo_orientation == "horizontal" } { $entity config -geo_attach "left" \ -geo_fill "none" } else { $entity config -geo_attach "top" \ -geo_fill "x" } } } } ;# end of class Rmenu #----------------------------------------------------------------------- # ======================================================================