OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [tags/] [start/] [insight/] [itcl/] [itk/] [library/] [Toplevel.itk] - Blame information for rev 579

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
#
2
# itk::Toplevel
3
# ----------------------------------------------------------------------
4
# Base class for toplevel windows in the [incr Tk] Toolkit.  Creates
5
# a new toplevel window to contain the widget.  Derived classes add
6
# widgets and methods to specialize behavior.
7
#
8
#   WIDGET ATTRIBUTES:
9
#     switch:  -background .... normal background color for widget
10
#       name:  background
11
#      class:  Background
12
#
13
#     switch:  -cursor ........ cursor for widget
14
#       name:  cursor
15
#      class:  Cursor
16
#
17
#     switch:  -title ......... title given to window manager
18
#       name:  title
19
#      class:  Title
20
#
21
# ----------------------------------------------------------------------
22
#   AUTHOR:  Michael J. McLennan
23
#            Bell Labs Innovations for Lucent Technologies
24
#            mmclennan@lucent.com
25
#            http://www.tcltk.com/itcl
26
#
27
#      RCS:  $Id: Toplevel.itk,v 1.1.1.1 2002-01-16 10:24:47 markom Exp $
28
# ----------------------------------------------------------------------
29
#            Copyright (c) 1993-1998  Lucent Technologies, Inc.
30
# ======================================================================
31
# See the file "license.terms" for information on usage and
32
# redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
33
 
34
itcl::class itk::Toplevel {
35
    inherit itk::Archetype
36
 
37
    constructor {args} {
38
        #
39
        #  Create a toplevel window with the same name as this object
40
        #
41
        set itk_hull [namespace tail $this]
42
        set itk_interior $itk_hull
43
 
44
        itk_component add hull {
45
            toplevel $itk_hull -class [namespace tail [info class]]
46
        } {
47
            keep -background -cursor -takefocus
48
        }
49
        bind itk-delete-$itk_hull  "itcl::delete object $this"
50
 
51
        set tags [bindtags $itk_hull]
52
        bindtags $itk_hull [linsert $tags 0 itk-delete-$itk_hull]
53
 
54
        eval itk_initialize $args
55
    }
56
 
57
    destructor {
58
        if {[winfo exists $itk_hull]} {
59
            set tags [bindtags $itk_hull]
60
            set i [lsearch $tags itk-delete-$itk_hull]
61
            if {$i >= 0} {
62
                bindtags $itk_hull [lreplace $tags $i $i]
63
            }
64
            destroy $itk_hull
65
        }
66
    }
67
 
68
    itk_option define -title title Title "" {
69
        wm title $itk_hull $itk_option(-title)
70
    }
71
 
72
    private variable itk_hull ""
73
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.