1 # vim: foldmarker=<<<,>>> ft=tcl foldmethod=marker shiftwidth=4 ts=4
3 # Based on the itk::Toplevel class, with the addition of the -menu
4 # link to allow configuring the toplevel's menu
6 class tlc::Mytoplevel {
12 itk_option define -title title Title ""
20 configbody tlc::Mytoplevel::title { #<<<1
21 wm title $topw $itk_option(-title)
25 body tlc::Mytoplevel::constructor {args} { #<<<1
26 set itk_interior [namespace tail $this]
27 set topw $itk_interior
29 itk_component add hull {
30 toplevel $topw -class [namespace tail [info class]]
32 keep -background -cursor -takefocus -menu
34 bind tlc-delete-$topw <Destroy> [code itcl::delete object $this]
35 bindtags $topw [concat [list tlc-delete-$topw] [bindtags $topw]]
37 eval itk_initialize $args
41 body tlc::Mytoplevel::destructor {} { #<<<1
42 if {[winfo exists $topw]} {
43 set bindtags [bindtags $topw]
44 set idx [lsearch $bindtags tlc-delete-$topw]
46 bindtags $topw [lreplace $bindtags $idx $idx]