Skip to content

Commit

Permalink
UI|AlertDialog: Adjusted list behavior
Browse files Browse the repository at this point in the history
The list of alerts is scrollable, and the latest alert appears at
the top of the list.
  • Loading branch information
skyjake committed Jan 2, 2014
1 parent 5a34193 commit db31ce1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions doomsday/client/src/ui/dialogs/alertdialog.cpp
Expand Up @@ -67,15 +67,16 @@ DENG_GUI_PIMPL(AlertDialog)
// browsing it up and down.
ScrollAreaWidget &area = self.area();
alerts = new MenuWidget;
alerts->enableScrolling(false);
alerts->setGridSize(1, ui::Expand, 0, ui::Expand);
alerts->rule()
.setLeftTop(area.contentRule().left(), area.contentRule().top());
area.setContentSize(alerts->rule().width(), alerts->rule().height());
area.margins().setLeft("");
area.margins().setRight("");
area.margins().setBottom("");
area.add(alerts);

area.enableIndicatorDraw(true);

alerts->organizer().audienceForWidgetCreation += this;
alerts->organizer().audienceForWidgetUpdate += this;
}
Expand Down Expand Up @@ -112,7 +113,7 @@ DENG_GUI_PIMPL(AlertDialog)
return;
}

alerts->items().append(alert);
alerts->items().insert(0, alert);
}

void widgetCreatedForItem(GuiWidget &widget, ui::Item const &item)
Expand All @@ -130,6 +131,8 @@ DENG_GUI_PIMPL(AlertDialog)
label.setOverrideImageSize(style().fonts().font("default").height().value());
label.setImageAlignment(ui::AlignTop);
label.setTextAlignment(ui::AlignRight);
label.margins().setLeft("");
label.margins().setRight("");
label.margins().setBottom("");

AlertItem const &alert = item.as<AlertItem>();
Expand Down

0 comments on commit db31ce1

Please sign in to comment.