Merge pull request #4977 from Diax170/drawer-state

Add CSS selector for expanded drawers
This commit is contained in:
Alexis Rouillard
2026-07-03 23:01:26 +02:00
committed by GitHub
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -375,6 +375,8 @@ A group may hide all but one element, showing them only on mouse hover. In order
Defines the direction of the transition animation. If true, the hidden elements will slide from left to right. If false, they will slide from right to left. Defines the direction of the transition animation. If true, the hidden elements will slide from left to right. If false, they will slide from right to left.
When the bar is vertical, it reads as top-to-bottom. When the bar is vertical, it reads as top-to-bottom.
Group drawers are also given the `.expanded` CSS class when they are expanded.
``` ```
"group/power": { "group/power": {
"orientation": "inherit", "orientation": "inherit",
+2
View File
@@ -96,11 +96,13 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
void Group::show_group() { void Group::show_group() {
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
revealer.set_reveal_child(true); revealer.set_reveal_child(true);
box.get_style_context()->add_class("expanded");
} }
void Group::hide_group() { void Group::hide_group() {
box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT); box.unset_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
revealer.set_reveal_child(false); revealer.set_reveal_child(false);
box.get_style_context()->remove_class("expanded");
} }
bool Group::handleMouseEnter(GdkEventCrossing* const& e) { bool Group::handleMouseEnter(GdkEventCrossing* const& e) {