InfoBox.st
author Claus Gittinger <cg@exept.de>
Thu, 09 Nov 2017 20:09:30 +0100
changeset 6225 0122e4e6c587
parent 6079 0cda554f60c7
child 6242 ca40c9a97367
permissions -rw-r--r--
#FEATURE by cg class: GenericToolbarIconLibrary class added: #hideFilter16x16Icon
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
"
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
    12
"{ Package: 'stx:libwidg' }"
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
    13
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
    14
"{ NameSpace: Smalltalk }"
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
    15
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    16
DialogBox subclass:#InfoBox
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
    17
	instanceVariableNames:'formAndLabelPanel formLabel textLabel'
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    18
	classVariableNames:'InfoBitmap'
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    19
	poolDictionaries:''
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    20
	category:'Views-DialogBoxes'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    21
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
    23
!InfoBox class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    24
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    25
copyright
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    26
"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    27
 COPYRIGHT (c) 1989 by Claus Gittinger
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    28
	      All Rights Reserved
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    29
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    30
 This software is furnished under a license and may be used
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    31
 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
    32
 inclusion of the above copyright notice.   This software may not
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    33
 be provided or otherwise made available to, or used by, any
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    34
 other person.  No title to or ownership of the software is
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    35
 hereby transferred.
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
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    38
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    39
!
8
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
    40
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
    41
documentation
82e87dc3540e *** empty log message ***
claus
parents: 7
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)
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
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
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    49
        In the future, those existing subclasses' functionality is going to
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    50
        be moved fully into Dialog, and the subclasses will be replaced by dummy
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
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    55
    this class implements a pop-up box to show an information message.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    56
    It has a single ok-Button, which closes the box.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    57
    Also entering return has (by default) the same effect as pressing
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    58
    the ok-button.
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    59
    InfoBox is a superclass of some other boxes - see WarningBox, YesNoBox etc.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    60
    most of them simply redefine the icon shown in the upper left or
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    61
    add buttons.
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    62
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    63
    [instance variables:]
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    64
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    65
        formLabel        <Label>        shows a bitmap (warning, question-mark)
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    66
355
a55f62047156 commentary
Claus Gittinger <cg@exept.de>
parents: 243
diff changeset
    67
        textLabel        <Label>        shows the boxes text
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    68
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    69
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    70
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 574
diff changeset
    71
        Claus Gittinger
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    72
"
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    73
!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    74
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    75
examples
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
    76
"
2469
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    77
    Notice, the preferred use is via the DialogBox class messages,
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
    78
    such as
2469
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    79
                                                                        [exBegin]
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    80
        Dialog information:'Time to go home'
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    81
                                                                        [exEnd]
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    82
    these (DialogBox) mesages are compatible with VW and should therefore
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    83
    be used for portability.
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    84
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    85
    Direct use of InfoBox is only required for highly specialized boxes.
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    86
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    87
da097548025a documentation
Claus Gittinger <cg@exept.de>
parents: 2362
diff changeset
    88
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    89
    InfoBoxes are created with:
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    90
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    91
        aBox := InfoBox title:'some title'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    92
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    93
    and shown with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    94
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    95
        aBox showAtPointer
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    96
    or
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
    97
        aBox open
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    98
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
    99
    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
   100
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   101
        aBox okText:'some string'.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   102
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   103
    the boxes bitmap-image can be changed with:
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   104
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   105
        aBox image:aForm
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   106
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   107
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   108
    Since this type of information is pretty common, a convenient information
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   109
    method has been added to Object.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   110
    Thus, you can use:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   111
                                                                        [exBegin]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   112
        self information:'hello world'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   113
                                                                        [exEnd]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   114
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   115
    everwhere in your program.
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   116
    for ST-80 compatibility, you can also use:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   117
                                                                        [exBegin]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   118
        Dialog information:'hello world'
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   119
                                                                        [exEnd]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   120
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   121
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   122
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   123
    standard box:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   124
                                                                        [exBegin]
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 open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   129
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   130
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   131
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   132
    changing the buttons label:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   133
                                                                        [exBegin]
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 world '.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   137
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   138
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   139
                                                                        [exEnd]
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
    changing the icon:
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   143
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   144
                                                                        [exBegin]
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2076
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 world '.
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   148
        box image:(Image fromFile:'libtool/bitmaps/SBrowser.xbm' inPackage:'stx:libtool').
370
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
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   151
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   152
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   153
    or even:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   154
                                                                        [exBegin]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   155
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   156
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   157
        box := InfoBox title:'hello garfield '.
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
   158
        box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100).
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   159
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   160
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   161
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   162
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   163
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   164
    If you plan to use boxes as in the last example, you may want to
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   165
    keep the box around for reuse (since the image magnification takes some time).
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   166
                                                                        [exBegin]
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   167
        |box|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   168
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   169
        box := InfoBox title:'hello garfield '.
2362
f6ace7307e4d examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents: 2076
diff changeset
   170
        box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100).
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   171
        box okText:'wow'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   172
        box open.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   173
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   174
        box title:'hello again'.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   175
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   176
                                                                        [exEnd]
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   177
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   178
"
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   179
! !
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   180
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   181
!InfoBox class methodsFor:'instance creation'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   182
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   183
title:titleString
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   184
    "create a new infoBox with title, aTitleString"
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   185
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   186
    ^ (self new) title:titleString
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   187
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   188
    "
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   189
     (InfoBox title:'hello') open
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   190
    "
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   191
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   192
    "Modified: / 22-12-2010 / 19:30:50 / cg"
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   193
!
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   194
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
   195
title:titleString label:labelString
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   196
    "create a new infoBox with label, labelString"
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   197
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
   198
    ^ (self new) title:titleString label:labelString
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   199
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   200
    "
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   201
     (InfoBox title:'hello' label:'Attention' ) open
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   202
    "
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   203
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   204
    "Created: / 22-12-2010 / 19:31:03 / cg"
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   205
! !
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   206
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   207
!InfoBox class methodsFor:'defaults'!
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   208
574
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   209
defaultLabel
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   210
    "return the boxes default window title."
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   211
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   212
    ^ 'Info'
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   213
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   214
    "Created: 23.4.1996 / 17:12:33 / cg"
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   215
!
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   216
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   217
iconBitmap
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   218
    "return the bitmap shown as icon in my instances.
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   219
     This is the default image; you can overwrite this in a concrete
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   220
     instance with the #image: message"
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   221
1365
aa6a855b5013 new resource naming
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   222
    <resource: #style (#'infoBox.icon' #'infoBox.iconFile')>
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   223
2786
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   224
    InfoBitmap isNil ifTrue:[
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   225
        InfoBitmap := self iconBitmapFromStyle:'infoBox.icon' orStyleFile:'infoBox.iconFile' orFilename:'bitmaps/Information.xbm'.
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   226
    ].
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   227
    ^ InfoBitmap
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   228
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   229
    "Modified: / 26.10.1997 / 17:02:51 / cg"
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   230
!
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   231
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   232
iconBitmapFromStyle:styleName orStyleFile:styleFile orFilename:fileName
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   233
    "return the bitmap shown as icon in my instances.
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   234
     This is the default image; you can overwrite this in a concrete
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   235
     instance with the #image: message"
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   236
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   237
    |img imgFileName|
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   238
2786
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   239
    img := self styleSheet at:styleName.
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   240
    img isNil ifTrue:[
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   241
        imgFileName := StyleSheet at:styleFile default:fileName.
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   242
        img := Smalltalk imageFromFileNamed:imgFileName forClass:self.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   243
    ].
2786
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   244
    img notNil ifTrue:[
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   245
        img := img onDevice:Display
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   246
    ].
06de7ca4b263 code shared
Claus Gittinger <cg@exept.de>
parents: 2785
diff changeset
   247
    ^ img
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   248
1365
aa6a855b5013 new resource naming
Claus Gittinger <cg@exept.de>
parents: 1172
diff changeset
   249
    "Modified: / 26.10.1997 / 17:02:51 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   250
! !
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   251
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   252
!InfoBox class methodsFor:'styles'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   253
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   254
updateStyleCache
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   255
    "extract values from the styleSheet and cache them in class variables.
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   256
     Here, the cached infoBitmap is simply flushed."
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 370
diff changeset
   257
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   258
    InfoBitmap := nil
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   259
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   260
    "Modified: 1.4.1997 / 14:44:50 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   261
! !
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   262
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   263
!InfoBox methodsFor:'accessing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   264
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   265
form:aFormOrImage
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   266
    "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
   267
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   268
    <resource:#obsolete>
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   269
184
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   270
    self image:aFormOrImage
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   271
!
cbc75a3ba885 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 180
diff changeset
   272
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   273
formLabel
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   274
    "return the formLabel = can be used to change its appearance"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   275
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   276
    ^ formLabel
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   277
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 8
diff changeset
   278
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   279
image:aForm
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   280
    "define a form to be displayed left of the title
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   281
     - usually left as defaulted:
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   282
        an exclamation-mark here, warn-sign in warningBox,
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   283
        others in other subclasses."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   284
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   285
    formLabel label:aForm.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   286
    formLabel forceResize.
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   287
    formAndLabelPanel forceResize.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   288
    verticalPanel forceResize.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   289
    shown ifTrue:[self resize]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   290
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   291
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   292
textLabel
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   293
    "return the textLabel = can be used to change its appearance"
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   294
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   295
    ^ textLabel
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   296
!
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   297
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   298
title
8
82e87dc3540e *** empty log message ***
claus
parents: 7
diff changeset
   299
    "return the boxes title string"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   300
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   301
    ^ textLabel label
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   302
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   303
    "Created: / 22-12-2010 / 19:27:43 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   304
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   305
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   306
title:aString
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   307
    "set the boxes label string"
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   308
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   309
    aString ~= textLabel label ifTrue:[
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   310
        textLabel label:aString.
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   311
        textLabel forceResize.
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   312
        formAndLabelPanel forceResize.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   313
        verticalPanel forceResize.
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   314
        shown ifTrue:[self resize]
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   315
    ]
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   316
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   317
    "Created: / 22-12-2010 / 19:27:16 / cg"
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   318
!
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   319
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   320
title:aString label:windowLabel
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   321
    "set the boxes label string"
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   322
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   323
    self label:windowLabel.
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   324
    self title:aString.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   325
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   326
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   327
!InfoBox methodsFor:'initialization'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   328
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   329
initFormBitmap
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   330
    "setup the bitmap shown in the upper left -
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   331
     extracted into a separate method for easier redefinition
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   332
     in subclasses"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   333
2969
eb87f1aedd6c Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents: 2802
diff changeset
   334
    formLabel label:(self class iconBitmap)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   335
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   336
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   337
initFormLabel
570
4a82b61a1497 commentary
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   338
    "setup the icon shown in the infoBox.
4a82b61a1497 commentary
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   339
     Can be redefined in subclasses."
4a82b61a1497 commentary
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   340
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   341
    |mm|
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   342
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   343
    mm := ViewSpacing.
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   344
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   345
    formLabel := Label in:formAndLabelPanel.
3866
7628105ef29f assign textLabel and textForm name when creating views
fm
parents: 3750
diff changeset
   346
    formLabel name: 'formLabel'.
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   347
    formLabel borderWidth:0.
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   348
"/    formLabel origin:(mm @ mm).
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   349
4385
bd433a8f6b4c refactored
Claus Gittinger <cg@exept.de>
parents: 4381
diff changeset
   350
    "Created: / 16-11-1995 / 18:32:32 / cg"
bd433a8f6b4c refactored
Claus Gittinger <cg@exept.de>
parents: 4381
diff changeset
   351
    "Modified: / 22-04-1996 / 18:15:37 / cg"
bd433a8f6b4c refactored
Claus Gittinger <cg@exept.de>
parents: 4381
diff changeset
   352
    "Modified (format): / 28-02-2012 / 18:20:23 / cg"
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   353
!
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   354
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   355
initialize
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   356
    |mm sep|
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   357
6079
0cda554f60c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5897
diff changeset
   358
    <modifier: #super> "must be called if redefined"
0cda554f60c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5897
diff changeset
   359
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   360
    super initialize.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   361
    self addOkButton.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   362
574
165d1b2b7922 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 570
diff changeset
   363
"/    label := 'Info'.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   364
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   365
"/    mm := ViewSpacing.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   366
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   367
    formAndLabelPanel := HorizontalPanelView in:self verticalPanel.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   368
180
0eb12501889e hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   369
    self initFormLabel.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   370
    self initFormBitmap.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   371
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   372
    formLabel width > 500 ifTrue:[
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   373
        textLabel := Label label:'Information' in:verticalPanel.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   374
    ] ifFalse:[
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   375
        textLabel := Label label:'Information' in:formAndLabelPanel.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   376
    ].
3866
7628105ef29f assign textLabel and textForm name when creating views
fm
parents: 3750
diff changeset
   377
    textLabel name: 'textLabel'.
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   378
    textLabel borderWidth:0.
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   379
    "/ textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   380
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   381
"/    yPosition := textLabel corner y.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   382
"/    formLabel notNil ifTrue:[yPosition := yPosition max:(formLabel corner y)].
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   383
"/    yPosition := yPosition + ViewSpacing.
4295
0d8d95fc9f63 changed: #initialize
Claus Gittinger <cg@exept.de>
parents: 4207
diff changeset
   384
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   385
    (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   386
        sep := Separator in:self verticalPanel.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   387
"/        sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + mm)].
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   388
        sep width:1.0. "/ extent:(1.0 @ sep preferredHeight).
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   389
"/        yPosition := yPosition max:(sep corner y).
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   390
"/        yPosition := yPosition + ViewSpacing.
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   391
    ].
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   392
77
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   393
    "
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   394
     |b|
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   395
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   396
     b := InfoBox new.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   397
     b title:'hello'.
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   398
     b open
565b052f5277 *** empty log message ***
claus
parents: 72
diff changeset
   399
    "
367
bc778f90e42d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 355
diff changeset
   400
6079
0cda554f60c7 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5897
diff changeset
   401
    "Modified: / 08-02-2017 / 00:26:21 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   402
! !
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   403
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   404
!InfoBox methodsFor:'queries'!
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   405
3121
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   406
beepWhenOpening
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   407
    ^ UserPreferences current beepForInfoDialog
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   408
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   409
    "
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   410
     Dialog information:'hello'
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   411
     Dialog warn:'hello'
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   412
     Dialog error:'hello'
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   413
    "
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   414
!
8e4d21e008c9 beep control
Claus Gittinger <cg@exept.de>
parents: 2969
diff changeset
   415
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
   416
preferredExtent
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   417
    "return my preferred extent"
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   418
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   419
    |w h mm|
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   420
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   421
^ super preferredExtent.
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   422
3750
3d4912629acf changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3609
diff changeset
   423
    "/ If I have an explicit preferredExtent..
3d4912629acf changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3609
diff changeset
   424
    explicitExtent notNil ifTrue:[
3d4912629acf changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3609
diff changeset
   425
        ^ explicitExtent
3d4912629acf changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3609
diff changeset
   426
    ].
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   427
3750
3d4912629acf changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3609
diff changeset
   428
    "/ If I have a cached preferredExtent value..
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   429
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   430
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   431
    ].
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   432
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   433
    mm := ViewSpacing.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   434
5897
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
   435
    w := ((margin + mm) * 2) +
2557ab3713e8 #OTHER by mawalch
mawalch
parents: 5402
diff changeset
   436
         formLabel widthIncludingBorder +
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   437
         mm + textLabel width.
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   438
3609
3bd1b03b1ffb added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   439
    w := w max:(okButton preferredWidth + (mm * 2)).
2802
19b141dd52b9 fixed preferredWidth when components were added
Claus Gittinger <cg@exept.de>
parents: 2800
diff changeset
   440
    w := w max:self maxPreferredWidthOfAddedComponents.
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   441
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   442
    h := (mm * 6)
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   443
         + ((formLabel heightIncludingBorder) max:(textLabel height))
3609
3bd1b03b1ffb added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3121
diff changeset
   444
         + ((addedComponents ? #()) inject:0 into:[:sum :thisComponent | sum + thisComponent preferredHeight])
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   445
         + okButton heightIncludingBorder.
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   446
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   447
    (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   448
        h := h + (ViewSpacing * 3)
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   449
    ].
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   450
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   451
    ^ w @ h
370
dc5b51904d3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 367
diff changeset
   452
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   453
    "Modified: 1.4.1997 / 14:53:35 / cg"
197
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   454
! !
00927189c882 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   455
1172
d10e4627b0e3 allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   456
!InfoBox class methodsFor:'documentation'!
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   457
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   458
version
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   459
    ^ '$Header$'
4207
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   460
!
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   461
281ffd00c1a8 #title:label:
Claus Gittinger <cg@exept.de>
parents: 3866
diff changeset
   462
version_CVS
5402
36164fbcd8dc class: InfoBox
Claus Gittinger <cg@exept.de>
parents: 4863
diff changeset
   463
    ^ '$Header$'
243
5c411425097d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 197
diff changeset
   464
! !
4863
12c87ee0e767 Replace references to Diplay with "Screen current" - where appropriate
Stefan Vogel <sv@exept.de>
parents: 4385
diff changeset
   465