3 # ----------------------------------------------------------------------
4 # Base class for ordinary widgets in the [incr Tk] Toolkit. Creates
5 # a frame to contain the widget. Derived classes add widgets and
6 # methods to specialize behavior.
11 # switch: -background .... normal background color for widget
15 # switch: -cursor ........ cursor used when pointer is inside
19 # ----------------------------------------------------------------------
20 # AUTHOR: Michael J. McLennan
21 # Bell Labs Innovations for Lucent Technologies
22 # mmclennan@lucent.com
23 # http://www.tcltk.com/itcl
26 # ----------------------------------------------------------------------
27 # Copyright (c) 1993-1998 Lucent Technologies, Inc.
28 # ======================================================================
29 # See the file "license.terms" for information on usage and
30 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
32 itcl::class itk::Widget {
33 inherit itk::Archetype
35 # ------------------------------------------------------------------
37 # ------------------------------------------------------------------
40 # Create a window with the same name as this object
42 set itk_hull [namespace tail $this]
43 set itk_interior $itk_hull
45 itk_component add hull {
46 frame $itk_hull -class [namespace tail [info class]]
48 keep -background -cursor
50 bind itk-delete-$itk_hull <Destroy> "itcl::delete object $this"
52 set tags [bindtags $itk_hull]
53 bindtags $itk_hull [linsert $tags 0 itk-delete-$itk_hull]
55 eval itk_initialize $args
59 if {[winfo exists $itk_hull]} {
60 set tags [bindtags $itk_hull]
61 set i [lsearch $tags itk-delete-$itk_hull]
63 bindtags $itk_hull [lreplace $tags $i $i]
67 itk_component delete hull
69 set components [component]
70 foreach component $components {
71 set path($component) [component $component]
73 foreach component $components {
74 if {[winfo exists $path($component)]} {
75 destroy $path($component)
80 private variable itk_hull ""