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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [itk/] [examples/] [Info.itk] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# ----------------------------------------------------------------------
2
#  EXAMPLE: info dialog box (Toplevel widget)
3
# ----------------------------------------------------------------------
4
#  COURSE:  Object-Oriented Programming with [incr Tcl]
5
#  AUTHOR:  Michael J. McLennan, Bell Labs Innovations
6
# ======================================================================
7
#               Copyright (c) 1996  Lucent Technologies
8
# ======================================================================
9
 
10
option add *Info.title "Info" widgetDefault
11
 
12
class Info {
13
    inherit itk::Toplevel
14
 
15
    constructor {args} {
16
        itk_component add dismiss {
17
            button $itk_interior.dismiss -text "Dismiss" \
18
                -command "destroy $itk_component(hull)"
19
        }
20
        pack $itk_component(dismiss) -side bottom -pady 4
21
 
22
        itk_component add separator {
23
            frame $itk_interior.sep -height 2 -borderwidth 1 -relief sunken
24
        }
25
        pack $itk_component(separator) -side bottom -fill x -padx 4
26
 
27
        itk_component add icon {
28
            label $itk_interior.icon -bitmap info
29
        }
30
        pack $itk_component(icon) -side left -padx 8 -pady 8
31
 
32
        itk_component add infoFrame {
33
            frame $itk_interior.info
34
        }
35
        pack $itk_component(infoFrame) -side left -expand yes \
36
            -fill both -padx 4 -pady 4
37
 
38
        set itk_interior $itk_component(infoFrame)
39
 
40
        eval itk_initialize $args
41
 
42
        after idle [code $this centerOnScreen]
43
    }
44
 
45
    protected method centerOnScreen {} {
46
        update idletasks
47
        set wd [winfo reqwidth $itk_component(hull)]
48
        set ht [winfo reqheight $itk_component(hull)]
49
        set x [expr ([winfo screenwidth $itk_component(hull)]-$wd)/2]
50
        set y [expr ([winfo screenheight $itk_component(hull)]-$ht)/2]
51
        wm geometry $itk_component(hull) +$x+$y
52
    }
53
}
54
 
55
usual Info {
56
    keep -background -cursor -foreground -font
57
    keep -activebackground -activeforeground -disabledforeground
58
    keep -highlightcolor -highlightthickness
59
}

powered by: WebSVN 2.1.0

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