Module: reefvision.widgets.scrollbar
Source: ./reefvision/widgets/scrollbar.reef
Overview
reefvision.widgets.scrollbar — thumb math + frame-integrated scroll gutter
object Scrollbar extends view.View. ListBox paints it by composition (a field, not a Group child).
Frame-integrated look (owner design): the vertical window border opens into an empty gutter for the thumb: top cap ┴ / ╩ (scroll_top) mid empty (no │/║ rail) + █ thumb bottom cap ┬ / ╦ (scroll_bot) Caps and thumb use theme.scrollbar style.
Pure helpers (thumb / offset_from_y / paint) stay as module functions — TextArea still calls scrollbar_offset_from_y until Task 11.
Types
ScrollSide (enum)
Variants:
RightLeft
Objects
Scrollbar
Extends: view.View
Fields:
| Name | Type |
|---|---|
content_len |
int |
view_len |
int |
offset |
int |
proc init(bounds: cell.Rect, content_len: int, view_len: int, offset: int)
Methods:
exclusive proc configure(bounds: cell.Rect, content_len: int, view_len: int, offset: int)
override exclusive proc draw(buf: cell.CellBuffer, abs: cell.Rect, clip: cell.Rect, focused: bool, th: theme.Theme)
exclusive proc draw_frame(buf: cell.CellBuffer, abs: cell.Rect, bx: theme.BoxGlyphs, st_frame: cell.Style, st_thumb: cell.Style)
shared fn offset_from_y(y_on_track: int): int
Functions
fn scroll_side_right(): ScrollSide
fn scroll_side_left(): ScrollSide
fn scroll_side_is_right(s: ScrollSide): bool
fn scrollbar_offset_from_y(content_len: int, view_len: int, track_h: int, y_on_track: int): int
Procedures
proc scrollbar_thumb(content_len: int, view_len: int, offset: int, track_h: int, out_start: [int], out_size: [int])
proc draw_scrollbar(buf: cell.CellBuffer, x: int, y: int, track_h: int, content_len: int, view_len: int, offset: int, st: cell.Style)
proc draw_frame_scrollbar(buf: cell.CellBuffer, x: int, y: int, track_h: int, content_len: int, view_len: int, offset: int, bx: theme.BoxGlyphs, st_frame: cell.Style, st_thumb: cell.Style)
Frame gutter: no rail — top ┴, empty, █ thumb, empty, bottom ┬. Caps share the frame style so they flow with the rest of the border.
Generated by reefc doc