Added scroll to sliders

This commit is contained in:
Ryzerth
2021-02-07 12:30:25 +01:00
parent c26855d07e
commit 9def1843b2
10 changed files with 198 additions and 16 deletions

View File

@ -8,6 +8,7 @@
#include <iio.h>
#include <ad9361.h>
#include <options.h>
#include <gui/widgets/scroll_behavior.h>
#define CONCAT(a, b) ((std::string(a) + b).c_str())
@ -192,7 +193,7 @@ private:
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (_this->gainMode) { style::beginDisabled(); }
if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76)) {
if (ImGui::SliderFloat(CONCAT("##_gain_select_", _this->name), &_this->gain, 0, 76) || ImGui::AllowScrollwheel<float>(_this->gain, 19, 0, 76)) {
if (_this->running) {
iio_channel_attr_write_longlong(iio_device_find_channel(_this->phy, "voltage0", false),"hardwaregain", round(_this->gain));
}