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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [itcl/] [itk/] [doc/] [Toplevel.n] - Blame information for rev 1782

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

Line No. Rev Author Line
1 578 markom
'\"
2
'\" Copyright (c) 1993-1998  Lucent Technologies, Inc.
3
'\"
4
'\" See the file "license.terms" for information on usage and redistribution
5
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6
'\"
7
'\" RCS: $Id: Toplevel.n,v 1.1.1.1 2002-01-16 10:24:47 markom Exp $
8
'\"
9
.so man.macros
10
.TH Toplevel n 3.0 itk "[incr\ Tk]"
11
.BS
12
'\" Note:  do not modify the .SH NAME line immediately below!
13
.SH NAME
14
Toplevel \- base class for mega-widgets in a top-level window
15
.SH "INHERITANCE"
16
itk::Archetype <- itk::Toplevel
17
.SH "STANDARD OPTIONS"
18
.LP
19
.nf
20
.ta 4c 8c 12c
21
\fBbackground\fR        \fBcursor\fR
22
.fi
23
.LP
24
See the "options" manual entry for details on the standard options.
25
.SH "WIDGET-SPECIFIC OPTIONS"
26
.LP
27
.nf
28
Name:   \fBtitle\fR
29
Class:  \fBTitle\fR
30
Command-Line Switch:    \fB-title\fR
31
.fi
32
.IP
33
Sets the title that the window manager displays in the title bar
34
above the window.  The default title is the null string.
35
.BE
36
 
37
.SH DESCRIPTION
38
.PP
39
The \fBToplevel\fR class inherits everything from the \fBArchetype\fR
40
class, and adds a Tk toplevel called the "hull" component to represent
41
the body of the mega-widget.  The window class name for the hull
42
is set to the most-specific class name for the mega-widget.
43
The protected variable \fBitk_interior\fR contains the window
44
path name for the "hull" component.  Derived classes specialize
45
this widget by packing other widget components into the hull.
46
.PP
47
Since the hull for the \fBToplevel\fR class is implemented with
48
a Tk toplevel, mega-widgets in the \fBToplevel\fR class have
49
their own toplevel window.  This class is used to create dialog
50
boxes and other pop-up windows.
51
 
52
.SH "COMPONENTS"
53
.LP
54
.nf
55
Name:   \fBhull\fR
56
Class:  \fBToplevel\fR
57
.fi
58
.IP
59
The "hull" component acts as the body for the entire mega-widget.
60
Other components are packed into the hull to further specialize
61
the widget.
62
 
63
.SH EXAMPLE
64
.PP
65
The following example implements a \fBMessageInfo\fR
66
mega-widget.  It creates a pop-up message that the
67
user can dismiss by pushing the "Dismiss" button.
68
.CS
69
option add *MessageInfo.title "Notice" widgetDefault
70
 
71
class MessageInfo {
72
    inherit itk::Toplevel
73
 
74
    constructor {args} {
75
        itk_component add dismiss {
76
            button $itk_interior.dismiss -text "Dismiss" \
77
                -command "destroy $itk_component(hull)"
78
        }
79
        pack $itk_component(dismiss) -side bottom -pady 4
80
 
81
        itk_component add separator {
82
            frame $itk_interior.sep -height 2 -borderwidth 1 -relief sunken
83
        }
84
        pack $itk_component(separator) -side bottom -fill x -padx 4
85
 
86
        itk_component add icon {
87
            label $itk_interior.icon -bitmap info
88
        }
89
        pack $itk_component(icon) -side left -padx 8 -pady 8
90
 
91
        itk_component add infoFrame {
92
            frame $itk_interior.info
93
        }
94
        pack $itk_component(infoFrame) -side left -expand yes \
95
            -fill both -padx 4 -pady 4
96
 
97
        itk_component add message {
98
            label $itk_interior.mesg -width 20
99
        } {
100
            usual
101
            rename -text -message message Text
102
        }
103
        pack $itk_component(message) -expand yes -fill both
104
 
105
        eval itk_initialize $args
106
 
107
        after idle [code $this centerOnScreen]
108
    }
109
 
110
    protected method centerOnScreen {} {
111
        update idletasks
112
        set wd [winfo reqwidth $itk_component(hull)]
113
        set ht [winfo reqheight $itk_component(hull)]
114
        set x [expr ([winfo screenwidth $itk_component(hull)]-$wd)/2]
115
        set y [expr ([winfo screenheight $itk_component(hull)]-$ht)/2]
116
        wm geometry $itk_component(hull) +$x+$y
117
    }
118
}
119
 
120
usual MessageInfo {
121
    keep -background -cursor -foreground -font
122
    keep -activebackground -activeforeground -disabledforeground
123
    keep -highlightcolor -highlightthickness
124
}
125
 
126
#
127
# EXAMPLE:  Create a notice window:
128
#
129
MessageInfo .m -message "File not found:\\n/usr/local/bin/foo"
130
.CE
131
 
132
.SH KEYWORDS
133
itk, Archetype, Widget, mega-widget

powered by: WebSVN 2.1.0

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