summaryrefslogtreecommitdiff
path: root/src/gui/widgets/itemcontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-30 17:47:23 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-30 18:19:54 +0300
commitbd429077f8985c5ee45a53009d02e2f495b4ad90 (patch)
treeaeaaaba43b24de34af6f332ac200b976b7056371 /src/gui/widgets/itemcontainer.cpp
parentb0388c5ad0a49f65becdee1120d4df476410dd01 (diff)
downloadmv-bd429077f8985c5ee45a53009d02e2f495b4ad90.tar.gz
mv-bd429077f8985c5ee45a53009d02e2f495b4ad90.tar.bz2
mv-bd429077f8985c5ee45a53009d02e2f495b4ad90.tar.xz
mv-bd429077f8985c5ee45a53009d02e2f495b4ad90.zip
Add strong typed bool enum ShowEmptyRows and use it in itemcontainer.
Diffstat (limited to 'src/gui/widgets/itemcontainer.cpp')
-rw-r--r--src/gui/widgets/itemcontainer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index d9d2b5f4b..5ae542357 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -159,6 +159,7 @@ namespace
ItemContainer::ItemContainer(const Widget2 *const widget,
Inventory *const inventory,
+ const ShowEmptyRows showEmptyRows,
const ForceQuantity forceQuantity) :
Widget(widget),
KeyListener(),
@@ -192,6 +193,7 @@ ItemContainer::ItemContainer(const Widget2 *const widget,
mPaddingItemY(mSkin ? mSkin->getOption("paddingItemY", 0) : 0),
mSelectionStatus(SEL_NONE),
mForceQuantity(forceQuantity),
+ mShowEmptyRows(showEmptyRows),
mDescItems(false),
mRedraw(true)
{
@@ -262,7 +264,8 @@ void ItemContainer::draw(Graphics *graphics)
mVertexes->clear();
const unsigned int invSize = mInventory->getSize();
- const int maxRows = invSize / mGridColumns;
+ const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
+ invSize / mGridColumns : mGridRows;
for (int j = 0; j < maxRows; j++)
{
const int intY0 = j * mBoxHeight;
@@ -385,7 +388,8 @@ void ItemContainer::safeDraw(Graphics *graphics)
if (mCellBackgroundImg)
{
const unsigned int invSize = mInventory->getSize();
- const int maxRows = invSize / mGridColumns;
+ const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
+ invSize / mGridColumns : mGridRows;
for (int j = 0; j < maxRows; j++)
{
const int intY0 = j * mBoxHeight;
@@ -865,7 +869,8 @@ void ItemContainer::adjustHeight()
++mGridRows;
const unsigned int invSize = mInventory->getSize();
- const int maxRows = invSize / mGridColumns;
+ const int maxRows = mShowEmptyRows == ShowEmptyRows_true ?
+ invSize / mGridColumns : mGridRows;
setHeight(maxRows * mBoxHeight);
updateMatrix();