Skip to content

Commit

Permalink
UI|Client|MenuWidget|Fixed: Layout logic for expanding unlimited columns
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 17, 2013
1 parent df27834 commit 24ee2d1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions doomsday/client/include/ui/widgets/menuwidget.h
Expand Up @@ -40,6 +40,8 @@
*/
class MenuWidget : public ScrollAreaWidget
{
Q_OBJECT

public:
MenuWidget(de::String const &name = "");

Expand All @@ -55,8 +57,8 @@ class MenuWidget : public ScrollAreaWidget
*
* If one of the dimensions is set to ui::Expand policy, the menu's size in
* that dimension is determined by the summed up size of the children, and
* the specified number of columns/rows is ignored for that dimension. Only
* one of the dimensions can be set to Expand.
* the specified number of columns/rows is ignored for that dimension. Both
* dimensions cannot be set to zero columns/rows.
*
* @param columns Number of columns in the grid.
* @param columnPolicy Policy for sizing columns.
Expand Down
16 changes: 12 additions & 4 deletions doomsday/client/src/ui/widgets/menuwidget.cpp
Expand Up @@ -254,9 +254,9 @@ public ContextWidgetOrganizer::IWidgetFactory
}
else if(rows->valuei() > 0)
{
DENG2_ASSERT(rowPolicy != Expand);
pos.x = ordinal % rows->valuei();
pos.y = ordinal / rows->valuei();
//DENG2_ASSERT(rowPolicy != Expand);
pos.x = ordinal / rows->valuei();
pos.y = ordinal % rows->valuei();
}
else
{
Expand Down Expand Up @@ -464,7 +464,15 @@ void MenuWidget::updateLayout()
{
if(col > 0)
{
widget->rule().setInput(Rule::Left, contentRule().left() + *d->colWidth * Const(col));
if(d->cols->valuei() > 0)
{
widget->rule().setInput(Rule::Left, contentRule().left() + *d->colWidth * Const(col));
}
else
{
DENG2_ASSERT(previous != 0);
widget->rule().setInput(Rule::Left, previous->rule().right());
}
}
else
{
Expand Down

0 comments on commit 24ee2d1

Please sign in to comment.