Skip to content

Commit

Permalink
libappfw|GuiRootWidget: Utility for moving a widget on top
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 12, 2014
1 parent a62d897 commit 405941b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 1 addition & 2 deletions doomsday/client/src/ui/widgets/tutorialwidget.cpp
Expand Up @@ -279,8 +279,7 @@ DENG_GUI_PIMPL(TutorialWidget)
GuiRootWidget &root = self.root();

// Keep the tutorial above any dialogs etc. that might've been opened.
root.remove(self);
root.addOnTop(&self);
root.moveToTop(self);

root.addOnTop(dlg);
dlg->open();
Expand Down
7 changes: 7 additions & 0 deletions doomsday/libappfw/include/de/framework/guirootwidget.h
Expand Up @@ -113,6 +113,13 @@ class LIBAPPFW_PUBLIC GuiRootWidget : public RootWidget
*/
virtual void addOnTop(GuiWidget *widget);

/**
* Reorders the children of the root widget so that @a widget is added to the top.
*
* @param widget Widget to move to the top.
*/
void moveToTop(GuiWidget &widget);

/**
* Sends the current mouse position as a mouse event, just like the mouse would've
* been moved.
Expand Down
9 changes: 9 additions & 0 deletions doomsday/libappfw/src/guirootwidget.cpp
Expand Up @@ -181,6 +181,15 @@ void GuiRootWidget::addOnTop(GuiWidget *widget)
add(widget);
}

void GuiRootWidget::moveToTop(GuiWidget &widget)
{
if(widget.parentWidget())
{
widget.parentWidget()->remove(widget);
}
addOnTop(&widget);
}

AtlasTexture &GuiRootWidget::atlas()
{
d->initAtlas();
Expand Down

0 comments on commit 405941b

Please sign in to comment.