Skip to content

Commit

Permalink
Fixed|libappfw: Menu closes open subwidgets when opening a new subwidget
Browse files Browse the repository at this point in the history
Todo for later: If necessary, this could be a behavior flag in
MenuWidget.

IssueID #1730
  • Loading branch information
skyjake committed Mar 21, 2015
1 parent 15fe1c6 commit cee36bc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions doomsday/sdk/libappfw/include/de/widgets/menuwidget.h
Expand Up @@ -27,6 +27,7 @@
#include "../GridLayout"
#include "../ScrollAreaWidget"
#include "../ButtonWidget"
#include "../PanelWidget"

namespace de {

Expand Down Expand Up @@ -139,6 +140,14 @@ class LIBAPPFW_PUBLIC MenuWidget : public ScrollAreaWidget
public slots:
void dismissPopups();

signals:
/**
* Called when a submenu/widget is opened by one of the items.
*
* @param panel Panel that was opened.
*/
void subWidgetOpened(de::PanelWidget *panel);

private:
DENG2_PRIVATE(d)
};
Expand Down
8 changes: 8 additions & 0 deletions doomsday/sdk/libappfw/src/widgets/menuwidget.cpp
Expand Up @@ -329,6 +329,14 @@ DENG2_PIMPL(MenuWidget)

w->audienceForClose() += this;
w->audienceForDeletion() += this;

emit self.subWidgetOpened(w);

// Automatically close other subwidgets when one is opened.
foreach(auto *panel, openSubs)
{
if(panel != w) panel->close();
}
}

bool isVisibleItem(Widget const *child) const
Expand Down

0 comments on commit cee36bc

Please sign in to comment.