Added -justify left to hoverbox internal label
[tcl-tlc.git] / scripts / mytoplevel.itk
blob03d9b976ded480a07f15a537d58623c6f778c5d7
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 {
7         inherit itk::Archetype
9         constructor {args} {}
10         destructor {}
12         itk_option define -title title Title ""
14         private {
15                 variable topw
16         }
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]]
31         } {
32                 keep -background -cursor -takefocus -menu
33         }
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]
45                 if {$idx != -1} {
46                         bindtags $topw [lreplace $bindtags $idx $idx]
47                 }
48                 destroy $topw
49         }