summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-19 21:48:49 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-06-19 21:48:49 +0000
commit5ccd40564e9524420056a1423209a3066d6db657 (patch)
tree5abbb5b9326105d19a693207171de88186c2161d /src/gui
parent9db14810dd0387f1fa63a4e3bba9b05947bd5d9f (diff)
downloadmana-5ccd40564e9524420056a1423209a3066d6db657.tar.gz
mana-5ccd40564e9524420056a1423209a3066d6db657.tar.bz2
mana-5ccd40564e9524420056a1423209a3066d6db657.tar.xz
mana-5ccd40564e9524420056a1423209a3066d6db657.zip
Mostly indenting fixes and corrected path for OpenGL font version.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/browserbox.cpp3
-rw-r--r--src/gui/buddywindow.cpp32
-rw-r--r--src/gui/buddywindow.h15
-rw-r--r--src/gui/popupmenu.cpp20
4 files changed, 29 insertions, 41 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 7a8d8588..fd1a235c 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -23,6 +23,7 @@
#include "browserbox.h"
#include "gui.h"
+#include "main.h"
int BrowserBox::instances = 0;
gcn::ImageFont* BrowserBox::browserFont;
@@ -41,7 +42,7 @@ BrowserBox::BrowserBox(unsigned int mode):
{
#ifdef USE_OPENGL
browserFont = new gcn::ImageFont(
- "data/graphics/gui/browserfont.png",
+ TMW_DATADIR "data/graphics/gui/browserfont.png",
" abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567"
"89:@!\"$%&/=?^+*#[]{}()<>_;'.,\\|-~`");
#else
diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp
index 5ca1b361..be6ee5ee 100644
--- a/src/gui/buddywindow.cpp
+++ b/src/gui/buddywindow.cpp
@@ -22,6 +22,8 @@
*/
#include "buddywindow.h"
+#include "scrollarea.h"
+#include "button.h"
BuddyWindow::BuddyWindow():
Window("Buddy")
@@ -63,25 +65,17 @@ BuddyWindow::~BuddyWindow()
delete cancel;
}
-void BuddyWindow::draw(gcn::Graphics *graphics)
-{
- // Draw the children
- Window::draw(graphics);
-}
-
void BuddyWindow::action(const std::string& eventId)
{
- if(eventId == "Talk") {
- // TODO
- }
- else if(eventId == "Remove") {
- int selected = listbox->getSelected();
- std::string who = getElementAt(selected);
- removeBuddy(who);
- }
- else if(eventId == "Cancel") {
- setVisible(false);
- }
-
+ if (eventId == "Talk") {
+ // TODO
+ }
+ else if (eventId == "Remove") {
+ int selected = listbox->getSelected();
+ std::string who = getElementAt(selected);
+ removeBuddy(who);
+ }
+ else if (eventId == "Cancel") {
+ setVisible(false);
+ }
}
-
diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h
index a4221700..02f0bd77 100644
--- a/src/gui/buddywindow.h
+++ b/src/gui/buddywindow.h
@@ -26,8 +26,6 @@
#include <guichan.hpp>
#include "window.h"
-#include "scrollarea.h"
-#include "button.h"
#include "../resources/buddylist.h"
/**
@@ -50,21 +48,16 @@ class BuddyWindow : public Window, public BuddyList,
~BuddyWindow();
/**
- * Draws updated list
- */
- void draw(gcn::Graphics *graphics);
-
- /**
* Performs action.
*/
void action(const std::string &actionId);
private:
gcn::ListBox *listbox;
- ScrollArea *scrollArea;
- Button *talk;
- Button *remove;
- Button *cancel;
+ gcn::ScrollArea *scrollArea;
+ gcn::Button *talk;
+ gcn::Button *remove;
+ gcn::Button *cancel;
};
#endif /* _TMW_BUDDYWINDOW_H */
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 911ed6dd..247bb2ce 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -32,7 +32,7 @@ PopupMenu::PopupMenu():
{
setResizable(false);
setTitleBarHeight(0);
-
+
browserBox = new BrowserBox();
browserBox->setPosition(4, 4);
browserBox->setHighlightMode(BrowserBox::BACKGROUND);
@@ -52,7 +52,7 @@ PopupMenu::~PopupMenu()
delete being;
delete floorItem;
}
-
+
void PopupMenu::setVisible(bool visible)
{
if (visible == false)
@@ -63,10 +63,10 @@ void PopupMenu::setVisible(bool visible)
}
setPosition(screen->w, screen->h);
}
-
+
mVisible = visible;
}
-
+
void PopupMenu::showPopup(int mx, int my)
{
being = findNode(mx, my);
@@ -74,7 +74,7 @@ void PopupMenu::showPopup(int mx, int my)
mX = mx;
mY = mY;
browserBox->clearRows();
-
+
if (being)
{
if (being->isMonster())
@@ -106,7 +106,7 @@ void PopupMenu::showPopup(int mx, int my)
//browserBox->addRow("@@look|Look To@@");
browserBox->addRow("##3---");
browserBox->addRow("@@cancel|Cancel@@");
-
+
setContentSize(browserBox->getWidth() + 8, browserBox->getHeight() + 8);
mx = (mx - camera_x) * 32 + 25;
my = (my - camera_y) * 32 + 25;
@@ -148,7 +148,7 @@ void PopupMenu::handleLink(const std::string& link)
attack(being);
}
}
-
+
// Talk To action
else if ((link == "talk") && being && being->isNpc() &&
(current_npc == 0))
@@ -176,10 +176,10 @@ void PopupMenu::handleLink(const std::string& link)
// Add Buddy action
else if ((link == "buddy") && being && being->isPlayer())
{
- if(!buddyWindow->isVisible())
+ if (!buddyWindow->isVisible())
buddyWindow->setVisible(true);
-
- buddyWindow->addBuddy(being->name);
+
+ buddyWindow->addBuddy(being->name);
}
// Pick Up Floor Item action