Add Show Image menu item and functionality.
authorsls <sls>
Wed, 21 Jun 1995 09:22:07 +0000 (09:22 +0000)
committersls <sls>
Wed, 21 Jun 1995 09:22:07 +0000 (09:22 +0000)
images_list.tcl

index 1cc0e3b903406e1bb2af96451242e55ec53c19dc..95e2abdd58664c1e3cb91d31233a0b4c75e8bdb9 100644 (file)
@@ -7,6 +7,12 @@
 widget images_list {
     object_include tkinspect_list
     param title "Images"
+    method create {} {
+       tkinspect_list:create $self
+       $slot(menu) add separator
+       $slot(menu) add command -label "Show Image" -underline 5 \
+           -command "$self show_image"
+    }
     method get_item_name {} { return image }
     method update {target} {
        $self clear
@@ -28,4 +34,26 @@ widget images_list {
     method send_filter {value} {
        return $value
     }
+    method show_image {} {
+       set target [$slot(main) target]
+       if ![string length $slot(current_item)] {
+           tkinspect_failure \
+            "No image has been selected.  Please select one first."
+       }
+       if ![send $target info exists __tkinspect_image_counter__] {
+           send $target set __tkinspect_image_counter__ 0
+       }
+       while {[send $target winfo exists .tkinspect_image\$__tkinspect_image_counter__]} {
+           send $target incr __tkinspect_image_counter__
+       }
+       set w .tkinspect_image[send $target set __tkinspect_image_counter__]
+       send $target [subst {
+           toplevel $w
+           button $w.close -text "Close $slot(current_item)" \
+               -command "destroy $w"
+           label $w.img -image $slot(current_item)
+           pack $w.close $w.img -side top
+           wm title $w "tkinspect $slot(current_item)"
+       }]
+    }
 }