eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FramedBox':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FramedBox


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--FramedBox

Package:
stx:libwidg
Category:
Views-Layout
Version:
rev: 1.75 date: 2023/07/06 14:35:51
user: cg
file: FramedBox.st directory: libwidg
module: stx stc-classLibrary: libwidg

Description:


a frame around something. The frame may have a label, whose position
is controlled by the labelPosition variable, a symbol which may be one of:
[#topCenter #topLeft #topRight #bottomLeft #bottomCenter #bottomRight #hidden]

The default labelPosition is controlled by the styleSheet variable:
'framedBoxLabelPosition' (usually, #topCenter).

Its also possible, to not show the frame but only the label, by setting
showFrame to false.

The distance from the outer viewBorder to the frame is controlled by
horizontalSpace / verticalSpace. The default is the font's height.

The distance from the frame to the interior area is controlled by
innerHorizontalSpace / innerVerticalSpace. The default is 0.

copyright

COPYRIGHT (c) 1991 by Claus Gittinger All Rights Reserved This software is furnished under a license and may be used only in accordance with the terms of that license and with the inclusion of the above copyright notice. This software may not be provided or otherwise made available to, or used by, any other person. No title to or ownership of the software is hereby transferred.

Instance protocol:

accessing
o  font: aFont
set the frame labelstrings font.
CAVEAT: with the addition of Text objects,
this method is going to be obsoleted by a textStyle
method, which allows specific control over
normalFont/boldFont/italicFont parameters.

o  frameColor
return the frame's color

o  frameColor: aColor
set the frame's foreground color

o  frameLineStyle
more control over the frame:
nil no frame
#all full rectangle
#topLine only a line at the top

o  frameLineStyle: aSymbolOrNil
more control over the frame:
nil no frame
#all full rectangle
#topLine only a line at the top

o  frameShown
return true, if frame is shown;
if false, only the label is shown.
OBSOLETE; use #showFrame.

o  horizontalSpace
return the number of pixels by which the frame is inset horizontally.
The default, nil, lets the box compute the horizontal inset from the
label's font height.

o  horizontalSpace: aNumber
set the number of pixels by which the frame is inset horizontally.
The default, nil, lets the box compute the horizontal inset from the
label's font height.

o  innerHorizontalSpace: aNumber
set the number of pixels by which the interior is inset horizontally from the frame.
The default is 0

o  innerVerticalSpace: aNumber
set the number of pixels by which the interior is inset vertically from the frame.
The default is 0

o  label
return the frames labelstring

o  label: aStringOrImage
set the frames labelstring or labelImage

o  labelPosition
return the labelPosition, which is a symbol describing
the label's position.

o  labelPosition: aSymbol
define the position of the label;
aSymbol may be one of:
#topLeft, #topCenter, #topRight;
#bottomLeft, #bottomCenter or #bottomRight
#hidden

o  layout: something
OBSOLETE compatibility interface. Will vanish.
In the meantime, try to figure out what is meant ... a kludge

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  setLabel: anImage
set the frames label.
same as #label: for ST-80 GroupBox compatibility

o  setLabelString: anImage
set the frames label.
same as #label: for ST-80 GroupBox compatibility

o  showFrame
return if the view shows its frame.
If false, only the label is drawn.
Now that we have frameLineStyle, this is kept for backward compatibility

o  showFrame: aBoolean
turn on/off showing of the frame -
without a frame, only the label is shown at its position.
(unless the label is nil or #hidden).
Now that we have frameLineStyle, this is kept for backward compatibility

o  verticalSpace
return the number of pixels by which the frame is inset vertically.
The default, nil, lets the box compute the vertical inset from the
label's font height.

o  verticalSpace: aNumber
set the number of pixels by which the frame is inset vertically.
The default, nil, lets the box compute the vertical inset from the
label's font height.

accessing-channels
o  labelChannel
return the labelChannel - or nil.
If not nil, it should provide the actual label via #value
(and may send out change notifications).
If nil, the static label is used.

o  labelChannel: aValueHolder
set the labelChannel - a valueHolder holding a string
which is shown as my logo.
If not nil, it should provide the actual label via #value
(and may send out change notifications).
If nil, the static label is used.

accessing-color & font
o  foregroundColor
return the label's foreground color

o  foregroundColor: aColor
set the frame label's foreground color

change & update
o  update: what with: aPara from: aModel
the MVC way of changing the label ...

drawing
o  drawFrame
redraw the frame

o  redraw
redraw the frame and name if present

event handling
o  sizeChanged: how from: oldExtentOrNil
my view has changed the size (not the contents)

initialization
o  fetchDeviceResources
fetch device colors, to avoid reallocation at redraw time

o  initStyle
setup style specifics.
The default position is top-center, except for ms-windows, where
the text is positioned at top-left

o  initialize
(comment from inherited method)
initialize all state of the view - usually redefined in subclasses,
but always doing a 'super initialize'. Each class should setup its
locals - and not forget the others.
View setup is separated into two parts, the general setup done here
and the style specific setup in initStyle. Each view should be prepared
for a stylechange by being sent another initStyle with a new style value.
(in this case, it should set all of its style-dependent things, but
leave the state and contents as-is)

o  release
(comment from inherited method)
remove all dependencies from the receiver

queries
o  computePreferredExtent
compute the boxes preferredExtent from the components' sizes.
Redefined to add space for the frame to the default extent

o  viewRectangle
return the inside area
- redefined to save frame from relative computations.


Examples:


simple:
    |top frame1 frame2 frame3|

    top := StandardSystemView new.
    top extent:300@200.

    frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame1 label:'frame1'.

    frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top.
    frame2 label:'frame2'.

    frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top.
    frame3 label:'frame3'.

    top open
non-string label:
    |top frame|

    top := StandardSystemView new.
    top extent:300@200.

    frame := FramedBox origin:0.0@0.0 corner:1.0@1.0 in:top.
    frame label:(Image fromFile:'bitmaps/SBrowser.xbm').

    top open
placing something inside:
    |top frame1 frame2 frame3 v1 v2 v3|

    top := StandardSystemView new.
    top extent:300@200.

    frame1 := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame1 label:'frame1'.
    v1 := View origin:0.0@0.0 corner:1.0@1.0 in:frame1.
    v1 viewBackground:(Color yellow);
       level:1.

    frame2 := FramedBox origin:0.5@0.0 corner:1.0@0.5 in:top.
    frame2 label:'frame2'.
    v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
    v2 viewBackground:(Color red);
       level:1.

    frame3 := FramedBox origin:0.0@0.5 corner:1.0@1.0 in:top.
    frame3 label:'frame3'.
    v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
    v3 viewBackground:(Color green);
       level:1.

    top open
placing something inside a frame in a dialog:
    |box panel frame1 frame2 frame3 v1 v1b v2 v3|

    box := Dialog new.

    frame1 := FramedBox label:'frame1'.
    panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1.
    v1 := View extent:100@100 in:panel.
    v1 viewBackground:(Color red);
       level:1.
    v1b := View extent:100@100 in:panel.
    v1b viewBackground:(Color yellow);
        level:1.

    box addComponent:frame1.

    frame2 := FramedBox label:'frame2'.
    v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
    v2 viewBackground:(Color green);
       level:1.
    box addComponent:frame2.

    frame3 := FramedBox label:'frame3'.
    v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
    v3 viewBackground:(Color blue);
       level:1.
    box addComponent:frame3.

    box addOkButton.
    box stickAtBottomWithVariableHeight:frame3.
    box open
placing something inside a frame in a dialog:
    |box panel frame1 frame2 frame3 v1 v1b v2 v3|

    box := Dialog new.

    frame1 := FramedBox label:'frame1'.
    panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:frame1.
    v1 := View extent:100@100 in:panel.
    v1 viewBackground:(Color red);
       level:1.
    v1b := View extent:100@100 in:panel.
    v1b viewBackground:(Color yellow);
        level:1.

    box addComponent:frame1.

    frame2 := FramedBox label:'frame2'.
    v2 := View origin:0.0@0.0 corner:1.0@1.0 in:frame2.
    v2 viewBackground:(Color green);
       level:1.
    box addComponent:frame2.

    frame3 := FramedBox label:'frame3'.
    v3 := View origin:0.0@0.0 corner:1.0@1.0 in:frame3.
    v3 viewBackground:(Color blue);
       level:1.
    box addComponent:frame3.

    box addOkButton.
    box stickAtBottomWithVariableHeight:frame3.
    box open
simple again, default spacings:
    |top frame v|

    top := StandardSystemView new.
    top extent:300@200.

    frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame label:'frame'.

    v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
    v viewBackground:(Color yellow); level:1.

    top open
changing spacings:
    |top frame v|

    top := StandardSystemView new.
    top extent:300@200.

    frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame label:'frame'.
    frame horizontalSpace:30.
    frame verticalSpace:20.

    v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
    v viewBackground:(Color yellow); level:1.

    top open
changing inner spacings:
    |top frame v|

    top := StandardSystemView new.
    top extent:300@200.

    frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame label:'frame'.
    frame innerHorizontalSpace:30.
    frame innerVerticalSpace:20.

    v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
    v viewBackground:(Color yellow); level:1.

    top open
label only (no frame around):
    |top frame v|

    top := StandardSystemView new.
    top extent:300@200.

    frame := FramedBox origin:0.0@0.0 corner:0.5@0.5 in:top.
    frame label:'frame'.
    frame showFrame:false.

    v := View origin:0.0@0.0 corner:1.0@1.0 in:frame.
    v viewBackground:(Color yellow); level:1.

    top open


ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sat, 21 Dec 2024 17:22:44 GMT