#------------------------------------------------------------------------------
#  Copyright (c) 2013-2025, Nucleic Development Team
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
"""
Example demonstrating a dual slider.

<< autodoc-me >>
"""
from enaml.layout.api import align, vbox, hbox
from enaml.stdlib.fields import IntField
from enaml.widgets.api import (
    Window, Container, Label, Field, DualSlider, Slider, Form
)


enamldef Main(Window):
    title = 'Dual Slider Example'
    Container:
        constraints = [
            vbox(
                hbox(label, low, high),
                hbox(min_lbl, dual_slider, max_lbl),
                hbox(sel_lbl, sel_field, sel_slider),
            ),
            align('v_center', label, low, high),
            align('v_center', min_lbl, dual_slider, max_lbl),
            align('v_center', sel_lbl, sel_field, sel_slider),
        ]
        Label: label:
            text = 'Range:'
        IntField: low:
            value := dual_slider.low_value
        IntField: high:
            value := dual_slider.high_value
        Label: min_lbl:
            text << str(dual_slider.minimum)
        Label: max_lbl:
            text << str(dual_slider.maximum)
        DualSlider: dual_slider:
            tick_interval = 10
            minimum = 1
            maximum = 100
        Label: sel_lbl:
            text = 'Set Minimum:'
        Field: sel_field:
            text << str(sel_slider.value)
            read_only = True
        Slider: sel_slider:
            tick_interval = 100
            minimum = 1
            maximum = 1000
            value >> dual_slider.minimum
