You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
707 B

#include "info.h"
Info::Info() {
set_hexpand(false);
set_halign(Gtk::Align::ALIGN_END);
auto content_area=dynamic_cast<Gtk::Container*>(get_content_area());
label.set_max_width_chars(40);
label.set_line_wrap(true);
content_area->add(label);
auto provider = Gtk::CssProvider::create();
provider->load_from_data("* {border-radius: 5px;}");
get_style_context()->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
void Info::print(const std::string &text) {
if(!enabled)
return;
timeout_connection.disconnect();
timeout_connection=Glib::signal_timeout().connect([this]() {
hide();
return false;
}, 3000);
label.set_text(text);
show();
}