summaryrefslogtreecommitdiff
path: root/src/gui/inventorywindow.cpp
diff options
context:
space:
mode:
authorBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 05:16:27 +0000
committerBjörn Steinbrink <B.Steinbrink@gmx.de>2006-03-09 05:16:27 +0000
commite5f795ad9952b8bba6993ee3e324b22a0f104816 (patch)
tree1602ac0f74865135eae5acf935b0a285a8e918c2 /src/gui/inventorywindow.cpp
parent7593d6c71e2331c3e43c732db60ad03ee4d5385d (diff)
downloadmana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.gz
mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.bz2
mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.tar.xz
mana-e5f795ad9952b8bba6993ee3e324b22a0f104816.zip
Made all class members named like mClassMember.
Diffstat (limited to 'src/gui/inventorywindow.cpp')
-rw-r--r--src/gui/inventorywindow.cpp109
1 files changed, 54 insertions, 55 deletions
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 0c8fb14e..422d92af 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -50,34 +50,33 @@ InventoryWindow::InventoryWindow():
setMinHeight(172);
setDefaultSize(115, 25, 322, 172);
- useButton = new Button("Use", "use", this);
- dropButton = new Button("Drop", "drop", this);
-
- items = new ItemContainer(player_node->mInventory.get());
- invenScroll = new ScrollArea(items);
- invenScroll->setPosition(8, 8);
- invenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
-
- itemNameLabel = new gcn::Label("Name:");
- itemDescriptionLabel = new gcn::Label("Description:");
- itemEffectLabel = new gcn::Label("Effect:");
- weightLabel = new gcn::Label("Total Weight: - Maximum Weight: ");
- weightLabel->setPosition(8, 8);
- invenScroll->setPosition(8,
- weightLabel->getY() + weightLabel->getHeight() + 5);
-
- add(useButton);
- add(dropButton);
- add(invenScroll);
- add(itemNameLabel);
- add(itemDescriptionLabel);
- add(itemEffectLabel);
- add(weightLabel);
-
- useButton->setSize(48, useButton->getHeight());
+ mUseButton = new Button("Use", "use", this);
+ mDropButton = new Button("Drop", "drop", this);
+
+ mItems = new ItemContainer(player_node->mInventory.get());
+ mInvenScroll = new ScrollArea(mItems);
+ mInvenScroll->setPosition(8, 8);
+ mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
+
+ mItemNameLabel = new gcn::Label("Name:");
+ mItemDescriptionLabel = new gcn::Label("Description:");
+ mItemEffectLabel = new gcn::Label("Effect:");
+ mWeightLabel = new gcn::Label("Total Weight: - Maximum Weight: ");
+ mWeightLabel->setPosition(8, 8);
+ mInvenScroll->setPosition(8,
+ mWeightLabel->getY() + mWeightLabel->getHeight() + 5);
+
+ add(mUseButton);
+ add(mDropButton);
+ add(mInvenScroll);
+ add(mItemNameLabel);
+ add(mItemDescriptionLabel);
+ add(mItemEffectLabel);
+ add(mWeightLabel);
+
+ mUseButton->setSize(48, mUseButton->getHeight());
loadWindowState();
-
}
void InventoryWindow::logic()
@@ -90,15 +89,15 @@ void InventoryWindow::logic()
// Update weight information
std::stringstream tempstr;
- tempstr << "Total Weight: " << player_node->totalWeight
- << " - Maximum Weight: " << player_node->maxWeight;
- weightLabel->setCaption(tempstr.str());
- weightLabel->adjustSize();
+ tempstr << "Total Weight: " << player_node->mTotalWeight
+ << " - Maximum Weight: " << player_node->mMaxWeight;
+ mWeightLabel->setCaption(tempstr.str());
+ mWeightLabel->adjustSize();
}
void InventoryWindow::action(const std::string &eventId)
{
- Item *item = items->getItem();
+ Item *item = mItems->getItem();
if (!item) {
return;
@@ -128,7 +127,7 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count)
{
Window::mouseClick(x, y, button, count);
- Item *item = items->getItem();
+ Item *item = mItems->getItem();
if (!item) {
return;
@@ -137,14 +136,14 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count)
// Show Name and Description
std::string SomeText;
SomeText = "Name: " + item->getInfo()->getName();
- itemNameLabel->setCaption(SomeText);
- itemNameLabel->adjustSize();
+ mItemNameLabel->setCaption(SomeText);
+ mItemNameLabel->adjustSize();
SomeText = "Effect: " + item->getInfo()->getEffect();
- itemEffectLabel->setCaption(SomeText);
- itemEffectLabel->adjustSize();
+ mItemEffectLabel->setCaption(SomeText);
+ mItemEffectLabel->adjustSize();
SomeText = "Description: " + item->getInfo()->getDescription();
- itemDescriptionLabel->setCaption(SomeText);
- itemDescriptionLabel->adjustSize();
+ mItemDescriptionLabel->setCaption(SomeText);
+ mItemDescriptionLabel->adjustSize();
if (button == gcn::MouseInput::RIGHT)
{
@@ -179,42 +178,42 @@ void InventoryWindow::updateWidgets()
}
// Resize widgets
- useButton->setPosition(8, height - 24);
- dropButton->setPosition(48 + 16, height - 24);
- invenScroll->setSize(width - 16, height - 110);
-
- itemNameLabel->setPosition(8,
- invenScroll->getY() + invenScroll->getHeight() + 4);
- itemEffectLabel->setPosition(8,
- itemNameLabel->getY() + itemNameLabel->getHeight() + 4);
- itemDescriptionLabel->setPosition(8,
- itemEffectLabel->getY() + itemEffectLabel->getHeight() + 4);
+ mUseButton->setPosition(8, height - 24);
+ mDropButton->setPosition(48 + 16, height - 24);
+ mInvenScroll->setSize(width - 16, height - 110);
+
+ mItemNameLabel->setPosition(8,
+ mInvenScroll->getY() + mInvenScroll->getHeight() + 4);
+ mItemEffectLabel->setPosition(8,
+ mItemNameLabel->getY() + mItemNameLabel->getHeight() + 4);
+ mItemDescriptionLabel->setPosition(8,
+ mItemEffectLabel->getY() + mItemEffectLabel->getHeight() + 4);
}
void InventoryWindow::updateButtons()
{
Item *item;
- if ((item = items->getItem()) && item->isEquipment())
+ if ((item = mItems->getItem()) && item->isEquipment())
{
if (item->isEquipped()) {
- useButton->setCaption("Unequip");
+ mUseButton->setCaption("Unequip");
}
else {
- useButton->setCaption("Equip");
+ mUseButton->setCaption("Equip");
}
}
else {
- useButton ->setCaption("Use");
+ mUseButton ->setCaption("Use");
}
- useButton->setEnabled(!!item);
- dropButton->setEnabled(!!item);
+ mUseButton->setEnabled(!!item);
+ mDropButton->setEnabled(!!item);
}
Item* InventoryWindow::getItem()
{
- return items->getItem();
+ return mItems->getItem();
}
void InventoryWindow::loadWindowState()