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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [itk/] [library/] [Widget.itk] - Blame information for rev 1771

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

Line No. Rev Author Line
1 578 markom
#
2
# itk::Widget
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.
7
#
8
#   METHODS:
9
#
10
#   WIDGET ATTRIBUTES:
11
#     switch:  -background .... normal background color for widget
12
#       name:  background
13
#      class:  Background
14
#
15
#     switch:  -cursor ........ cursor used when pointer is inside
16
#       name:  cursur           widget
17
#      class:  Cursur
18
#
19
# ----------------------------------------------------------------------
20
#   AUTHOR:  Michael J. McLennan
21
#            Bell Labs Innovations for Lucent Technologies
22
#            mmclennan@lucent.com
23
#            http://www.tcltk.com/itcl
24
#
25
#      RCS:  $Id: Widget.itk,v 1.1.1.1 2002-01-16 10:24:47 markom Exp $
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.
31
 
32
itcl::class itk::Widget {
33
    inherit itk::Archetype
34
 
35
    # ------------------------------------------------------------------
36
    #  CONSTRUCTOR
37
    # ------------------------------------------------------------------
38
    constructor {args} {
39
        #
40
        #  Create a window with the same name as this object
41
        #
42
        set itk_hull [namespace tail $this]
43
        set itk_interior $itk_hull
44
 
45
        itk_component add hull {
46
            frame $itk_hull -class [namespace tail [info class]]
47
        } {
48
            keep -background -cursor
49
        }
50
        bind itk-delete-$itk_hull  "itcl::delete object $this"
51
 
52
        set tags [bindtags $itk_hull]
53
        bindtags $itk_hull [linsert $tags 0 itk-delete-$itk_hull]
54
 
55
        eval itk_initialize $args
56
    }
57
 
58
    destructor {
59
        if {[winfo exists $itk_hull]} {
60
            set tags [bindtags $itk_hull]
61
            set i [lsearch $tags itk-delete-$itk_hull]
62
            if {$i >= 0} {
63
                bindtags $itk_hull [lreplace $tags $i $i]
64
            }
65
            destroy $itk_hull
66
        }
67
    }
68
 
69
    private variable itk_hull ""
70
}

powered by: WebSVN 2.1.0

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