/usr/share/tcltk/iwidgets4.1.0/scripts/mainwindow.itk is in iwidgets4 4.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 | #
# Mainwindow
# ----------------------------------------------------------------------
# This class implements a mainwindow containing a menubar, toolbar,
# mousebar, childsite, status line, and help line. Each item may
# be filled and configured to suit individual needs.
#
# ----------------------------------------------------------------------
# AUTHOR: Mark L. Ulferts EMAIL: mulferts@austin.dsccc.com
#
# @(#) RCS: $Id: mainwindow.itk,v 1.2 2001/08/07 19:56:48 smithc Exp $
# ----------------------------------------------------------------------
# Copyright (c) 1997 DSC Technologies Corporation
# ======================================================================
# Permission to use, copy, modify, distribute and license this software
# and its documentation for any purpose, and without fee or written
# agreement with DSC, is hereby granted, provided that the above copyright
# notice appears in all copies and that both the copyright notice and
# warranty disclaimer below appear in supporting documentation, and that
# the names of DSC Technologies Corporation or DSC Communications
# Corporation not be used in advertising or publicity pertaining to the
# software without specific, written prior permission.
#
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
# SOFTWARE.
# ======================================================================
# ------------------------------------------------------------------
# MAINWINDOW
# ------------------------------------------------------------------
itcl::class iwidgets::Mainwindow {
inherit iwidgets::Shell
constructor {args} {}
itk_option define -helpline helpLine HelpLine 1
itk_option define -statusline statusLine StatusLine 1
public {
method childsite {}
method menubar {args}
method mousebar {args}
method msgd {args}
method toolbar {args}
}
protected {
method _exitCB {}
common _helpVar
common _statusVar
}
}
#
# Provide a lowercased access method for the ::iwidgets::Mainwindow class.
#
proc iwidgets::mainwindow {pathName args} {
uplevel ::iwidgets::Mainwindow $pathName $args
}
# ------------------------------------------------------------------
# CONSTRUCTOR
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::constructor {args} {
itk_option add hull.width hull.height
pack propagate $itk_component(hull) no
wm protocol $itk_component(hull) WM_DELETE_WINDOW [itcl::code $this _exitCB]
#
# Create a menubar, renaming the font, foreground, and background
# so they may be separately set. The help variable will be setup
# as well.
#
itk_component add menubar {
iwidgets::Menubar $itk_interior.menubar \
-helpvariable [itcl::scope _helpVar($this)]
} {
keep -disabledforeground -cursor \
-highlightbackground -highlightthickness
rename -font \
-menubarfont menuBarFont Font
rename -foreground \
-menubarforeground menuBarForeground Foreground
rename -background \
-menubarbackground menuBarBackground Background
}
#
# Add a toolbar beneath the menubar.
#
itk_component add toolbar {
iwidgets::Toolbar $itk_interior.toolbar -orient horizontal \
-helpvariable [itcl::scope _helpVar($this)]
} {
keep -balloonbackground -balloondelay1 -balloondelay2 \
-balloonfont -balloonforeground -disabledforeground -cursor \
-highlightbackground -highlightthickness
rename -font -toolbarfont toolbarFont Font
rename -foreground -toolbarforeground toolbarForeground Foreground
rename -background -toolbarbackground toolbarBackground Background
}
#
# Add a mouse bar on the left.
#
itk_component add mousebar {
iwidgets::Toolbar $itk_interior.mousebar -orient vertical \
-helpvariable [itcl::scope _helpVar($this)]
} {
keep -balloonbackground -balloondelay1 -balloondelay2 \
-balloonfont -balloonforeground -disabledforeground -cursor \
-highlightbackground -highlightthickness
rename -font -toolbarfont toolbarFont Font
rename -foreground -toolbarforeground toolbarForeground Foreground
rename -background -toolbarbackground toolbarBackground Background
}
#
# Create the childsite window window.
#
itk_component add -protected mwchildsite {
frame $itk_interior.mwchildsite
}
#
# Add the help and system status lines
#
itk_component add -protected lineframe {
frame $itk_interior.lineframe
}
itk_component add help {
label $itk_component(lineframe).help \
-textvariable [itcl::scope _helpVar($this)] \
-relief sunken -borderwidth 2 -width 10
}
itk_component add status {
label $itk_component(lineframe).status \
-textvariable [itcl::scope _statusVar($this)] \
-relief sunken -borderwidth 2 -width 10
}
#
# Create the message dialog for use throughout the mainwindow.
#
itk_component add msgd {
iwidgets::Messagedialog $itk_interior.msgd -modality application
} {
usual
ignore -modality
}
#
# Use the grid to pack together the menubar, toolbar, mousebar,
# childsite, and status area.
#
grid $itk_component(menubar) -row 0 -column 0 -columnspan 2 -sticky ew
grid $itk_component(toolbar) -row 1 -column 0 -columnspan 2 -sticky ew
grid $itk_component(mousebar) -row 2 -column 0 -sticky ns
grid $itk_component(mwchildsite) -row 2 -column 1 -sticky nsew \
-padx 5 -pady 5
grid $itk_component(lineframe) -row 3 -column 0 -columnspan 2 -sticky ew
grid columnconfigure $itk_interior 1 -weight 1
grid rowconfigure $itk_interior 2 -weight 1
#
# Set the interior to be the childsite for derived classes.
#
set itk_interior $itk_component(mwchildsite)
#
# Initialize all the configuration options.
#
eval itk_initialize $args
}
# ------------------------------------------------------------------
# OPTIONS
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# OPTION: -helpline
#
# Specifies whether or not to display the help line. The value
# may be given in any of the forms acceptable to Tk_GetBoolean.
# ------------------------------------------------------------------
itcl::configbody iwidgets::Mainwindow::helpline {
if {$itk_option(-helpline)} {
pack $itk_component(help) -side left -fill x -expand yes -padx 2
} else {
pack forget $itk_component(help)
}
}
# ------------------------------------------------------------------
# OPTION: -statusline
#
# Specifies whether or not to display the status line. The value
# may be given in any of the forms acceptable to Tk_GetBoolean.
# ------------------------------------------------------------------
itcl::configbody iwidgets::Mainwindow::statusline {
if {$itk_option(-statusline)} {
pack $itk_component(status) -side right -fill x -expand yes -padx 2
} else {
pack forget $itk_component(status)
}
}
# ------------------------------------------------------------------
# METHODS
# ------------------------------------------------------------------
# ------------------------------------------------------------------
# METHOD: childsite
#
# Return the childsite widget.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::childsite {} {
return $itk_component(mwchildsite)
}
# ------------------------------------------------------------------
# METHOD: menubar ?args?
#
# Evaluate the args against the Menubar component.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::menubar {args} {
if {[llength $args] == 0} {
return $itk_component(menubar)
} else {
return [eval $itk_component(menubar) $args]
}
}
# ------------------------------------------------------------------
# METHOD: toolbar ?args?
#
# Evaluate the args against the Toolbar component.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::toolbar {args} {
if {[llength $args] == 0} {
return $itk_component(toolbar)
} else {
return [eval $itk_component(toolbar) $args]
}
}
# ------------------------------------------------------------------
# METHOD: mousebar ?args?
#
# Evaluate the args against the Mousebar component.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::mousebar {args} {
if {[llength $args] == 0} {
return $itk_component(mousebar)
} else {
return [eval $itk_component(mousebar) $args]
}
}
# ------------------------------------------------------------------
# METHOD: msgd ?args?
#
# Evaluate the args against the Messagedialog component.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::msgd {args} {
if {[llength $args] == 0} {
return $itk_component(msgd)
} else {
return [eval $itk_component(msgd) $args]
}
}
# ------------------------------------------------------------------
# PRIVATE METHOD: _exitCB
#
# Menu callback for the exit option from the file menu. The method
# confirms the user's request to exit the application prior to
# taking the action.
# ------------------------------------------------------------------
itcl::body iwidgets::Mainwindow::_exitCB {} {
#
# Configure the message dialog for confirmation of the exit request.
#
msgd configure -title Confirmation -bitmap questhead \
-text "Exit confirmation\n\
Are you sure ?"
msgd buttonconfigure OK -text Yes
msgd buttonconfigure Cancel -text No
msgd default Cancel
msgd center $itk_component(hull)
#
# Activate the message dialog and given a positive response
# proceed to exit the application
#
if {[msgd activate]} {
::exit
}
}
|