1 |
578 |
markom |
#
|
2 |
|
|
# Messagedialog
|
3 |
|
|
# ----------------------------------------------------------------------
|
4 |
|
|
# Implements a message dialog composite widget. The Messagedialog is
|
5 |
|
|
# derived from the Dialog class and is composed of an image and text
|
6 |
|
|
# component. The image will accept both images as well as bitmaps.
|
7 |
|
|
# The text can extend mutliple lines by embedding newlines.
|
8 |
|
|
#
|
9 |
|
|
# ----------------------------------------------------------------------
|
10 |
|
|
# AUTHOR: Mark L. Ulferts EMAIL: mulferts@austin.dsccc.com
|
11 |
|
|
#
|
12 |
|
|
# @(#) $Id: messagedialog.itk,v 1.1.1.1 2002-01-16 10:24:50 markom Exp $
|
13 |
|
|
# ----------------------------------------------------------------------
|
14 |
|
|
# Copyright (c) 1995 DSC Technologies Corporation
|
15 |
|
|
# ======================================================================
|
16 |
|
|
# Permission to use, copy, modify, distribute and license this software
|
17 |
|
|
# and its documentation for any purpose, and without fee or written
|
18 |
|
|
# agreement with DSC, is hereby granted, provided that the above copyright
|
19 |
|
|
# notice appears in all copies and that both the copyright notice and
|
20 |
|
|
# warranty disclaimer below appear in supporting documentation, and that
|
21 |
|
|
# the names of DSC Technologies Corporation or DSC Communications
|
22 |
|
|
# Corporation not be used in advertising or publicity pertaining to the
|
23 |
|
|
# software without specific, written prior permission.
|
24 |
|
|
#
|
25 |
|
|
# DSC DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
26 |
|
|
# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, AND NON-
|
27 |
|
|
# INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND THE
|
28 |
|
|
# AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE MAINTENANCE,
|
29 |
|
|
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. IN NO EVENT SHALL
|
30 |
|
|
# DSC BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
31 |
|
|
# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
32 |
|
|
# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTUOUS ACTION,
|
33 |
|
|
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
34 |
|
|
# SOFTWARE.
|
35 |
|
|
# ======================================================================
|
36 |
|
|
|
37 |
|
|
#
|
38 |
|
|
# Usual options.
|
39 |
|
|
#
|
40 |
|
|
itk::usual Messagedialog {
|
41 |
|
|
keep -background -cursor -font -foreground -modality
|
42 |
|
|
}
|
43 |
|
|
|
44 |
|
|
# ------------------------------------------------------------------
|
45 |
|
|
# MESSAGEDIALOG
|
46 |
|
|
# ------------------------------------------------------------------
|
47 |
|
|
class iwidgets::Messagedialog {
|
48 |
|
|
inherit iwidgets::Dialog
|
49 |
|
|
|
50 |
|
|
constructor {args} {}
|
51 |
|
|
|
52 |
|
|
itk_option define -imagepos imagePos Position w
|
53 |
|
|
}
|
54 |
|
|
|
55 |
|
|
#
|
56 |
|
|
# Provide a lowercased access method for the Messagedialog class.
|
57 |
|
|
#
|
58 |
|
|
proc ::iwidgets::messagedialog {pathName args} {
|
59 |
|
|
uplevel ::iwidgets::Messagedialog $pathName $args
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
#
|
63 |
|
|
# Use option database to override default resources of base classes.
|
64 |
|
|
#
|
65 |
|
|
option add *Messagedialog.title "Message Dialog" widgetDefault
|
66 |
|
|
option add *Messagedialog.master "." widgetDefault
|
67 |
|
|
option add *Messagedialog.textPadX 20 widgetDefault
|
68 |
|
|
option add *Messagedialog.textPadY 20 widgetDefault
|
69 |
|
|
|
70 |
|
|
# ------------------------------------------------------------------
|
71 |
|
|
# CONSTRUCTOR
|
72 |
|
|
# ------------------------------------------------------------------
|
73 |
|
|
body iwidgets::Messagedialog::constructor {args} {
|
74 |
|
|
#
|
75 |
|
|
# Create the image component which may be either a bitmap or image.
|
76 |
|
|
#
|
77 |
|
|
itk_component add image {
|
78 |
|
|
label $itk_interior.image
|
79 |
|
|
} {
|
80 |
|
|
keep -background -bitmap -cursor -foreground -image
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
#
|
84 |
|
|
# Create the text message component. The message may extend over
|
85 |
|
|
# several lines by embedding '\n' characters.
|
86 |
|
|
#
|
87 |
|
|
itk_component add message {
|
88 |
|
|
label $itk_interior.message
|
89 |
|
|
} {
|
90 |
|
|
keep -background -cursor -font -foreground -text
|
91 |
|
|
|
92 |
|
|
rename -padx -textpadx textPadX Pad
|
93 |
|
|
rename -pady -textpady textPadY Pad
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
#
|
97 |
|
|
# Hide the apply and help buttons.
|
98 |
|
|
#
|
99 |
|
|
hide Apply
|
100 |
|
|
hide Help
|
101 |
|
|
|
102 |
|
|
#
|
103 |
|
|
# Initialize the widget based on the command line options.
|
104 |
|
|
#
|
105 |
|
|
eval itk_initialize $args
|
106 |
|
|
}
|
107 |
|
|
|
108 |
|
|
# ------------------------------------------------------------------
|
109 |
|
|
# OPTIONS
|
110 |
|
|
# ------------------------------------------------------------------
|
111 |
|
|
|
112 |
|
|
# ------------------------------------------------------------------
|
113 |
|
|
# OPTION: -imagepos
|
114 |
|
|
#
|
115 |
|
|
# Specifies the image position relative to the message: n, s,
|
116 |
|
|
# e, or w. The default is w.
|
117 |
|
|
# ------------------------------------------------------------------
|
118 |
|
|
configbody iwidgets::Messagedialog::imagepos {
|
119 |
|
|
switch $itk_option(-imagepos) {
|
120 |
|
|
n {
|
121 |
|
|
grid $itk_component(image) -row 0 -column 0
|
122 |
|
|
grid $itk_component(message) -row 1 -column 0
|
123 |
|
|
}
|
124 |
|
|
s {
|
125 |
|
|
grid $itk_component(message) -row 0 -column 0
|
126 |
|
|
grid $itk_component(image) -row 1 -column 0
|
127 |
|
|
}
|
128 |
|
|
e {
|
129 |
|
|
grid $itk_component(message) -row 0 -column 0
|
130 |
|
|
grid $itk_component(image) -row 0 -column 1
|
131 |
|
|
}
|
132 |
|
|
w {
|
133 |
|
|
grid $itk_component(image) -row 0 -column 0
|
134 |
|
|
grid $itk_component(message) -row 0 -column 1
|
135 |
|
|
}
|
136 |
|
|
|
137 |
|
|
default {
|
138 |
|
|
error "bad imagepos option \"$itk_option(-imagepos)\":\
|
139 |
|
|
should be n, e, s, or w"
|
140 |
|
|
}
|
141 |
|
|
}
|
142 |
|
|
}
|