00001 /* 00002 * The Mana World 00003 * Copyright (C) 2008 The Mana World Development Team 00004 * 00005 * This file is part of The Mana World. 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 */ 00021 00022 #ifndef PARTYWINDOW_H 00023 #define PARTYWINDOW_H 00024 00025 #include "gui/confirm_dialog.h" 00026 00027 #include "gui/widgets/avatar.h" 00028 #include "gui/widgets/window.h" 00029 00030 #include <guichan/actionevent.hpp> 00031 #include <guichan/actionlistener.hpp> 00032 00033 #include <string> 00034 #include <map> 00035 00040 struct PartyMember 00041 { 00042 std::string name; 00043 int health; 00044 int healthMax; 00045 bool leader; 00046 bool online; 00047 Avatar *avatar; 00048 }; 00049 00055 class PartyWindow : public Window, gcn::ActionListener 00056 { 00057 public: 00058 PartyWindow(); 00059 00063 ~PartyWindow(); 00064 00068 void draw(gcn::Graphics *graphics); 00069 00073 PartyMember *findMember(int id) const; 00074 00079 int findMember(const std::string &name) const; 00080 00084 void updateMember(int id, const std::string &memberName, 00085 bool leader = false, bool online = true); 00086 00090 void removeMember(int id); 00091 00095 void removeMember(const std::string &name); 00096 00100 void updateOnlne(int id, bool online); 00101 00105 void showPartyInvite(const std::string &inviter, 00106 const std::string &partyName = ""); 00107 00111 void action(const gcn::ActionEvent &event); 00112 00113 void clear(); 00114 00115 private: 00119 PartyMember *findOrCreateMember(int id); 00120 00121 typedef std::map<int, PartyMember*> PartyList; 00122 PartyList mMembers; 00123 std::string mPartyInviter; 00124 ConfirmDialog *acceptDialog; 00125 }; 00126 00127 extern PartyWindow *partyWindow; 00128 00129 #endif