Skip to content

Commit

Permalink
Widgets|libappfw: Improved MessageDialog layout with custom widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Jul 15, 2016
1 parent 8a67e2b commit ee62a92
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion doomsday/sdk/libappfw/include/de/dialogs/messagedialog.h
Expand Up @@ -38,11 +38,13 @@ class LIBAPPFW_PUBLIC MessageDialog : public DialogWidget
LabelWidget &title();
LabelWidget &message();

enum LayoutBehavior { ExcludeHidden, IncludeHidden };

/**
* Derived classes should call this after they add or remove widgets in the
* dialog content area.
*/
void updateLayout();
void updateLayout(LayoutBehavior behavior = ExcludeHidden);

private:
DENG2_PRIVATE(d)
Expand Down
8 changes: 4 additions & 4 deletions doomsday/sdk/libappfw/src/dialogs/messagedialog.cpp
Expand Up @@ -55,7 +55,7 @@ DENG_GUI_PIMPL(MessageDialog)
updateLayout();
}

void updateLayout()
void updateLayout(LayoutBehavior behavior = ExcludeHidden)
{
ScrollAreaWidget &area = self.area();

Expand All @@ -68,7 +68,7 @@ DENG_GUI_PIMPL(MessageDialog)
foreach (Widget *w, area.childWidgets())
{
// Individual children can be hidden to exclude them from the layout.
if (!w->behavior().testFlag(Widget::Hidden))
if (behavior == IncludeHidden || !w->behavior().testFlag(Widget::Hidden))
{
layout << w->as<GuiWidget>();
}
Expand Down Expand Up @@ -106,9 +106,9 @@ LabelWidget &MessageDialog::message()
return *d->message;
}

void MessageDialog::updateLayout()
void MessageDialog::updateLayout(LayoutBehavior behavior)
{
d->updateLayout();
d->updateLayout(behavior);
}

} // namespace de

0 comments on commit ee62a92

Please sign in to comment.