summaryrefslogtreecommitdiff
path: root/src/listeners
diff options
context:
space:
mode:
Diffstat (limited to 'src/listeners')
-rw-r--r--src/listeners/actionlistener.h109
-rw-r--r--src/listeners/actorspritelistener.h44
-rw-r--r--src/listeners/configlistener.h50
-rw-r--r--src/listeners/deathlistener.h106
-rw-r--r--src/listeners/depricatedlistener.cpp39
-rw-r--r--src/listeners/depricatedlistener.h40
-rw-r--r--src/listeners/focuslistener.h116
-rw-r--r--src/listeners/keylistener.h116
-rw-r--r--src/listeners/mouselistener.h193
-rw-r--r--src/listeners/playerrelationslistener.h43
-rw-r--r--src/listeners/selectionlistener.h114
-rw-r--r--src/listeners/widgetlistener.h140
12 files changed, 1110 insertions, 0 deletions
diff --git a/src/listeners/actionlistener.h b/src/listeners/actionlistener.h
new file mode 100644
index 000000000..895cc985d
--- /dev/null
+++ b/src/listeners/actionlistener.h
@@ -0,0 +1,109 @@
+/*
+ * 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 LISTENERS_ACTIONLISTENER_H
+#define LISTENERS_ACTIONLISTENER_H
+
+#include <string>
+
+#include "events/actionevent.h"
+
+/**
+ * Interface for listening for action events from widgets.
+ *
+ * @see Widget::addActionListener, Widget::removeActionListener,
+ * ActionEvent
+ * @author Olof Naessén
+ * @author Per Larsson
+ */
+class ActionListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~ActionListener()
+ { }
+
+ /**
+ * Called when an action is recieved from a widget. It is used
+ * to be able to recieve a notification that an action has
+ * occured.
+ *
+ * @param actionEvent The event of the action.
+ * @since 0.6.0
+ */
+ virtual void action(const ActionEvent &actionEvent) = 0;
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of ActionListener,
+ * therefore its constructor is protected.
+ */
+ ActionListener()
+ { }
+};
+
+#endif // LISTENERS_ACTIONLISTENER_H
diff --git a/src/listeners/actorspritelistener.h b/src/listeners/actorspritelistener.h
new file mode 100644
index 000000000..7b4d89b44
--- /dev/null
+++ b/src/listeners/actorspritelistener.h
@@ -0,0 +1,44 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2010 The Mana Developers
+ * 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/>.
+ */
+
+#ifndef LISTENERS_ACTORSPRITELISTENER_H
+#define LISTENERS_ACTORSPRITELISTENER_H
+
+class ActorSprite;
+
+class ActorSpriteListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~ActorSpriteListener()
+ { }
+
+ /**
+ * Called when the ActorSprite has been destroyed. The listener will
+ * have to be registered first.
+ * @param actorSprite the ActorSprite being destroyed.
+ */
+ virtual void actorSpriteDestroyed(const ActorSprite &actorSprite) = 0;
+};
+
+#endif // LISTENERS_ACTORSPRITELISTENER_H
diff --git a/src/listeners/configlistener.h b/src/listeners/configlistener.h
new file mode 100644
index 000000000..757d24bfc
--- /dev/null
+++ b/src/listeners/configlistener.h
@@ -0,0 +1,50 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * 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/>.
+ */
+
+#ifndef LISTENERS_CONFIGLISTENER_H
+#define LISTENERS_CONFIGLISTENER_H
+
+#include <string>
+
+/**
+ * The listener interface for receiving notifications about changes to
+ * configuration options.
+ *
+ * \ingroup CORE
+ */
+class ConfigListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~ConfigListener()
+ { }
+
+ /**
+ * Called when an option changed. The config listener will have to be
+ * registered to the option name first.
+ */
+ virtual void optionChanged(const std::string &name) = 0;
+};
+
+#endif // LISTENERS_CONFIGLISTENER_H
diff --git a/src/listeners/deathlistener.h b/src/listeners/deathlistener.h
new file mode 100644
index 000000000..ddd7db910
--- /dev/null
+++ b/src/listeners/deathlistener.h
@@ -0,0 +1,106 @@
+/*
+ * 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 LISTENERS_DEATHLISTENER_H
+#define LISTENERS_DEATHLISTENER_H
+
+#include <string>
+
+#include "events/event.h"
+
+/**
+ * Interface for listening for death events from widgets.
+ *
+ * @see Widget::addDeathListener, Widget::removeDeathListener
+ * @author Olof Naessén
+ * @since 0.6.0
+ */
+class DeathListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~DeathListener()
+ { }
+
+ /**
+ * Called when a widget dies. It is used to be able to recieve
+ * a notification when a death of a widget occurs.
+ *
+ * @param event The event of the death.
+ */
+ virtual void death(const Event &event) = 0;
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of DeathListener,
+ * therefore its constructor is protected.
+ */
+ DeathListener()
+ { }
+};
+
+#endif // LISTENERS_DEATHLISTENER_H
diff --git a/src/listeners/depricatedlistener.cpp b/src/listeners/depricatedlistener.cpp
new file mode 100644
index 000000000..c853c028d
--- /dev/null
+++ b/src/listeners/depricatedlistener.cpp
@@ -0,0 +1,39 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2010 The Mana Developers
+ * 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/>.
+ */
+
+#include "listeners/depricatedlistener.h"
+
+#include "debug.h"
+
+DepricatedListener::~DepricatedListener()
+{
+ DepricatedEvent::remove(this);
+}
+
+void DepricatedListener::listen(Channels channel)
+{
+ DepricatedEvent::bind(this, channel);
+}
+
+void DepricatedListener::ignore(Channels channel)
+{
+ DepricatedEvent::unbind(this, channel);
+}
diff --git a/src/listeners/depricatedlistener.h b/src/listeners/depricatedlistener.h
new file mode 100644
index 000000000..175eec74a
--- /dev/null
+++ b/src/listeners/depricatedlistener.h
@@ -0,0 +1,40 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2010 The Mana Developers
+ * 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/>.
+ */
+
+#ifndef LISTENERS_DEPRICATEDLISTENER_H
+#define LISTENERS_DEPRICATEDLISTENER_H
+
+#include "depricatedevent.h"
+
+class DepricatedListener
+{
+ public:
+ virtual ~DepricatedListener();
+
+ void listen(Channels channel);
+
+ void ignore(Channels channel);
+
+ virtual void processEvent(const Channels channel,
+ const DepricatedEvent &event) = 0;
+};
+
+#endif // LISTENERS_DEPRICATEDLISTENER_H
diff --git a/src/listeners/focuslistener.h b/src/listeners/focuslistener.h
new file mode 100644
index 000000000..10e4a2af0
--- /dev/null
+++ b/src/listeners/focuslistener.h
@@ -0,0 +1,116 @@
+/*
+ * 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 LISTENERS_FOCUSLISTENER_H
+#define LISTENERS_FOCUSLISTENER_H
+
+#include <string>
+
+#include "events/event.h"
+
+#include "localconsts.h"
+
+/**
+ * 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()
+ { }
+};
+
+#endif // LISTENERS_FOCUSLISTENER_H
diff --git a/src/listeners/keylistener.h b/src/listeners/keylistener.h
new file mode 100644
index 000000000..efc387300
--- /dev/null
+++ b/src/listeners/keylistener.h
@@ -0,0 +1,116 @@
+/*
+ * 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 LISTENERS_KEYLISTENER_H
+#define LISTENERS_KEYLISTENER_H
+
+#include "events/keyevent.h"
+
+#include "localconsts.h"
+
+class Key;
+
+/**
+ * Interface for listening for key events from widgets.
+ *
+ * @see Widget::addKeyListener, Widget::removeKeyListener
+ */
+class KeyListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~KeyListener()
+ { }
+
+ /**
+ * Called if a key is pressed when the widget has keyboard focus.
+ * If a key is held down the widget will generate multiple key
+ * presses.
+ *
+ * @param keyEvent Discribes the event.
+ */
+ virtual void keyPressed(KeyEvent &keyEvent A_UNUSED)
+ { }
+
+ /**
+ * Called if a key is released when the widget has keyboard focus.
+ *
+ * @param keyEvent Discribes the event.
+ */
+ virtual void keyReleased(KeyEvent &keyEvent A_UNUSED)
+ { }
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of KeyListener,
+ * therefore its constructor is protected.
+ */
+ KeyListener()
+ { }
+};
+
+#endif // LISTENERS_KEYLISTENER_H
diff --git a/src/listeners/mouselistener.h b/src/listeners/mouselistener.h
new file mode 100644
index 000000000..9a2a4ef04
--- /dev/null
+++ b/src/listeners/mouselistener.h
@@ -0,0 +1,193 @@
+/*
+ * 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 LISTENERS_MOUSELISTENER_H
+#define LISTENERS_MOUSELISTENER_H
+
+#include "events/mouseevent.h"
+
+#include "localconsts.h"
+
+/**
+ * Interface for listening for mouse events from widgets.
+ *
+ * @see Widget::addMouseListener, Widget::removeMouseListener
+ * @since 0.1.0
+ */
+class MouseListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~MouseListener()
+ { }
+
+ /**
+ * Called when the mouse has entered into the widget area.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseEntered(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when the mouse has exited the widget area.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseExited(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when a mouse button has been pressed on the widget area.
+ *
+ * NOTE: A mouse press is NOT equal to a mouse click.
+ * Use mouseClickMessage to check for mouse clicks.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mousePressed(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when a mouse button has been released on the widget area.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseReleased(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when a mouse button is pressed and released (clicked) on
+ * the widget area.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseClicked(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when the mouse wheel has moved up on the widget area.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseWheelMovedUp(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when the mouse wheel has moved down on the widget area.
+ *
+ * @param mousEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when the mouse has moved in the widget area and no mouse button
+ * has been pressed (i.e no widget is being dragged).
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseMoved(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ /**
+ * Called when the mouse has moved and the mouse has previously been
+ * pressed on the widget.
+ *
+ * @param mouseEvent Describes the event.
+ * @since 0.6.0
+ */
+ virtual void mouseDragged(MouseEvent &mouseEvent A_UNUSED)
+ {
+ }
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of MouseListener,
+ * therefore its constructor is protected.
+ */
+ MouseListener()
+ { }
+};
+
+#endif // LISTENERS_MOUSELISTENER_H
diff --git a/src/listeners/playerrelationslistener.h b/src/listeners/playerrelationslistener.h
new file mode 100644
index 000000000..6a8bf3b20
--- /dev/null
+++ b/src/listeners/playerrelationslistener.h
@@ -0,0 +1,43 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2008-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * 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/>.
+ */
+
+#ifndef LISTENERS_PLAYERRELATIONSLISTENER_H
+#define LISTENERS_PLAYERRELATIONSLISTENER_H
+
+#include <string>
+
+class PlayerRelationsListener
+{
+ public:
+ virtual ~PlayerRelationsListener()
+ { }
+
+ virtual void updatedPlayer(const std::string &name) = 0;
+
+ virtual void updateAll() = 0;
+
+ protected:
+ PlayerRelationsListener()
+ { }
+};
+
+#endif // LISTENERS_PLAYERRELATIONSLISTENER_H
diff --git a/src/listeners/selectionlistener.h b/src/listeners/selectionlistener.h
new file mode 100644
index 000000000..2efe0a67e
--- /dev/null
+++ b/src/listeners/selectionlistener.h
@@ -0,0 +1,114 @@
+/*
+ * 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 LISTENERS_SELECTIONLISTENER_H
+#define LISTENERS_SELECTIONLISTENER_H
+
+#include <string>
+
+#include "events/selectionevent.h"
+
+#include "localconsts.h"
+
+/**
+ * Interface for listening for selection events from widgets.
+ *
+ * @see ListBox::addSelectionListener,
+ * ListBox::removeSelectionListener,
+ * DropDown::addSelectionListener,
+ * DropDown::removeSelectionListener
+ * @author Olof Naessén
+ * @since 0.8.0
+ */
+class SelectionListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~SelectionListener()
+ { }
+
+ /**
+ * Called when the value of a selection has been changed in a Widget.
+ * It is used to be able to recieve a notification that a value has
+ * been changed.
+ *
+ * @param event The event of the value change.
+ * @since 0.8.0
+ */
+ virtual void valueChanged(const SelectionEvent &event A_UNUSED)
+ { }
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of SelectionListener,
+ * therefore its constructor is protected.
+ */
+ SelectionListener()
+ { }
+};
+
+#endif // LISTENERS_SELECTIONLISTENER_H
diff --git a/src/listeners/widgetlistener.h b/src/listeners/widgetlistener.h
new file mode 100644
index 000000000..48641cbaa
--- /dev/null
+++ b/src/listeners/widgetlistener.h
@@ -0,0 +1,140 @@
+/*
+ * 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 LISTENERS_WIDGETLISTENER_H
+#define LISTENERS_WIDGETLISTENER_H
+
+#include <string>
+
+#include "events/event.h"
+
+#include "localconsts.h"
+
+/**
+ * Interface for listening for events from widgets. When a widget's size,
+ * location or visibility changes, the relevant method of the listener is
+ * invoked.
+ *
+ * @see Widget::addWidgetListener, Widget::removeWidgetListener
+ * @author Olof Naessén
+ * @since 0.8.0
+ */
+class WidgetListener
+{
+ public:
+ /**
+ * Destructor.
+ */
+ virtual ~WidgetListener()
+ { }
+
+ /**
+ * Invoked when a widget changes its size.
+ *
+ * @param event Describes the event.
+ * @since 0.8.0
+ */
+ virtual void widgetResized(const Event &event A_UNUSED)
+ { }
+
+ /**
+ * Invoked when a widget is moved.
+ *
+ * @param event Describes the event.
+ * @since 0.8.0
+ */
+ virtual void widgetMoved(const Event &event A_UNUSED)
+ { }
+
+ /**
+ * Invoked when a widget is hidden, i.e it's set to be
+ * not visible.
+ *
+ * @param event Describes the event.
+ * @since 0.8.0
+ */
+ virtual void widgetHidden(const Event &event A_UNUSED)
+ { }
+
+ /**
+ * Invoked when a widget is shown, i.e it's set to be
+ * visible.
+ *
+ * @param event Describes the event.
+ * @since 0.8.0
+ */
+ virtual void widgetShown(const Event &event A_UNUSED)
+ { }
+
+ protected:
+ /**
+ * Constructor.
+ *
+ * You should not be able to make an instance of WidgetListener,
+ * therefore its constructor is protected.
+ */
+ WidgetListener()
+ { }
+};
+
+#endif // LISTENERS_WIDGETLISTENER_H