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