looper/backends/ui/gtk/my_slider.hpp

54 lines
1.5 KiB
C++
Raw Permalink Normal View History

#pragma once
#include <gtkmm.h>
#include <glibmm.h>
2024-03-26 18:39:02 -07:00
#include "theme.hpp"
class MySlider : public Gtk::Box {
double value;
double max_value;
double min_value;
2024-05-01 09:07:08 -07:00
struct {
double xmin;
double xmax;
double x0;
double x1;
double a;
double b;
} log_data;
bool logarithmic = false;
bool text_valid = true;
bool text_editing;
Gtk::Button edit_btn;
Gtk::Entry text_entry;
Gtk::Scale slider;
Gtk::Label prefix_label;
Gtk::Label value_label;
Gtk::Label suffix_label;
bool update_occurring = false;
void update(bool force = false);
void update_text_entry(std::string text);
void update_slider(double value);
Glib::ustring prefix;
Glib::ustring suffix;
unsigned digits_after_decimal;
2024-05-01 09:07:08 -07:00
void update_log_data();
double scale_log(double input);
double unscale_log(double input);
public:
double get_value();
2024-03-26 18:39:02 -07:00
void set_value(double value, bool force = false);
sigc::signal<void(double)> value_changed;
2024-05-01 09:07:08 -07:00
bool get_logarithmic();
void set_logarithmic(bool value = true);
double get_max_value();
void set_max_value(double value);
double get_min_value();
void set_min_value(double value);
Glib::ustring get_prefix();
void set_prefix(Glib::ustring value);
Glib::ustring get_suffix();
void set_suffix(Glib::ustring value);
unsigned get_digits_after_decimal();
void set_digits_after_decimal(unsigned value);
2024-03-26 18:39:02 -07:00
MySlider();
};