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