InfoBox.st
author Claus Gittinger <cg@exept.de>
Wed, 21 Feb 1996 00:56:21 +0100
changeset 370 dc5b51904d3f
parent 367 bc778f90e42d
child 440 2beb33cb0146
permissions -rw-r--r--
checkin from browser
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: 38
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
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    13
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    14
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    15
DialogBox subclass:#InfoBox
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    16
	instanceVariableNames:'formLabel textLabel'
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    17
	classVariableNames:'InfoBitmap'
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    18
	poolDictionaries:''
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    19
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    20
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    22
!InfoBox class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    24
copyright
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    25
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    26
 COPYRIGHT (c) 1989 by Claus Gittinger
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    27
	      All Rights Reserved
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    28
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    29
 This software is furnished under a license and may be used
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    30
 only in accordance with the terms of that license and with the
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    32
 be provided or otherwise made available to, or used by, any
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    33
 other person.  No title to or ownership of the software is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    34
 hereby transferred.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    35
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    36
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    37
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    38
!
8
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
    39
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
    40
documentation
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
    41
"
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    42
   Historic note:
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    43
        originally, ST/X had separate classes for the various entry methods;
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    44
        there were YesNoBox, EnterBox, InfoBox and so on.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    45
        In the meantime, the DialogBox class (and therefore its alias: Dialog)
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    46
        is going to duplicate most funcionality found in these classes.
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    47
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    48
        In the future, those existing subclasses' functionality is going to
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    49
        be moved fully into Dialog, and the subclasses will be replaced by dummy
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    50
        delegators. (They will be kept for backward compatibility, though).
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    51
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    52
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    53
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    54
    this class implements a pop-up box to show an information message.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    55
    It has a single ok-Button, which closes the box.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    56
    Also entering return has (by default) the same effect as pressing
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    57
    the ok-button.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    58
    InfoBox is a superclass of some other boxes - see WarningBox, YesNoBox etc.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    59
    most of them simply redefine the icon shown in the upper left or
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    60
    add buttons.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    61
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    62
    instance variables:
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    63
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    64
        formLabel        <Label>        shows a bitmap (warning, question-mark)
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    65
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    66
        textLabel        <Label>        shows the boxes text
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    67
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    68
"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    69
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    70
!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    71
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    72
examples
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    73
"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    74
    InfoBoxes are created with:
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    75
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    76
        aBox := InfoBox title:'some title'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    77
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    78
    and shown with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    79
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    80
        aBox showAtPointer
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    81
    or
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    82
        aBox open
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    83
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    84
    The default box shows 'yes' in its button; this can be changed with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    85
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    86
        aBox okText:'some string'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    87
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    88
    the boxes bitmap-image can be changed with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    89
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    90
        aBox image:aForm
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    91
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    92
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    93
    Since this type of information is pretty common, a convenient information
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    94
    method has been added to Object.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    95
    Thus, you can use:
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    96
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    97
        self information:'hello world'
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    98
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    99
    everwhere in your program.
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   100
    for ST-80 compatibility, you can also use:
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   101
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   102
        Dialog information:'hello world'
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   103
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   104
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   105
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   106
    standard box:
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   107
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   108
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   109
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   110
        box := InfoBox title:'hello world '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   111
        box open
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   112
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   113
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   114
    changing the buttons label:
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   115
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   116
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   117
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   118
        box := InfoBox title:'hello world '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   119
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   120
        box open
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   121
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   122
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   123
    changing the icon:
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   124
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   125
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   126
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   127
        box := InfoBox title:'hello world '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   128
        box image:(Image fromFile:'bitmaps/SBrowser.xbm').
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   129
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   130
        box open
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   131
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   132
    or even:
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   133
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   134
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   135
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   136
        box := InfoBox title:'hello garfield '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   137
        box image:((Image fromFile:'bitmaps/garfield.gif') magnifiedTo:200@100).
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   138
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   139
        box open
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   140
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   141
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   142
    If you plan to use boxes as in the last example, you may want to
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   143
    keep the box around for reuse (since the image magnification takes some time).
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   144
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   145
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   146
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   147
        box := InfoBox title:'hello garfield '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   148
        box image:((Image fromFile:'bitmaps/garfield.gif') magnifiedTo:200@100).
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   149
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   150
        box open.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   151
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   152
        box title:'hello again'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   153
        box open
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   154
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   155
"
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   156
! !
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   157
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   158
!InfoBox class methodsFor:'instance creation'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   159
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   160
title:titleString
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   161
    "create a new infoBox with title, aTitleString"
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   162
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   163
    ^ (self new) title:titleString
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   164
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   165
    "
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   166
     (InfoBox title:'hello') open
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   167
    "
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   168
! !
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   169
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   170
!InfoBox class methodsFor:'defaults'!
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   171
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   172
iconBitmap
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   173
    "return the bitmap shown as icon in my instances.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   174
     The form is cached and reused, for faster opening."
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   175
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   176
    InfoBitmap isNil ifTrue:[
108
0acd243c622a *** empty log message ***
claus
parents: 97
diff changeset
   177
	InfoBitmap := Image fromFile:'bitmaps/Information.xbm'. 
0acd243c622a *** empty log message ***
claus
parents: 97
diff changeset
   178
	InfoBitmap notNil ifTrue:[
0acd243c622a *** empty log message ***
claus
parents: 97
diff changeset
   179
	    InfoBitmap := InfoBitmap on:Display 
0acd243c622a *** empty log message ***
claus
parents: 97
diff changeset
   180
	]
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   181
    ].
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   182
    ^ InfoBitmap
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   183
! !
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   184
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   185
!InfoBox class methodsFor:'styles'!
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   186
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   187
updateStyleCache
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   188
    |img|
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   189
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   190
    img := StyleSheet at:'informationBoxIcon'.
72
730e270a37e6 last version before using new DialogBox
claus
parents: 63
diff changeset
   191
    img notNil ifTrue:[InfoBitmap := img on:Display].
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   192
! !
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   193
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   194
!InfoBox methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   195
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   196
form:aFormOrImage
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   197
    "historical leftover - define a form to be displayed left of the title"
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   198
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   199
    self image:aFormOrImage
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   200
!
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   201
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   202
formLabel
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   203
    "return the formLabel = can be used to change its appearance"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   204
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   205
    ^ formLabel
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   206
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   207
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   208
image:aForm
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   209
    "define a form to be displayed left of the title
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   210
     - usually left as defaulted:
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   211
	an exclamation-mark here, warn-sign in warningBox,
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   212
	others in other subclasses."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   213
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   214
    formLabel form:aForm.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   215
    formLabel forceResize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   216
    shown ifTrue:[self resize]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   217
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   218
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   219
textLabel
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   220
    "return the textLabel = can be used to change its appearance"
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   221
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   222
    ^ textLabel
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   223
!
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   224
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   225
title
8
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
   226
    "return the boxes title string"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   227
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   228
    ^ textLabel label
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   229
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   230
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   231
title:aString
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   232
    "set the boxes title string"
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   233
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   234
    aString ~= textLabel label ifTrue:[
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   235
	textLabel label:aString.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   236
	textLabel forceResize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   237
	shown ifTrue:[self resize]
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   238
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   239
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   240
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   241
!InfoBox methodsFor:'initialization'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   242
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   243
initFormBitmap
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   244
    "setup the bitmap shown in the upper left -
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   245
     extracted into a separate method for easier redefinition
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   246
     in subclasses"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   247
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   248
    formLabel form:(self class iconBitmap)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   249
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   250
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   251
initFormLabel
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   252
    |mm|
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   253
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   254
    mm := ViewSpacing.
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   255
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   256
    formLabel := Label in:self.
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   257
    formLabel borderWidth:0.
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   258
    formLabel origin:(mm @ mm).
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   259
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   260
    "Created: 16.11.1995 / 18:32:32 / cg"
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   261
!
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   262
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   263
initialize
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   264
    |mm|
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   265
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   266
    super initialize.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   267
    self addOkButton.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   268
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   269
    label := 'Info'.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   270
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   271
    mm := ViewSpacing.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   272
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   273
    self initFormLabel.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   274
    self initFormBitmap.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   275
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   276
    textLabel := Label label:'Information' in:self.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   277
    textLabel borderWidth:0.
367
bc778f90e42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   278
    textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   279
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   280
    "
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   281
     |b|
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   282
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   283
     b := InfoBox new.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   284
     b title:'hello'.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   285
     b open
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   286
    "
367
bc778f90e42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   287
bc778f90e42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   288
    "Modified: 20.2.1996 / 20:22:43 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   289
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   290
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   291
!InfoBox methodsFor:'queries'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   292
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   293
preferredExtent 
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   294
    "return my preferred extent"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   295
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   296
    |w h mm|
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   297
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   298
"/    formLabel resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   299
"/    textLabel resize.
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   300
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   301
    mm := ViewSpacing.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   302
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   303
    w := ((margin + mm) * 2) + 
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   304
         formLabel widthIncludingBorder + 
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   305
         mm + textLabel width.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   306
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   307
    w := w max:(okButton preferredExtent x + (mm * 2)).
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   308
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   309
    h := (mm * 6)
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   310
         + ((formLabel heightIncludingBorder) max:(textLabel height))
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   311
         + okButton heightIncludingBorder.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   312
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   313
    ^ w @ h
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   314
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   315
    "Modified: 21.2.1996 / 00:54:19 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   316
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   317
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   318
!InfoBox class methodsFor:'documentation'!
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   319
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   320
version
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   321
    ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.24 1996-02-20 23:56:21 cg Exp $'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   322
! !