eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ArrowButton':

Home

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

Class: ArrowButton


Inheritance:

   Object
   |
   +--GraphicsMedium
      |
      +--DisplaySurface
         |
         +--SimpleView
            |
            +--View
               |
               +--Label
                  |
                  +--Button
                     |
                     +--ArrowButton

Package:
stx:libwidg
Category:
Views-Interactors
Version:
rev: 1.85 date: 2021/01/20 12:17:14
user: cg
file: ArrowButton.st directory: libwidg
module: stx stc-classLibrary: libwidg

Description:


ArrowButtons display an arrow as their label; they are mainly
used for scrollbars, but can be useful on their own in some applications.
Beside the contents, their default behavior is to perform their action
when pressed - not (as is the default for normal buttons) when released.

Indivdual ArrowButtons can be created by sending one of:
        ArrowButton upIn:aView /downIn: / leftIn: or rightIn:
passing the parent view as argument.

See examples.


[styleSheet parameters:]

    arrowButtonStyle            <Symbol>        the style of the button;
                                                #motif, #st80 or nil (default)
    arrowButtonForegroundColor  <nil | Color>   foregroundColor 
    arrowButtonBackgroundColor  <nil | Color>   backgroundColor 

    arrowButtonActiveForegroundColor            foregroundColor when pressed
    arrowButtonActiveBackgroundColor            backgroundColor when pressed

    arrowButtonEnteredForegroundColor           foregroundColor when mouse pointer entered
    arrowButtonEnteredBackgroundColor           backgroundColor when mouse pointer entered

copyright

COPYRIGHT (c) 1993 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:

defaults
o  DownArrowForm

o  LeftArrowForm

o  RightArrowForm

o  UpArrowForm

o  downArrowButtonForm: styleSymbol on: aDevice
return the form used for the scrollDown Button

o  leftArrowButtonForm: styleSymbol on: aDevice
return the form used for the scrollLeft Button

o  rightArrowButtonForm: styleSymbol on: aDevice
return the form used for the scrollRight Button

o  upArrowButtonForm: styleSymbol on: aDevice
return the form used for the scrollUp Button

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

Usage example(s):

     self updateStyleCache

defaults-helpers
o  activeArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice

o  arrowButtonFormForStyle: styleSymbol direction: direction on: aDevice
return the form used for the scrollDown Button

o  arrowButtonFormForStyle: styleSymbol nameKey: styleSheetName fileNameKey: styleSheetFileName variableName: formVariableName direction: direction useDefault: useDefault on: aDevice
return the form used for the scrollDown Button

o  defaultArrowButtonFormForStyle: styleSymbol direction: direction onDevice: aDevice
return the default form used for the scrollUp Button
(if no styleSheet value is defined, and no form can be constructed)

Usage example(s):

     self defaultArrowButtonFormForStyle:#macosx direction:#up onDevice:Screen

o  defaultMACArrowButtonFormForDirection: direction onDevice: aDevice

o  defaultST80ArrowButtonFormForDirection: direction onDevice: aDevice

o  defaultWIN32ArrowButtonFormForDirection: direction onDevice: aDevice
self defaultWIN32ArrowButtonFormForDirection:#down onDevice:Screen current

o  disabledArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice

o  enteredArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice

instance creation
o  downIn: aView
create and return a new down-button in aView

o  leftIn: aView
create and return a new left-button in aView

o  new
return a new arrowButton - direction defaults to #up

o  rightIn: aView
create and return a new right-button in aView

o  upIn: aView
create and return a new up-button in aView


Instance protocol:

accessing
o  direction
return the buttons direction - a symbol

o  direction: aDirectionSymbol
create and return a new arrow button in aView

accessing-look
o  allViewBackground: something if: condition
(comment from inherited method)
no longer ignored here

o  viewBackground: aColor
Modified (format): / 12-02-2017 / 12:58:23 / cg

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

initialization
o  initStyle
setup viewStyle specifics

o  initialize
must be called if redefined

redrawing
o  drawWith: fg and: bg
this is a q&d hack for motif ...


Examples:


example1:
    |v p b1 b2 b3 b4|

    v := StandardSystemView extent:200@200.
    p := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v.
    b1 := ArrowButton upIn:p.
    b2 := ArrowButton downIn:p.
    b3 := ArrowButton leftIn:p.
    b4 := ArrowButton rightIn:p.

    b1 action:['whatEver you like here ...'].
    b2 action:['whatEver you like here ...'].
    b3 action:['whatEver you like here ...'].
    b4 action:['whatEver you like here ...'].

    v open
example2:
    |v p b1 b2 b3 b4|

    v := StandardSystemView extent:200@200.
    p := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v.
    b1 := (ArrowButton upIn:p) extent:30@30.
    b2 := (ArrowButton downIn:p) extent:30@30.
    b3 := (ArrowButton leftIn:p) extent:30@30.
    b4 := (ArrowButton rightIn:p) extent:30@30.

    b1 action:['whatEver you like here ...'].
    b2 action:['whatEver you like here ...'].
    b3 action:['whatEver you like here ...'].
    b4 action:['whatEver you like here ...'].

    v open
example3:
    |v p b1 b2 b3 b4|

    v := StandardSystemView extent:200@200.
    p := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v.
    b1 := (ArrowButton upIn:p) origin:(0.33 @ 0.0) corner:(0.67 @ 0.33).
    b3 := (ArrowButton leftIn:p) origin:(0.0 @ 0.33) corner:(0.33 @ 0.67).
    b4 := (ArrowButton rightIn:p) origin:(0.67 @ 0.33) corner:(1.0 @ 0.67).
    b2 := (ArrowButton downIn:p) origin:(0.33 @ 0.67) corner:(0.67 @ 1.0).

    b1 action:['whatEver you like here ...'].
    b2 action:['whatEver you like here ...'].
    b3 action:['whatEver you like here ...'].
    b4 action:['whatEver you like here ...'].

    v open
example4 (not good coding style, to explicitely use a particular style, just a demonstration how it looks ..):
    |v p b1 b2 b3 b4 oldStyle|

    oldStyle := View defaultStyle.
    View defaultStyle:#motif.

    v := StandardSystemView extent:100@100.
    p := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:v.

    b1 := (ArrowButton upIn:p) origin:(0.33 @ 0.0) corner:(0.67 @ 0.33).
    b3 := (ArrowButton leftIn:p) origin:(0.0 @ 0.33) corner:(0.33 @ 0.67).
    b4 := (ArrowButton rightIn:p) origin:(0.67 @ 0.33) corner:(1.0 @ 0.67).
    b2 := (ArrowButton downIn:p) origin:(0.33 @ 0.67) corner:(0.67 @ 1.0).

    b1 action:['whatEver you like here ...'].
    b2 action:['whatEver you like here ...'].
    b3 action:['whatEver you like here ...'].
    b4 action:['whatEver you like here ...'].

    View defaultStyle:oldStyle.
    v open


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