|
Class: ArrowButton
Object
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--Label
|
+--Button
|
+--ArrowButton
- Package:
- stx:libwidg
- Category:
- Views-Interactors
- Version:
- rev:
1.82
date: 2018/05/24 12:31:23
- user: cg
- file: ArrowButton.st directory: libwidg
- module: stx stc-classLibrary: libwidg
- Author:
- Claus Gittinger
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
Button
Toggle
CheckToggle
CheckBox
ScrollBar
defaults
-
DownArrowForm
-
-
LeftArrowForm
-
-
RightArrowForm
-
-
UpArrowForm
-
-
downArrowButtonForm: styleSymbol on: aDevice
-
return the form used for the scrollDown Button
-
leftArrowButtonForm: styleSymbol on: aDevice
-
return the form used for the scrollLeft Button
-
rightArrowButtonForm: styleSymbol on: aDevice
-
return the form used for the scrollRight Button
-
upArrowButtonForm: styleSymbol on: aDevice
-
return the form used for the scrollUp Button
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
usage example(s):
defaults-helpers
-
activeArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice
-
-
arrowButtonFormForStyle: styleSymbol direction: direction on: aDevice
-
return the form used for the scrollDown Button
-
arrowButtonFormForStyle: styleSymbol nameKey: styleSheetName fileNameKey: styleSheetFileName variableName: formVariableName direction: direction useDefault: useDefault on: aDevice
-
return the form used for the scrollDown Button
-
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
|
-
defaultMACArrowButtonFormForDirection: direction onDevice: aDevice
-
-
defaultST80ArrowButtonFormForDirection: direction onDevice: aDevice
-
-
defaultWIN32ArrowButtonFormForDirection: direction onDevice: aDevice
-
self defaultWIN32ArrowButtonFormForDirection:#down onDevice:Screen current
-
disabledArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice
-
-
enteredArrowButtonFormForStyle: styleSymbol direction: direction on: aDevice
-
instance creation
-
downIn: aView
-
create and return a new down-button in aView
-
leftIn: aView
-
create and return a new left-button in aView
-
new
-
return a new arrowButton - direction defaults to #up
-
rightIn: aView
-
create and return a new right-button in aView
-
upIn: aView
-
create and return a new up-button in aView
accessing
-
direction
-
return the buttons direction - a symbol
-
direction: aDirectionSymbol
-
create and return a new arrow button in aView
accessing-look
-
allViewBackground: something if: condition
-
-
viewBackground: aColor
-
Modified (format): / 12-02-2017 / 12:58:23 / cg
focus handling
-
wantsFocusWithButtonPress
-
no, do not catch the keyboard focus on button click
initialization
-
initStyle
-
setup viewStyle specifics
-
initialize
-
must be called if redefined
redrawing
-
drawWith: fg and: bg
-
this is a q&d hack for motif ...
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
|
|