eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ScrollBar':

Home

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

Class: ScrollBar


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--ScrollBar
               |
               +--HorizontalScrollBar
               |
               +--SteppingSlider

Package:
stx:libwidg
Category:
Views-Interactors
Version:
rev: 1.104 date: 2021/08/28 07:10:25
user: cg
file: ScrollBar.st directory: libwidg
module: stx stc-classLibrary: libwidg

Description:


this class implements vertical scrollbars with scroller and
2 step-scroll buttons. when moved or stepped, it performs a
predefined action.

The action is specified by:                 the block to be evaluated for step-up
    aScrollBar scrollUpAction:aBlock
    (scrollLeftAction for hor-Scrollbars)

    aScrollBar scrollDownAction:aBlock      the block to be evaluated for step-down
    (scrollRightAction for hor-Scrollbars)

    aScrollbar scrollAction:aBlock          the block to be evaluated for scroll
                                            passing percentage as argument.

Scrollbars can scroll synchronous (i.e. every movement is notified immediately via the
scrollAction) or asynchronous (i.e. only one notification takes place at the end of the movement).
The choice is up to the user of the scrollbar (typically, views which are complicated to redraw,
will set it to asynchronous.)

Most often scrollbars are used hidden with ScrollableView or HVScrollableView (i.e. you
don't have to care for all the details).

The scrollBars and scrollers protocols have been made similar enough to
allow transparent use of either a scroller or a scrollBar in applications.

copyright

COPYRIGHT (c) 1989 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.

Class protocol:

style changes
o  updateStyleCache
extract values from the styleSheet and cache them in class variables


Instance protocol:

accessing
o  thumbHeight
return height of thumb in percent

o  thumbHeight: newHeight
set height of thumb in percent

o  thumbOrigin
return position of (top of) thumb in percent

o  thumbOrigin: newOrigin
set position of (top of) thumb in percent

o  thumbOrigin: newOrigin thumbHeight: newHeight
set origin and height of thumb (both in percent)

accessing-behavior
o  asynchronousOperation

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

o  beAsynchronous
set asynchronous-mode - scroll action is performed after movement
of scroller when mouse-button is finally released (no tracking).
This is forwarded to the scroller here.

o  beSynchronous
set synchronous-mode - scroll action is performed for every movement
of scroller (tracking).
This is forwarded to the scroller here.

o  isSynchronous
return true if the scroll-mode is synchronous.
If true, the scroll action is performed for every movement of the thumb (tracking).
If false, the scroll action is only performed at the end.

o  scrollAction: aBlock
set the action, aBlock to be performed when the scroller is moved.
The block will be called with positionInPercent as argument.
This is forwarded to the scroller here.

o  scrollDownAction
return the action which is performed on scroll-down.
(vertical scrollBars)

o  scrollDownAction: aBlock
set the action, aBlock to be performed when the down-button is pressed.
(for vertical scrollBars)

o  scrollLeftAction
return the action which is performed on scroll-left
(for horizontal scrollBars)

o  scrollLeftAction: aBlock
set the action to be performed on scroll-left.
(for horizontal scrollBars)

o  scrollRightAction
return the action which is performed on scroll-right.
(for horizontal scrollBars)

o  scrollRightAction: aBlock
set the action to be performed on scroll-right.
(for horizontal scrollBars)

o  scrollUpAction
return the action which is performed on scroll-up.
(for vertical scrollBars)

o  scrollUpAction: aBlock
set the action, aBlock to be performed when the up-button is pressed.
(for vertical scrollBars)

o  synchronousOperation

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

accessing-components
o  downButton
return the down-button
(Please: only use this direct access for special applications)

Usage example(s):

     |v|

     v := ScrollableView for:EditTextView.
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
     v scrollBar upButton activeForegroundColor:Color red.
     v scrollBar downButton activeForegroundColor:Color red.
     v open

o  thumb
return the thumb (i.e. the scroller subview)
(Please: only use this direct access for special applications)

Usage example(s):

     |v|

     v := ScrollableView for:EditTextView.
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
     v scrollBar thumb thumbColor:(Color red).
     v open

o  upButton
return the up-button
(Please: only use this direct access for special applications)

Usage example(s):

     |v|

     v := ScrollableView for:EditTextView.
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
     v scrollBar upButton foregroundColor:(Color red).
     v scrollBar upButton enteredForegroundColor:(Color red lightened).
     v scrollBar downButton foregroundColor:(Color green).
     v scrollBar downButton enteredForegroundColor:(Color green lightened).
     v open

accessing-look
o  allViewBackground: something if: condition
blocked for all scrollBars (I want my own background)

Usage example(s):

^ super allViewBackground:something

o  orientation
for ST-80 compatibility, answer this query

o  orientation: aSymbol
set the orientation; either #horizontal or #vertical

o  thumbColor: aColor
set the thumbs color

o  upButtonLabel: label1 downButtonLabel: label2
set the labels shown in the buttons.
Because of the fixed button sizes, this only makes sense with
single-character strings or small bitmaps.

Usage example(s):

also possible :
     |v|

     v := ScrollableView for:EditTextView.
     v scrolledView contents:('/etc/passwd' asFilename contentsOfEntireFile).
     v scrollBar upButtonLabel:'u' downButtonLabel:'d'.
     v open

change & update
o  update: something with: aParameter from: changedObject
(comment from inherited method)
an update request

events
o  keyPress: key x: x y: y
(comment from inherited method)
a key has been pressed. If there are components,
pass it to the corresponding one.
Otherwise, forward it to the superview, if there is any.

o  sizeChanged: how from: oldExtentOrNil
when my size changes, I have to resize/reposition the subviews.
Also, if I became too small, hide thumb/buttons.

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

forced scroll
o  pageDown
page down/right

o  pageUp
page up/left

o  scrollToBeginning
to top

o  scrollToEnd
to end

initialization
o  createElements
private: create my elements

o  defaultExtent
compute my extent from sub-components

o  initStyle
setup viewStyle specifics

o  initialize
setup; create the 2 buttons and a scroller

o  reinitialize
(comment from inherited method)
this is called right after snapIn

o  setElementPositions
position sub-components

native widget support
o  beNativeWidget

o  makeElementsInvisible
when using native widget, my elements are not visible.
(they are not destroyed, to keep a place for their attributes,
and to allow future dynamic switching and snapshot restore on
a non-native system)

o  nativeWindowType
return a symbol describing my native window type
(may be used internally by the device as a native window creation hint,
if the device supports native windows)

o  updateNativeWidget

private
o  changeVisibilityOf: aComponent to: aBoolean

o  enableDisableButtons
only used with styles which disable their buttons if the
thumb is at either end. Check where the thumb is and enable/disable
as appropriate.

private-scrollview interface
o  setThumbFor: aView
adjust thumb for aView
(i.e. adjust thumbs origin & size for views size & views contents).
This is forwarded to the scroller here.

o  setThumbHeightFor: aView
adjust thumbs height for aViews size & contents.
This is forwarded to the scroller here.

o  setThumbOriginFor: aView
adjust thumbs origin for aViews size & contents.
This is forwarded to the scroller here.

queries
o  computePreferredExtent
compute my extent from sub-components

o  isMiniScroller

o  isScrolling
true, if thumb is being moved (by user)



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Sun, 16 Jun 2024 02:32:34 GMT