summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buddywindow.h21
-rw-r--r--src/gui/buy.h2
-rw-r--r--src/gui/buysell.h2
-rw-r--r--src/gui/char_select.h2
-rw-r--r--src/gui/char_server.h4
-rw-r--r--src/gui/chargedialog.h3
-rw-r--r--src/gui/chat.h4
-rw-r--r--src/gui/confirm_dialog.cpp9
-rw-r--r--src/gui/equipment.h2
-rw-r--r--src/gui/gui.h3
-rw-r--r--src/gui/inventory.cpp43
-rw-r--r--src/gui/inventory.h23
-rw-r--r--src/gui/item_amount.cpp6
-rw-r--r--src/gui/item_amount.h19
-rw-r--r--src/gui/itemcontainer.h2
-rw-r--r--src/gui/login.h2
-rw-r--r--src/gui/minimap.h2
-rw-r--r--src/gui/newskill.h7
-rw-r--r--src/gui/npc.h2
-rw-r--r--src/gui/npc_text.h2
-rw-r--r--src/gui/progressbar.h4
-rw-r--r--src/gui/requesttrade.h2
-rw-r--r--src/gui/sell.h2
-rw-r--r--src/gui/setup.h2
-rw-r--r--src/gui/shop.h3
-rw-r--r--src/gui/skill.h2
-rw-r--r--src/gui/stats.h5
-rw-r--r--src/gui/status.h2
-rw-r--r--src/gui/trade.h2
29 files changed, 108 insertions, 76 deletions
diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h
index d3ddbbb3..8fa515d5 100644
--- a/src/gui/buddywindow.h
+++ b/src/gui/buddywindow.h
@@ -29,11 +29,16 @@
#include "textbox.h"
#include "../resources/buddylist.h"
+/**
+ * Window showing buddy list.
+ *
+ * \ingroup Interface
+ */
class BuddyWindow : public Window, public BuddyList,
public gcn::ActionListener
{
public:
- /**
+ /**
* Constructor.
*/
BuddyWindow();
@@ -43,19 +48,19 @@ class BuddyWindow : public Window, public BuddyList,
*/
~BuddyWindow();
- /**
+ /**
* Draws updated list
*/
void draw(gcn::Graphics *graphics);
- /**
- * Performs action.
- */
- void action(const std::string &actionId);
+ /**
+ * Performs action.
+ */
+ void action(const std::string &actionId);
private:
- TextBox *textlist;
- ScrollArea *scrollArea;
+ TextBox *textlist;
+ ScrollArea *scrollArea;
};
#endif /* _TMW_BUDDYWINDOW_H */
diff --git a/src/gui/buy.h b/src/gui/buy.h
index ecdb0cb8..693ddffa 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -32,7 +32,7 @@
/**
* The buy dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class BuyDialog : public Window, public gcn::ActionListener,
public gcn::ListModel
diff --git a/src/gui/buysell.h b/src/gui/buysell.h
index 19c1e859..ab2583cd 100644
--- a/src/gui/buysell.h
+++ b/src/gui/buysell.h
@@ -29,7 +29,7 @@
/**
* A dialog to choose between buying or selling at a shop.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class BuySellDialog : public Window, public gcn::ActionListener
{
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index 1bfd14b9..8cc57e77 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -33,7 +33,7 @@
/**
* Character selection dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class CharSelectDialog : public Window, public gcn::ActionListener {
private:
diff --git a/src/gui/char_server.h b/src/gui/char_server.h
index 59ba6c69..b6fd9f27 100644
--- a/src/gui/char_server.h
+++ b/src/gui/char_server.h
@@ -32,8 +32,6 @@
/**
* The list model for the server list.
- *
- * \ingroup GUI
*/
class ServerListModel : public gcn::ListModel {
public:
@@ -44,7 +42,7 @@ class ServerListModel : public gcn::ListModel {
/**
* The server select dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class ServerSelectDialog : public Window, public gcn::ActionListener {
public:
diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h
index 7d47a732..6615fff6 100644
--- a/src/gui/chargedialog.h
+++ b/src/gui/chargedialog.h
@@ -29,6 +29,9 @@
#define CHARGE_TIME 1000 // time in milliseconds it takes to charge up an attack
+/**
+ * \ingroup Interface
+ */
class ChargeDialog : public Window, public gcn::ActionListener
{
private:
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 61fe902a..f242e3ee 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -98,7 +98,9 @@ struct CHATSKILL
};
/**
- * Simple chatlog object.
+ * The chat window.
+ *
+ * \ingroup Interface
*/
class ChatWindow : public Window, public gcn::ActionListener,
public gcn::KeyListener
diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp
index f9513002..967355a6 100644
--- a/src/gui/confirm_dialog.cpp
+++ b/src/gui/confirm_dialog.cpp
@@ -69,12 +69,15 @@ void ConfirmDialog::init(const std::string &msg, gcn::ActionListener *listener)
yesButton->addActionListener(listener);
noButton->addActionListener(listener);
}
-
+
add(userLabel);
add(yesButton);
add(noButton);
-
- setLocationRelativeTo(getParent());
+
+ if (getParent()) {
+ setLocationRelativeTo(getParent());
+ getParent()->moveToTop(this);
+ }
yesButton->requestFocus();
}
diff --git a/src/gui/equipment.h b/src/gui/equipment.h
index dbbcb6fa..2de0af03 100644
--- a/src/gui/equipment.h
+++ b/src/gui/equipment.h
@@ -36,7 +36,7 @@ typedef struct {
/**
* Equipment dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class EquipmentWindow : public Window, gcn::ActionListener {
public:
diff --git a/src/gui/gui.h b/src/gui/gui.h
index f2d48c77..599203e9 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -30,7 +30,8 @@
#include "../graphics.h"
/**
- * \defgroup GUI GUI related classes
+ * \defgroup GUI Core GUI related classes (widgets)
+ * \defgroup Interface User interface related classes (windows, dialogs)
*/
/**
diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp
index 088cb81c..bb8b7bf5 100644
--- a/src/gui/inventory.cpp
+++ b/src/gui/inventory.cpp
@@ -163,25 +163,20 @@ void InventoryWindow::action(const std::string &eventId)
itemAmountWindow->setUsage(AMOUNT_ITEM_DROP);
itemAmountWindow->setVisible(true);
itemAmountWindow->requestMoveToTop();
- }
+ }
+
+ updateUseButton();
}
}
void InventoryWindow::mouseClick(int x, int y, int button, int count)
{
Window::mouseClick(x, y, button, count);
+
+ updateUseButton();
if (items->getIndex() != -1)
{
- // Differentiate items & equipment
- if (items->isEquipment(items->getIndex()))
- if (items->isEquipped(items->getIndex()))
- useButton->setCaption("Unequip");
- else
- useButton->setCaption("Equip");
- else
- useButton ->setCaption("Use");
-
// Show Name and Description
std::string SomeText;
SomeText = "Name: " + itemDb->getItemInfo(items->getId())->getName();
@@ -198,20 +193,40 @@ void InventoryWindow::mouseMotion(int mx, int my)
int tmpWidth = getWidth(), tmpHeight = getHeight();
Window::mouseMotion(mx, my);
if (getWidth() != tmpWidth || getHeight() != tmpHeight) {
- updateWidgets();
+ updateWidgets();
}
}
void InventoryWindow::updateWidgets()
{
- //resize widgets
+ // Resize widgets
useButton->setPosition(8, getHeight() - 24);
dropButton->setPosition(48 + 16, getHeight() - 24);
- items->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
+ items->setSize(getWidth() - 24 - 12 - 1,
+ (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1);
invenScroll->setSize(getWidth() - 16, getHeight() - 72);
itemNameLabel->setPosition(8, invenScroll->getY() + invenScroll->getHeight() + 4);
- itemDescriptionLabel->setPosition(8, itemNameLabel->getY() + itemNameLabel->getHeight() + 4);
+ itemDescriptionLabel->setPosition(8,
+ itemNameLabel->getY() + itemNameLabel->getHeight() + 4);
setContentSize(getWidth(), getHeight());
}
+
+void InventoryWindow::updateUseButton()
+{
+ if (items->getIndex() != -1 && items->isEquipment(items->getIndex()))
+ {
+ if (items->isEquipped(items->getIndex())) {
+ useButton->setCaption("Unequip");
+ }
+ else {
+ useButton->setCaption("Equip");
+ }
+ }
+ else {
+ useButton ->setCaption("Use");
+ }
+
+ useButton->setEnabled(items->getIndex() != -1);
+}
diff --git a/src/gui/inventory.h b/src/gui/inventory.h
index 257c64ea..177b5662 100644
--- a/src/gui/inventory.h
+++ b/src/gui/inventory.h
@@ -35,7 +35,7 @@
/**
* Inventory dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class InventoryWindow : public Window, gcn::ActionListener {
public:
@@ -80,28 +80,29 @@ class InventoryWindow : public Window, gcn::ActionListener {
* Increase quantity of an item.
*/
int increaseQuantity(int index, int quantity);
-
+
/**
* Called when receiving actions from the widgets.
*/
void action(const std::string& eventId);
-
+
int dropItem(int index, int quantity);
void mouseClick(int x, int y, int button, int count);
- void mouseMotion(int mx, int my);
-
+ void mouseMotion(int mx, int my);
+
ItemContainer *items;
-
+
private:
gcn::Button *useButton, *dropButton;
- ScrollArea *invenScroll;
- int useItem(int index, int id);
- void updateWidgets();
+ ScrollArea *invenScroll;
- gcn::Label *itemNameLabel;
- gcn::Label *itemDescriptionLabel;
+ int useItem(int index, int id);
+ void updateWidgets(); /** Updates widgets size/position */
+ void updateUseButton(); /** Updates use button to selected item */
+ gcn::Label *itemNameLabel;
+ gcn::Label *itemDescriptionLabel;
};
#endif
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index 7f609a6c..8cd51b10 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -29,7 +29,6 @@
ItemAmountWindow::ItemAmountWindow():
Window("Select amount of items to drop.")
{
-
// New labels
itemAmountLabel = new gcn::Label("1");
@@ -98,11 +97,10 @@ void ItemAmountWindow::setUsage(int usage) {
break;
}
-
}
-
-void ItemAmountWindow::action(const std::string& eventId) {
+void ItemAmountWindow::action(const std::string& eventId)
+{
if (eventId == "Cancel")
{
resetAmount();
diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h
index e0faf5de..4b889b86 100644
--- a/src/gui/item_amount.h
+++ b/src/gui/item_amount.h
@@ -31,7 +31,13 @@
#define AMOUNT_TRADE_ADD 1
#define AMOUNT_ITEM_DROP 2
-class ItemAmountWindow : public Window, public gcn::ActionListener {
+/**
+ * Window used for selecting the amount of items to drop.
+ *
+ * \ingroup Interface
+ */
+class ItemAmountWindow : public Window, public gcn::ActionListener
+{
public:
/**
* Constructor.
@@ -59,15 +65,8 @@ class ItemAmountWindow : public Window, public gcn::ActionListener {
void resetAmount();
private:
- /**
- * Amount of items to be dropped.
- */
- int amount;
-
- /**
- * Item Amount captions.
- */
- gcn::Label *itemAmountLabel;
+ int amount; /**< Amount of items to be dropped. */
+ gcn::Label *itemAmountLabel; /**< Item amount caption. */
/**
* Item Amount buttons.
diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h
index 0e84f0af..97c17924 100644
--- a/src/gui/itemcontainer.h
+++ b/src/gui/itemcontainer.h
@@ -44,7 +44,7 @@ struct ITEM_HOLDER
};
/**
- * An item container. Used to show items in inventory.
+ * An item container. Used to show items in inventory and trade dialog.
*
* \ingroup GUI
*/
diff --git a/src/gui/login.h b/src/gui/login.h
index 8cde041d..dba74856 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -31,7 +31,7 @@
/**
* The login dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class LoginDialog : public Window, public gcn::ActionListener {
public:
diff --git a/src/gui/minimap.h b/src/gui/minimap.h
index ddf821f0..8e75a78c 100644
--- a/src/gui/minimap.h
+++ b/src/gui/minimap.h
@@ -30,7 +30,7 @@
/**
* Minimap dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class Minimap : public Window {
public:
diff --git a/src/gui/newskill.h b/src/gui/newskill.h
index 743adbd0..db15958b 100644
--- a/src/gui/newskill.h
+++ b/src/gui/newskill.h
@@ -36,7 +36,12 @@ struct nSkill {
short level;
short exp;
};
-
+
+/**
+ * Dialog showing the skills in the planned skill model.
+ *
+ * \ingroup Interface
+ */
class NewSkillDialog : public Window, public gcn::ActionListener
{
private:
diff --git a/src/gui/npc.h b/src/gui/npc.h
index 68d63c4f..5bede528 100644
--- a/src/gui/npc.h
+++ b/src/gui/npc.h
@@ -32,7 +32,7 @@
/**
* The npc list dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class NpcListDialog : public Window, public gcn::ActionListener,
public gcn::ListModel
diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h
index ed228931..bae47ce8 100644
--- a/src/gui/npc_text.h
+++ b/src/gui/npc_text.h
@@ -32,7 +32,7 @@
/**
* The npc text dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class NpcTextDialog : public Window, public gcn::ActionListener
{
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index b1f5bb1b..abfbe92d 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -21,8 +21,8 @@
* $Id$
*/
-#ifndef __PROGRESSBAR_H__
-#define __PROGRESSBAR_H__
+#ifndef _TMW_PROGRESSBAR_H
+#define _TMW_PROGRESSBAR_H
#include <guichan.hpp>
#include "../resources/image.h"
diff --git a/src/gui/requesttrade.h b/src/gui/requesttrade.h
index 447b1ab4..3d6c4c22 100644
--- a/src/gui/requesttrade.h
+++ b/src/gui/requesttrade.h
@@ -33,7 +33,7 @@
/**
* The request trade dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class RequestTradeDialog : public Window, public gcn::ActionListener
{
diff --git a/src/gui/sell.h b/src/gui/sell.h
index e1c5d804..17763bf6 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -32,7 +32,7 @@
/**
* The sell dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class SellDialog : public Window, public gcn::ActionListener,
public gcn::ListModel
diff --git a/src/gui/setup.h b/src/gui/setup.h
index 21f65038..2adc9708 100644
--- a/src/gui/setup.h
+++ b/src/gui/setup.h
@@ -30,7 +30,7 @@
/**
* The list model for mode list.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class ModeListModel : public gcn::ListModel {
public:
diff --git a/src/gui/shop.h b/src/gui/shop.h
index c3d85780..f2f31a19 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -24,9 +24,6 @@
#ifndef _SHOP_H
#define _SHOP_H
-#include <stdlib.h>
-#include <stdio.h>
-
struct ITEM_SHOP {
char name[30];
int price;
diff --git a/src/gui/skill.h b/src/gui/skill.h
index c27f5ad2..0a87afed 100644
--- a/src/gui/skill.h
+++ b/src/gui/skill.h
@@ -35,7 +35,7 @@ struct SKILL {
/**
* The skill dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class SkillDialog : public Window, public gcn::ActionListener,
public gcn::ListModel
diff --git a/src/gui/stats.h b/src/gui/stats.h
index edd94a73..82bff443 100644
--- a/src/gui/stats.h
+++ b/src/gui/stats.h
@@ -28,6 +28,11 @@
#include <string>
#include <sstream>
+/**
+ * Window showing player stats.
+ *
+ * \ingroup Interface
+ */
class StatsWindow : public Window, public gcn::ActionListener {
public:
/**
diff --git a/src/gui/status.h b/src/gui/status.h
index 4b485729..0caf588d 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -32,7 +32,7 @@
/**
* The player status dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class StatusWindow : public Window, public gcn::ActionListener {
public:
diff --git a/src/gui/trade.h b/src/gui/trade.h
index d1b293cf..09e56d06 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -35,7 +35,7 @@
/**
* Trade dialog.
*
- * \ingroup GUI
+ * \ingroup Interface
*/
class TradeWindow : public Window, gcn::ActionListener {
public: