author | Claus Gittinger <cg@exept.de> |
Wed, 18 Dec 2019 19:08:06 +0100 | |
changeset 6768 | c9329ef316b5 |
parent 6741 | e10ca4712018 |
child 6837 | 0247bc167e3a |
permissions | -rw-r--r-- |
6741 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
5 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
14 |
"{ Package: 'stx:libwidg' }" |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
15 |
|
5402 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
77 | 18 |
DialogBox subclass:#InfoBox |
5402 | 19 |
instanceVariableNames:'formAndLabelPanel formLabel textLabel' |
355 | 20 |
classVariableNames:'InfoBitmap' |
21 |
poolDictionaries:'' |
|
22 |
category:'Views-DialogBoxes' |
|
0 | 23 |
! |
24 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
25 |
!InfoBox class methodsFor:'documentation'! |
0 | 26 |
|
197 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
||
40 |
||
77 | 41 |
! |
8 | 42 |
|
43 |
documentation |
|
44 |
" |
|
355 | 45 |
Historic note: |
46 |
originally, ST/X had separate classes for the various entry methods; |
|
47 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
48 |
In the meantime, the DialogBox class (and therefore its alias: Dialog) |
|
5897 | 49 |
is going to duplicate most functionality found in these classes. |
355 | 50 |
|
51 |
In the future, those existing subclasses' functionality is going to |
|
52 |
be moved fully into Dialog, and the subclasses will be replaced by dummy |
|
53 |
delegators. (They will be kept for backward compatibility, though). |
|
54 |
||
55 |
||
56 |
||
38 | 57 |
this class implements a pop-up box to show an information message. |
58 |
It has a single ok-Button, which closes the box. |
|
59 |
Also entering return has (by default) the same effect as pressing |
|
60 |
the ok-button. |
|
59 | 61 |
InfoBox is a superclass of some other boxes - see WarningBox, YesNoBox etc. |
62 |
most of them simply redefine the icon shown in the upper left or |
|
63 |
add buttons. |
|
64 |
||
585 | 65 |
[instance variables:] |
59 | 66 |
|
355 | 67 |
formLabel <Label> shows a bitmap (warning, question-mark) |
59 | 68 |
|
355 | 69 |
textLabel <Label> shows the boxes text |
59 | 70 |
|
585 | 71 |
|
72 |
[author:] |
|
73 |
Claus Gittinger |
|
77 | 74 |
" |
75 |
! |
|
38 | 76 |
|
77 | 77 |
examples |
78 |
" |
|
2469 | 79 |
Notice, the preferred use is via the DialogBox class messages, |
5897 | 80 |
such as |
2469 | 81 |
[exBegin] |
82 |
Dialog information:'Time to go home' |
|
83 |
[exEnd] |
|
84 |
these (DialogBox) mesages are compatible with VW and should therefore |
|
85 |
be used for portability. |
|
86 |
||
87 |
Direct use of InfoBox is only required for highly specialized boxes. |
|
88 |
||
89 |
||
90 |
||
59 | 91 |
InfoBoxes are created with: |
92 |
||
370 | 93 |
aBox := InfoBox title:'some title'. |
38 | 94 |
|
95 |
and shown with: |
|
96 |
||
370 | 97 |
aBox showAtPointer |
59 | 98 |
or |
370 | 99 |
aBox open |
38 | 100 |
|
101 |
The default box shows 'yes' in its button; this can be changed with: |
|
102 |
||
370 | 103 |
aBox okText:'some string'. |
38 | 104 |
|
105 |
the boxes bitmap-image can be changed with: |
|
106 |
||
370 | 107 |
aBox image:aForm |
77 | 108 |
|
109 |
||
110 |
Since this type of information is pretty common, a convenient information |
|
111 |
method has been added to Object. |
|
112 |
Thus, you can use: |
|
593 | 113 |
[exBegin] |
370 | 114 |
self information:'hello world' |
593 | 115 |
[exEnd] |
370 | 116 |
|
77 | 117 |
everwhere in your program. |
370 | 118 |
for ST-80 compatibility, you can also use: |
593 | 119 |
[exBegin] |
370 | 120 |
Dialog information:'hello world' |
593 | 121 |
[exEnd] |
370 | 122 |
|
123 |
||
77 | 124 |
|
125 |
standard box: |
|
593 | 126 |
[exBegin] |
370 | 127 |
|box| |
77 | 128 |
|
370 | 129 |
box := InfoBox title:'hello world '. |
130 |
box open |
|
593 | 131 |
[exEnd] |
77 | 132 |
|
133 |
||
134 |
changing the buttons label: |
|
593 | 135 |
[exBegin] |
370 | 136 |
|box| |
77 | 137 |
|
370 | 138 |
box := InfoBox title:'hello world '. |
139 |
box okText:'wow'. |
|
140 |
box open |
|
593 | 141 |
[exEnd] |
77 | 142 |
|
143 |
||
144 |
changing the icon: |
|
145 |
||
593 | 146 |
[exBegin] |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
147 |
|box| |
77 | 148 |
|
370 | 149 |
box := InfoBox title:'hello world '. |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
150 |
box image:(Image fromFile:'libtool/bitmaps/SBrowser.xbm' inPackage:'stx:libtool'). |
370 | 151 |
box okText:'wow'. |
152 |
box open |
|
593 | 153 |
[exEnd] |
77 | 154 |
|
155 |
or even: |
|
593 | 156 |
[exBegin] |
370 | 157 |
|box| |
77 | 158 |
|
370 | 159 |
box := InfoBox title:'hello garfield '. |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
160 |
box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100). |
370 | 161 |
box okText:'wow'. |
162 |
box open |
|
593 | 163 |
[exEnd] |
77 | 164 |
|
165 |
||
166 |
If you plan to use boxes as in the last example, you may want to |
|
167 |
keep the box around for reuse (since the image magnification takes some time). |
|
593 | 168 |
[exBegin] |
370 | 169 |
|box| |
77 | 170 |
|
370 | 171 |
box := InfoBox title:'hello garfield '. |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
172 |
box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100). |
370 | 173 |
box okText:'wow'. |
174 |
box open. |
|
77 | 175 |
|
370 | 176 |
box title:'hello again'. |
177 |
box open |
|
593 | 178 |
[exEnd] |
77 | 179 |
|
63 | 180 |
" |
77 | 181 |
! ! |
182 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
183 |
!InfoBox class methodsFor:'instance creation'! |
38 | 184 |
|
77 | 185 |
title:titleString |
186 |
"create a new infoBox with title, aTitleString" |
|
187 |
||
188 |
^ (self new) title:titleString |
|
38 | 189 |
|
77 | 190 |
" |
191 |
(InfoBox title:'hello') open |
|
192 |
" |
|
4207 | 193 |
|
194 |
"Modified: / 22-12-2010 / 19:30:50 / cg" |
|
195 |
! |
|
196 |
||
5897 | 197 |
title:titleString label:labelString |
4207 | 198 |
"create a new infoBox with label, labelString" |
199 |
||
5897 | 200 |
^ (self new) title:titleString label:labelString |
4207 | 201 |
|
202 |
" |
|
203 |
(InfoBox title:'hello' label:'Attention' ) open |
|
204 |
" |
|
205 |
||
206 |
"Created: / 22-12-2010 / 19:31:03 / cg" |
|
77 | 207 |
! ! |
60 | 208 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
209 |
!InfoBox class methodsFor:'defaults'! |
60 | 210 |
|
574 | 211 |
defaultLabel |
212 |
"return the boxes default window title." |
|
213 |
||
214 |
^ 'Info' |
|
215 |
||
216 |
"Created: 23.4.1996 / 17:12:33 / cg" |
|
217 |
! |
|
218 |
||
77 | 219 |
iconBitmap |
220 |
"return the bitmap shown as icon in my instances. |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
221 |
This is the default image; you can overwrite this in a concrete |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
222 |
instance with the #image: message" |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
223 |
|
1365 | 224 |
<resource: #style (#'infoBox.icon' #'infoBox.iconFile')> |
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
225 |
|
2786 | 226 |
InfoBitmap isNil ifTrue:[ |
227 |
InfoBitmap := self iconBitmapFromStyle:'infoBox.icon' orStyleFile:'infoBox.iconFile' orFilename:'bitmaps/Information.xbm'. |
|
228 |
]. |
|
229 |
^ InfoBitmap |
|
230 |
||
6242 | 231 |
" |
232 |
InfoBitmap := self iconWithAlpha |
|
233 |
" |
|
234 |
||
2786 | 235 |
"Modified: / 26.10.1997 / 17:02:51 / cg" |
236 |
! |
|
237 |
||
238 |
iconBitmapFromStyle:styleName orStyleFile:styleFile orFilename:fileName |
|
239 |
"return the bitmap shown as icon in my instances. |
|
240 |
This is the default image; you can overwrite this in a concrete |
|
241 |
instance with the #image: message" |
|
242 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
243 |
|img imgFileName| |
38 | 244 |
|
2786 | 245 |
img := self styleSheet at:styleName. |
246 |
img isNil ifTrue:[ |
|
247 |
imgFileName := StyleSheet at:styleFile default:fileName. |
|
248 |
img := Smalltalk imageFromFileNamed:imgFileName forClass:self. |
|
77 | 249 |
]. |
2786 | 250 |
img notNil ifTrue:[ |
251 |
img := img onDevice:Display |
|
252 |
]. |
|
253 |
^ img |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
254 |
|
1365 | 255 |
"Modified: / 26.10.1997 / 17:02:51 / cg" |
59 | 256 |
! ! |
257 |
||
6242 | 258 |
!InfoBox class methodsFor:'image specs'! |
259 |
||
260 |
iconWithAlpha |
|
261 |
"This resource specification was automatically generated |
|
262 |
by the ImageEditor of ST/X." |
|
263 |
||
264 |
"Do not manually edit this!! If it is corrupted, |
|
265 |
the ImageEditor may not be able to read the specification." |
|
266 |
||
267 |
" |
|
268 |
self iconWithAlpha inspect |
|
269 |
ImageEditor openOnClass:self andSelector:#iconWithAlpha |
|
270 |
Icon flushCachedIcons |
|
271 |
" |
|
272 |
||
273 |
<resource: #image> |
|
274 |
||
275 |
^Icon |
|
276 |
constantNamed:'WarningBox class iconWithAlpha' |
|
277 |
ifAbsentPut:[(Depth32Image width:32 height:32 photometric:(#rgba)) bitsPerSample:(#[8 8 8 8]); bits:(ByteArray fromPackedString:' |
|
278 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M?_8O?_8NC?8NC ?>C 8O? 8NC?8NC ?>C 8O? 8NC?8NC ?=? 8O?@0LC?7=?@?0@@ |
|
279 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@0LC@?<C_7??????????????????????? |
|
280 |
????????????????????????????????????????????????(K>??=?_0O<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
281 |
@@@@@@@@8NC ?>C 8O??????????????????????????????????????/<C@?:B /????????????????????????????????????????????:B?0O<@@@@@ |
|
282 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M?_8O? 8NC???? ?????????????????????????????????3=__?<@@C??@@@??0@_ |
|
283 |
W????????????????????????????????????????????;?@7?>?0K??@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@C_7>C?8NC ?>C 8O?????? |
|
284 |
???????????????????????????@7=??@@A@?0@_ O<@G8C?@@A ?7>@/?????????????????????????????????? 8O???????<C_8O> /;??@@@@@@@@ |
|
285 |
@@@@@@@@@@@@@@@@@@@@@@@@7=? ?>C 8O? 8NC??????????????????????????????????????>C ??<@@FC?@BB_?4B@7?<@HJC?'':C_???????????? |
|
286 |
8O???????????????????>C???? 8O??8O???:C@7?>?/;??@@@@@@@@@@@@@@@@@@@@@M?_7??_7=??8NC ?>C????????????????????????????????? |
|
287 |
?????????????8B_0O<_PJC?W8C ?6B@0O???????????>C???? ????8O???>C??????????????>C????_8O??8O???7>_(O?@0K>@@@@@@@@@@@@@@@@@ |
|
288 |
0M?_?=?_8O? 8O????????????????????????????????????????????????????????????????????????????? ????8O???>C???? ????8O???>C? |
|
289 |
?????????????=? ???_8O??0M? ?7=?''??_7<B@@@@@@M?_7??_7=??7>C ?>C?????????8O???>C???? ????8O???>C????????????????????????? |
|
290 |
??????????? ????8O???>C???? ????8O???>C???? ????8NC??=??????????8O???=? ??? ????W7>_?9> (H@@@@@@/<C_?=?_7??_8NC????????? |
|
291 |
??? ????8O???>C???? ????8O???>C???= JC?G3= ?2A@ O<?PHC?G3= ?0@_PO>@'';???????>C???? ????7>C??=? ???_8O??7>C??>C???? ???? |
|
292 |
7>C??=? ??> 0NC?XFB@?=?_0HB?0LC?0M?_?=? ??? ????8O???>C???? ????8O???>C???? ????8O???8B_0O<@HHC?@@A??0@_ O<@HHC?@@A ?7>_ |
|
293 |
0O??????7????=? ???_8O??7>C??=? ???_8O??7>C??>C????_8O??0M? ?;?_8O<?PFC?(K>? K?@0O?@0M??7>C??>C???? ????8O???>C???? ???? |
|
294 |
8NC??>C???? ??????????????<_PI??@BB_?0@?''?<@G8C?_9?@???????_8O??7>C??=? ???_8O??7>C??=? ???_8O??7????<C ??>?7>C?/=? ?1<? |
|
295 |
W?>_''9>@/<C@?;?@7??_8O??8O???>C???? ????7>C??=? ???_8O??7>C??=? ??? ?????????4A (O<@G8C?@C>_?0@_ O=?''<C?8O???=? ???_8O?? |
|
296 |
7>C??=? ???_8O??7>C??=? ???_8O??0NC??;?@8O>?7>C?G2A_?8B_''8B?0LC?/<C_?=? ??? ????7????=? ???_8O??7>C??=? ???_8O??7>C??=?? |
|
297 |
??? ????PFB_?0@_ O<@O9??@A>@?7>_0O? ????7>C??<C ???_8O??7>C??<C ???@8O??0NC??=? ???@8O??/<C ?;?@8O<_HE?? I>_ JB?0O>?0M?? |
|
298 |
0M? ?=?????_8O??7>C??=? ???_8O??7>C??=? ???_8O??7>C??>C???=@XI??@A>@?0@?''?<@G8C?_9?@?>C????_8O??0NC??<C ???@8O??0NC??<C |
|
299 |
???@8O??0NC??<C_??>?0NC?(LC ?1< W?>@''9>@(K?@?;>?0O>?7>C?7>C??=? ???_8O??7>C??=? ???_8O??7>C??=? ???_8O??8O???4A ''?<@G8C? |
|
300 |
@C>_?0@_ O=?''<C?8O???<C ???@8O??0NC??<C ???@8O??0NC??<C ???@8O??/<C ?;?@7?>_/=??G2A_?8B_''8B?/<C?(K?@?;?@7??@7???7>C??=? |
|
301 |
???@8O??7>C??<C ???@8O??0NC??=? ???_????PFB_?0@_ O<@O9??@A>@?7>_0O?_????0NC??<C ???@8O??0NC??<C ???@8O??0NC??;?_??> 0NC? |
|
302 |
(LC_?5= ''?<_HE??''9> M?_0HB 0M??(K?@?;?@7??@8O??7>C??<C ???@8O??0NC??<C ???@8O??0NC??=????<?XI??@A>@?0@?''?<@G8C?_9?@?=?? |
|
303 |
???@8O??0NC??<C ???@8O??0NC??<C ??>?7???(LC ?:B?7?>_/=??HC= ?3=@XO>?/;>@@@@@@I> /?> /<C?(K?@?;?@8O?@8O??0NC??<C ???@8O?? |
|
304 |
0NC??<C ???@8O??7????4A ''?<@G8C?@BB_?0@__?= LC?8O???<C ???@8O??/=???;?_??>?8O??/=???:C@8O>_/=??'';?_?5=?(O<@G4C?XG>@?=?_ |
|
305 |
0H@@@@@@7=?@ HB /?>_/<C?(K?@?;?@8O?@7???0NC??<C ???@8O??0NC??<C ??>?7???G3>@?0@ ''?<@O:C?@C>_?1=@ O>?7???0NC??;?_??>?8O?? |
|
306 |
/=???;?_??> 0NC?'';?_?9>?0O=?''<C?@BA_?2@?XO>_(JB@7=?@@@@@@@@@@@@@(K>??8B 0O>_(LC?'';?@?:C@8O>?7???0NC??<C ???_????_9?@?0@@ |
|
307 |
XO<@HI??G5>??2A_0O< W<C?G4B??0@? O>@(M??0NC??;?_??> 7???(LC ?9>?7?>_/<C?_:C@?2@?XO<_HE??_7>@ M?_0H@@@@@@@@@@@@@@@@@@@@@@ |
|
308 |
'':B??7>_/?>_/<C?'';?@?9>?7?> 0NC?/=???;? ??>?7???''<C??;?_??> 7???(LC??:C@??>?8O??(M???:C@??>?7???(LC ?9>?7?>_/<C?'';?@?6B_ |
|
309 |
/?< PG??G2A@?5= _8B?/;>@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@''9> ?6B@(O>@(LC?'':C@?9> 0O>_/=??'';?_?:C@8O>?7???/=???;?_??>?8O?? |
|
310 |
0NC??;? ??>?7???''<C ?9>?7?>@(LC? JC@?8B 0O=__:C?G2A_?1< PO=_XG??/;>? @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@(JB ?5= |
|
311 |
O= K?? JB??8B 0O>@(LC? JC@?8B 0O>@(LC?'';?_?9?@8O> 7???(LC??9>?7?>_(LC? JC@?8B 0O= K??HDA??0@ PO< O5??XG>@ K>?/8@@@@@@ |
|
312 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@0LB? G>@''8A@XHC?O5>@?5=?(O=?'';??_9>??7>_/?>@(LC? JC@?9?@8O>_0NC? JC_?6B_ |
|
313 |
/?<?XHC?HDA??0@_PO< O5??W5=? I>_(HC@0LB@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@7=?@ K>?/8A? I>@ |
|
314 |
W6A??4A__?< O6C?O4A??7>_/?>@(LC?''<C ?:C@??>@(LC?G3= ?1< PO<?PFC?W6A??8B_''8C@0K>@8M?_@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
315 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M?_0HC_7<B@7=?@ K>?/8A@PFC?O5=??8B?7?>_/>C?(M???7> 7?< O5??XG>@?:B?/8C@0LB@ |
|
316 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@LC@ |
|
317 |
0H@?PFC?XI>??9>?8O> 0O??_:C_?2@?XO>_(JB@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
318 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@K>?/8@ O6C?W8B??:C@??= (M??HC=_?9>_(H@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
319 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@K?@/8A@W7?? |
|
320 |
_:C_?7> 7?<_O6C?''9> @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
321 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@M?_0HA _8C?O6B_?2A@XO>_'':B@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
322 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@B (JB@ HB_ K>? |
|
323 |
/0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@a'); yourself] |
|
324 |
! ! |
|
325 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
326 |
!InfoBox class methodsFor:'styles'! |
59 | 327 |
|
328 |
updateStyleCache |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
329 |
"extract values from the styleSheet and cache them in class variables. |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
330 |
Here, the cached infoBitmap is simply flushed." |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
370
diff
changeset
|
331 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
332 |
InfoBitmap := nil |
38 | 333 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
334 |
"Modified: 1.4.1997 / 14:44:50 / cg" |
59 | 335 |
! ! |
336 |
||
0 | 337 |
!InfoBox methodsFor:'accessing'! |
338 |
||
184 | 339 |
form:aFormOrImage |
340 |
"historical leftover - define a form to be displayed left of the title" |
|
341 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
342 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
343 |
|
184 | 344 |
self image:aFormOrImage |
345 |
! |
|
346 |
||
38 | 347 |
formLabel |
348 |
"return the formLabel = can be used to change its appearance" |
|
349 |
||
350 |
^ formLabel |
|
351 |
! |
|
352 |
||
197 | 353 |
image:aForm |
354 |
"define a form to be displayed left of the title |
|
355 |
- usually left as defaulted: |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
356 |
an exclamation-mark here, warn-sign in warningBox, |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
357 |
others in other subclasses." |
0 | 358 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
359 |
formLabel label:aForm. |
197 | 360 |
formLabel forceResize. |
5402 | 361 |
formAndLabelPanel forceResize. |
362 |
verticalPanel forceResize. |
|
197 | 363 |
shown ifTrue:[self resize] |
0 | 364 |
! |
365 |
||
77 | 366 |
textLabel |
367 |
"return the textLabel = can be used to change its appearance" |
|
368 |
||
369 |
^ textLabel |
|
370 |
! |
|
371 |
||
0 | 372 |
title |
6407 | 373 |
"return the boxes label string" |
6408 | 374 |
"sigh: the old name for the windowTitle was label here, |
375 |
and the contents was called title. |
|
376 |
Squeak expects label to access the title" |
|
0 | 377 |
|
6741 | 378 |
^ textLabel label |
4207 | 379 |
|
380 |
"Created: / 22-12-2010 / 19:27:43 / cg" |
|
6408 | 381 |
"Modified (comment): / 26-08-2018 / 18:11:29 / Claus Gittinger" |
197 | 382 |
! |
0 | 383 |
|
197 | 384 |
title:aString |
6741 | 385 |
"set the boxes label string" |
6408 | 386 |
"sigh: the old name for the windowTitle was label here, |
387 |
and the contents was called title. |
|
388 |
Squeak expects label to access the title" |
|
60 | 389 |
|
197 | 390 |
aString ~= textLabel label ifTrue:[ |
4207 | 391 |
textLabel label:aString. |
392 |
textLabel forceResize. |
|
5402 | 393 |
formAndLabelPanel forceResize. |
394 |
verticalPanel forceResize. |
|
4207 | 395 |
shown ifTrue:[self resize] |
197 | 396 |
] |
4207 | 397 |
|
6408 | 398 |
"Created: / 26-08-2018 / 18:21:08 / Claus Gittinger" |
4207 | 399 |
! |
400 |
||
6408 | 401 |
title:labelString label:windowTitleString |
4207 | 402 |
"set the boxes label string" |
6408 | 403 |
"sigh: the old name for the windowTitle was label here, |
404 |
and the contents was called title. |
|
405 |
Squeak expects label to access the title" |
|
4207 | 406 |
|
6408 | 407 |
self windowTitle:windowTitleString. |
6407 | 408 |
self title:labelString. |
409 |
||
6408 | 410 |
"Modified: / 26-08-2018 / 18:25:47 / Claus Gittinger" |
6741 | 411 |
! |
412 |
||
413 |
xxlabel |
|
414 |
^ textLabel label |
|
415 |
||
416 |
"Created: / 26-08-2018 / 17:12:50 / Claus Gittinger" |
|
0 | 417 |
! ! |
418 |
||
77 | 419 |
!InfoBox methodsFor:'initialization'! |
0 | 420 |
|
77 | 421 |
initFormBitmap |
422 |
"setup the bitmap shown in the upper left - |
|
423 |
extracted into a separate method for easier redefinition |
|
424 |
in subclasses" |
|
0 | 425 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
426 |
formLabel label:(self class iconBitmap) |
0 | 427 |
! |
428 |
||
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
429 |
initFormLabel |
570 | 430 |
"setup the icon shown in the infoBox. |
431 |
Can be redefined in subclasses." |
|
432 |
||
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
433 |
|mm| |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
434 |
|
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
435 |
mm := ViewSpacing. |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
436 |
|
5402 | 437 |
formLabel := Label in:formAndLabelPanel. |
3866 | 438 |
formLabel name: 'formLabel'. |
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
439 |
formLabel borderWidth:0. |
5402 | 440 |
"/ formLabel origin:(mm @ mm). |
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
441 |
|
4385 | 442 |
"Created: / 16-11-1995 / 18:32:32 / cg" |
443 |
"Modified: / 22-04-1996 / 18:15:37 / cg" |
|
444 |
"Modified (format): / 28-02-2012 / 18:20:23 / cg" |
|
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
445 |
! |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
446 |
|
77 | 447 |
initialize |
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
448 |
|mm sep| |
77 | 449 |
|
6079 | 450 |
<modifier: #super> "must be called if redefined" |
451 |
||
77 | 452 |
super initialize. |
453 |
self addOkButton. |
|
0 | 454 |
|
574 | 455 |
"/ label := 'Info'. |
77 | 456 |
|
5402 | 457 |
"/ mm := ViewSpacing. |
458 |
||
459 |
formAndLabelPanel := HorizontalPanelView in:self verticalPanel. |
|
77 | 460 |
|
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
461 |
self initFormLabel. |
77 | 462 |
self initFormBitmap. |
0 | 463 |
|
5402 | 464 |
formLabel width > 500 ifTrue:[ |
465 |
textLabel := Label label:'Information' in:verticalPanel. |
|
466 |
] ifFalse:[ |
|
467 |
textLabel := Label label:'Information' in:formAndLabelPanel. |
|
468 |
]. |
|
3866 | 469 |
textLabel name: 'textLabel'. |
77 | 470 |
textLabel borderWidth:0. |
5402 | 471 |
"/ textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm]. |
0 | 472 |
|
5402 | 473 |
"/ yPosition := textLabel corner y. |
474 |
"/ formLabel notNil ifTrue:[yPosition := yPosition max:(formLabel corner y)]. |
|
475 |
"/ yPosition := yPosition + ViewSpacing. |
|
4295 | 476 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
477 |
(styleSheet at:'infoBoxSeparator' default:false) ifTrue:[ |
5402 | 478 |
sep := Separator in:self verticalPanel. |
479 |
"/ sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + mm)]. |
|
480 |
sep width:1.0. "/ extent:(1.0 @ sep preferredHeight). |
|
481 |
"/ yPosition := yPosition max:(sep corner y). |
|
482 |
"/ yPosition := yPosition + ViewSpacing. |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
483 |
]. |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
484 |
|
77 | 485 |
" |
486 |
|b| |
|
487 |
||
488 |
b := InfoBox new. |
|
489 |
b title:'hello'. |
|
490 |
b open |
|
491 |
" |
|
367 | 492 |
|
6079 | 493 |
"Modified: / 08-02-2017 / 00:26:21 / cg" |
0 | 494 |
! ! |
197 | 495 |
|
496 |
!InfoBox methodsFor:'queries'! |
|
497 |
||
3121 | 498 |
beepWhenOpening |
499 |
^ UserPreferences current beepForInfoDialog |
|
500 |
||
501 |
" |
|
502 |
Dialog information:'hello' |
|
503 |
Dialog warn:'hello' |
|
504 |
Dialog error:'hello' |
|
505 |
" |
|
197 | 506 |
! ! |
507 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
508 |
!InfoBox class methodsFor:'documentation'! |
243 | 509 |
|
510 |
version |
|
5402 | 511 |
^ '$Header$' |
4207 | 512 |
! |
513 |
||
514 |
version_CVS |
|
5402 | 515 |
^ '$Header$' |
243 | 516 |
! ! |
4863
12c87ee0e767
Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents:
4385
diff
changeset
|
517 |