Files
Waybar/include/group.hpp
T
Piotr Piwoński 67df5f5838 feat(Group): enhance widget visibility management - set visibility instantly on module update using dynamic signal handling.
Improve performance - manage the visibility of updated module only instead of iterating over all modules on `hide_group`.
2025-03-30 14:49:07 +00:00

43 lines
1.1 KiB
C++

#pragma once
#include <gtkmm/box.h>
#include <gtkmm/widget.h>
#include <json/json.h>
#include "AModule.hpp"
#include "gtkmm/revealer.h"
namespace waybar {
class Group : public AModule {
public:
Group(const std::string &, const std::string &, const Json::Value &, bool);
~Group() override = default;
auto update() -> void override;
operator Gtk::Widget &() override;
virtual Gtk::Box &getBox();
void addWidget(AModule* module);
protected:
Gtk::Box box;
Gtk::Box revealer_box;
Gtk::Revealer revealer;
bool is_first_widget = true;
bool is_drawer = false;
bool click_to_reveal = false;
std::string always_visible_class;
std::string add_class_to_drawer_children;
bool handleMouseEnter(GdkEventCrossing *const &ev) override;
bool handleMouseLeave(GdkEventCrossing *const &ev) override;
bool handleToggle(GdkEventButton *const &ev) override;
void show_group();
void hide_group();
void manage_visibility(AModule* module);
void show_widget(Gtk::Widget& widget);
void hide_widget(Gtk::Widget& widget);
void hide_current_widget_if_inactive();
};
} // namespace waybar