## scrollbar.api
#
# "The scrollbar widget is used to indicate
# a position and size, and to allow the user
# to change the position. Scrollbars are
# most commonly used to specify the view a
# windw gives on a logically much larger
# display area, and to allow the user to
# pan the window over the display area."
#
# -- p26, Gansner+Reppy 1993 eXene widget manual,
# http://mythryl.org/pub/exene/1993-widgets.ps
#
#
# Compare with:
#
src/lib/x-kit/widget/old/leaf/slider.api#
#
# size:
# The size specified in the make() functions is
# for the narrow dimension, and is treated as
# tight -- the scrollbar's expressed size preference
# is for no shrink or stretch in that dimension.
# A zero or negative size value will raise BAD_ARG.
#
# The scrollbar is arbitrarily elastic along the
# long dimension.
#
# color:
# The scrollbar thumb is drawn in the specified
# color (defaults to black) on its parent's background
# color.
#
# set_scrollbar_thumb:
# The value displayed and controlled by the scrollbar
# varies from 0.0 to 1.0 inclusive. The set_scrollbar_thumb
# function allows external code to control the scrollbar.
# For example the call
#
# set_scrollbar_thumb
# #
# scrollbar_widget
# #
# { size => THE 0.2, # Must have top + size < 1.0
# top => THE 0.5
# }
#
# sets the scrollbar cursor to be halfway up
# the scrollbar gutter and to occupy one-fifth
# of the gutter's length.
#
# scrollbar_change'_of:
# Use this function to get the scrollbar_change'
# mailop reporting scrollbar changes. You MUST
# read this mailop (typically using 'do_one_mailop' or
# 'block_until_mailop_fires'): If you do not, the scrollbar
# impl will block, locking up the scrollbar.
# Compiled by:
#
src/lib/x-kit/widget/xkit-widget.sublib### "If you look out into the darkness,
### you don't discover anything, 'cause
### you can't see anything. So you're
### always working at the edge of light."
###
### -- Whitfield Diffie
stipulate
include package threadkit; # threadkit is from
src/lib/src/lib/thread-kit/src/core-thread-kit/threadkit.pkg #
package wg = widget; # widget is from
src/lib/x-kit/widget/old/basic/widget.pkg package xc = xclient; # xclient is from
src/lib/x-kit/xclient/xclient.pkgherein
api Scrollbar {
Scroll_Event
#
= SCROLL_UP Float # Generated when user clicks mouse button 1.
| SCROLL_DOWN Float
# Generated when user clicks mouse button 3. XXX BUGGO FIXME this is gross button over-use!
| SCROLL_START Float
# User has begun to move thumb with middle mouse button. XXX BUGGO FIXME -- should be button 1 for least surprise.
| SCROLL_MOVE Float
# Generated "continuously" while scrollbar thumb is in motion.
| SCROLL_END Float
# Final position of thumb after a move.
;
Scrollbar;
make_horizontal_scrollbar': (wg::Root_Window, wg::View, List(wg::Arg)) -> Scrollbar;
make_vertical_scrollbar': (wg::Root_Window, wg::View, List(wg::Arg)) -> Scrollbar;
make_horizontal_scrollbar: wg::Root_Window -> { color: Null_Or( xc::Rgb ), size: Int } -> Scrollbar;
make_vertical_scrollbar: wg::Root_Window -> { color: Null_Or( xc::Rgb ), size: Int } -> Scrollbar;
as_widget: Scrollbar -> wg::Widget;
scrollbar_change'_of: Scrollbar -> Mailop( Scroll_Event );
set_scrollbar_thumb
:
Scrollbar
->
{ size: Null_Or(Float), # Thumb length as a fraction of gutter length -- 0.2 fills 1/5 of the widget length.
top: Null_Or(Float) # Position of thumb top as a fraction of gutter length -- 0.5 is in the middle.
} # Must have top + size < 1.0
->
Void;
};
end;
## COPYRIGHT (c) 1991 by AT&T Bell Laboratories See SMLNJ-COPYRIGHT file for details.
## Subsequent changes by Jeff Prothero Copyright (c) 2010-2015,
## released per terms of SMLNJ-COPYRIGHT.