summaryrefslogtreecommitdiff
path: root/src/widget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widget.cpp')
-rw-r--r--src/widget.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/src/widget.cpp b/src/widget.cpp
index 7a3371c2b..4ece7f3a5 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -973,7 +973,7 @@ void NWidgetBase::Invalidate(const Window *w) const
}
/**
- * @fn NWidgetCore *GetWidgetFromPos(int x, int y)
+ * @fn NWidgetCore *NWidgetBase::GetWidgetFromPos(int x, int y)
* Retrieve a widget by its position.
* @param x Horizontal position relative to the left edge of the window.
* @param y Vertical position relative to the top edge of the window.
@@ -981,11 +981,14 @@ void NWidgetBase::Invalidate(const Window *w) const
*/
/**
- * @fn NWidgetBase *GetWidgetOfType(WidgetType tp)
* Retrieve a widget by its type.
* @param tp Widget type to search for.
* @return Returns the first widget of the specified type, or \c NULL if no widget can be found.
*/
+NWidgetBase *NWidgetBase::GetWidgetOfType(WidgetType tp)
+{
+ return (this->type == tp) ? this : NULL;
+}
/**
* Constructor for resizable nested widgets.
@@ -1109,6 +1112,11 @@ void NWidgetCore::StoreWidgets(Widget *widgets, int length, bool left_moving, bo
w->tooltips = this->tool_tip;
}
+NWidgetCore *NWidgetCore::GetWidgetFromPos(int x, int y)
+{
+ return (IsInsideBS(x, this->pos_x, this->current_x) && IsInsideBS(y, this->pos_y, this->current_y)) ? this : NULL;
+}
+
/**
* @fn Scrollbar *NWidgetCore::FindScrollbar(Window *w, bool allow_next = true)
* Find the scrollbar of the widget through the Window::nested_array.
@@ -1200,7 +1208,6 @@ static inline uint ComputeOffset(uint space, uint max_space)
return (max_space - space) / 2;
}
-
/**
* Widgets stacked on top of each other.
* @param tp Kind of stacking, must be either #NWID_SELECTION or #NWID_LAYERED.
@@ -1615,11 +1622,6 @@ NWidgetCore *NWidgetSpacer::GetWidgetFromPos(int x, int y)
return NULL;
}
-NWidgetBase *NWidgetSpacer::GetWidgetOfType(WidgetType tp)
-{
- return (this->type == tp) ? this : NULL;
-}
-
/**
* Constructor parent nested widgets.
* @param tp Type of parent widget.
@@ -2152,10 +2154,6 @@ void NWidgetLeaf::Invalidate(const Window *w) const
NWidgetBase::Invalidate(w);
}
-NWidgetCore *NWidgetLeaf::GetWidgetFromPos(int x, int y)
-{
- return (IsInsideBS(x, this->pos_x, this->current_x) && IsInsideBS(y, this->pos_y, this->current_y)) ? this : NULL;
-}
Scrollbar *NWidgetLeaf::FindScrollbar(Window *w, bool allow_next)
{
@@ -2169,11 +2167,6 @@ Scrollbar *NWidgetLeaf::FindScrollbar(Window *w, bool allow_next)
return NULL;
}
-NWidgetBase *NWidgetLeaf::GetWidgetOfType(WidgetType tp)
-{
- return (this->type == tp) ? this : NULL;
-}
-
/**
* Intialize nested widget tree and convert to widget array.
* @param nwid Nested widget tree.