summaryrefslogtreecommitdiff
path: root/src/gui/widgets/layout.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-28 19:05:52 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-28 19:05:52 +0300
commitb6eb53b9abdf48b88cb1978b9af97f2a879d2717 (patch)
tree5aad5623d352ec0b4aa245856958c61a384861c7 /src/gui/widgets/layout.cpp
parent4d453108f45f9fb2ff4f5715cc1b3ddd63d36a80 (diff)
parent71fe51d38a406012e166589b7b720d83c1ab3ade (diff)
downloadmanaplus-stripped1.1.11.27.tar.gz
manaplus-stripped1.1.11.27.tar.bz2
manaplus-stripped1.1.11.27.tar.xz
manaplus-stripped1.1.11.27.zip
Merge commit 'v1.1.11.27' into strippedstripped1.1.11.27
Conflicts: data/Makefile.am
Diffstat (limited to 'src/gui/widgets/layout.cpp')
-rw-r--r--src/gui/widgets/layout.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp
index 7f2f1f621..f0359062e 100644
--- a/src/gui/widgets/layout.cpp
+++ b/src/gui/widgets/layout.cpp
@@ -222,11 +222,15 @@ LayoutCell &LayoutArray::place(gcn::Widget *widget, int x, int y, int w, int h)
return cell;
}
-void LayoutArray::align(int &pos, int &size, int dim,
- LayoutCell const &cell, int *sizes) const
+void LayoutArray::align(int &pos, int &size, int dim, LayoutCell const &cell,
+ int *sizes, int sizeCount) const
{
int size_max = sizes[0];
- for (int i = 1; i < cell.mExtent[dim]; ++i)
+ int cnt = cell.mExtent[dim];
+ if (sizeCount && cell.mExtent[dim] > sizeCount)
+ cnt = sizeCount;
+
+ for (int i = 1; i < cnt; ++i)
size_max += sizes[i] + mSpacing;
size = std::min<int>(cell.mSize[dim], size_max);
@@ -274,7 +278,8 @@ std::vector<int> LayoutArray::getSizes(int dim, int upp) const
}
}
- if (upp == Layout::AUTO_DEF) return sizes;
+ if (upp == Layout::AUTO_DEF)
+ return sizes;
// Compute the FILL sizes.
int nb = static_cast<int>(sizes.size());
@@ -343,8 +348,10 @@ void LayoutArray::reflow(int nx, int ny, int nw, int nh)
if (cell && cell->mType != LayoutCell::NONE)
{
int dx = x, dy = y, dw = 0, dh = 0;
- align(dx, dw, 0, *cell, &widths[gridX]);
- align(dy, dh, 1, *cell, &heights[gridY]);
+ align(dx, dw, 0, *cell, &widths[gridX],
+ widths.size() - gridX);
+ align(dy, dh, 1, *cell, &heights[gridY],
+ heights.size() - gridY);
cell->reflow(dx, dy, dw, dh);
}
x += widths[gridX] + mSpacing;