2024-03-23 18:41:26 -07:00
|
|
|
#pragma once
|
|
|
|
#include <gtkmm.h>
|
|
|
|
#include <glibmm.h>
|
2024-03-26 18:39:02 -07:00
|
|
|
#include "theme.hpp"
|
2024-03-23 18:41:26 -07:00
|
|
|
class MySlider : public Gtk::Box {
|
|
|
|
double value;
|
|
|
|
double max_value;
|
|
|
|
double min_value;
|
|
|
|
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;
|
|
|
|
public:
|
|
|
|
double get_value();
|
2024-03-26 18:39:02 -07:00
|
|
|
void set_value(double value, bool force = false);
|
2024-03-23 18:41:26 -07:00
|
|
|
sigc::signal<void(double)> value_changed;
|
|
|
|
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
|
|
|
|
2024-03-23 18:41:26 -07:00
|
|
|
MySlider();
|
|
|
|
};
|