summaryrefslogtreecommitdiff
path: root/src/gui/npc.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 16:26:25 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2004-12-29 16:26:25 +0000
commit9ddc6e0d5208820a374f3bc9b9c5678e013535b2 (patch)
tree8f536daa9dd1eabd890e1bb97235fec2cad94296 /src/gui/npc.h
parent1265eb758eedb57b8a66d6ebee8f03c22672586c (diff)
downloadmana-client-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.gz
mana-client-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.bz2
mana-client-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.xz
mana-client-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.zip
Ported NPC list dialog to Guichan.
Diffstat (limited to 'src/gui/npc.h')
-rw-r--r--src/gui/npc.h60
1 files changed, 51 insertions, 9 deletions
diff --git a/src/gui/npc.h b/src/gui/npc.h
index a8077dcf..acc91173 100644
--- a/src/gui/npc.h
+++ b/src/gui/npc.h
@@ -24,19 +24,61 @@
#ifndef _NPC_H
#define _NPC_H
-struct ITEM {
- char *name;
-};
-
-char *item_list(int index, int *list_size);
+#include <guichan.hpp>
+#include <vector>
+#include <string>
+#include "window.h"
/**
- * Fills the options list for an NPC dialog.
+ * The npc list dialog.
*
- * @param string A string with the options separated with colons.
+ * \ingroup GUI
*/
-void parse_items(const char *string);
+class NpcListDialog : public Window, public gcn::ActionListener,
+ public gcn::ListModel
+{
+ public:
+ /**
+ * Constructor.
+ *
+ * @see Window::Window
+ */
+ NpcListDialog(gcn::Container *parent);
+
+ /**
+ * Called when receiving actions from the widgets.
+ */
+ void action(const std::string& eventId);
+
+ /**
+ * Returns the number of items in the choices list.
+ */
+ int getNumberOfElements();
+
+ /**
+ * Returns the name of item number i of the choices list.
+ */
+ std::string getElementAt(int i);
-void remove_all_items();
+ /**
+ * Fills the options list for an NPC dialog.
+ *
+ * @param string A string with the options separated with colons.
+ */
+ void parseItems(const char *string);
+
+ /**
+ * Resets the list by removing all items.
+ */
+ void reset();
+
+ private:
+ gcn::Button *okButton;
+ gcn::Button *cancelButton;
+ gcn::ListBox *itemList;
+ gcn::ScrollArea *scrollArea;
+
+ std::vector<std::string> items;
+};
#endif