diff options
Diffstat (limited to 'src/ui/widget.cc')
-rw-r--r-- | src/ui/widget.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/ui/widget.cc b/src/ui/widget.cc index 8c40c04..73c454a 100644 --- a/src/ui/widget.cc +++ b/src/ui/widget.cc @@ -9,6 +9,7 @@ #include "ui/paint.h" #include "ui/ui.h" #include "ui/widget.h" +#include "ui/tooltip.h" #include <cassert> @@ -22,8 +23,9 @@ Widget::Widget(Widget *parent) widget_border = true; widget_background = false; widget_enabled = true; - widget_palette = 0; - widget_font = 0; + widget_palette = nullptr; + widget_font = nullptr; + widget_tooltip = nullptr; widget_label.assign("widget"); if (!parent) { @@ -241,19 +243,18 @@ void Widget::set_label(const char *label) } -void Widget::set_tooltip(const std::string &tooltip) +void Widget::set_tooltip(const std::string &tooltip_text) { - widget_tooltip.assign(tooltip); + set_tooltip(tooltip_text.c_str()); } -void Widget::set_tooltip(const char *tooltip) +void Widget::set_tooltip(const char *tooltip_text) { - if (tooltip == nullptr) + if (widget_tooltip == nullptr) { - widget_tooltip.clear(); - } else { - widget_label.assign(tooltip); + widget_tooltip = new Tooltip(this); } + widget_tooltip->set_text(tooltip_text); } void Widget::set_palette(const Palette *palette) |