eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'PanelView':

Home

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

Class: PanelView


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--PanelView
               |
               +--GridBagLayoutView
               |
               +--HorizontalPanelView
               |
               +--MultiColumnPanelView
               |
               +--VerticalPanelView

Package:
stx:libwidg
Category:
Views-Layout
Version:
rev: 1.59 date: 2019/05/30 09:20:59
user: cg
file: PanelView.st directory: libwidg
module: stx stc-classLibrary: libwidg
Author:
Claus Gittinger

Description:


this is a view for holding subviews. (layout-widget ?)

Instances of PanelView try to get all their subviews into them,
arranging subviews left-to-right, top-to-bottom.

If you don't like its layout, define a new subclass or use one of
the existing subclasses: HorizontalPanelView and VerticalPanelView.

The panel assumes, that the elements do not resize themselfes, after it
became visible. This is not true for all widgets (buttons or labels may
like to change). If you have changing elements, tell this to the panel
with 'aPanel elementsChangeSize:true'. In that case, the panel will react
to size changes, and reorganize things.

PanelViews normally delay the actual positioning/sizing of their elements,
until actually displayed. This is useful, if more elements are to
be added, to avoid repeated configuration of the elements.

If you want to query for the relative position of an element BEFORE
the view is visible, you have to send #setChildPositionsIfChanged before
doing so (otherwise, you may get invalid origins from the subviews). As
an example, the modalBoxes do so before showing themselfes to ask for the
position of the ok-button relative to the top-left box-origin, in order to
position the ok-button under the mouse-pointer.

[Instance variables:]

    hLayout         <Symbol>        controls horizontal layout; ignored in this
                                    class, but used in Horizontal- and
                                    VerticalPanelViews. See more info there.

    vLayout         <Symbol>        controls vertical layout; ignored in this
                                    class, but used in Horizontal- and
                                    VerticalPanelViews. See more info there.

    horizontalSpace <Integer>       number of pixels to use as space between elements
                                    defaults to ViewSpacing, which is 1mm

    verticalSpace   <Integer>       number of pixels to use as space between elements
                                    defaults to ViewSpacing, which is 1mm

    mustRearrange   <Boolean>       internal flag, if rearrangement is needed

    elementsChangeSize   
                    <Boolean>       if true, the panel takes care of this situation.
                                    By default, this is false.

    ignoreInvisibleComponents
                    <Boolean>       if true, invisible (i.e. hidden) views
                                    are not considered in the layout computation.
                                    If false, they will lead to additional space
                                    between visible components.
                                    The default is false.


Instance protocol:

accessing
o  elementsChangeSize
tell the panel if elements are to change their size by themselfes
(for example, Labels or Buttons may do so if their contents changes).
Setting this flag will make the panel reorganize the elements whenever
any element changes its size.

o  elementsChangeSize: aBoolean
tell the panel if elements are to change their size by themselfes
(for example, Labels or Buttons may do so if their contents changes).
Setting this flag will make the panel reorganize the elements whenever
any element changes its size.

o  hierarchicalIndexOfChild: aView

o  horizontalLayout
not supported by this view

o  horizontalLayout: aLayoutSymbol
not supported by this view

o  horizontalLayout: layoutSymbolH verticalLayout: layoutSymbolV

o  horizontalSpace
return the horizontal space between elements on pixels (default is 1mm)

o  horizontalSpace: numberOfPixels
set the horizontal space between elements on pixels (default is 1mm)

o  ignoreInvisibleComponents
return the flag which controls if invisible (unrealized)
components should be ignored in the layout computation.
By default, it is false, which means that invisible components will
lead to a visible space between visible components

o  ignoreInvisibleComponents: aBoolean
set/clears the flag which controls if invisible (unrealized)
components should be ignored in the layout computation.
By default, it is false, which means that invisible components will
lead to a visible space between visible components.

o  space: numberOfPixels
set the space between elements in pixels (default is 1mm) for both directions

o  verticalLayout
not supported by this view

o  verticalLayout: aLayoutSymbol
not supported by this view

o  verticalSpace
return the vertical space between elements on pixels (default is 1mm)

o  verticalSpace: numberOfPixels
set the vertical space between elements (in pixels).
The default is computed for 1mm spacing.

accessing-channels
o  backgroundChannel
return a valueHolder for background color

o  backgroundChannel: aValueHolder
set the backgroundChannel - a valueHolder holding a color

adding & removing subviews
o  addComponent: aComponent
redefined to recompute layout when a component is added

o  addSubView: aView
redefined to recompute layout when a subview is added

o  addSubView: newView after: aViewOrNil
redefined to recompute layout when a subview is added

o  addSubView: newView before: aViewOrNil
redefined to recompute layout when a subview is added

o  removeSubView: aView
redefined to recompute layout when a subview is removed

enumerating subviews
o  changeSequenceOrderFor: aSubView to: anIndex
change a subview's position in the subviews collection.
This affects the arrangement of the views.

event handling
o  backgroundColorChanged
called to update the background color

o  sizeChanged: how
my size has changed - must rearrange elements

o  update: something with: aParameter from: changedObject
an element changed its size

focus handling
o  wantsFocusWithButtonPress
no, do not catch the keyboard focus on button click

initialization & release
o  initialize
must be called if redefined

o  mapped

o  realize

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

o  resize

o  setChildPositionsIfChanged
set all of my child positions - this is usually delayed,
until the panel is actually shown (since we do not know, if more
elements are to be added) thus avoiding repositioning the elements
over and over. However, sometimes it is necessary to force positioning
the elements, for example, before querying the relative position of
an element (modalBoxes do so, to position the OK-button under the mouse
pointer).

layout
o  computePreferredExtent
return a good extent, one that makes subviews fit.
Note that width is considered as given, and compute height here.

o  setChildPositions
(re)compute position of every child.
This method is redefined for different layout characteristics - you may
even create subclasses with completely different geometry management.

private
o  addedView: aView
added a new element - rearrange components

o  layoutChanged
called whenever repositioning is required. If the panel view is
already visible, reposition elements right now. Otherwise, remember
that a repositioning is needed to do so when the view eventually becomes
visible.

o  makeMyselfDependentOnSubviews

o  subViewsToConsider
return a collection of subviews which are to be considered in
the layout. If ignoreInvisibleComponents is true, only visible
components are considered; otherwise, all are considered.

queries
o  isLayoutWrapper
answer true, if this view defines the layout of it's subviews


Examples:


The generic panelView simply tries to get its components arranged for fitting them all into its area. No special layout is done, except for horizontal/vertical spacings. The view is filled top-left to bottom-right with subcomponents. Subcomponents are not resized. example:
    |v p b1 b2 b3|

    v := StandardSystemView new.
    v label:'panel'.

    p := PanelView in:v.
    p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    b1 := Button label:'button1' in:p.
    b2 := Button label:'button2' in:p.
    b3 := Button label:'button3' in:p.
    v extent:300 @ 100.
    v open
invisible component not considered in layout:
    |v p b1 b2 b3|

    v := StandardSystemView new.
    v label:'panel'.

    p := PanelView in:v.
    p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    b1 := Button label:'button1' in:p.
    b2 := Button label:'button2' in:p.
    b2 beInvisible.
    b3 := Button label:'button3' in:p.
    v extent:300 @ 100.
    v open
invisible component considered in layout:
    |v p b1 b2 b3|

    v := StandardSystemView new.
    v label:'panel'.

    p := PanelView in:v.
    p origin:(0.0 @ 0.0) corner:(1.0 @ 1.0).
    p ignoreInvisibleComponents:false.
    b1 := Button label:'button1' in:p.
    b2 := Button label:'button2' in:p.
    b2 beInvisible.
    b3 := Button label:'button3' in:p.
    v extent:300 @ 100.
    v open


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 00:04:07 GMT