summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-16 00:36:17 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-16 00:36:17 +0300
commit9bca06b1c7c121f410766ad99b91075902ce24c7 (patch)
treeaa6bbb63cf3a2e111afeaae71edef5f3d9f5b78e
parent9093f12ebbfbdacb3df7a5f5fcdda422daa22754 (diff)
downloadplus-9bca06b1c7c121f410766ad99b91075902ce24c7.tar.gz
plus-9bca06b1c7c121f410766ad99b91075902ce24c7.tar.bz2
plus-9bca06b1c7c121f410766ad99b91075902ce24c7.tar.xz
plus-9bca06b1c7c121f410766ad99b91075902ce24c7.zip
move selectionlistener from base into listeners.
-rw-r--r--src/gui/base/widgets/listbox.cpp2
-rw-r--r--src/gui/base/widgets/listbox.hpp4
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropdown.h4
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.h12
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_colors.h4
-rw-r--r--src/gui/windowmenu.cpp2
-rw-r--r--src/gui/windowmenu.h4
-rw-r--r--src/gui/windows/buydialog.cpp6
-rw-r--r--src/gui/windows/buydialog.h4
-rw-r--r--src/gui/windows/inventorywindow.cpp2
-rw-r--r--src/gui/windows/inventorywindow.h4
-rw-r--r--src/gui/windows/selldialog.cpp4
-rw-r--r--src/gui/windows/selldialog.h4
-rw-r--r--src/gui/windows/serverdialog.cpp2
-rw-r--r--src/gui/windows/serverdialog.h4
-rw-r--r--src/gui/windows/shopwindow.cpp2
-rw-r--r--src/gui/windows/shopwindow.h4
-rw-r--r--src/gui/windows/tradewindow.cpp2
-rw-r--r--src/gui/windows/tradewindow.h4
-rw-r--r--src/listeners/selectionlistener.h (renamed from src/gui/base/selectionlistener.hpp)57
23 files changed, 65 insertions, 72 deletions
diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp
index 3ae4caa91..7f46b4b10 100644
--- a/src/gui/base/widgets/listbox.cpp
+++ b/src/gui/base/widgets/listbox.cpp
@@ -72,7 +72,7 @@
#include "gui/base/key.hpp"
#include "gui/base/listmodel.hpp"
#include "gui/base/mouseinput.hpp"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include "render/graphics.h"
diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp
index 793aba840..61c8486bb 100644
--- a/src/gui/base/widgets/listbox.hpp
+++ b/src/gui/base/widgets/listbox.hpp
@@ -72,10 +72,10 @@
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
+class SelectionListener;
+
namespace gcn
{
- class SelectionListener;
-
/**
* An implementation of a list box where an item can be selected.
*
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index efb3235a4..1aed0dfe1 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -61,7 +61,7 @@ DropDown::DropDown(const Widget2 *const widget,
KeyListener(),
MouseListener(),
FocusListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
Widget2(widget),
mPopup(new PopupList(this, listModel, extended, modal)),
mShadowColor(getThemeColor(Theme::DROPDOWN_SHADOW)),
diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h
index 7d645a478..692b341ca 100644
--- a/src/gui/widgets/dropdown.h
+++ b/src/gui/widgets/dropdown.h
@@ -32,7 +32,7 @@
#include "listeners/focuslistener.h"
#include "listeners/keylistener.h"
#include "listeners/mouselistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include "localconsts.h"
@@ -55,7 +55,7 @@ class DropDown final : public ActionListener,
public KeyListener,
public MouseListener,
public FocusListener,
- public gcn::SelectionListener,
+ public SelectionListener,
public Widget2
{
public:
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 40c87d272..036cb6c1b 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -47,7 +47,7 @@
#include "resources/image.h"
#include "gui/base/font.hpp"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include <algorithm>
diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h
index 77d7e1c28..74ae72a23 100644
--- a/src/gui/widgets/itemcontainer.h
+++ b/src/gui/widgets/itemcontainer.h
@@ -39,11 +39,7 @@ class Image;
class Inventory;
class Item;
class ItemPopup;
-
-namespace gcn
-{
- class SelectionListener;
-}
+class SelectionListener;
/**
* An item container. Used to show items in inventory and trade dialog.
@@ -116,14 +112,14 @@ class ItemContainer final : public gcn::Widget,
* Adds a listener to the list that's notified each time a change to
* the selection occurs.
*/
- void addSelectionListener(gcn::SelectionListener *listener)
+ void addSelectionListener(SelectionListener *listener)
{ mSelectionListeners.push_back(listener); }
/**
* Removes a listener from the list that's notified each time a change
* to the selection occurs.
*/
- void removeSelectionListener(gcn::SelectionListener *listener)
+ void removeSelectionListener(SelectionListener *listener)
{ mSelectionListeners.remove(listener); }
void setFilter(const int tag);
@@ -192,7 +188,7 @@ class ItemContainer final : public gcn::Widget,
gcn::Color mEquipedColor2;
gcn::Color mUnEquipedColor;
gcn::Color mUnEquipedColor2;
- typedef std::list<gcn::SelectionListener*> SelectionListenerList;
+ typedef std::list<SelectionListener*> SelectionListenerList;
typedef SelectionListenerList::iterator SelectionListenerIterator;
SelectionListenerList mSelectionListeners;
int mGridColumns;
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index 1094f5e29..fadea948a 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -47,7 +47,7 @@ const char *const Setup_Colors::rawmsg =
Setup_Colors::Setup_Colors(const Widget2 *const widget) :
SetupTab(widget),
- gcn::SelectionListener(),
+ SelectionListener(),
mColorBox(new ListBox(this, userPalette, "")),
mScroll(new ScrollArea(mColorBox, true, "setup_colors_background.xml")),
mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, true,
diff --git a/src/gui/widgets/tabs/setup_colors.h b/src/gui/widgets/tabs/setup_colors.h
index 38f0f2687..0bcc9c7f0 100644
--- a/src/gui/widgets/tabs/setup_colors.h
+++ b/src/gui/widgets/tabs/setup_colors.h
@@ -24,7 +24,7 @@
#include "gui/widgets/tabs/setuptab.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include <string>
@@ -37,7 +37,7 @@ class TextField;
class TextPreview;
class Setup_Colors final : public SetupTab,
- public gcn::SelectionListener
+ public SelectionListener
{
public:
explicit Setup_Colors(const Widget2 *const widget);
diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp
index aeef201e7..631fe3437 100644
--- a/src/gui/windowmenu.cpp
+++ b/src/gui/windowmenu.cpp
@@ -45,7 +45,7 @@
WindowMenu::WindowMenu(const Widget2 *const widget) :
Container(widget),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
MouseListener(),
mSkin(Theme::instance() ? Theme::instance()->load("windowmenu.xml", "")
: nullptr),
diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h
index 0b613fce9..b472be579 100644
--- a/src/gui/windowmenu.h
+++ b/src/gui/windowmenu.h
@@ -29,7 +29,7 @@
#include "gui/widgets/button.h"
#include "listeners/actionlistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include "localconsts.h"
@@ -78,7 +78,7 @@ struct ButtonText final
class WindowMenu final : public Container,
public ConfigListener,
public ActionListener,
- public gcn::SelectionListener,
+ public SelectionListener,
public MouseListener
{
public:
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 2d6d7d9db..def60b942 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -194,7 +194,7 @@ BuyDialog::BuyDialog() :
// TRANSLATORS: buy dialog name
Window(_("Create items"), false, nullptr, "buy.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mNpcId(-2), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(),
mSortModel(nullptr),
mSortDropDown(nullptr)
@@ -206,7 +206,7 @@ BuyDialog::BuyDialog(const int npcId) :
// TRANSLATORS: buy dialog name
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mNpcId(npcId), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(),
mSortModel(nullptr),
mSortDropDown(nullptr)
@@ -218,7 +218,7 @@ BuyDialog::BuyDialog(std::string nick) :
// TRANSLATORS: buy dialog name
Window(_("Buy"), false, nullptr, "buy.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mNpcId(-1), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(nick),
mSortModel(new SortListModelBuy),
mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort"))
diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h
index ef51c04b2..9e493b91e 100644
--- a/src/gui/windows/buydialog.h
+++ b/src/gui/windows/buydialog.h
@@ -26,7 +26,7 @@
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
class Button;
class DropDown;
@@ -46,7 +46,7 @@ class Slider;
*/
class BuyDialog final : public Window,
public ActionListener,
- public gcn::SelectionListener
+ public SelectionListener
{
public:
/**
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 9e2c1a6ff..7066a9c8e 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -103,7 +103,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory):
Window("Inventory", false, nullptr, "inventory.xml"),
ActionListener(),
KeyListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
InventoryListener(),
mInventory(inventory),
mItems(new ItemContainer(this, mInventory)),
diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h
index 066d0d6d5..2d5ec6191 100644
--- a/src/gui/windows/inventorywindow.h
+++ b/src/gui/windows/inventorywindow.h
@@ -31,7 +31,7 @@
#include "listeners/actionlistener.h"
#include "listeners/keylistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
class Button;
class DropDown;
@@ -53,7 +53,7 @@ class TextPopup;
class InventoryWindow final : public Window,
public ActionListener,
public KeyListener,
- public gcn::SelectionListener,
+ public SelectionListener,
public InventoryListener,
public DepricatedListener
{
diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp
index 888a2432d..9db7bda27 100644
--- a/src/gui/windows/selldialog.cpp
+++ b/src/gui/windows/selldialog.cpp
@@ -54,7 +54,7 @@ SellDialog::SellDialog(const int npcId) :
// TRANSLATORS: sell dialog name
Window(_("Sell"), false, nullptr, "sell.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mNpcId(npcId), mMaxItems(0), mAmountItems(0), mNick("")
{
init();
@@ -64,7 +64,7 @@ SellDialog::SellDialog(const std::string &nick):
// TRANSLATORS: sell dialog name
Window(_("Sell"), false, nullptr, "sell.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mNpcId(-1), mMaxItems(0), mAmountItems(0), mNick(nick)
{
init();
diff --git a/src/gui/windows/selldialog.h b/src/gui/windows/selldialog.h
index c23112f8a..f1747ca7e 100644
--- a/src/gui/windows/selldialog.h
+++ b/src/gui/windows/selldialog.h
@@ -26,7 +26,7 @@
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
class Button;
class Item;
@@ -43,7 +43,7 @@ class Slider;
*/
class SellDialog final : public Window,
private ActionListener,
- private gcn::SelectionListener
+ private SelectionListener
{
public:
/**
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index a307b043e..32e838ac3 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -246,7 +246,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo,
Window(_("Choose Your Server"), false, nullptr, "server.xml"),
ActionListener(),
KeyListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mMutex(),
mDescription(new Label(this, std::string())),
// TRANSLATORS: servers dialog button
diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h
index afcdf1643..c01f8dd08 100644
--- a/src/gui/windows/serverdialog.h
+++ b/src/gui/windows/serverdialog.h
@@ -33,7 +33,7 @@
#include "listeners/actionlistener.h"
#include "listeners/keylistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include "gui/base/listmodel.hpp"
@@ -94,7 +94,7 @@ class ServersListModel final : public gcn::ListModel
class ServerDialog final : public Window,
public ActionListener,
public KeyListener,
- public gcn::SelectionListener
+ public SelectionListener
{
public:
/**
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index 1485f18c9..7e50e4c37 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -72,7 +72,7 @@ ShopWindow::ShopWindow():
// TRANSLATORS: shop window name
Window(_("Personal Shop"), false, nullptr, "shop.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
// TRANSLATORS: shop window button
mCloseButton(new Button(this, _("Close"), "close", this)),
mBuyShopItems(new ShopItems),
diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h
index 606080986..9149b79cb 100644
--- a/src/gui/windows/shopwindow.h
+++ b/src/gui/windows/shopwindow.h
@@ -26,7 +26,7 @@
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
class Button;
class CheckBox;
@@ -44,7 +44,7 @@ class ShopListBox;
*/
class ShopWindow final : public Window,
public ActionListener,
- public gcn::SelectionListener
+ public SelectionListener
{
public:
enum ShopMode
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 6a9f9a8af..a5b7f1a47 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -68,7 +68,7 @@ TradeWindow::TradeWindow():
// TRANSLATORS: trade window caption
Window(_("Trade: You"), false, nullptr, "trade.xml"),
ActionListener(),
- gcn::SelectionListener(),
+ SelectionListener(),
mMyInventory(new Inventory(Inventory::TRADE)),
mPartnerInventory(new Inventory(Inventory::TRADE)),
mMyItemContainer(new ItemContainer(this, mMyInventory.get())),
diff --git a/src/gui/windows/tradewindow.h b/src/gui/windows/tradewindow.h
index 69ba64ed7..c5e1d7e8f 100644
--- a/src/gui/windows/tradewindow.h
+++ b/src/gui/windows/tradewindow.h
@@ -26,7 +26,7 @@
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
-#include "gui/base/selectionlistener.hpp"
+#include "listeners/selectionlistener.h"
#include <memory>
@@ -44,7 +44,7 @@ class TextField;
*/
class TradeWindow final : public Window,
private ActionListener,
- private gcn::SelectionListener
+ private SelectionListener
{
public:
/**
diff --git a/src/gui/base/selectionlistener.hpp b/src/listeners/selectionlistener.h
index b1a4d73ba..e258440e6 100644
--- a/src/gui/base/selectionlistener.hpp
+++ b/src/listeners/selectionlistener.h
@@ -70,48 +70,45 @@
#include "localconsts.h"
-namespace gcn
+/**
+ * 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
{
- /**
- * 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.
- */
+ * 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)
+ * 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 gcn::SelectionEvent &event A_UNUSED)
{ }
protected:
/**
- * Constructor.
- *
- * You should not be able to make an instance of SelectionListener,
- * therefore its constructor is protected.
- */
+ * Constructor.
+ *
+ * You should not be able to make an instance of SelectionListener,
+ * therefore its constructor is protected.
+ */
SelectionListener()
{ }
- };
-} // namespace gcn
+};
#endif // end GCN_SELECTIONLISTENER_HPP