infinipaint/src/GUIStuff/ElementHelpers/NumberSliderHelpers.hpp

21 lines
773 B
C++
Raw Normal View History

#pragma once
#include "../GUIManager.hpp"
#include "TextBoxHelpers.hpp"
#include "../Elements/NumberSlider.hpp"
namespace GUIStuff { namespace ElementHelpers {
template <typename T> void slider_scalar_field(GUIManager& gui, const char* id, std::string_view name, T* val, T min, T max, TextBoxScalarOptions options = {}) {
2026-03-30 18:51:14 +03:00
gui.new_id(id, [&] {
options.onEdit = [&, oE = options.onEdit] {
if(oE) oE();
2026-03-30 18:51:14 +03:00
gui.set_to_layout();
};
left_to_right_line_layout(gui, [&]() {
text_label(gui, name);
input_scalar(gui, "textbox", val, min, max, options);
});
gui.element<NumberSlider<T>>("slider", val, min, max, options.onEdit);
});
}
}}