summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-01 16:44:58 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-11-01 16:44:58 +0000
commitbabaec33e51991475ba2ab9ec06c95bbe5f220c0 (patch)
tree562b6bac909eed6154deb248e16abefeb6c643c6 /src/gui
parent55e0ddd7e1d60a56ece679a4c2563bef854e892b (diff)
downloadmana-babaec33e51991475ba2ab9ec06c95bbe5f220c0.tar.gz
mana-babaec33e51991475ba2ab9ec06c95bbe5f220c0.tar.bz2
mana-babaec33e51991475ba2ab9ec06c95bbe5f220c0.tar.xz
mana-babaec33e51991475ba2ab9ec06c95bbe5f220c0.zip
Merged revisions 4207-4209,4221-4222 via svnmerge from
https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r4207 | b_lindeijer | 2008-04-29 11:10:43 +0200 (Tue, 29 Apr 2008) | 6 lines * Fixed issue with determining whether chat input is focused (method no longer virtual). * Fixed sometimes rendering with the wrong font. * Fixed warnings about hiding virtual method, Window now always deletes its children (the option not to do so was never used anyway). ........ r4208 | b_lindeijer | 2008-04-29 13:25:26 +0200 (Tue, 29 Apr 2008) | 3 lines Removed unused option from GCContainer to not delete a child, fixing warnings about hiding virtual method gcn::Container::add. ........ r4209 | b_lindeijer | 2008-04-29 14:58:21 +0200 (Tue, 29 Apr 2008) | 3 lines When compiling with GCC, use the printf format attribute for the log method so that the compiler checks the type of its parameters. ........ r4221 | peaveydk | 2008-05-06 21:23:49 +0200 (Tue, 06 May 2008) | 1 line Dont allow dragging of empty placeholders. ........ r4222 | peaveydk | 2008-05-08 00:49:38 +0200 (Thu, 08 May 2008) | 1 line Make F8 toggle shortcut window as suggested by And1 an fate. ........
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chat.cpp2
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/gccontainer.cpp14
-rw-r--r--src/gui/gccontainer.h8
-rw-r--r--src/gui/guildwindow.cpp2
-rw-r--r--src/gui/guildwindow.h4
-rw-r--r--src/gui/itemshortcutcontainer.cpp4
-rw-r--r--src/gui/window.cpp23
-rw-r--r--src/gui/window.h8
9 files changed, 30 insertions, 37 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index b7c63247..bda31427 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -297,7 +297,7 @@ ChatWindow::requestChatFocus()
}
bool
-ChatWindow::isFocused()
+ChatWindow::isInputFocused()
{
return mChatInput->isFocused();
}
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 3923e097..f7af6480 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -110,7 +110,7 @@ class ChatWindow : public Window,
/**
* Checks whether ChatWindow is Focused or not.
*/
- bool isFocused();
+ bool isInputFocused();
/**
* Determines whether the message is a command or message, then
diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp
index c22ddfc9..1edb4daf 100644
--- a/src/gui/gccontainer.cpp
+++ b/src/gui/gccontainer.cpp
@@ -37,21 +37,15 @@ GCContainer::~GCContainer()
mDeathList.clear();
}
-void GCContainer::add(gcn::Widget *w, bool delChild)
+void GCContainer::add(gcn::Widget *w)
{
- if (delChild) {
- mDeathList.push_back(w);
- }
-
+ mDeathList.push_back(w);
Container::add(w);
}
-void GCContainer::add(gcn::Widget *w, int x, int y, bool delChild)
+void GCContainer::add(gcn::Widget *w, int x, int y)
{
- if (delChild) {
- mDeathList.push_back(w);
- }
-
+ mDeathList.push_back(w);
Container::add(w, x, y);
}
diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h
index e27eaa96..8b8a7ffe 100644
--- a/src/gui/gccontainer.h
+++ b/src/gui/gccontainer.h
@@ -28,14 +28,18 @@
#include <guichan/widgets/container.hpp>
+/**
+ * A garbage collecting container. Childs added to this container are
+ * automatically deleted when the container is deleted.
+ */
class GCContainer : public gcn::Container
{
public:
virtual ~GCContainer();
- virtual void add(gcn::Widget *w, bool delChild = true);
+ virtual void add(gcn::Widget *w);
- virtual void add(gcn::Widget *w, int x, int y, bool delChild = true);
+ virtual void add(gcn::Widget *w, int x, int y);
virtual void death(const gcn::Event &event);
diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp
index a2b8243c..a50bd219 100644
--- a/src/gui/guildwindow.cpp
+++ b/src/gui/guildwindow.cpp
@@ -208,7 +208,7 @@ void GuildWindow::setTab(const std::string &guildName)
mGuildButton[2]->setEnabled(true);
}
-bool GuildWindow::isFocused()
+bool GuildWindow::isWindowFocused()
{
return mFocus;
}
diff --git a/src/gui/guildwindow.h b/src/gui/guildwindow.h
index c2ac2b4d..e1bd99d7 100644
--- a/src/gui/guildwindow.h
+++ b/src/gui/guildwindow.h
@@ -87,9 +87,9 @@ public:
void updateTab();
/**
- * Check if the window is in focus
+ * Check if the window is in focus.
*/
- bool isFocused();
+ bool isWindowFocused();
/**
* Create a dialog for accepting an invite
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index a54e3678..23b41650 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -76,6 +76,8 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
{
Graphics *g = static_cast<Graphics*>(graphics);
+ graphics->setFont(getFont());
+
for (int i = 0; i < mMaxItems; i++)
{
const int itemX = (i % mGridWidth) * mBoxWidth;
@@ -149,6 +151,8 @@ ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
if (index == -1) {
return;
}
+ if (itemShortcut->getItem(index) < 0)
+ return;
Item *item = player_node->searchForItem(itemShortcut->getItem(index));
if (item)
{
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 24c9f850..2bce49b2 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -306,14 +306,7 @@ bool Window::isSticky()
void Window::setVisible(bool visible)
{
- if (isSticky())
- {
- gcn::Window::setVisible(true);
- }
- else
- {
- gcn::Window::setVisible(visible);
- }
+ gcn::Window::setVisible(isSticky() || visible);
}
void Window::scheduleDelete()
@@ -576,24 +569,22 @@ void Window::setGuiAlpha()
mAlphaChanged = false;
}
-void Window::loadSkin(const std::string filename)
+void Window::loadSkin(const std::string &fileName)
{
- const std::string windowId = Window::getId();
-
- ResourceManager *resman = ResourceManager::getInstance();
+ ResourceManager *resman = ResourceManager::getInstance();
- logger->log("Loading Window Skin '%s'.", filename.c_str());
- logger->log("Loading Window ID '%d'.", windowId.c_str());
+ logger->log("Loading Window Skin '%s'.", fileName.c_str());
+ logger->log("Loading Window ID '%s'.", Window::getId().c_str());
- if(filename == "")
+ if (fileName == "")
logger->error("Window::loadSkin(): Invalid File Name.");
// TODO:
// If there is an error loading the specified file, we should try to revert
// to a 'default' skin file. Only if the 'default' skin file can't be loaded
// should we have a terminating error.
- XML::Document doc(filename);
+ XML::Document doc(fileName);
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "skinset"))
diff --git a/src/gui/window.h b/src/gui/window.h
index bdd737af..44982500 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -251,10 +251,10 @@ class Window : public gcn::Window, gcn::WidgetListener
*/
ContainerPlacer getPlacer(int x, int y);
- /**
- * Loads a window skin
- */
- void loadSkin(const std::string filename);
+ /**
+ * Loads a window skin
+ */
+ void loadSkin(const std::string &fileName);
private:
/**