Merge remote-tracking branch 'origin/master' into group-reveal-by-default
# Conflicts: # src/group.cpp
This commit is contained in:
+30
-3
@@ -26,7 +26,7 @@ Gtk::RevealerTransitionType getPreferredTransitionType(bool is_vertical) {
|
||||
|
||||
Group::Group(const std::string& name, const std::string& id, const Json::Value& config,
|
||||
bool vertical)
|
||||
: AModule(config, name, id, true, true),
|
||||
: AModule(config, name, id, true, false),
|
||||
box{vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0},
|
||||
revealer_box{vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0} {
|
||||
box.set_name(name_);
|
||||
@@ -67,12 +67,17 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
|
||||
: false);
|
||||
|
||||
click_to_reveal = drawer_config["click-to-reveal"].asBool();
|
||||
reveal_delay = drawer_config["reveal-delay"].asInt();
|
||||
|
||||
const bool start_expanded =
|
||||
(drawer_config["start-expanded"].isBool() ? drawer_config["start-expanded"].asBool()
|
||||
: false);
|
||||
|
||||
auto transition_type = getPreferredTransitionType(vertical);
|
||||
|
||||
revealer.set_transition_type(transition_type);
|
||||
revealer.set_transition_duration(transition_duration);
|
||||
if (click_to_reveal && reveal_by_default) {
|
||||
if ((click_to_reveal && reveal_by_default) || start_expanded) {
|
||||
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
|
||||
revealer.set_reveal_child(true);
|
||||
} else {
|
||||
@@ -105,13 +110,30 @@ void Group::hide_group() {
|
||||
|
||||
bool Group::handleMouseEnter(GdkEventCrossing* const& e) {
|
||||
if (!click_to_reveal) {
|
||||
show_group();
|
||||
if (reveal_delay > 0) {
|
||||
if (reveal_timeout_.connected()) {
|
||||
reveal_timeout_.disconnect();
|
||||
}
|
||||
|
||||
reveal_timeout_ = Glib::signal_timeout().connect(
|
||||
[this]() {
|
||||
show_group();
|
||||
return false;
|
||||
},
|
||||
reveal_delay);
|
||||
} else {
|
||||
show_group();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Group::handleMouseLeave(GdkEventCrossing* const& e) {
|
||||
if (!click_to_reveal && e->detail != GDK_NOTIFY_INFERIOR) {
|
||||
if (reveal_delay > 0 && reveal_timeout_.connected()) {
|
||||
reveal_timeout_.disconnect();
|
||||
}
|
||||
|
||||
hide_group();
|
||||
}
|
||||
return false;
|
||||
@@ -133,6 +155,11 @@ auto Group::update() -> void {
|
||||
// noop
|
||||
}
|
||||
|
||||
bool Group::handleScroll(GdkEventScroll* e) {
|
||||
// no scroll.
|
||||
return true;
|
||||
}
|
||||
|
||||
Gtk::Box& Group::getBox() { return is_drawer ? (is_first_widget ? box : revealer_box) : box; }
|
||||
|
||||
void Group::addWidget(Gtk::Widget& widget) {
|
||||
|
||||
Reference in New Issue
Block a user