summaryrefslogtreecommitdiff
path: root/src/components/volumemeter.hpp
diff options
context:
space:
mode:
authorouwou <26526779+ouwou@users.noreply.github.com>2023-05-29 06:29:39 +0000
committerGitHub <noreply@github.com>2023-05-29 06:29:39 +0000
commit3fbc71e369fedddd7ebc2eb08c9721860ae6b597 (patch)
tree297c9e2d905b0ba33978be5f64b9624773661a30 /src/components/volumemeter.hpp
parent8e9fb27e0bec4c9dd4b706e15987cbb16cf42005 (diff)
parent7da37a2fa90cebf43631c74aa1abfb9842502291 (diff)
downloadabaddon-portaudio-3fbc71e369fedddd7ebc2eb08c9721860ae6b597.tar.gz
abaddon-portaudio-3fbc71e369fedddd7ebc2eb08c9721860ae6b597.zip
Merge pull request #105 from uowuo/voice
Voice support 🤯
Diffstat (limited to 'src/components/volumemeter.hpp')
-rw-r--r--src/components/volumemeter.hpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/components/volumemeter.hpp b/src/components/volumemeter.hpp
new file mode 100644
index 0000000..83e0861
--- /dev/null
+++ b/src/components/volumemeter.hpp
@@ -0,0 +1,31 @@
+#pragma once
+#include <gtkmm/widget.h>
+
+class VolumeMeter : public Gtk::Widget {
+public:
+ VolumeMeter();
+
+ void SetVolume(double fraction);
+ void SetTick(double fraction);
+ void SetShowTick(bool show);
+
+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<Cairo::Context> &cr) override;
+
+private:
+ Glib::RefPtr<Gdk::Window> m_window;
+
+ double m_fraction = 0.0;
+ double m_tick = 0.0;
+ bool m_show_tick = false;
+};