summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AethyraLin2WinXcompile.cbp6
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/setup.cpp2
-rw-r--r--src/gui/trade.cpp64
-rw-r--r--src/gui/trade.h10
5 files changed, 55 insertions, 29 deletions
diff --git a/AethyraLin2WinXcompile.cbp b/AethyraLin2WinXcompile.cbp
index 3b03aca2..a2b5df59 100644
--- a/AethyraLin2WinXcompile.cbp
+++ b/AethyraLin2WinXcompile.cbp
@@ -32,6 +32,7 @@
<Add library="SDL_image" />
<Add library="SDL_mixer" />
<Add library="SDL_net" />
+ <Add library="SDL_ttf" />
<Add library="mingw32" />
<Add library="SDLmain" />
<Add library="SDL.dll" />
@@ -67,6 +68,7 @@
<Add library="SDL_mixer" />
<Add library="SDL_net" />
<Add library="SDL_image" />
+ <Add library="SDL_ttf" />
<Add library="png" />
</Linker>
</Target>
@@ -230,8 +232,8 @@
<Unit filename="src\gui\textfield.h" />
<Unit filename="src\gui\trade.cpp" />
<Unit filename="src\gui\trade.h" />
- <Unit filename="src\gui\truetypefont.cpp"/>
- <Unit filename="src\gui\truetypefont.h"/>
+ <Unit filename="src\gui\truetypefont.cpp" />
+ <Unit filename="src\gui\truetypefont.h" />
<Unit filename="src\gui\updatewindow.cpp" />
<Unit filename="src\gui\updatewindow.h" />
<Unit filename="src\gui\vbox.cpp" />
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index b647b9a1..75968fa9 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -50,7 +50,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener
NpcTextDialog();
/**
- * Called when resizing the window
+ * Called when resizing the window.
*
* @param event The calling event
*/
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index baa2bf2b..a61d3bb2 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -42,6 +42,7 @@ extern Window *minimap;
extern Window *skillDialog;
extern Window *statusWindow;
extern Window *itemShortcutWindow;
+extern Window *tradeWindow;
Setup::Setup():
Window("Setup")
@@ -134,5 +135,6 @@ void Setup::action(const gcn::ActionEvent &event)
helpWindow->resetToDefaultSize();
skillDialog->resetToDefaultSize();
itemShortcutWindow->resetToDefaultSize();
+ tradeWindow->resetToDefaultSize();
}
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 843c9663..bae8daa6 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -50,7 +50,11 @@ TradeWindow::TradeWindow(Network *network):
mPartnerInventory(new Inventory(INVENTORY_SIZE))
{
setWindowName("Trade");
- setDefaultSize(115, 227, 332, 209);
+ setDefaultSize(115, 227, 342, 209);
+ setResizable(true);
+
+ setMinWidth(342);
+ setMinHeight(209);
mAddButton = new Button("Add", "add", this);
mOkButton = new Button("Ok", "ok", this);
@@ -73,7 +77,8 @@ TradeWindow::TradeWindow(Network *network):
mMoneyLabel = new gcn::Label("You get: 0 GP");
mMoneyLabel2 = new gcn::Label("You give:");
- mMoneyField = new TextField();
+ mMoneyField = new TextField;
+ mMoneyField->setWidth(50);
mAddButton->adjustSize();
mOkButton->adjustSize();
@@ -98,38 +103,49 @@ TradeWindow::TradeWindow(Network *network):
add(mMoneyLabel);
loadWindowState();
+}
+
+TradeWindow::~TradeWindow()
+{
+}
- gcn::Rectangle area = getChildrenArea();
- int width = area.width;
- int height = area.height;
+void TradeWindow::widgetResized(const gcn::Event &event)
+{
+ Window::widgetResized(event);
- mMoneyField->setPosition(8 + 60, height - 20);
- mMoneyField->setWidth(50);
+ const gcn::Rectangle &area = getChildrenArea();
+ const int width = area.width;
+ const int height = area.height;
+
+ mMoneyLabel2->setPosition(8, height - 8 - mMoneyLabel2->getHeight());
+ mMoneyField->setPosition(
+ 8 + mMoneyLabel2->getWidth(),
+ height - 8 - mMoneyField->getHeight());
+ mMoneyLabel->setPosition(
+ mMoneyField->getX() + mMoneyField->getWidth() + 6,
+ mMoneyLabel2->getY());
- mMoneyLabel->setPosition(8 + 60 + 50 + 6, height - 20);
- mMoneyLabel2->setPosition(8, height - 20);
+ mCancelButton->setPosition(width - 54, height - 8 - mCancelButton->getHeight());
+ mTradeButton->setPosition(mCancelButton->getX() - 41, mCancelButton->getY());
+ mOkButton->setPosition(mTradeButton->getX() - 24, mCancelButton->getY());
+ mAddButton->setPosition(mOkButton->getX() - 31, mCancelButton->getY());
- mCancelButton->setPosition(width - 54, height - 49);
- mTradeButton->setPosition(mCancelButton->getX() - 41, height - 49);
- mOkButton->setPosition(mTradeButton->getX() - 24, height - 49);
- mAddButton->setPosition(mOkButton->getX() - 31, height - 49);
+ mItemDescriptionLabel->setPosition(8,
+ mOkButton->getY() - mItemDescriptionLabel->getHeight() - 4);
+ mItemNameLabel->setPosition(8,
+ mItemDescriptionLabel->getY() - mItemNameLabel->getHeight() - 4);
+
+ const int remaining = mItemNameLabel->getY() - 4 - 8 - 8;
+ const int itemContainerHeight = remaining / 2;
mMyItemContainer->setSize(width - 24 - 12 - 1,
(INVENTORY_SIZE * 24) / (width / 24) - 1);
- mMyScroll->setSize(width - 16, (height - 76) / 2);
+ mMyScroll->setSize(width - 16, itemContainerHeight);
mPartnerItemContainer->setSize(width - 24 - 12 - 1,
(INVENTORY_SIZE * 24) / (width / 24) - 1);
- mPartnerScroll->setSize(width - 16, (height - 76) / 2);
-
- mItemNameLabel->setPosition(8,
- mPartnerScroll->getY() + mPartnerScroll->getHeight() + 4);
- mItemDescriptionLabel->setPosition(8,
- mItemNameLabel->getY() + mItemNameLabel->getHeight() + 4);
-}
-
-TradeWindow::~TradeWindow()
-{
+ mPartnerScroll->setSize(width - 16, itemContainerHeight);
+ mPartnerScroll->setPosition(8, 8 + itemContainerHeight + 8);
}
void TradeWindow::addMoney(int amount)
diff --git a/src/gui/trade.h b/src/gui/trade.h
index 5d587991..fafe138a 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -56,6 +56,13 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener
~TradeWindow();
/**
+ * Called when resizing the window.
+ *
+ * @param event The calling event
+ */
+ void widgetResized(const gcn::Event &event);
+
+ /**
* Add money to the trade window.
*/
void addMoney(int quantity);
@@ -98,8 +105,7 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener
/**
* Send trade packet.
*/
- void
- tradeItem(Item *item, int quantity);
+ void tradeItem(Item *item, int quantity);
/**
* Updates the labels and makes sure only one item is selected in