Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/widget.cc')
-rw-r--r--src/ui/widget.cc33
1 files changed, 25 insertions, 8 deletions
diff --git a/src/ui/widget.cc b/src/ui/widget.cc
index 982b792..8c40c04 100644
--- a/src/ui/widget.cc
+++ b/src/ui/widget.cc
@@ -228,14 +228,31 @@ void Widget::set_label(const std::string & label)
widget_label.assign(label);
aux::to_label(widget_label);
}
-
+
void Widget::set_label(const char *label)
{
- if (label) {
+ if (label == nullptr)
+ {
+ widget_label.clear();
+ } else {
widget_label.assign(label);
aux::to_label(widget_label);
+ }
+}
+
+
+void Widget::set_tooltip(const std::string &tooltip)
+{
+ widget_tooltip.assign(tooltip);
+}
+
+void Widget::set_tooltip(const char *tooltip)
+{
+ if (tooltip == nullptr)
+ {
+ widget_tooltip.clear();
} else {
- widget_label.clear();
+ widget_label.assign(tooltip);
}
}
@@ -300,7 +317,7 @@ Widget *Widget::next_sibling()
// find this widget in the parent's children
Children::iterator it = parent()->children().begin();
while (it != parent()->children().end() && ((*it) != this)) {
- it++;
+ it++;
}
// assert this widget is a child of its parent
@@ -384,17 +401,17 @@ Widget *Widget::find_visible_child(const Widget *widget)
return 0;
}
-Widget *Widget::find_mouse_focus(const math::Vector2f & pos)
+Widget *Widget::find_widget_in_location(const math::Vector2f & location)
{
// this widget is not visible
- if (!visible() || !size().contains(pos))
- return 0;
+ if (!visible() || !size().contains(location))
+ return nullptr;
// reverse-iterate children
for (Children::reverse_iterator rit = widget_children.rbegin(); rit != widget_children.rend(); ++rit) {
Widget *w = (*rit);
if (w->visible() && w->enabled()) {
- Widget *f = w->find_mouse_focus(pos - w->location());
+ Widget *f = w->find_widget_in_location(location - w->location());
if (f)
return f;
}