type gr_scrollbar =
{ sb_window : gr_window
; mutable sb_left : int
; mutable sb_top : int
; mutable sb_length : int
; mutable sb_pos : int
; mutable sb_delta : int
; mutable sb_dir : direction
; mutable sb_callback : gr_scrollbar -> event -> bool
}
;;
The vertical and horizontal scrollbars are objects of type
gr_scroll. If the user presses the mouse button when the mouse cursor
is on the shaft, the shaft follows the mouse motions until the user
releases the mouse button. If the user clicks outside the shaft, the
shaft moves a variable number of pixels in the direction of the mouse
cursor. The scrollbars are define by:
- the type of scrollbar (horizontal: sb_dir=Horizontal,
vertical: sb_dir=Vertical),
- the coordinates of upper left corner (sb_left,sb_top),
- the length (sb_length),
- the shaft position (sb_pos), that takes values from 0 to
gr_scroll_course Scroll.sb_length,
- the attached window (sb_window),
- the callback function called when the shaft position is
changed by the user (sb_callback),
- the number of pixels the shaft should move when the
user clicks outside the shaft (sb_delta).
The variables and functions linked to scrollbars are:
gr_shaft_width : int
- is the width of the shaft in pixels (changes with the look).
gr_shaft_height : int
- is the height of the shaft (changes with look).
gr_scroll_width : int
- is the width of a scrollbar.
gr_scroll_course : int -> int
- gr_scroll_course Scroll.sb_length returns the maximum value
that Scroll.sb_pos can take.
gr_draw_scrollbar : gr_scrollbar -> unit
- gr_draw_scrollbar Scroll draws the scrollbar Scroll.
gr_scrollbar_managed : gr_scrollbar -> event -> bool
- is the function used by Camlwin to manage the scrollbars.