# 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.slider
.title Slider
.toc 0 Slider
.index Slider
.index wgtSlider
.index wgtSliderSetValue
.index wgtSliderGetValue

.h2 Slider

A horizontal slider (track bar) for selecting an integer value within a range. The user drags the thumb or clicks the track to change the value.

Header: widgets/slider.h

.h3 Creation

.code
WidgetT *sl = wgtSlider(parent, 0, 100);
.endcode

.h3 API Functions

.table
  Function                                          Description
  --------                                          -----------
  WidgetT *wgtSlider(parent, minVal, maxVal)        Create a slider with the given integer range.
  void wgtSliderSetValue(w, value)                  Set the slider value programmatically.
  int32_t wgtSliderGetValue(w)                      Get the current slider value.
.endtable

.h3 API Struct (wgtRegisterApi "slider")

.table
  Slot       Function
  ----       --------
  create     wgtSlider
  setValue   wgtSliderSetValue
  getValue   wgtSliderGetValue
.endtable

.h3 Properties (BASIC Interface)

.table
  Property     Type       Access       Description
  --------     ----       ------       -----------
  Value        Integer    Read/Write   Current slider value.
.endtable

.h3 Methods

No widget-specific methods.

.h3 Events

.table
  Callback     Description
  --------     -----------
  onChange     Fires when the slider value changes.
.endtable

.h3 Default Event

"Change" (VB basName: HScrollBar, namePrefix: HScroll).
