From 88f2e63eeb0b0b9912133ab14ad1f24a452b1c2b Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 18 Oct 2022 02:53:11 -0400 Subject: custom draw capture volume with gate indicator --- src/components/volumemeter.hpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 src/components/volumemeter.hpp (limited to 'src/components/volumemeter.hpp') diff --git a/src/components/volumemeter.hpp b/src/components/volumemeter.hpp new file mode 100644 index 0000000..e9656b6 --- /dev/null +++ b/src/components/volumemeter.hpp @@ -0,0 +1,29 @@ +#pragma once +#include + +class VolumeMeter : public Gtk::Widget { +public: + VolumeMeter(); + + void SetVolume(double fraction); + void SetTick(double fraction); + +protected: + Gtk::SizeRequestMode get_request_mode_vfunc() const override; + void get_preferred_width_vfunc(int &minimum_width, int &natural_width) const override; + void get_preferred_width_for_height_vfunc(int height, int &minimum_width, int &natural_width) const override; + void get_preferred_height_vfunc(int &minimum_height, int &natural_height) const override; + void get_preferred_height_for_width_vfunc(int width, int &minimum_height, int &natural_height) const override; + void on_size_allocate(Gtk::Allocation &allocation) override; + void on_map() override; + void on_unmap() override; + void on_realize() override; + void on_unrealize() override; + bool on_draw(const Cairo::RefPtr &cr) override; + +private: + Glib::RefPtr m_window; + + double m_fraction = 0.0; + double m_tick = 0.0; +}; -- cgit v1.2.3