summaryrefslogtreecommitdiff
path: root/src
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
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')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/gui/base/focushandler.cpp3
-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
-rw-r--r--src/listeners/focuslistener.h (renamed from src/gui/base/focuslistener.hpp)61
15 files changed, 59 insertions, 56 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d68026c5d..324e65cac 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -778,7 +778,7 @@ SET(SRCS
gui/base/event.hpp
gui/base/exception.hpp
gui/base/focushandler.hpp
- gui/base/focuslistener.hpp
+ listeners/focuslistener.h
gui/base/font.hpp
gui/base/gui.hpp
gui/base/input.hpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 7a74b3d17..da16e98d7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -165,7 +165,7 @@ manaplus_SOURCES += gui/base/actionevent.hpp \
gui/base/event.hpp \
gui/base/exception.hpp \
gui/base/focushandler.hpp \
- gui/base/focuslistener.hpp \
+ listeners/focuslistener.h \
gui/base/font.hpp \
gui/base/graphics.hpp \
gui/base/gui.hpp \
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/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:
diff --git a/src/gui/base/focuslistener.hpp b/src/listeners/focuslistener.h
index f6a7da5ea..1a6dd3fb2 100644
--- a/src/gui/base/focuslistener.hpp
+++ b/src/listeners/focuslistener.h
@@ -61,8 +61,8 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef GCN_FOCUSLISTENER_HPP
-#define GCN_FOCUSLISTENER_HPP
+#ifndef LISTENERS_FOCUSLISTENER_HPP
+#define LISTENERS_FOCUSLISTENER_HPP
#include <string>
@@ -70,50 +70,47 @@
#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
{
- /**
- * 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.
- */
+ * 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 gains focus.
+ *
+ * @param event Discribes the event.
+ */
+ virtual void focusGained(const gcn::Event &event A_UNUSED)
{ }
/**
- * Called when a widget loses focus.
- *
- * @param event Discribes the event.
- */
- virtual void focusLost(const Event& event A_UNUSED)
+ * Called when a widget loses focus.
+ *
+ * @param event Discribes the event.
+ */
+ virtual void focusLost(const gcn::Event &event A_UNUSED)
{ }
protected:
/**
- * Constructor.
- *
- * You should not be able to make an instance of FocusListener,
- * therefore its constructor is 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
+#endif // LISTENERS_FOCUSLISTENER_HPP