diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-29 16:26:25 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2004-12-29 16:26:25 +0000 |
commit | 9ddc6e0d5208820a374f3bc9b9c5678e013535b2 (patch) | |
tree | 8f536daa9dd1eabd890e1bb97235fec2cad94296 /src/gui/npc.h | |
parent | 1265eb758eedb57b8a66d6ebee8f03c22672586c (diff) | |
download | mana-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.gz mana-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.bz2 mana-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.tar.xz mana-9ddc6e0d5208820a374f3bc9b9c5678e013535b2.zip |
Ported NPC list dialog to Guichan.
Diffstat (limited to 'src/gui/npc.h')
-rw-r--r-- | src/gui/npc.h | 60 |
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 |