YesNoBox.st
author Claus Gittinger <cg@exept.de>
Tue, 01 Apr 1997 14:54:41 +0200
changeset 1173 86440dfaca06
parent 949 4c9ab41146a1
child 1187 6f8bd39b5515
permissions -rw-r--r--
allow either image or imageFileName to be specified in styleSheet;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
WarningBox subclass:#YesNoBox
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    14
	instanceVariableNames:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    15
	classVariableNames:'RequestBitmap'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    16
	poolDictionaries:''
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    17
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
    20
!YesNoBox class methodsFor:'documentation'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    21
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    22
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    23
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    24
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
    25
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    26
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    27
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    28
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    30
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    31
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    32
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    33
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    34
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    35
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    36
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    37
"
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    38
   Historic note:
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    39
        originally, ST/X had separate classes for the various entry methods;
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    40
        there were YesNoBox, EnterBox, InfoBox and so on.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    41
        In the meantime, the DialogBox class (and therefore its alias: Dialog)
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    42
        is going to duplicate most funcionality found in these classes.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    43
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    44
        In the future, those existing subclasses' functionality is going to
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    45
        be moved fully into Dialog, and the subclasses will be replaced by dummy
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    46
        delegators. (They will be kept for backward compatibility, though).
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    47
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
    48
    New applications should use corresponding confirmation
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
    49
    methods from DialogBox.
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    50
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    51
    this class implements yes-no boxes by adding another (no-) Button to the WarnBox-View.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    52
    They are created with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    53
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    54
        aBox := YesNoBox title:'some title'.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    55
        aBox okAction:[ .. some action to be performed when ok is pressed ].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    56
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    57
    and finally shown with:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    58
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    59
        aBox showAtPointer
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    60
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    61
    The default box shows 'yes' and 'no' in its buttons; this can be changed with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    62
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    63
        aBox yesText:'some string'.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    64
        aBox noText:'some string'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    65
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    66
    There is also protocol to set both button titles in one message.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    67
    Also, the action associated to the noButton can be changed.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    68
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    69
    For very simple yes/no queries, you can also use the much simpler confirm:.
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    70
    Since implemented in Object, everyone understands confirm. You can pass
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    71
    a question message (but not change the buttons labels).
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    72
    Use is:
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    73
        self confirm:'some question'  
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    74
    and will return true or false.
125
claus
parents: 119
diff changeset
    75
claus
parents: 119
diff changeset
    76
    For compatibility with ST-80, use:
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 253
diff changeset
    77
        Dialog confirm:'hello'
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    78
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    79
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    80
        DialogBox
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    81
        EnterBox
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    82
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    83
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    84
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    85
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    86
"
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    87
!
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    88
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    89
examples
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
    90
"
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    91
    Examples:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    92
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    93
        |aBox|
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
    94
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    95
        aBox := YesNoBox title:'Coffee or tee ?'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    96
        aBox noText:'tee'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    97
        aBox yesText:'coffee'.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
    98
        aBox yesAction:[Transcript showCR:'make coffee'].
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
    99
        aBox noAction:[Transcript showCR:'make tee'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   100
        aBox showAtPointer.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   101
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   102
    or, shorter:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   103
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   104
        |aBox|
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   105
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   106
        aBox := YesNoBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   107
        aBox title:'Coffee or Tee ?' 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   108
             yesAction:[Transcript showCR:'make coffee']
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   109
             noAction:[Transcript showCR:'make tee'].
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   110
        aBox yesText:'Coffee' noText:'Tee'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   111
        aBox showAtPointer
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   112
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   113
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   114
    Also, have a look at the inherited protocol; for example, this allows changing
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   115
    the bitmap (default: a question mark) and other properties.
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   116
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   117
    If the box is needed to ask for a simple boolean, you can also use the
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   118
    #confirm method, to bring up a box, let it ask for something and return
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   119
    true or false. 
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   120
    Example:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   121
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   122
        |box value|
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   123
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   124
        box := YesNoBox new.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   125
        value := box confirm:'yes or no:'.
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   126
        value ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   127
            Transcript showCR:'yes'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   128
        ] ifFalse:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   129
            Transcript showCR:'no'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   130
        ]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   131
                                                                        [exEnd]
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   132
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   133
    of course, this can also be written shorter as:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   134
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   135
        (YesNoBox new confirm:'yes or no:') ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   136
            Transcript showCR:'yes'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   137
        ] ifFalse:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   138
            Transcript showCR:'no'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   139
        ]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   140
                                                                        [exEnd]
125
claus
parents: 119
diff changeset
   141
    or:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   142
                                                                        [exBegin]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   143
        (Dialog confirm:'yes or no:') ifTrue:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   144
            Transcript showCR:'yes'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   145
        ] ifFalse:[
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   146
            Transcript showCR:'no'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   147
        ]
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   148
                                                                        [exEnd]
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   149
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   150
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   151
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   152
!YesNoBox class methodsFor:'instance creation'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   153
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   154
title:t yesText:yesString noText:noString
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   155
    "return a new YesNoBox with title, and buttonLabels yesString/noString"
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   156
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   157
    ^ (self new) title:t yesText:yesString noText:noString
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   158
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   159
    "Modified: 23.4.1996 / 00:12:48 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   160
! !
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   161
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   162
!YesNoBox class methodsFor:'icon bitmap'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   163
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   164
iconBitmap
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   165
    "return the bitmap shown as icon in my instances.
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   166
     This is the default image; you can overwrite this in a concrete
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   167
     instance with the image: message"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   168
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   169
    <resource: #style (#requestBoxIcon #requestBoxIconFile)>
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   170
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   171
    |img imgFileName|
943
034b63540f10 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   172
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   173
    RequestBitmap isNil ifTrue:[
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   174
        img := StyleSheet at:'requestBoxIcon'.
943
034b63540f10 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   175
        img notNil ifTrue:[
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   176
            RequestBitmap := img
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   177
        ] ifFalse:[
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   178
            imgFileName := StyleSheet at:'requestBoxIconFile' default:'bitmaps/Request.xbm'.
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   179
            RequestBitmap := Image fromFile:imgFileName.
943
034b63540f10 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   180
        ].
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   181
        RequestBitmap notNil ifTrue:[
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   182
            RequestBitmap := RequestBitmap on:Display
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   183
        ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   184
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   185
    ^ RequestBitmap
943
034b63540f10 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 856
diff changeset
   186
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   187
    "Created: 17.11.1995 / 18:16:47 / cg"
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   188
    "Modified: 1.4.1997 / 14:50:35 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   189
! !
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   190
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   191
!YesNoBox class methodsFor:'styles'!
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   192
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   193
updateStyleCache
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   194
    "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: 949
diff changeset
   195
     Here, the cached infoBitmap is simply flushed."
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   196
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   197
    RequestBitmap := nil
444
ef26eba8c854 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 373
diff changeset
   198
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   199
    "Modified: 1.4.1997 / 14:51:30 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   200
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   201
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   202
!YesNoBox methodsFor:'accessing'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   203
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   204
noAction:aBlock
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   205
    "define the action to be performed when 'no' is pressed"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   206
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   207
    abortAction := aBlock
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   208
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   209
    "Modified: 16.1.1997 / 11:29:18 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   210
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   211
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   212
noButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   213
    "return the no-button"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   214
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   215
    ^ abortButton
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   216
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   217
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   218
noLabel:aString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   219
    "define the label of the 'no'-button.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   220
     And alias for #noText: - for backward compatibility"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   221
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   222
    self noText:aString.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   223
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   224
    "Created: 13.12.1995 / 16:21:57 / cg"
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   225
    "Modified: 16.1.1997 / 11:30:25 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   226
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   227
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   228
noText:aString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   229
    "define the label of the no-button.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   230
     If not set, it defaults to the resource-string for 'no'."
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   231
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   232
    aString ~= abortButton label ifTrue:[
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   233
        abortButton label:aString.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   234
        abortButton resize.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   235
        shown ifTrue:[self resize]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   236
    ]
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   237
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   238
    "Modified: 16.1.1997 / 11:30:01 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   239
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   240
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   241
okText:yesString noText:noString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   242
    "define the labels of both buttons.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   243
     Alias for yesText:noText: for backward compatibility."
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   244
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   245
    ^ self yesText:yesString noText:noString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   246
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   247
    "Modified: 16.1.1997 / 11:30:58 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   248
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   249
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   250
title:aString yesAction:yesBlock noAction:noBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   251
    "define title and actions"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   252
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   253
    self title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   254
    okAction := yesBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   255
    abortAction := noBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   256
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   257
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   258
title:aString yesText:yesString noText:noString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   259
    "define title and button labels"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   260
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   261
    self title:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   262
    self yesText:yesString noText:noString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   263
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   264
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   265
yesAction:aBlock 
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   266
    "define the action to be performed when 'yes' is pressed"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   267
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   268
    okAction := aBlock
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   269
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   270
    "Modified: 16.1.1997 / 11:31:21 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   271
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   272
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   273
yesAction:yesBlock noAction:noBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   274
    "define both actions"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   275
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   276
    okAction := yesBlock.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   277
    abortAction := noBlock
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   278
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   279
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   280
yesButton
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   281
    "return the 'yes'-button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   282
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   283
    ^ okButton
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   284
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   285
    "Modified: 16.1.1997 / 11:31:27 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   286
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   287
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   288
yesLabel:aString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   289
    "define the label of the 'yes'-button.
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   290
     An alias for #yesText: for backward compatibility."
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   291
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   292
    self yesText:aString.
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   293
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   294
    "Created: 13.12.1995 / 16:22:05 / cg"
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   295
    "Modified: 16.1.1997 / 11:31:58 / cg"
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   296
!
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   297
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   298
yesText:aString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   299
    "define the label of the 'yes'-button"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   300
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   301
    self okText:aString
949
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   302
4c9ab41146a1 commentary
Claus Gittinger <cg@exept.de>
parents: 946
diff changeset
   303
    "Modified: 16.1.1997 / 11:31:39 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   304
!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   305
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   306
yesText:yesString noText:noString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   307
    "define the labels of both buttons"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   308
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   309
    ((yesString ~= okButton label) or:[noString ~= abortButton label]) ifTrue:[
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   310
        okButton label:yesString. 
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   311
        abortButton label:noString.
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   312
        okButton resize.
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   313
        abortButton resize.
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   314
        shown ifTrue:[self resize]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
    ]
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   316
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   317
    "Modified: 21.2.1996 / 00:58:38 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   318
! !
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   319
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   320
!YesNoBox methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   321
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   322
initialize
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   323
    super initialize.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   324
150
claus
parents: 130
diff changeset
   325
    label := resources string:'Choose'.
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
   326
130
claus
parents: 125
diff changeset
   327
    buttonPanel horizontalLayout:#fitSpace.  "/ looks better; should it come from the StyleSheet ?
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
   328
946
ccaa76951823 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 943
diff changeset
   329
    textLabel label:(resources string:'please confirm').
ccaa76951823 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 943
diff changeset
   330
    okButton label:(resources string:'yes').
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   331
162
claus
parents: 150
diff changeset
   332
    abortButton := Button abortButton.
claus
parents: 150
diff changeset
   333
    buttonPanel addSubView:abortButton before:okButton.
946
ccaa76951823 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 943
diff changeset
   334
    abortButton label:(resources string:'no').
162
claus
parents: 150
diff changeset
   335
    abortButton height:(okButton height).
claus
parents: 150
diff changeset
   336
    abortButton model:self; change:#noPressed
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   337
946
ccaa76951823 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 943
diff changeset
   338
    "Modified: 15.1.1997 / 23:32:21 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   339
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   340
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   341
!YesNoBox methodsFor:'queries'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   342
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   343
preferredExtent 
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   344
    "compute the boxes preferredExtent from the components' sizes"
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
   345
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   346
    |w h max mm|
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   347
796
935b2faf035b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   348
    "/ If I have an explicit preferredExtent ..
935b2faf035b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   349
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   350
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   351
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   352
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
   353
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   354
    mm := ViewSpacing.
79
6d917a89f7b7 *** empty log message ***
claus
parents: 63
diff changeset
   355
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   356
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   357
     make the two buttons of equal size
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   358
    "
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   359
    max := okButton preferredExtent x max:abortButton preferredExtent x.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   360
    okButton width:max.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   361
    abortButton width:max.
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   362
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   363
    w := (formLabel width + textLabel width) max:max * 2.
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   364
    w := w + (3 * mm) + (okButton borderWidth + abortButton borderWidth * 2).
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   365
    h := (mm * 5)
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   366
         + ((formLabel height) max:(textLabel height))
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   367
         + okButton heightIncludingBorder.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   368
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   369
    ^ (w @ h).
373
da46657e62bc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   370
796
935b2faf035b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 740
diff changeset
   371
    "Modified: 19.7.1996 / 20:45:53 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   372
! !
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   373
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   374
!YesNoBox methodsFor:'startup'!
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   375
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   376
confirm
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   377
    "open the receiver and return true for yes, false for no.
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   378
     This is an easier interface to use, since no action blocks
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   379
     have to be defined. The title is used as previously defined."
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   380
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   381
    self yesAction:[^ true] noAction:[^ false].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
   382
    self showAtPointer.
f4eaf04d1eaf *** empty log message ***
claus
parents: 59
diff changeset
   383
    self yesAction:nil noAction:nil. "/ clear actions for earlier release of context
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   384
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   385
    "
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   386
     YesNoBox new confirm
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   387
    "
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   388
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   389
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   390
confirm:aString
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   391
    "open the receiver and return true for yes, false for no.
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   392
     This is an easier interface to use, since no action blocks
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   393
     have to be defined."
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 9
diff changeset
   394
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   395
    self title:aString.
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   396
    ^ self confirm
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   397
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   398
    "
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   399
     YesNoBox new confirm:'really ?'
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   400
     YesNoBox confirm:'really ?'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   401
     self confirm:'really ?'
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   402
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   403
    for ST-80 compatibility, you should use Dialogs confirm
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   404
    (which simply forwards the request to the YesNoBox anyway):
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   405
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   406
     Dialog confirm:'really ?'    
59
450ce95a72a4 *** empty log message ***
claus
parents: 55
diff changeset
   407
    "
253
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   408
f071ff350cd5 added confirm with button-labels
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
   409
    "Modified: 13.12.1995 / 16:20:01 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   410
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   411
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   412
!YesNoBox methodsFor:'user interaction'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   413
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   414
noPressed
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   415
    "user pressed the no-button;
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   416
     hide myself and evaluate the action"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   417
162
claus
parents: 150
diff changeset
   418
    abortButton turnOffWithoutRedraw.
claus
parents: 150
diff changeset
   419
    self hideAndEvaluate:abortAction
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   420
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   421
856
1b5b9d753163 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 796
diff changeset
   422
!YesNoBox class methodsFor:'documentation'!
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   423
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   424
version
1173
86440dfaca06 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   425
    ^ '$Header: /cvs/stx/stx/libwidg/YesNoBox.st,v 1.37 1997-04-01 12:54:41 cg Exp $'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   426
! !