summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-15 23:40:05 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-15 23:40:05 +0300
commit01d93aedcc4d1632ff5915c3989a502ec31cd978 (patch)
treec66fef008a583f4a9c556e4fd7577cd08db5ac17 /src/gui
parent580ce9af9e9a241aac083107b18c9c81e1c1da0d (diff)
downloadmanaverse-01d93aedcc4d1632ff5915c3989a502ec31cd978.tar.gz
manaverse-01d93aedcc4d1632ff5915c3989a502ec31cd978.tar.bz2
manaverse-01d93aedcc4d1632ff5915c3989a502ec31cd978.tar.xz
manaverse-01d93aedcc4d1632ff5915c3989a502ec31cd978.zip
move focuslistener from base into listeners.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/base/focushandler.cpp3
-rw-r--r--src/gui/base/focuslistener.hpp119
-rw-r--r--src/gui/base/widget.hpp2
-rw-r--r--src/gui/base/widgets/button.cpp4
-rw-r--r--src/gui/base/widgets/button.hpp5
-rw-r--r--src/gui/gui.cpp4
-rw-r--r--src/gui/gui.h9
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropdown.h7
-rw-r--r--src/gui/widgets/popuplist.cpp2
-rw-r--r--src/gui/widgets/popuplist.h5
-rw-r--r--src/gui/widgets/textfield.cpp2
-rw-r--r--src/gui/widgets/textfield.h5
13 files changed, 28 insertions, 141 deletions
diff --git a/src/gui/base/focushandler.cpp b/src/gui/base/focushandler.cpp
index 6984d1fcd..ff149bf99 100644
--- a/src/gui/base/focushandler.cpp
+++ b/src/gui/base/focushandler.cpp
@@ -67,10 +67,11 @@
#include "gui/base/focushandler.hpp"
-#include "gui/base/focuslistener.hpp"
#include "gui/base/exception.hpp"
#include "gui/base/widget.hpp"
+#include "listeners/focuslistener.h"
+
#include "debug.h"
namespace gcn
diff --git a/src/gui/base/focuslistener.hpp b/src/gui/base/focuslistener.hpp
deleted file mode 100644
index f6a7da5ea..000000000
--- a/src/gui/base/focuslistener.hpp
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * The ManaPlus Client
- * Copyright (C) 2011-2014 The ManaPlus Developers
- *
- * This file is part of The ManaPlus Client.
- *
- * This program 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.
- *
- * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/* _______ __ __ __ ______ __ __ _______ __ __
- * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\
- * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / /
- * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / /
- * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / /
- * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ /
- * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/
- *
- * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson
- *
- *
- * Per Larsson a.k.a finalman
- * Olof Naessén a.k.a jansem/yakslem
- *
- * Visit: http://guichan.sourceforge.net
- *
- * License: (BSD)
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- * 3. Neither the name of Guichan nor the names of its contributors may
- * be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef GCN_FOCUSLISTENER_HPP
-#define GCN_FOCUSLISTENER_HPP
-
-#include <string>
-
-#include "gui/base/event.hpp"
-
-#include "localconsts.h"
-
-namespace gcn
-{
- /**
- * Interface for listening for focus events from widgets.
- *
- * @see Widget::addFocusListener, Widget::removeFocusListener
- * @author Olof Naessén
- * @since 0.7.0
- */
- class FocusListener
- {
- public:
- /**
- * Destructor.
- */
- virtual ~FocusListener()
- { }
-
- /**
- * Called when a widget gains focus.
- *
- * @param event Discribes the event.
- */
- virtual void focusGained(const Event& event A_UNUSED)
- { }
-
- /**
- * Called when a widget loses focus.
- *
- * @param event Discribes the event.
- */
- virtual void focusLost(const Event& event A_UNUSED)
- { }
-
- protected:
- /**
- * Constructor.
- *
- * You should not be able to make an instance of FocusListener,
- * therefore its constructor is protected.
- */
- FocusListener()
- { }
- };
-} // namespace gcn
-
-#endif // end GCN_FOCUSLISTENER_HPP
diff --git a/src/gui/base/widget.hpp b/src/gui/base/widget.hpp
index b896ac1e9..a6dc2ed13 100644
--- a/src/gui/base/widget.hpp
+++ b/src/gui/base/widget.hpp
@@ -75,13 +75,13 @@
class ActionListener;
class DeathListener;
+class FocusListener;
class Graphics;
namespace gcn
{
class BasicContainer;
class FocusHandler;
- class FocusListener;
class Font;
class KeyInput;
class KeyListener;
diff --git a/src/gui/base/widgets/button.cpp b/src/gui/base/widgets/button.cpp
index 3e699670a..82ff878a0 100644
--- a/src/gui/base/widgets/button.cpp
+++ b/src/gui/base/widgets/button.cpp
@@ -83,7 +83,7 @@ namespace gcn
gcn::Widget(),
gcn::MouseListener(),
gcn::KeyListener(),
- gcn::FocusListener(),
+ FocusListener(),
mCaption(),
mHasMouse(false),
mKeyPressed(false),
@@ -104,7 +104,7 @@ namespace gcn
gcn::Widget(),
gcn::MouseListener(),
gcn::KeyListener(),
- gcn::FocusListener(),
+ FocusListener(),
mCaption(caption),
mHasMouse(false),
mKeyPressed(false),
diff --git a/src/gui/base/widgets/button.hpp b/src/gui/base/widgets/button.hpp
index cd41a1b02..e2d6c0c8e 100644
--- a/src/gui/base/widgets/button.hpp
+++ b/src/gui/base/widgets/button.hpp
@@ -66,10 +66,11 @@
#include <string>
-#include "gui/base/focuslistener.hpp"
+#include "listeners/focuslistener.h"
#include "gui/base/keylistener.hpp"
-#include "gui/base/mouseevent.hpp"
#include "gui/base/mouselistener.hpp"
+
+#include "gui/base/mouseevent.hpp"
#include "gui/base/widget.hpp"
#include "render/graphics.h"
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index 4da397a73..a398ca427 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -910,12 +910,12 @@ void Gui::handleMouseReleased(const gcn::MouseInput &mouseInput)
mFocusHandler->setDraggedWidget(nullptr);
}
-void Gui::addGlobalFocusListener(gcn::FocusListener* focusListener)
+void Gui::addGlobalFocusListener(FocusListener* focusListener)
{
mFocusListeners.push_back(focusListener);
}
-void Gui::removeGlobalFocusListener(gcn::FocusListener* focusListener)
+void Gui::removeGlobalFocusListener(FocusListener* focusListener)
{
mFocusListeners.remove(focusListener);
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 4737c62fb..544d9dd3d 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -24,9 +24,10 @@
#define GUI_GUI_H
#include "gui/base/color.hpp"
-#include "gui/base/focuslistener.hpp"
#include "gui/base/gui.hpp"
+#include "listeners/focuslistener.h"
+
#include "localconsts.h"
class Graphics;
@@ -151,9 +152,9 @@ class Gui final : public gcn::Gui
int &restrict x,
int &restrict y);
- void addGlobalFocusListener(gcn::FocusListener* focusListener);
+ void addGlobalFocusListener(FocusListener* focusListener);
- void removeGlobalFocusListener(gcn::FocusListener* focusListener);
+ void removeGlobalFocusListener(FocusListener* focusListener);
void distributeGlobalFocusGainedEvent(const gcn::Event &focusEvent);
@@ -195,7 +196,7 @@ class Gui final : public gcn::Gui
uint16_t mLastMouseRealX;
uint16_t mLastMouseRealY;
#endif
- typedef std::list<gcn::FocusListener*> FocusListenerList;
+ typedef std::list<FocusListener*> FocusListenerList;
typedef FocusListenerList::iterator FocusListenerIterator;
FocusListenerList mFocusListeners;
gcn::Color mForegroundColor;
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 070afdbb5..0e9241f21 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -60,7 +60,7 @@ DropDown::DropDown(const Widget2 *const widget,
gcn::BasicContainer(),
gcn::KeyListener(),
gcn::MouseListener(),
- gcn::FocusListener(),
+ FocusListener(),
gcn::SelectionListener(),
Widget2(widget),
mPopup(new PopupList(this, listModel, extended, modal)),
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 0b6ada6dd..ca0743ae7 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -26,9 +26,10 @@
#include "gui/widgets/widget2.h"
#include "gui/base/basiccontainer.hpp"
-#include "gui/base/focuslistener.hpp"
-#include "gui/base/keylistener.hpp"
#include "gui/base/listmodel.hpp"
+
+#include "listeners/focuslistener.h"
+#include "gui/base/keylistener.hpp"
#include "gui/base/mouselistener.hpp"
#include "gui/base/selectionlistener.hpp"
@@ -54,7 +55,7 @@ class DropDown final : public ActionListener,
public gcn::BasicContainer,
public gcn::KeyListener,
public gcn::MouseListener,
- public gcn::FocusListener,
+ public FocusListener,
public gcn::SelectionListener,
public Widget2
{
diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp
index f7f8afc66..b8e4dabb4 100644
--- a/src/gui/widgets/popuplist.cpp
+++ b/src/gui/widgets/popuplist.cpp
@@ -32,7 +32,7 @@ PopupList::PopupList(DropDown *const widget,
gcn::ListModel *const listModel,
bool extended, bool modal):
Popup("PopupList", "popuplist.xml"),
- gcn::FocusListener(),
+ FocusListener(),
mListModel(listModel),
mListBox(extended ? new ExtendedListBox(
widget, listModel, "extendedlistbox.xml", 0) :
diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h
index dfe93c0ae..454b5617c 100644
--- a/src/gui/widgets/popuplist.h
+++ b/src/gui/widgets/popuplist.h
@@ -23,7 +23,8 @@
#include "gui/widgets/popup.h"
-#include "gui/base/focuslistener.hpp"
+#include "listeners/focuslistener.h"
+
#include "gui/base/listmodel.hpp"
#include "localconsts.h"
@@ -33,7 +34,7 @@ class ListBox;
class ScrollArea;
class PopupList final : public Popup,
- public gcn::FocusListener
+ public FocusListener
{
public:
PopupList(DropDown *const widget,
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 692a5608e..22e9d42dd 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -57,7 +57,7 @@ TextField::TextField(const Widget2 *restrict const widget,
const std::string &restrict eventId,
const bool sendAlwaysEvents):
gcn::TextField(text),
- gcn::FocusListener(),
+ FocusListener(),
Widget2(widget),
mSendAlwaysEvents(sendAlwaysEvents),
mCaretColor(&getThemeColor(Theme::CARET)),
diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h
index 80d022bb1..4545e9ff9 100644
--- a/src/gui/widgets/textfield.h
+++ b/src/gui/widgets/textfield.h
@@ -25,7 +25,8 @@
#include "gui/widgets/widget2.h"
-#include "gui/base/focuslistener.hpp"
+#include "listeners/focuslistener.h"
+
#include "gui/base/widgets/textfield.hpp"
#include "localconsts.h"
@@ -38,7 +39,7 @@ class PopupMenu;
* \ingroup GUI
*/
class TextField : public gcn::TextField,
- public gcn::FocusListener,
+ public FocusListener,
public Widget2
{
public: