# 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.splitter
.title Splitter
.toc 0 Splitter
.index Splitter
.index wgtSplitter
.index wgtSplitterSetPos
.index wgtSplitterGetPos

.h2 Splitter

A two-pane container with a draggable divider. The user drags the splitter bar to resize the two panes. Can be oriented vertically (left/right panes) or horizontally (top/bottom panes). Add exactly two children.

Header: widgets/splitter.h

.h3 Creation

.code
WidgetT *sp = wgtSplitter(parent, true);  // vertical = left|right
WidgetT *left  = wgtVBox(sp);
WidgetT *right = wgtVBox(sp);
.endcode

.h3 API Functions

.table
  Function                                       Description
  --------                                       -----------
  WidgetT *wgtSplitter(parent, vertical)         Create a splitter. vertical=true for left/right panes (vertical divider), false for top/bottom.
  void wgtSplitterSetPos(w, pos)                 Set the divider position in pixels from the leading edge.
  int32_t wgtSplitterGetPos(w)                   Get the current divider position in pixels.
.endtable

.h3 API Struct (wgtRegisterApi "splitter")

.table
  Slot       Function
  ----       --------
  create     wgtSplitter
  setPos     wgtSplitterSetPos
  getPos     wgtSplitterGetPos
.endtable

.h3 Properties (BASIC Interface)

.table
  Property     Type       Access       Description
  --------     ----       ------       -----------
  Position     Integer    Read/Write   Divider position in pixels.
.endtable

.h3 Methods

No widget-specific methods.

.h3 Events

Splitter has no widget-specific events. Common events apply.

.h3 Default Event

None. (VB basName: Splitter.)
