Add widgetGetCurrentlyMousedOver to return the widget that currently has the mouse over it.
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5834 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
eaffd089b3
commit
077cfee020
|
@ -1226,6 +1226,31 @@ widget *widgetGetCurrentlyFocused(widget *self)
|
|||
return self;
|
||||
}
|
||||
|
||||
widget *widgetGetCurrentlyMousedOver(widget *self)
|
||||
{
|
||||
int i;
|
||||
|
||||
// Make sure we have the mouse
|
||||
if (!self->hasMouse)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// See if any of our children are moused over
|
||||
for (i = 0; i < vectorSize(self->children); i++)
|
||||
{
|
||||
widget *child = vectorAt(self->children, i);
|
||||
|
||||
if (child->hasMouse)
|
||||
{
|
||||
return widgetGetCurrentlyMousedOver(child);
|
||||
}
|
||||
}
|
||||
|
||||
// None of our children have the mouse; return ourself
|
||||
return self;
|
||||
}
|
||||
|
||||
bool widgetHandleEventImpl(widget *self, const event *evt)
|
||||
{
|
||||
// If the event should be passed onto our children
|
||||
|
|
|
@ -815,11 +815,22 @@ void widgetDestroy(widget *self);
|
|||
* Should none of self's child widgets have focus (but it does) then self is
|
||||
* returned.
|
||||
*
|
||||
* @param self The widget to get the further down focused child of.
|
||||
* @param self The widget to get the furthest down focused child of.
|
||||
* @return A pointer to the widget, or NULL if self is not focused.
|
||||
*/
|
||||
widget *widgetGetCurrentlyFocused(widget *self);
|
||||
|
||||
/**
|
||||
* Very much the same as widgetGetCurrentlyFocused except that it returns a
|
||||
* pointer to the widget furthest down the hierarchy which currently has the
|
||||
* mouse over it. Like with widgetGetCurrentlyFocused should self not have the
|
||||
* mouse over it, NULL is returned.
|
||||
*
|
||||
* @param self The widget to get the furthest down moused-over child of.
|
||||
* @param A pointer to the widget, or NULL if self does not have the mouse.
|
||||
*/
|
||||
widget *widgetGetCurrentlyMousedOver(widget *self);
|
||||
|
||||
/**
|
||||
* If the widget is capable of holding keyboard focus and does not currently
|
||||
* hold it then this method will bring it into focus. Should ->parent not be
|
||||
|
|
Loading…
Reference in New Issue