diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 2 | ||||
-rw-r--r-- | src/gui/chat.h | 2 | ||||
-rw-r--r-- | src/gui/gccontainer.cpp | 14 | ||||
-rw-r--r-- | src/gui/gccontainer.h | 8 | ||||
-rw-r--r-- | src/gui/guildwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/guildwindow.h | 4 | ||||
-rw-r--r-- | src/gui/itemshortcutcontainer.cpp | 4 | ||||
-rw-r--r-- | src/gui/window.cpp | 23 | ||||
-rw-r--r-- | src/gui/window.h | 8 |
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: /** |