WarningBox.st
author Claus Gittinger <cg@exept.de>
Fri, 06 Mar 2020 21:56:26 +0100
changeset 6843 6c5e543e903e
parent 6290 9c06dcc35aaa
permissions -rw-r--r--
#OTHER by cg class: SimpleView added: #isWarningBox
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6843
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
     1
"{ Encoding: utf8 }"
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
 COPYRIGHT (c) 1993 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2073
diff changeset
    14
"{ Package: 'stx:libwidg' }"
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2073
diff changeset
    15
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
    16
"{ NameSpace: Smalltalk }"
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
InfoBox subclass:#WarningBox
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    19
	instanceVariableNames:''
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
    20
	classVariableNames:'WarnBitmap ErrorBitmap'
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    21
	poolDictionaries:''
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    22
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    25
!WarningBox class methodsFor:'documentation'!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    26
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    27
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    28
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    29
 COPYRIGHT (c) 1993 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    30
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    31
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    32
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    33
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    34
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    35
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    36
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    37
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    39
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    40
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    41
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    42
"
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    43
   Historic note:
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    44
        originally, ST/X had separate classes for the various entry methods;
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    45
        there were YesNoBox, EnterBox, InfoBox and so on.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    46
        In the meantime, the DialogBox class (and therefore its alias: Dialog)
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
    47
        is going to duplicate most functionality found in these classes.
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    48
2468
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    49
        In the future, those existing subclasses' functionality might
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    50
        be moved fully into Dialog, and the subclasses be replaced by dummy
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    51
        delegators. (They will be kept for backward compatibility, though).
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    52
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    53
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    54
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
    55
    this class implements a pop-up box to show an information message.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    56
    WarningBoxes are basically InfoBoxes with a different bitmap-image.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    57
    (also, they add a beep when popping up)
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    58
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    59
    They are created with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    60
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    61
        aBox := WarningBox title:'some title'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    62
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    63
    and shown with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    64
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    65
        aBox showAtPointer
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    66
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    67
    The default box shows 'yes' in its button; this can be changed with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    68
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    69
        aBox okText:'some string'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    70
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
    71
    Since showing warnings is a common action, a convenient method has been
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
    72
    added to Object; thus you can use:
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
    73
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    74
        self warn:'oops - headcrash'
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
    75
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
    76
    everywhere in your code.
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    77
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    78
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    79
        DialogBox InfoBox YesNoBox
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    80
        ( introduction to view programming :html: programming/viewintro.html )
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    81
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    82
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 493
diff changeset
    83
        Claus Gittinger
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    84
"
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    85
!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
    86
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    87
examples
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    88
"
2468
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    89
    Notice, the preferred use is via the DialogBox class messages,
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
    90
    such as
2468
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    91
                                                                        [exBegin]
2469
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2468
diff changeset
    92
        Dialog warn:'Attention !!'
2468
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    93
                                                                        [exEnd]
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    94
    these (DialogBox) mesages are compatible with VW and should therefore
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    95
    be used for portability.
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    96
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    97
    Direct reference to WarnBox is only required for highly specialized boxes.
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    98
abb90d63faf2 documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    99
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   100
    standard warning dialogs
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   101
    (recommended, since these are ST-80 compatible interfaces)
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   102
                                                                        [exBegin]
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   103
        Dialog warn:'you should not do this'
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   104
                                                                        [exEnd]
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   105
    since all objects support the #warn message,
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   106
    you can also simply use (for any self):
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   107
                                                                        [exBegin]
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
   108
        self warn:'you should not do this'
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   109
                                                                        [exEnd]
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   110
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   111
    with attributed text:
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   112
                                                                        [exBegin]
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
   113
        Dialog warn:(Text string:'you should not do this'
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   114
                          emphasis:#color->Color red)
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   115
                                                                        [exEnd]
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
   116
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   117
    specifying more details of the warnBox (low level entries).
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   118
    label of OK-button:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   119
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   120
        |aBox|
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
   121
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   122
        aBox := WarningBox title:'Press ''OK'' to continue'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   123
        aBox okText:'OK'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   124
        aBox showAtPointer.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   125
                                                                        [exEnd]
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   126
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   127
    accessing the ok-Button component and changing its color:
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   128
                                                                        [exBegin]
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   129
        |aBox|
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   130
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   131
        aBox := WarningBox title:'Do you really want to do this ?'.
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   132
        aBox okText:'yes, go on'.
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   133
        aBox okButton foregroundColor:Color red.
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   134
        aBox showAtPointer.
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   135
                                                                        [exEnd]
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
   136
    since warnboxes are much like infoBoxes, all of look can be changed
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
   137
    like described there:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   138
                                                                        [exBegin]
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   139
        |image aBox|
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
   140
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   141
        aBox := WarningBox title:'Press ''OK'' to continue'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   142
        aBox okText:'yes, continue'.
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2073
diff changeset
   143
        image := Image fromFile:'bitmaps/SmalltalkX.xbm' inPackage:'stx:libtool'.
644
dbb02e0858fa examples
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   144
        aBox form:image.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   145
        aBox showAtPointer.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   146
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 26
diff changeset
   147
"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   148
! !
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   149
6290
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   150
!WarningBox class methodsFor:'defaults'!
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   151
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   152
defaultLabel
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   153
    ^ 'Warning'
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   154
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   155
    "Created: / 01-03-2018 / 22:44:19 / mawalch"
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   156
! !
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   157
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   158
!WarningBox class methodsFor:'icon bitmap'!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   159
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   160
errorIconBitmap
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   161
    "return the bitmap shown as icon in my instances.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   162
     This is the default image; you can overwrite this in a concrete
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   163
     instance with the image: message"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   164
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   165
    <resource: #style (#'errorBox.icon' #'errorBox.iconFile')>
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   166
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   167
    ErrorBitmap isNil ifTrue:[
2786
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   168
        ErrorBitmap := self iconBitmapFromStyle:'errorBox.icon' orStyleFile:'errorBox.iconFile' orFilename:'bitmaps/Error.xbm'.
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   169
        ErrorBitmap isNil ifTrue:[
3665
7ff70da31a25 care for non-existing bitmap files
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   170
            ErrorBitmap := ToolbarIconLibrary errorIcon.
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   171
        ].
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   172
    ].
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   173
    ^ ErrorBitmap
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   174
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   175
    "
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   176
     |box|
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   177
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   178
     box := WarningBox title:'foo bar'.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   179
     box image:(WarningBox errorIconBitmap).
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   180
     box showAtPointer.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   181
    "
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   182
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   183
    "Created: / 17.11.1995 / 18:16:47 / cg"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   184
    "Modified: / 16.11.2001 / 15:02:54 / cg"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   185
!
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   186
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   187
iconBitmap
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   188
    "return the bitmap shown as icon in my instances.
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   189
     This is the default image; you can overwrite this in a concrete
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   190
     instance with the image: message"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   191
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   192
    ^ self warnIconBitmap
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   193
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   194
    "
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   195
     self warn:'foo bar'.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   196
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   197
     |box|
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   198
     box := WarningBox title:'foo bar'.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   199
     box showAtPointer.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   200
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   201
     |box|
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   202
     box := WarningBox title:'foo bar'.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   203
     box image:(Image fromFile:'QUESTION.xpm' inPackage:'stx:goodies/bitmaps/xpmBitmaps').
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   204
     box showAtPointer.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   205
    "
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   206
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   207
    "Created: / 17.11.1995 / 18:16:47 / cg"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   208
    "Modified: / 16.11.2001 / 15:02:38 / cg"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   209
!
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   210
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   211
warnIconBitmap
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   212
    "return the bitmap shown as icon in my instances.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   213
     This is the default image; you can overwrite this in a concrete
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   214
     instance with the image: message"
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   215
1365
aa6a855b5013 new resource naming
Claus Gittinger <cg@exept.de>
parents: 1173
diff changeset
   216
    <resource: #style (#'warningBox.icon' #'warningBox.iconFile')>
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   217
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   218
    WarnBitmap isNil ifTrue:[
2786
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   219
        WarnBitmap := self iconBitmapFromStyle:'warningBox.icon' orStyleFile:'warningBox.iconFile' orFilename:'bitmaps/Warning.xbm'.
3665
7ff70da31a25 care for non-existing bitmap files
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   220
        WarnBitmap isNil ifTrue:[
7ff70da31a25 care for non-existing bitmap files
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   221
            WarnBitmap := ToolbarIconLibrary warnIcon.
7ff70da31a25 care for non-existing bitmap files
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   222
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   223
    ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   224
    ^ WarnBitmap
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   225
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   226
    "
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   227
     self warn:'foo bar'.
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   228
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   229
     |box|
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   230
     box := WarningBox title:'foo bar'.
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   231
     box showAtPointer.
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   232
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   233
     |box|
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   234
     box := WarningBox title:'foo bar'.
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2073
diff changeset
   235
     box image:(Image fromFile:'QUESTION.xpm' inPackage:'stx:goodies/bitmaps/xpmBitmaps').
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   236
     box showAtPointer.
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   237
    "
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   238
1915
cb30b0787270 comment
Claus Gittinger <cg@exept.de>
parents: 1743
diff changeset
   239
    "Modified: / 25.5.1999 / 15:22:25 / cg"
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   240
    "Created: / 16.11.2001 / 15:02:24 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   241
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   242
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   243
!WarningBox class methodsFor:'styles'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   244
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   245
updateStyleCache
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   246
    "extract values from the styleSheet and cache them in class variables.
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 693
diff changeset
   247
     Here, the cached infoBitmap is simply flushed."
443
555bb9c7e1be added style resource directive
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   248
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   249
    WarnBitmap := nil.
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   250
    ErrorBitmap := nil.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   251
2474
c297943dc3d7 errorIconBitmap
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
   252
    "Modified: / 16.11.2001 / 15:00:43 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   253
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   254
3121
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
   255
!WarningBox methodsFor:'queries'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   256
3121
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
   257
beepWhenOpening
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2786
diff changeset
   258
    ^ UserPreferences current beepForWarningDialog
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   259
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   260
6843
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   261
!WarningBox methodsFor:'testing'!
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   262
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   263
isWarningBox
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   264
    ^ true
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   265
! !
6c5e543e903e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6290
diff changeset
   266
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   267
!WarningBox class methodsFor:'documentation'!
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   268
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   269
version
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
   270
    ^ '$Header$'
6290
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   271
!
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   272
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   273
version_CVS
9c06dcc35aaa #REFACTORING by mawalch
mawalch
parents: 5894
diff changeset
   274
    ^ '$Header$'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   275
! !
5894
317a89cd0996 #OTHER by mawalch
mawalch
parents: 3665
diff changeset
   276