FramedBox.st
author ca
Thu, 03 Aug 2000 09:29:45 +0200
changeset 2203 1550851c94f6
parent 1992 6d6b16f9d55e
child 2227 58426f7611f2
permissions -rw-r--r--
add labelChannel
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) 1991 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
2203
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
    13
"{ Package: 'stx:libwidg' }"
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
    14
118
claus
parents: 70
diff changeset
    15
SimpleView subclass:#FramedBox
2203
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
    16
	instanceVariableNames:'label labelChannel labelPosition fgColor showFrame frame3D
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
    17
		horizontalSpace verticalSpace innerHorizontalSpace
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
    18
		innerVerticalSpace'
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    19
	classVariableNames:''
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    20
	poolDictionaries:''
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    21
	category:'Views-Layout'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
    24
!FramedBox class methodsFor:'documentation'!
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    25
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    26
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    27
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    28
 COPYRIGHT (c) 1991 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
    29
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    30
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    31
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    32
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    34
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    35
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    36
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    37
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    38
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    39
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    40
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    41
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    42
    a frame around something. The frame may have a label, whose position
133
claus
parents: 130
diff changeset
    43
    is controlled by the labelPosition variable, a symbol which may be one of:
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    44
    [#topCenter #topLeft #topRight #bottomLeft #bottomCenter #bottomRight]
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    45
133
claus
parents: 130
diff changeset
    46
    The default labelPosition is controlled by the styleSheet variable:
claus
parents: 130
diff changeset
    47
    'framedBoxLabelPosition' (usually, #topCenter).
claus
parents: 130
diff changeset
    48
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    49
    Its also possible, to not show the frame but only the label, by setting
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    50
    showFrame to false.
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    51
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    52
    The distance from the outer viewBorder to the frame is controlled by
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    53
    horizontalSpace / verticalSpace. The default is the fonts height.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    54
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    55
    The distance from the frame to the interior area is controlled by
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    56
    innerHorizontalSpace / innerVerticalSpace. The default is 0.
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    57
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    58
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 572
diff changeset
    59
        Claus Gittinger
685
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
    60
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
    61
    [see also:]
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
    62
        PanelView Separator
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
    63
"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    65
125
claus
parents: 118
diff changeset
    66
examples 
claus
parents: 118
diff changeset
    67
"
claus
parents: 118
diff changeset
    68
    simple:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    69
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    70
        |top frame1 frame2 frame3|
125
claus
parents: 118
diff changeset
    71
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    72
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    73
        top extent:300@200.
125
claus
parents: 118
diff changeset
    74
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    75
        frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    76
        frame1 label:'frame1'.
3
claus
parents: 0
diff changeset
    77
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    78
        frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    79
        frame2 label:'frame2'.
125
claus
parents: 118
diff changeset
    80
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    81
        frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    82
        frame3 label:'frame3'.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
    84
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
    85
                                                                        [exEnd]
125
claus
parents: 118
diff changeset
    86
claus
parents: 118
diff changeset
    87
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    88
    non-string label:
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    89
                                                                        [exBegin]
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    90
        |top frame|
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    91
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    92
        top := StandardSystemView new.
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    93
        top extent:300@200.
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    94
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    95
        frame := FramedBox origin:0.0@0.0 corner:1.0@1.0 in:top.
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    96
        frame label:(Image fromFile:'bitmaps/SBrowser.xbm').
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    97
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    98
        top open
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
    99
                                                                        [exEnd]
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   100
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   101
125
claus
parents: 118
diff changeset
   102
    placing something inside:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   103
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   104
        |top frame1 frame2 frame3 v1 v2 v3|
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   105
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   106
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   107
        top extent:300@200.
3
claus
parents: 0
diff changeset
   108
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   109
        frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   110
        frame1 label:'frame1'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   111
        v1 := View origin:0.0@0.0 corner:1.0@1.0 in:frame1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   112
        v1 viewBackground:(Color yellow);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   113
           level:1.
125
claus
parents: 118
diff changeset
   114
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   115
        frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   116
        frame2 label:'frame2'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   117
        v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   118
        v2 viewBackground:(Color red);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   119
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   120
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   121
        frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   122
        frame3 label:'frame3'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   123
        v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   124
        v3 viewBackground:(Color green);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   125
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   126
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   127
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   128
                                                                        [exEnd]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   129
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   130
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   131
    placing something inside a frame in a dialog:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   132
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   133
        |box panel frame1 frame2 frame3 v1 v1b v2 v3|
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   134
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   135
        box := Dialog new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   136
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   137
        frame1 := FramedBox label:'frame1'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   138
        panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   139
        v1 := View extent:100@100 in:panel.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   140
        v1 viewBackground:(Color red);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   141
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   142
        v1b := View extent:100@100 in:panel.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   143
        v1b viewBackground:(Color yellow);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   144
            level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   145
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   146
        box addComponent:frame1.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   147
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   148
        frame2 := FramedBox label:'frame2'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   149
        v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   150
        v2 viewBackground:(Color green);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   151
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   152
        box addComponent:frame2.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   153
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   154
        frame3 := FramedBox label:'frame3'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   155
        v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   156
        v3 viewBackground:(Color blue);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   157
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   158
        box addComponent:frame3.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   159
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   160
        box addOkButton.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   161
        box stickAtBottomWithVariableHeight:frame3.
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   162
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   163
                                                                        [exEnd]
125
claus
parents: 118
diff changeset
   164
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   165
125
claus
parents: 118
diff changeset
   166
    placing something inside a frame in a dialog:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   167
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   168
        |box panel frame1 frame2 frame3 v1 v1b v2 v3|
125
claus
parents: 118
diff changeset
   169
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   170
        box := Dialog new.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   171
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   172
        frame1 := FramedBox label:'frame1'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   173
        panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   174
        v1 := View extent:100@100 in:panel.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   175
        v1 viewBackground:(Color red);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   176
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   177
        v1b := View extent:100@100 in:panel.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   178
        v1b viewBackground:(Color yellow);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   179
            level:1.
125
claus
parents: 118
diff changeset
   180
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   181
        box addComponent:frame1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   182
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   183
        frame2 := FramedBox label:'frame2'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   184
        v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   185
        v2 viewBackground:(Color green);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   186
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   187
        box addComponent:frame2.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   188
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   189
        frame3 := FramedBox label:'frame3'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   190
        v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   191
        v3 viewBackground:(Color blue);
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   192
           level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   193
        box addComponent:frame3.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   194
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   195
        box addOkButton.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   196
        box stickAtBottomWithVariableHeight:frame3.
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   197
        box open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   198
                                                                        [exEnd]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   199
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   200
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   201
    simple again, default spacings:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   202
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   203
        |top frame v|
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   204
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   205
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   206
        top extent:300@200.
125
claus
parents: 118
diff changeset
   207
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   208
        frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   209
        frame label:'frame'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   210
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   211
        v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   212
        v viewBackground:(Color yellow); level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   213
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   214
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   215
                                                                        [exEnd]
125
claus
parents: 118
diff changeset
   216
claus
parents: 118
diff changeset
   217
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   218
    changing spacings:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   219
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   220
        |top frame v|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   221
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   222
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   223
        top extent:300@200.
125
claus
parents: 118
diff changeset
   224
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   225
        frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   226
        frame label:'frame'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   227
        frame horizontalSpace:30.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   228
        frame verticalSpace:20.
125
claus
parents: 118
diff changeset
   229
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   230
        v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   231
        v viewBackground:(Color yellow); level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   232
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   233
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   234
                                                                        [exEnd]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   235
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   236
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   237
    changing inner spacings:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   238
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   239
        |top frame v|
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   240
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   241
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   242
        top extent:300@200.
125
claus
parents: 118
diff changeset
   243
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   244
        frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   245
        frame label:'frame'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   246
        frame innerHorizontalSpace:30.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   247
        frame innerVerticalSpace:20.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   248
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   249
        v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   250
        v viewBackground:(Color yellow); level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   251
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   252
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   253
                                                                        [exEnd]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   254
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   255
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   256
     label only (no frame around):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   257
                                                                        [exBegin]
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   258
        |top frame v|
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   259
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   260
        top := StandardSystemView new.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   261
        top extent:300@200.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   262
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   263
        frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   264
        frame label:'frame'.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   265
        frame showFrame:false.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   266
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   267
        v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   268
        v viewBackground:(Color yellow); level:1.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   269
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   270
        top open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   271
                                                                        [exEnd]
125
claus
parents: 118
diff changeset
   272
"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   273
! !
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   274
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   275
!FramedBox methodsFor:'accessing'!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   276
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   277
font:aFont
664
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   278
    "set the frame labelstrings font.
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   279
     CAVEAT: with the addition of Text objects,
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   280
             this method is going to be obsoleted by a textStyle
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   281
             method, which allows specific control over
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   282
             normalFont/boldFont/italicFont parameters."
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   283
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   284
    (font ~= aFont) ifTrue:[
664
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   285
        super font:aFont.
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   286
        shown ifTrue:[
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   287
            self invalidate
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   288
        ]
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   289
    ]
664
57763dde86f3 commentary
Claus Gittinger <cg@exept.de>
parents: 608
diff changeset
   290
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   291
    "Modified: / 6.6.1998 / 20:05:05 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   292
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   293
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   294
foregroundColor
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   295
    "return the frame labels foreground color"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   296
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   297
    ^ fgColor
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   298
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   299
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   300
foregroundColor:aColor
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   301
    "set the frame labels foreground color"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   302
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   303
    aColor ~= fgColor ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   304
        fgColor := aColor.
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   305
        shown ifTrue:[
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   306
            self invalidateRepairNow:true
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   307
        ]
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   308
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   309
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   310
    "Modified: / 6.6.1998 / 19:23:14 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   311
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   312
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   313
frameShown
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   314
    "return true, if frame is shown;
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   315
     if false, oly the label is shown.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   316
     OBSOLETE; use #showFrame."
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   317
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   318
    ^ showFrame
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   319
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   320
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   321
horizontalSpace
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   322
    "return the number of pixels by which the frame is inset horizontally.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   323
     The default, nil, lets the box compute the horizontal inset from the
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   324
     labels font height."
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   325
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   326
    ^ horizontalSpace
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   327
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   328
    "Modified: 5.9.1995 / 17:24:21 / claus"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   329
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   330
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   331
horizontalSpace:aNumber 
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   332
    "set the number of pixels by which the frame is inset horizontally.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   333
     The default, nil, lets the box compute the horizontal inset from the
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   334
     labels font height."
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   335
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   336
    horizontalSpace := aNumber
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   337
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   338
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   339
innerHorizontalSpace:aNumber 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   340
    "set the number of pixels by which the interior is inset horizontally from the frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   341
     The default is 0"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   342
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   343
    innerHorizontalSpace := aNumber
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   344
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   345
    "Created: 10.1.1996 / 14:39:20 / cg"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   346
!
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   347
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   348
innerVerticalSpace:aNumber 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   349
    "set the number of pixels by which the interior is inset vertically from the frame.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   350
     The default is 0"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   351
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   352
    innerVerticalSpace := aNumber
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   353
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   354
    "Created: 10.1.1996 / 14:39:35 / cg"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   355
!
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   356
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   357
label
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   358
    "return the frames labelstring"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   359
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   360
    ^ label
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   361
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   362
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   363
label:aStringOrImage
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   364
    "set the frames labelstring or labelImage"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   365
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   366
    (label ~= aStringOrImage) ifTrue:[
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   367
        (aStringOrImage isString 
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   368
        and:[aStringOrImage isEmpty]) ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   369
            label := nil
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   370
        ] ifFalse:[
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   371
            label := aStringOrImage.
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   372
        ].
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   373
        shown ifTrue:[
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   374
            self invalidateRepairNow:true
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   375
        ]
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   376
    ]
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   377
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   378
    "Modified: / 5.9.1995 / 17:20:05 / claus"
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   379
    "Modified: / 6.6.1998 / 19:23:17 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   380
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   381
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   382
labelPosition
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   383
    "return the labelPosition, which is a symbol describing
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   384
     the labels position."
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   385
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   386
    ^ labelPosition
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   387
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   388
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   389
labelPosition:aSymbol
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   390
    "define the position of the label;
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   391
     aSymbol may be one of: 
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   392
        #topLeft, #topCenter, #topRight;
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   393
        #bottomLeft, #bottomCenter or #bottomRight"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   394
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   395
    labelPosition ~~ aSymbol ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   396
        labelPosition := aSymbol.
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   397
        shown ifTrue:[
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   398
            self invalidate
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   399
        ]
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   400
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   401
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   402
    "Modified: / 6.6.1998 / 20:04:22 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   403
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   404
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   405
layout:something
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   406
    "OBSOLETE compatibility interface. Will vanish.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   407
     In the meantime, try to figure out what is meant ... a kludge"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   408
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   409
    something isLayout ifTrue:[^ super layout:something].
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   410
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   411
    self obsoleteMethodWarning:'use #labelPosition:'.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   412
    ^ self labelPosition:something
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   413
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   414
    "Modified: 31.8.1995 / 23:07:00 / claus"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   415
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   416
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   417
setLabel:anImage
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   418
    "set the frames label.
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   419
     same as #label: for ST-80 GroupBox compatibility"
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   420
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   421
    ^ self label:anImage
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   422
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   423
    "Created: 17.2.1997 / 11:03:04 / cg"
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   424
    "Modified: 17.2.1997 / 11:03:24 / cg"
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   425
!
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   426
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   427
setLabelString:anImage
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   428
    "set the frames label.
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   429
     same as #label: for ST-80 GroupBox compatibility"
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   430
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   431
    ^ self label:anImage
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   432
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   433
    "Modified: 17.2.1997 / 11:03:19 / cg"
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   434
!
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   435
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   436
showFrame
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   437
    "return if the view shows its frame.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   438
     If false, only the label is drawn"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   439
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   440
    ^ showFrame
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   441
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   442
    "Modified: 5.9.1995 / 17:21:37 / claus"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   443
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   444
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   445
showFrame:aBoolean
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   446
    "turn on/off showing of the frame -
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   447
     without a frame, only the label is shown at its position"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   448
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   449
    aBoolean ~~ showFrame ifTrue:[
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   450
        showFrame := aBoolean.
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   451
        shown ifTrue:[
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   452
            self invalidate
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   453
        ]
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   454
    ]
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   455
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   456
    "Modified: / 6.6.1998 / 20:03:50 / cg"
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   457
!
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   458
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   459
verticalSpace
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   460
    "return the number of pixels by which the frame is inset vertically.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   461
     The default, nil, lets the box compute the vertical inset from the
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   462
     labels font height."
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   463
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   464
    ^ verticalSpace
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   465
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   466
    "Modified: 5.9.1995 / 17:24:21 / claus"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   467
    "Created: 10.1.1996 / 14:38:21 / cg"
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   468
!
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   469
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   470
verticalSpace:aNumber 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   471
    "set the number of pixels by which the frame is inset vertically.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   472
     The default, nil, lets the box compute the vertical inset from the
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   473
     labels font height."
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   474
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   475
    verticalSpace := aNumber.
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   476
1555
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   477
    "Created: / 10.1.1996 / 14:38:31 / cg"
49aee7cb2f36 label changes are redrawn immediately
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
   478
    "Modified: / 6.6.1998 / 20:04:39 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   479
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   480
2203
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   481
!FramedBox methodsFor:'accessing - channels'!
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   482
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   483
labelChannel
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   484
    "return the labelChannel - or nil"
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   485
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   486
    ^ labelChannel.
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   487
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   488
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   489
!
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   490
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   491
labelChannel:aValueHolder
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   492
    "set the labelChannel - a valueHolder holding a string
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   493
     which is shown as my logo
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   494
    "
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   495
    labelChannel notNil ifTrue:[
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   496
        labelChannel removeDependent:self.
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   497
    ].
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   498
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   499
    (labelChannel := aValueHolder) notNil ifTrue:[
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   500
        labelChannel addDependent:self.
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   501
        self label:(labelChannel value).
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   502
    ].
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   503
! !
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   504
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   505
!FramedBox methodsFor:'change and update'!
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   506
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   507
update:what with:aPara from:aModel
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   508
    "the MVC way of changing the label ...
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   509
    "
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   510
    (labelChannel notNil and:[aModel == labelChannel]) ifTrue:[
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   511
        self label:(aModel value).
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   512
      ^ self
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   513
    ].
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   514
    ^ super update:what with:aPara from:aModel
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   515
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   516
! !
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   517
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   518
!FramedBox methodsFor:'drawing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   519
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   520
drawFrame
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   521
    "redraw the frame"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   522
133
claus
parents: 130
diff changeset
   523
    |halfSepX halfSepY w h|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   524
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   525
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   526
     if there is no label, give more real estate to the inside
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   527
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   528
    label isNil ifTrue:[
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   529
        halfSepX := halfSepY := 2
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   530
    ] ifFalse:[
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   531
        halfSepX := halfSepY := (label heightOn:self) // 2.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   532
    ].
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   533
133
claus
parents: 130
diff changeset
   534
    horizontalSpace notNil ifTrue:[
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   535
        halfSepX := horizontalSpace.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   536
    ].
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   537
    verticalSpace notNil ifTrue:[
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   538
        halfSepY := verticalSpace.
133
claus
parents: 130
diff changeset
   539
    ].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   540
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   541
    halfSepX := halfSepX + margin.
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   542
    halfSepY := halfSepY + margin.
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   543
133
claus
parents: 130
diff changeset
   544
    w := width - halfSepX - halfSepX.
claus
parents: 130
diff changeset
   545
    h := height - halfSepY - halfSepY.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   546
59
450ce95a72a4 *** empty log message ***
claus
parents: 38
diff changeset
   547
    frame3D ifFalse:[
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   548
        self displayRectangleX:halfSepX 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   549
                             y:halfSepY
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   550
                         width:w 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   551
                        height:h.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   552
        ^ self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   553
    ].
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   554
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   555
    w := w + 1.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   556
    h := h + 1.
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   557
685
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   558
    self paint:lightColor.
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   559
    self displayRectangleX:halfSepX 
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   560
                         y:halfSepY
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   561
                     width:w
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   562
                    height:h.
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   563
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   564
    self paint:shadowColor.
133
claus
parents: 130
diff changeset
   565
    self displayRectangleX:halfSepX-1 
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   566
                         y:halfSepY-1
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   567
                     width:w 
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   568
                    height:h.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   569
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   570
    "Modified: 17.2.1997 / 11:04:34 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   571
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   572
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   573
redraw
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   574
    "redraw the frame and name if present"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   575
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   576
    |labelLen l x y|
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   577
1084
f890ae939e49 clear in redraw;
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   578
    self clear.
f890ae939e49 clear in redraw;
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   579
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   580
    label isNil ifTrue:[
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   581
        labelLen := 0
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   582
    ] ifFalse:[
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   583
        label isString ifTrue:[
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   584
            l := ' ' , label , ' '.
1992
6d6b16f9d55e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
   585
            font := font onDevice:device.
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   586
        ] ifFalse:[
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   587
            l := label
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   588
        ].
1084
f890ae939e49 clear in redraw;
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   589
        labelLen := l widthOn:self
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   590
    ].
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   591
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   592
    showFrame ifTrue:[
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   593
        self drawFrame.
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   594
    ].
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 25
diff changeset
   595
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   596
    labelLen > 0 ifTrue:[
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   597
        labelLen < width ifTrue:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   598
            (labelPosition == #topLeft 
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   599
            or:[labelPosition == #topCenter
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   600
            or:[labelPosition == #topRight]]) ifTrue:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   601
                "
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   602
                 label at top
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   603
                "
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   604
                y := font ascent + margin.
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   605
            ] ifFalse:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   606
                "
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   607
                 label at bottom
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   608
                "
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   609
                y := height - margin - font descent.
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   610
            ].
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   611
            (labelPosition == #topLeft
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   612
            or:[labelPosition == #bottomLeft]) ifTrue:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   613
                "
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   614
                 label at left
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   615
                "
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   616
                x := font height + margin
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   617
            ] ifFalse:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   618
                (labelPosition == #topRight
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   619
                or:[labelPosition == #bottomRight]) ifTrue:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   620
                    "
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   621
                     label at right
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   622
                    "
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   623
                    x := width - margin - labelLen - font height
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   624
                ] ifFalse:[
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   625
                    "
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   626
                     label at center
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   627
                    "
1635
095c31e9c914 fixed drawingPosition, with big margin (i.e. 3D level)
Claus Gittinger <cg@exept.de>
parents: 1555
diff changeset
   628
                    x := (width - margin - labelLen) // 2
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   629
                ]
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   630
            ].
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   631
            self paint:fgColor on:viewBackground.
1019
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   632
            label isString ifTrue:[
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   633
                self displayOpaqueString:l x:x y:y
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   634
            ] ifFalse:[
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   635
                l displayOpaqueOn:self x:x y:y - font ascent
0d027812861e allow image-labels (for compatibility with ST-80's GroupBox)
Claus Gittinger <cg@exept.de>
parents: 993
diff changeset
   636
            ]
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   637
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   638
    ]
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   639
1084
f890ae939e49 clear in redraw;
Claus Gittinger <cg@exept.de>
parents: 1019
diff changeset
   640
    "Modified: 28.2.1997 / 21:28:09 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   641
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   642
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   643
!FramedBox methodsFor:'event handling'!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   644
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   645
sizeChanged:how
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   646
    shown ifTrue:[
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   647
        self invalidate.
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   648
    ].
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   649
    super sizeChanged:how
721
4a01084cf643 use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
   650
993
51cce445b5d5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
   651
    "Modified: 8.2.1997 / 15:19:52 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   652
! !
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   653
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   654
!FramedBox methodsFor:'initialization'!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   655
2203
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   656
destroy
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   657
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   658
    labelChannel notNil ifTrue:[
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   659
        labelChannel removeDependent:self.
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   660
        labelChannel := nil.
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   661
    ].
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   662
    super destroy
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   663
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   664
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   665
!
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   666
944
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   667
fetchDeviceResources
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   668
    "fetch device colors, to avoid reallocation at redraw time"
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   669
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   670
    super fetchDeviceResources.
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   671
1992
6d6b16f9d55e #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1845
diff changeset
   672
    fgColor := fgColor onDevice:device.
944
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   673
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   674
    "Created: 15.2.1997 / 16:57:56 / cg"
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   675
!
87c58d0fd30c fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 914
diff changeset
   676
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   677
initStyle
959
331da6bc19ec commentary
Claus Gittinger <cg@exept.de>
parents: 944
diff changeset
   678
    "setup style specifics.
331da6bc19ec commentary
Claus Gittinger <cg@exept.de>
parents: 944
diff changeset
   679
     The default position is top-center, except for ms-windows, where
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   680
     the text is positioned at top-left"
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   681
1364
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   682
    <resource: #style (#'framedBox.foregroundColor' 
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   683
                       #'framedBox.labelPosition'
1845
84f68da8e19b added framedBox.font attribute in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1635
diff changeset
   684
                       #'framedBox.font'
1364
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   685
                       #'framedBox.3DFrame')>
608
aedd7bf72edc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   686
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   687
    super initStyle.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   688
1364
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   689
    fgColor := StyleSheet at:'framedBox.foregroundColor' default:Black.
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   690
    labelPosition := StyleSheet at:'framedBox.labelPosition' default:#topCenter.
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   691
    frame3D := StyleSheet at:'framedBox.3DFrame' default:true.
1845
84f68da8e19b added framedBox.font attribute in styleSheet
Claus Gittinger <cg@exept.de>
parents: 1635
diff changeset
   692
    font := StyleSheet at:'framedBox.font' default:font.
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   693
    borderWidth := 0.
608
aedd7bf72edc checkin from browser
Claus Gittinger <cg@exept.de>
parents: 593
diff changeset
   694
1364
6610f90eea47 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1291
diff changeset
   695
    "Modified: / 26.10.1997 / 17:00:57 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   696
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   697
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   698
initialize
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   699
    innerHorizontalSpace := innerVerticalSpace := 0.
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   700
    super initialize.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   701
    showFrame := true
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   702
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   703
    "Modified: 10.1.1996 / 14:38:40 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   704
! !
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   705
125
claus
parents: 118
diff changeset
   706
!FramedBox methodsFor:'queries'!
claus
parents: 118
diff changeset
   707
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   708
preferredExtent
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   709
    "compute the boxes preferredExtent from the components' sizes.
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   710
     Redefined to add space for the frame to the default extent" 
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   711
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   712
    |m2 sep|
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   713
797
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   714
    "/ If I have an explicit preferredExtent ..
2f9cd56f48ee *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 721
diff changeset
   715
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   716
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   717
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   718
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 685
diff changeset
   719
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   720
    sep := font heightOn:device.
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   721
    m2 := sep + sep.
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   722
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   723
    showFrame ifFalse:[
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   724
        ^ super preferredExtent + (0 @ m2)
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   725
    ].
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   726
    ^ super preferredExtent+(m2 @ m2)
572
121735c2aff6 commentary
Claus Gittinger <cg@exept.de>
parents: 277
diff changeset
   727
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   728
    "Modified: 3.1.1997 / 22:02:56 / cg"
195
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   729
!
fb03114fa1c3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   730
125
claus
parents: 118
diff changeset
   731
viewRectangle
claus
parents: 118
diff changeset
   732
    "return the inside area 
claus
parents: 118
diff changeset
   733
     - redefined to save frame from relative computations."
claus
parents: 118
diff changeset
   734
685
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   735
    |mH mV sepH sepV imH imV lw|
125
claus
parents: 118
diff changeset
   736
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   737
    sepH := sepV := font heightOn:device.
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   738
    horizontalSpace notNil ifTrue:[
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   739
        sepH := horizontalSpace
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   740
    ].
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   741
    verticalSpace notNil ifTrue:[
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   742
        sepV := verticalSpace
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   743
    ].
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   744
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   745
    mH := sepH * 2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   746
    mV := sepV * 2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   747
    imH := innerHorizontalSpace * 2.
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   748
    imV := innerVerticalSpace * 2.
125
claus
parents: 118
diff changeset
   749
claus
parents: 118
diff changeset
   750
    showFrame ifFalse:[
685
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   751
        sepH := mH := lw := 0.
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   752
    ] ifTrue:[
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   753
        lw := 2.
125
claus
parents: 118
diff changeset
   754
    ].
685
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   755
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   756
    ^ ((sepH + innerHorizontalSpace + lw) @ (innerVerticalSpace + sepV + lw)) 
48b91a79927d frame inset was wrong
Claus Gittinger <cg@exept.de>
parents: 664
diff changeset
   757
        extent:((width - imH - mH - lw - lw) @ (height - imV - mV - lw - lw))
125
claus
parents: 118
diff changeset
   758
claus
parents: 118
diff changeset
   759
"/    |m2 sepH sepV|
claus
parents: 118
diff changeset
   760
"/
claus
parents: 118
diff changeset
   761
"/    sepV := font height.
claus
parents: 118
diff changeset
   762
"/
claus
parents: 118
diff changeset
   763
"/    showFrame ifFalse:[
claus
parents: 118
diff changeset
   764
"/        ^ (0 @ sepV) extent:(width @ (height - sepV - sepV))
claus
parents: 118
diff changeset
   765
"/    ].
claus
parents: 118
diff changeset
   766
"/    sepH := sepV // 2.
claus
parents: 118
diff changeset
   767
"/    ^ (sepH @ sepH) extent:((width - sepH - sepH) @ (height - sepV - sepV))
277
243d138cf316 more frame layout control added
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   768
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   769
    "Modified: 3.1.1997 / 22:03:08 / cg"
125
claus
parents: 118
diff changeset
   770
! !
claus
parents: 118
diff changeset
   771
914
c2435be998ba care for font being on device before querying
Claus Gittinger <cg@exept.de>
parents: 797
diff changeset
   772
!FramedBox class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
   773
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
   774
version
2203
1550851c94f6 add labelChannel
ca
parents: 1992
diff changeset
   775
    ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.41 2000-08-03 07:29:45 ca Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 195
diff changeset
   776
! !