[GtkTemplate (ui = "/io/gitlab/nekocwd/pipetap/gui/main_bar.ui")]
public class PipeTap.Ui.MainBar : PipeTap.Ui.FloatingWindow {
    [GtkChild]
    private unowned Gtk.ToggleButton exposure;
    [GtkChild]
    private unowned Gtk.ToggleButton contrast;
    [GtkChild]
    private new unowned Gtk.ToggleButton focus;

    public MainBar (PipeTap.Application app) {
        base (app, "main-controls");
        exposure.bind_property ("active", app.exposure, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
        contrast.bind_property ("active", app.contrast, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
        focus.bind_property ("active", app.focus, "visible", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
        app.exposure.bind_property ("is_available", exposure, "sensitive", GLib.BindingFlags.SYNC_CREATE);
        app.contrast.bind_property ("is_available", contrast, "sensitive", GLib.BindingFlags.SYNC_CREATE);
        app.focus.bind_property ("is_available", focus, "sensitive", GLib.BindingFlags.SYNC_CREATE);
        notify["visible"].connect (() => {
            if (visible == true)
                return;
            app.exposure.visible = false;
            app.contrast.visible = false;
            app.focus.visible = false;
        });
    }
}