diff --git a/src/selectiondialog.cc b/src/selectiondialog.cc index ba1daaa..4ad73ca 100644 --- a/src/selectiondialog.cc +++ b/src/selectiondialog.cc @@ -33,12 +33,12 @@ ListViewText::ListViewText(bool use_markup) : Gtk::TreeView(), use_markup(use_ma set_rules_hint(true); } -void ListViewText::ListViewText::append(const std::string& value) { +void ListViewText::append(const std::string& value) { auto new_row=list_store->append(); new_row->set_value(column_record.text, value); } -void ListViewText::ListViewText::hide() { +void ListViewText::hide() { Gtk::TreeView::hide(); list_store->clear(); } diff --git a/src/tooltips.cc b/src/tooltips.cc index a8a3a53..9874c6b 100644 --- a/src/tooltips.cc +++ b/src/tooltips.cc @@ -138,7 +138,7 @@ void Tooltip::wrap_lines(Glib::RefPtr text_buffer) { } void Tooltips::show(const Gdk::Rectangle& rectangle, bool disregard_drawn) { - for(auto& tooltip: *this) { + for(auto &tooltip : tooltip_list) { tooltip.update(); if(rectangle.intersects(tooltip.activation_rectangle)) { tooltip.adjust(disregard_drawn); @@ -150,7 +150,7 @@ void Tooltips::show(const Gdk::Rectangle& rectangle, bool disregard_drawn) { } void Tooltips::show(bool disregard_drawn) { - for(auto& tooltip: *this) { + for(auto &tooltip : tooltip_list) { tooltip.update(); tooltip.adjust(disregard_drawn); tooltip.window->show_all(); @@ -158,7 +158,7 @@ void Tooltips::show(bool disregard_drawn) { } void Tooltips::hide() { - for(auto& tooltip: *this) { + for(auto &tooltip : tooltip_list) { if(tooltip.window) tooltip.window->hide(); } diff --git a/src/tooltips.h b/src/tooltips.h index 9330394..4f21953 100644 --- a/src/tooltips.h +++ b/src/tooltips.h @@ -25,14 +25,23 @@ private: int tooltip_width, tooltip_height; }; -class Tooltips : public std::list { +class Tooltips { public: static void init() {drawn_tooltips_rectangle=Gdk::Rectangle();} void show(const Gdk::Rectangle& rectangle, bool disregard_drawn=false); void show(bool disregard_drawn=false); void hide(); + void clear() {tooltip_list.clear();}; + template + void emplace_back(Ts&&... params) { + tooltip_list.emplace_back(std::forward(params)...); + } + static Gdk::Rectangle drawn_tooltips_rectangle; + + private: + std::list tooltip_list; }; #endif // JUCI_TOOLTIPS_H_