0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
59
|
3 |
All Rights Reserved
|
0
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
InfoBox subclass:#WarningBox
|
|
14 |
instanceVariableNames:''
|
|
15 |
classVariableNames:'WarnBitmap'
|
|
16 |
poolDictionaries:''
|
38
|
17 |
category:'Views-DialogBoxes'
|
0
|
18 |
!
|
|
19 |
|
|
20 |
WarningBox comment:'
|
|
21 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
59
|
22 |
All Rights Reserved
|
0
|
23 |
|
107
|
24 |
$Header: /cvs/stx/stx/libwidg/WarningBox.st,v 1.8 1995-03-20 11:45:30 claus Exp $
|
38
|
25 |
'!
|
|
26 |
|
|
27 |
!WarningBox class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
59
|
32 |
All Rights Reserved
|
38
|
33 |
|
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
version
|
|
44 |
"
|
107
|
45 |
$Header: /cvs/stx/stx/libwidg/WarningBox.st,v 1.8 1995-03-20 11:45:30 claus Exp $
|
38
|
46 |
"
|
|
47 |
!
|
0
|
48 |
|
38
|
49 |
documentation
|
|
50 |
"
|
|
51 |
this class implements a pop-up box to show an information message.
|
|
52 |
WarningBoxes are basically InfoBoxes with a different bitmap-image.
|
|
53 |
(also, they add a beep when popping up)
|
|
54 |
|
|
55 |
They are created with:
|
|
56 |
|
59
|
57 |
aBox := WarningBox title:'some title'.
|
38
|
58 |
|
|
59 |
and shown with:
|
|
60 |
|
59
|
61 |
aBox showAtPointer
|
38
|
62 |
|
|
63 |
The default box shows 'yes' in its button; this can be changed with:
|
|
64 |
|
59
|
65 |
aBox okText:'some string'.
|
38
|
66 |
|
79
|
67 |
Since showing warnings is a common action, a convenient method has been
|
|
68 |
added to Object; thus you can use:
|
|
69 |
|
|
70 |
self warn:'oops - headcrash'
|
|
71 |
|
|
72 |
everywhere in your code.
|
63
|
73 |
"
|
|
74 |
!
|
38
|
75 |
|
63
|
76 |
examples
|
|
77 |
"
|
38
|
78 |
Examples:
|
|
79 |
|
59
|
80 |
|aBox|
|
38
|
81 |
|
59
|
82 |
aBox := WarningBox title:'Press ''OK'' to continue'.
|
|
83 |
aBox okText:'OK'.
|
|
84 |
aBox showAtPointer.
|
38
|
85 |
|
79
|
86 |
since warnboxes are much like infoBoxes, all of look can be changed
|
|
87 |
like described there:
|
|
88 |
|
|
89 |
|aBox|
|
|
90 |
|
|
91 |
aBox := WarningBox title:'Press ''OK'' to continue'.
|
|
92 |
aBox okText:'yes, continue'.
|
|
93 |
aBox form:(Image fromFile:'bitmaps/SmalltalkX.xbm').
|
|
94 |
aBox showAtPointer.
|
38
|
95 |
"
|
|
96 |
! !
|
0
|
97 |
|
59
|
98 |
!WarningBox class methodsFor:'styles'!
|
|
99 |
|
|
100 |
updateStyleCache
|
|
101 |
|img|
|
0
|
102 |
|
59
|
103 |
img := StyleSheet at:'warningBoxIcon'.
|
79
|
104 |
img notNil ifTrue:[WarnBitmap := img on:Display].
|
59
|
105 |
! !
|
|
106 |
|
|
107 |
!WarningBox class methodsFor:'icon bitmap'!
|
|
108 |
|
|
109 |
iconBitmap
|
|
110 |
"return the bitmap shown as icon in my instances"
|
|
111 |
|
0
|
112 |
WarnBitmap isNil ifTrue:[
|
107
|
113 |
WarnBitmap := Image fromFile:'bitmaps/Warning.xbm'
|
|
114 |
WarnBitmap notNil ifTrue:[
|
|
115 |
WarnBitmap := WarnBitmap on:Display
|
|
116 |
]
|
0
|
117 |
].
|
59
|
118 |
^ WarnBitmap
|
0
|
119 |
! !
|
|
120 |
|
79
|
121 |
!WarningBox methodsFor:'initialization'!
|
|
122 |
|
|
123 |
initialize
|
|
124 |
super initialize.
|
|
125 |
label := 'Warning'
|
|
126 |
! !
|
|
127 |
|
0
|
128 |
!WarningBox methodsFor:'realization'!
|
|
129 |
|
|
130 |
show
|
|
131 |
"added bell to wake up user"
|
|
132 |
|
|
133 |
device beep.
|
|
134 |
super show
|
26
|
135 |
!
|
|
136 |
|
|
137 |
showAtPointer
|
|
138 |
"added bell to wake up user"
|
|
139 |
|
|
140 |
device beep.
|
|
141 |
super showAtPointer
|
0
|
142 |
! !
|