ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
ScrollBar.h File Reference

A visible, draggable vertical scrollbar, owned by a ScrollView. More...

Go to the source code of this file.

Data Structures

struct  ScrollBar
 A draggable scrollbar, owned by a ScrollView. More...
 

Enumerations

enum  ScrollBarVisibility { ScrollBarHide , ScrollBarShow , ScrollBarAuto }
 Governs whether a ScrollView's ScrollBar is shown. More...
 

Functions

OBJECTIVELYMVC_EXPORT Class * _ScrollBar (void)
 

Variables

OBJECTIVELYMVC_EXPORT const EnumName ScrollBarVisibilityNames []
 String <-> ScrollBarVisibility mapping for the scrollbar attribute.
 

Detailed Description

A visible, draggable vertical scrollbar, owned by a ScrollView.

ScrollBar is a hideable subview a ScrollView owns internally (see ScrollView::setShowsScrollBar / the scrollbar style attribute) – it is not meant to be instantiated directly by consumers. No arrows (matches modern conventions, e.g. macOS/Xcode's own overlay scrollbars): ScrollBar itself IS the track (clips its own subviews, fills the whole bar), and clicking it above or below the handle pages the content by one viewport's worth in that direction.

Anatomy (AppKit-inspired: NSScroller's knob / knob slot):

ScrollBar (bar base + track, vertical View) `– handle the ScrollHandle grabby-widget

The handle's size tracks the visible/content ratio and its position tracks the ScrollView's contentOffset; dragging the handle scrolls the content. Anything that changes either just flags needsLayoutScrollBar's own layoutSubviews is what actually repositions/resizes the handle.

Styling is plain View attributes, set in the stylesheet like any other View – no ScrollBar-specific CSS at all: width/background-color on ScrollBar for the bar/track, and background-color/min-height on ScrollBar > .handle for the handle and its minimum size.

Definition in file ScrollBar.h.

Enumeration Type Documentation

◆ ScrollBarVisibility

Governs whether a ScrollView's ScrollBar is shown.

Enumerator
ScrollBarHide 
ScrollBarShow 
ScrollBarAuto 

Definition at line 67 of file ScrollBar.h.

67 {
ScrollBarVisibility
Governs whether a ScrollView's ScrollBar is shown.
Definition ScrollBar.h:67
@ ScrollBarHide
Definition ScrollBar.h:68
@ ScrollBarAuto
Definition ScrollBar.h:70
@ ScrollBarShow
Definition ScrollBar.h:69

Function Documentation

◆ _ScrollBar()

OBJECTIVELYMVC_EXPORT Class * _ScrollBar ( void  )

Definition at line 225 of file ScrollBar.c.

225 {
226 static Class *clazz;
227 static Once once;
228
229 do_once(&once, {
230 clazz = _initialize(&(const ClassDef) {
231 .name = "ScrollBar",
232 .superclass = _View(),
233 .instanceSize = sizeof(ScrollBar),
234 .interfaceOffset = offsetof(ScrollBar, interface),
235 .interfaceSize = sizeof(ScrollBarInterface),
237 });
238 });
239
240 return clazz;
241}
static void initialize(Class *clazz)
Definition ScrollBar.c:209
Class * _View(void)
Definition View.c:2056
A draggable scrollbar, owned by a ScrollView.
Definition ScrollBar.h:85

Variable Documentation

◆ ScrollBarVisibilityNames

OBJECTIVELYMVC_EXPORT const EnumName ScrollBarVisibilityNames[]

String <-> ScrollBarVisibility mapping for the scrollbar attribute.

Definition at line 76 of file ScrollBar.h.