|
Class: FramedBox
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--FramedBox
- Package:
- stx:libwidg
- Category:
- Views-Layout
- Version:
- rev:
1.69
date: 2018/11/09 23:17:32
- user: cg
- file: FramedBox.st directory: libwidg
- module: stx stc-classLibrary: libwidg
- Author:
- Claus Gittinger
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.
PanelView
Separator
accessing
-
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.
-
frameColor
-
return the frame's color
-
frameColor: aColor
-
set the frame's foreground color
-
frameShown
-
return true, if frame is shown;
if false, only the label is shown.
OBSOLETE; use #showFrame.
-
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
labels font height.
-
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
labels font height.
-
innerHorizontalSpace: aNumber
-
set the number of pixels by which the interior is inset horizontally from the frame.
The default is 0
-
innerVerticalSpace: aNumber
-
set the number of pixels by which the interior is inset vertically from the frame.
The default is 0
-
label
-
return the frames labelstring
-
label: aStringOrImage
-
set the frames labelstring or labelImage
-
labelPosition
-
return the labelPosition, which is a symbol describing
the labels position.
-
labelPosition: aSymbol
-
define the position of the label;
aSymbol may be one of:
#topLeft, #topCenter, #topRight;
#bottomLeft, #bottomCenter or #bottomRight
#hidden
-
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) **
-
setLabel: anImage
-
set the frames label.
same as #label: for ST-80 GroupBox compatibility
-
setLabelString: anImage
-
set the frames label.
same as #label: for ST-80 GroupBox compatibility
-
showFrame
-
return if the view shows its frame.
If false, only the label is drawn
-
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)
-
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
labels font height.
-
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
labels font height.
accessing-channels
-
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.
-
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
-
foregroundColor
-
return the label's foreground color
-
foregroundColor: aColor
-
set the frame label's foreground color
change & update
-
update: what with: aPara from: aModel
-
the MVC way of changing the label ...
drawing
-
drawFrame
-
redraw the frame
-
redraw
-
redraw the frame and name if present
event handling
-
sizeChanged: how
-
(comment from inherited method)
tell subviews that I changed size.
How is either #smaller, #larger or nil, and is used to control the order,
in which subviews are notified (possibly reducing redraw activity)
initialization
-
fetchDeviceResources
-
fetch device colors, to avoid reallocation at redraw time
-
initStyle
-
setup style specifics.
The default position is top-center, except for ms-windows, where
the text is positioned at top-left
-
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)
-
release
-
queries
-
computePreferredExtent
-
compute the boxes preferredExtent from the components' sizes.
Redefined to add space for the frame to the default extent
-
viewRectangle
-
return the inside area
- redefined to save frame from relative computations.
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
|
|