summaryrefslogtreecommitdiff
path: root/src/gui/buddywindow.cpp
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2008-11-25 16:50:21 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-01-05 00:39:27 +0100
commit8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1 (patch)
tree7c7e0b52b72e6d09970522faecdf10163c8e080b /src/gui/buddywindow.cpp
parent98c58bb9d3d39e4edbff05387b905a6c0fffa85d (diff)
downloadmana-8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1.tar.gz
mana-8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1.tar.bz2
mana-8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1.tar.xz
mana-8b6bfeb0a70d4f97cc2d20ce04fc240b65082cf1.zip
Add buddy window
Diffstat (limited to 'src/gui/buddywindow.cpp')
-rw-r--r--src/gui/buddywindow.cpp65
1 files changed, 21 insertions, 44 deletions
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp
index 14a941a5..0535f837 100644
--- a/src/gui/buddywindow.cpp
+++ b/src/gui/buddywindow.cpp
@@ -20,64 +20,41 @@
*/
#include "buddywindow.h"
-
-#include <guichan/widgets/listbox.hpp>
-
-#include "button.h"
#include "chat.h"
-#include "scrollarea.h"
+#include "icon.h"
+
+#include "widgets/avatar.h"
-#include "../resources/buddylist.h"
+#include "../resources/resourcemanager.h"
+#include "../utils/gettext.h"
extern ChatWindow *chatWindow;
BuddyWindow::BuddyWindow():
- Window("Buddy")
+ Window(_("Buddy"))
{
+ setVisible(false);
setContentSize(124, 202);
+ setCaption(_("Buddy List"));
+ setResizable(true);
+ setCloseButton(true);
- 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);
+ Image *addImg = ResourceManager::getInstance()->getImage("buddyadd.png");
+ Image *delImg = ResourceManager::getInstance()->getImage("buddydel.png");
- Button *talk = new Button("Talk", "Talk", this);
- Button *remove = new Button("Remove", "Remove", this);
- Button *cancel = new Button("Cancel", "Cancel", this);
+ if (addImg && delImg)
+ {
+ Icon *addBuddy = new Icon(addImg);
+ Icon *delBuddy = new Icon(delImg);
- talk->setPosition(2,180);
- remove->setPosition(talk->getWidth()+2,180);
- cancel->setPosition(talk->getWidth()+remove->getWidth()+2,180);
+ add(addBuddy);
+ add(delBuddy);
+ }
- add(talk);
- add(remove);
- add(cancel);
+ loadWindowState("Buddy");
}
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);
- }
+
}