1 |
578 |
markom |
#
|
2 |
|
|
# Dialog
|
3 |
|
|
# ----------------------------------------------------------------------
|
4 |
|
|
# Implements a standard dialog box providing standard buttons and a
|
5 |
|
|
# child site for use in derived classes. The buttons include ok, apply,
|
6 |
|
|
# cancel, and help. Options exist to configure the buttons.
|
7 |
|
|
#
|
8 |
|
|
# ----------------------------------------------------------------------
|
9 |
|
|
# AUTHOR: Mark L. Ulferts EMAIL: mulferts@austin.dsccc.com
|
10 |
|
|
#
|
11 |
|
|
# @(#) $Id: dialog.itk,v 1.1.1.1 2002-01-16 10:24:50 markom Exp $
|
12 |
|
|
# ----------------------------------------------------------------------
|
13 |
|
|
# Copyright (c) 1995 DSC Technologies Corporation
|
14 |
|
|
# ======================================================================
|
15 |
|
|
# Permission to use, copy, modify, distribute and license this software
|
16 |
|
|
# and its documentation for any purpose, and without fee or written
|
17 |
|
|
# agreement with DSC, is hereby granted, provided that the above copyright
|
18 |
|
|
# notice appears in all copies and that both the copyright notice and
|
19 |
|
|
# warranty disclaimer below appear in supporting documentation, and that
|
20 |
|
|
# the names of DSC Technologies Corporation or DSC Communications
|
21 |
|
|
# Corporation not be used in advertising or publicity pertaining to the
|
22 |
|
|
# software without specific, written prior permission.
|
23 |
|
|
#
|
24 |
|
|
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
25 |
|
|
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
|
26 |
|
|
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
|
27 |
|
|
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
28 |
|
|
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
|
29 |
|
|
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
30 |
|
|
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
31 |
|
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
|
32 |
|
|
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
33 |
|
|
# SOFTWARE.
|
34 |
|
|
# ======================================================================
|
35 |
|
|
|
36 |
|
|
#
|
37 |
|
|
# Usual options.
|
38 |
|
|
#
|
39 |
|
|
itk::usual Dialog {
|
40 |
|
|
keep -background -cursor -foreground -modality
|
41 |
|
|
}
|
42 |
|
|
|
43 |
|
|
# ------------------------------------------------------------------
|
44 |
|
|
# DIALOG
|
45 |
|
|
# ------------------------------------------------------------------
|
46 |
|
|
class iwidgets::Dialog {
|
47 |
|
|
inherit iwidgets::Dialogshell
|
48 |
|
|
|
49 |
|
|
constructor {args} {}
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
#
|
53 |
|
|
# Provide a lowercased access method for the Dialog class.
|
54 |
|
|
#
|
55 |
|
|
proc ::iwidgets::dialog {pathName args} {
|
56 |
|
|
uplevel ::iwidgets::Dialog $pathName $args
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
#
|
60 |
|
|
# Use option database to override default resources of base classes.
|
61 |
|
|
#
|
62 |
|
|
option add *Dialog.master "." widgetDefault
|
63 |
|
|
|
64 |
|
|
# ------------------------------------------------------------------
|
65 |
|
|
# CONSTRUCTOR
|
66 |
|
|
# ------------------------------------------------------------------
|
67 |
|
|
body iwidgets::Dialog::constructor {args} {
|
68 |
|
|
#
|
69 |
|
|
# Add the standard buttons: OK, Apply, Cancel, and Help, making
|
70 |
|
|
# OK be the default button.
|
71 |
|
|
#
|
72 |
|
|
add OK -text OK -command [code $this deactivate 1]
|
73 |
|
|
add Apply -text Apply
|
74 |
|
|
add Cancel -text Cancel -command [code $this deactivate 0]
|
75 |
|
|
add Help -text Help
|
76 |
|
|
|
77 |
|
|
default OK
|
78 |
|
|
|
79 |
|
|
#
|
80 |
|
|
# Bind the window manager delete protocol to invocation of the
|
81 |
|
|
# cancel button. This can be overridden by the user via the
|
82 |
|
|
# execution of a similar command outside the class.
|
83 |
|
|
#
|
84 |
|
|
wm protocol $itk_component(hull) WM_DELETE_WINDOW \
|
85 |
|
|
[code $this invoke Cancel]
|
86 |
|
|
|
87 |
|
|
#
|
88 |
|
|
# Initialize the widget based on the command line options.
|
89 |
|
|
#
|
90 |
|
|
eval itk_initialize $args
|
91 |
|
|
}
|
92 |
|
|
|