# The MIT License (MIT)
#
# Copyright (C) 2026 Scott Duensing
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.

.section Widgets
.topic widget.scrollpane
.title ScrollPane
.toc 0 ScrollPane
.index ScrollPane
.index wgtScrollPane
.index wgtScrollPaneScrollToChild
.index wgtScrollPaneSetNoBorder

.h2 ScrollPane

A scrollable container that provides vertical and/or horizontal scrollbars when its content exceeds the visible area. Place a single child (typically a VBox or HBox) inside the scroll pane.

Header: widgets/scrlPane.h

.h3 Creation

.code
WidgetT *sp = wgtScrollPane(parent);
WidgetT *content = wgtVBox(sp);
// add children to content...
.endcode

.h3 API Functions

.table
  Function                                          Description
  --------                                          -----------
  WidgetT *wgtScrollPane(parent)                    Create a scroll pane container.
  void wgtScrollPaneScrollToChild(sp, child)        Scroll so that the given child widget is visible.
  void wgtScrollPaneScrollToTop(w)                  Scroll back to the top-left of the content.
  void wgtScrollPaneSetNoBorder(w, noBorder)        When true, removes the border around the scroll pane.
.endtable

.h3 API Struct (wgtRegisterApi "scrollpane")

.table
  Slot             Function
  ----             --------
  create           wgtScrollPane
  scrollToChild    wgtScrollPaneScrollToChild
  setNoBorder      wgtScrollPaneSetNoBorder
  scrollToTop      wgtScrollPaneScrollToTop
.endtable

.h3 Properties (BASIC Interface)

.table
  Property     Type       Access       Description
  --------     ----       ------       -----------
  NoBorder     Boolean    Read/Write   Whether the border around the scroll pane is hidden.
.endtable

.h3 Methods

No widget-specific methods.

.h3 Events

.table
  Callback     Description
  --------     -----------
  onScroll     Fires when the scroll position changes.
.endtable

.h3 Default Event

None. (VB basName: ScrollPane, namePrefix: Scroll.)
