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.h')
-rw-r--r--src/ui/widget.h42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/ui/widget.h b/src/ui/widget.h
index 14bea7b..243fdda 100644
--- a/src/ui/widget.h
+++ b/src/ui/widget.h
@@ -129,6 +129,11 @@ public:
inline const std::string &label() const {
return widget_label;
}
+
+ /// widget tooltip
+ inline const std::string &tooltip() const {
+ return widget_tooltip;
+ }
/// true if this widget will draw a background
inline const bool background() const {
@@ -220,29 +225,35 @@ public:
/// set location of the top-left corner, relative to the parent
void set_location(const math::Vector2f &location);
- /// set the widgets width and height
+ /// set the widget's width and height
void set_size(const float w, const float h);
- /// set the widgets width and height
+ /// set the widget's width and height
void set_size(const math::Vector2f &size);
- /// set the widgets width
+ /// set the widget's width
void set_width(const float w);
- /// set the widgets height
+ /// set the widget's height
void set_height(const float h);
- /// set the widgets palette
+ /// set the widget's palette
void set_palette(const Palette *palette);
- /// set the widgets font
+ /// set the widget's font
void set_font(const Font *font);
- /// set the widgets label
+ /// set the widget's label
void set_label(const std::string &label);
- /// set the widgets label
- void set_label(const char *label);
+ /// set the widget's label
+ void set_label(const char *label = nullptr);
+
+ /// set the wdiget's widget_tooltip
+ void set_tooltip(const std::string &tooltip);
+
+ /// set the wdiget's widget_tooltip
+ void set_tooltip(const char *tooltip = nullptr);
/// enable or disable widget border
void set_border(const bool border = true);
@@ -309,10 +320,14 @@ protected:
/// find the widget that has input focus
virtual Widget *find_input_focus();
- /// find widget that has mouse focus
- /** @param cursor mouse cursor position relative to this widget's location
- */
- Widget *find_mouse_focus(const math::Vector2f & cursor);
+ /**
+ * @brief find the widget in a given location
+ * Searches the widget's children tree for the leaf widget visible in a given location.
+ * If no child contains the location, the widget itself is tested. Returns a nullptr ig
+ * the location is not within the widget's boundries.
+ * @param location search position, relative to this widget's location
+ **/
+ Widget *find_widget_in_location(const math::Vector2f &location);
/// find a visible widget
Widget *find_visible_child(const Widget *widget);
@@ -431,6 +446,7 @@ private:
math::Vector2f widget_location;
math::Vector2f widget_size;
std::string widget_label;
+ std::string widget_tooltip;
Children widget_children;