SLider Manager - Horizon-NTH/HorizonGUI GitHub Wiki

SliderManager

Overview

The SliderManager class, located in the hgui namespace, provides a flexible way to manage Sliders in your graphical application. The class can be found inside the header file SliderManager.h.

Member Functions

  • std::shared_ptr<kernel::Slider> create(const kernel::Ranges& range, const size& size, const point& position, const std::tuple<color, color, color>& colors = {HGUI_COLOR_WHITE, color("#424242"), color("#097fe0")}, const Function& function = []{}): Creates a new slider by specifying range, size, position, colors and function.

Example Usage

#include <hgui/header/SliderManager.h>

{ // Example Usage of SliderManager
    hgui::kernel::Ranges sliderRange{ 0.0, 100.0, 1, 2 };
    hgui::size sliderSize{ 200, 20 };
    hgui::point sliderPosition{ 100, 100 };
    hgui::color inactiveColor(66);
    hgui::color activeColor(9, 127, 224);
    hgui::color sliderColor = HGUI_COLOR_WHITE;

    // Create a slider
    std::shared_ptr<hgui::kernel::Slider> customSlider = hgui::SliderManager::create(sliderRange, sliderSize, sliderPosition, inactiveColor, activeColor, sliderColor, []{}, 0.0f);

    // Use the slider as needed
    // (Interact with the custom slider here)
} // Here the custom slider is destroyed

Note: In the "Example Usage" section, we demonstrate how to create a custom slider with the SliderManager class.