summaryrefslogtreecommitdiff
path: root/src/components/volumemeter.hpp
blob: e9656b65b2ce872ee8fdd1af746b0f5746f4477d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <gtkmm/widget.h>

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<Cairo::Context> &cr) override;

private:
    Glib::RefPtr<Gdk::Window> m_window;

    double m_fraction = 0.0;
    double m_tick = 0.0;
};