diff options
author | Ira Rice <irarice@gmail.com> | 2008-12-07 16:53:32 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2008-12-07 16:53:32 -0700 |
commit | aef082e6fe4fca268f9bfe401409eb342f82e4af (patch) | |
tree | 26e9f2f2be9ad59666a4c039c7717e0e5becd3eb /src/gui/buddywindow.cpp | |
parent | 7f24abc455a407e84f13d75099e36db77fa8931d (diff) | |
parent | a7c21e6f8add37af7412449742ec55c8daa8571a (diff) | |
download | mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.gz mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.bz2 mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.tar.xz mana-aef082e6fe4fca268f9bfe401409eb342f82e4af.zip |
Merge commit 'a7c21e6f8add37af7412449742ec55c8daa8571a'
Conflicts:
AUTHORS
CMakeLists.txt
ChangeLog
INSTALL
README
aethyra.cbp
configure.ac
data/help/changes.txt
data/help/commands.txt
data/help/header.txt
data/help/support.txt
src/Makefile.am
src/aethyra.rc
src/being.cpp
src/being.h
src/equipment.cpp
src/equipment.h
src/floor_item.h
src/game.cpp
src/gui/buddywindow.cpp
src/gui/char_select.cpp
src/gui/char_server.cpp
src/gui/chat.cpp
src/gui/chat.h
src/gui/equipmentwindow.cpp
src/gui/equipmentwindow.h
src/gui/gui.cpp
src/gui/inventorywindow.cpp
src/gui/inventorywindow.h
src/gui/itemcontainer.cpp
src/gui/itemcontainer.h
src/gui/minimap.cpp
src/gui/ministatus.cpp
src/gui/newskill.cpp
src/gui/npc_text.cpp
src/gui/npclistdialog.h
src/gui/ok_dialog.cpp
src/gui/setup_video.cpp
src/gui/skill.cpp
src/gui/skill.h
src/gui/status.h
src/gui/table_model.h
src/gui/updatewindow.cpp
src/gui/viewport.cpp
src/inventory.cpp
src/inventory.h
src/keyboardconfig.cpp
src/keyboardconfig.h
src/localplayer.cpp
src/localplayer.h
src/logindata.h
src/main.cpp
src/map.cpp
src/monster.cpp
src/monster.h
src/net/beinghandler.cpp
src/net/beinghandler.h
src/net/buysellhandler.cpp
src/net/equipmenthandler.cpp
src/net/loginhandler.cpp
src/net/loginhandler.h
src/net/network.h
src/net/npchandler.cpp
src/net/playerhandler.cpp
src/net/protocol.h
src/net/tradehandler.cpp
src/npc.cpp
src/npc.h
src/particleemitter.cpp
src/particleemitterprop.h
src/player.cpp
src/player.h
src/player_relations.cpp
src/resources/imageset.cpp
src/resources/imageset.h
src/resources/itemdb.cpp
src/resources/mapreader.cpp
src/resources/monsterinfo.h
src/text.cpp
src/text.h
src/textmanager.cpp
src/textmanager.h
src/tileset.h
src/utils/fastsqrt.h
src/utils/strprintf.cpp
src/winver.h
tools/tmxcopy/Makefile
tools/tmxcopy/base64.cpp
tools/tmxcopy/base64.h
tools/tmxcopy/tostring.h
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/buddywindow.cpp')
-rw-r--r-- | src/gui/buddywindow.cpp | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp new file mode 100644 index 00000000..14a941a5 --- /dev/null +++ b/src/gui/buddywindow.cpp @@ -0,0 +1,83 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "buddywindow.h" + +#include <guichan/widgets/listbox.hpp> + +#include "button.h" +#include "chat.h" +#include "scrollarea.h" + +#include "../resources/buddylist.h" + +extern ChatWindow *chatWindow; + +BuddyWindow::BuddyWindow(): + Window("Buddy") +{ + setContentSize(124, 202); + + mBuddyList = new BuddyList(); + + mListbox = new gcn::ListBox(); + mListbox->setListModel(mBuddyList); + + ScrollArea *scrollArea = new ScrollArea(mListbox); + scrollArea->setDimension(gcn::Rectangle( + 7, 5, 110, 170)); + add(scrollArea); + + Button *talk = new Button("Talk", "Talk", this); + Button *remove = new Button("Remove", "Remove", this); + Button *cancel = new Button("Cancel", "Cancel", this); + + talk->setPosition(2,180); + remove->setPosition(talk->getWidth()+2,180); + cancel->setPosition(talk->getWidth()+remove->getWidth()+2,180); + + add(talk); + add(remove); + add(cancel); +} + +void BuddyWindow::action(const gcn::ActionEvent &event) +{ + if (event.getId() == "Talk") { + int selected = mListbox->getSelected(); + if ( selected > -1 ) + { + std::string who = mBuddyList->getElementAt(selected); + chatWindow->setInputText(who +": "); + } + } + else if (event.getId() == "Remove") { + int selected = mListbox->getSelected(); + if ( selected > -1 ) + { + std::string who = mBuddyList->getElementAt(selected); + mBuddyList->removeBuddy(who); + } + } + else if (event.getId() == "Cancel") { + setVisible(false); + } +} |