From 5fc6d9e0f9637e3aaa71972478bee9febbe78ca7 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 22 Feb 2014 16:26:52 +0300 Subject: Move listmodel into gui/modesl directory. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/gui/base/listmodel.hpp | 106 ------------------------------- src/gui/base/widgets/listbox.cpp | 2 +- src/gui/base/widgets/listbox.hpp | 3 +- src/gui/models/listmodel.h | 103 ++++++++++++++++++++++++++++++ src/gui/popups/popupmenu.cpp | 4 +- src/gui/popups/popupmenu.h | 8 +-- src/gui/userpalette.h | 4 +- src/gui/widgets/avatarlistbox.h | 4 +- src/gui/widgets/colormodel.h | 4 +- src/gui/widgets/colorpage.cpp | 2 +- src/gui/widgets/colorpage.h | 2 +- src/gui/widgets/dropdown.cpp | 12 ++-- src/gui/widgets/dropdown.h | 12 ++-- src/gui/widgets/extendedlistbox.cpp | 4 +- src/gui/widgets/extendedlistbox.h | 2 +- src/gui/widgets/extendedlistmodel.h | 4 +- src/gui/widgets/listbox.cpp | 4 +- src/gui/widgets/listbox.h | 7 +- src/gui/widgets/namesmodel.h | 4 +- src/gui/widgets/popuplist.cpp | 4 +- src/gui/widgets/popuplist.h | 14 ++-- src/gui/widgets/setupitem.cpp | 12 ++-- src/gui/widgets/setupitem.h | 22 +++---- src/gui/widgets/shopitems.h | 4 +- src/gui/widgets/shoplistbox.cpp | 6 +- src/gui/widgets/shoplistbox.h | 4 +- src/gui/widgets/skillmodel.h | 4 +- src/gui/widgets/sliderlist.cpp | 4 +- src/gui/widgets/sliderlist.h | 10 +-- src/gui/widgets/tabs/setup_audio.h | 2 +- src/gui/widgets/tabs/setup_input.cpp | 4 +- src/gui/widgets/tabs/setup_relations.cpp | 4 +- src/gui/widgets/tabs/setup_relations.h | 8 +-- src/gui/widgets/tabs/setup_theme.cpp | 2 +- src/gui/widgets/tabs/setup_video.cpp | 6 +- src/gui/windows/buydialog.cpp | 2 +- src/gui/windows/chatwindow.cpp | 2 +- src/gui/windows/editserverdialog.h | 4 +- src/gui/windows/inventorywindow.cpp | 4 +- src/gui/windows/itemamountwindow.cpp | 4 +- src/gui/windows/logindialog.cpp | 6 +- src/gui/windows/serverdialog.h | 4 +- src/gui/windows/textcommandeditor.cpp | 8 +-- src/gui/windows/worldselectdialog.cpp | 4 +- 46 files changed, 206 insertions(+), 237 deletions(-) delete mode 100644 src/gui/base/listmodel.hpp create mode 100644 src/gui/models/listmodel.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cfab9cccb..497b66cd9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -776,7 +776,7 @@ SET(SRCS input/key.h events/keyevent.h listeners/keylistener.h - gui/base/listmodel.hpp + gui/models/listmodel.h events/mouseevent.h listeners/mouselistener.h gui/rectangle.h diff --git a/src/Makefile.am b/src/Makefile.am index eba67d244..b7f6e8bc4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -162,7 +162,7 @@ manaplus_SOURCES += events/actionevent.h \ input/key.h \ events/keyevent.h \ listeners/keylistener.h \ - gui/base/listmodel.hpp \ + gui/models/listmodel.h \ events/mouseevent.h \ listeners/mouselistener.h \ gui/rectangle.h \ diff --git a/src/gui/base/listmodel.hpp b/src/gui/base/listmodel.hpp deleted file mode 100644 index 4b98f46fe..000000000 --- a/src/gui/base/listmodel.hpp +++ /dev/null @@ -1,106 +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 . - */ - -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * 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_LISTMODEL_HPP -#define GCN_LISTMODEL_HPP - -#include - -#include "localconsts.h" - -namespace gcn -{ - /** - * An interface for a model that represents a list. It is - * used in certain widgets, like the ListBox, to handle a - * lists with string elements. If you want to use widgets - * like ListBox, make a derived class from this class that - * represents your list. - */ - class ListModel - { - public: - /** - * Destructor. - */ - virtual ~ListModel() - { } - - /** - * Gets the number of elements in the list. - * - * @return The number of elements in the list - */ - virtual int getNumberOfElements() A_WARN_UNUSED = 0; - - /** - * Gets an element at a certain index in the list. - * - * @param i An index in the list. - * @return An element as a string at the a certain index. - */ - virtual std::string getElementAt(int i) A_WARN_UNUSED = 0; - }; -} // namespace gcn - -#endif // end GCN_LISTMODEL_HPP diff --git a/src/gui/base/widgets/listbox.cpp b/src/gui/base/widgets/listbox.cpp index 9aca373b9..62a3062a5 100644 --- a/src/gui/base/widgets/listbox.cpp +++ b/src/gui/base/widgets/listbox.cpp @@ -69,7 +69,7 @@ #include "gui/font.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "listeners/selectionlistener.h" diff --git a/src/gui/base/widgets/listbox.hpp b/src/gui/base/widgets/listbox.hpp index 4046f5ddf..079e5a7d5 100644 --- a/src/gui/base/widgets/listbox.hpp +++ b/src/gui/base/widgets/listbox.hpp @@ -71,12 +71,11 @@ #include "listeners/keylistener.h" #include "listeners/mouselistener.h" +class ListModel; class SelectionListener; namespace gcn { - class ListModel; - /** * An implementation of a list box where an item can be selected. * diff --git a/src/gui/models/listmodel.h b/src/gui/models/listmodel.h new file mode 100644 index 000000000..dfce6d4d5 --- /dev/null +++ b/src/gui/models/listmodel.h @@ -0,0 +1,103 @@ +/* + * 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 . + */ + +/* _______ __ __ __ ______ __ __ _______ __ __ + * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ + * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / + * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / + * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / + * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / + * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ + * + * 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 GUI_MODELS_LISTMODEL_H +#define GUI_MODELS_LISTMODEL_H + +#include + +#include "localconsts.h" + +/** + * An interface for a model that represents a list. It is + * used in certain widgets, like the ListBox, to handle a + * lists with string elements. If you want to use widgets + * like ListBox, make a derived class from this class that + * represents your list. + */ +class ListModel +{ + public: + /** + * Destructor. + */ + virtual ~ListModel() + { } + + /** + * Gets the number of elements in the list. + * + * @return The number of elements in the list + */ + virtual int getNumberOfElements() A_WARN_UNUSED = 0; + + /** + * Gets an element at a certain index in the list. + * + * @param i An index in the list. + * @return An element as a string at the a certain index. + */ + virtual std::string getElementAt(int i) A_WARN_UNUSED = 0; +}; + +#endif // GUI_MODELS_LISTMODEL_H diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index a37994884..3905d91e6 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -81,7 +81,7 @@ #include "utils/gettext.h" #include "utils/process.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "debug.h" @@ -2685,7 +2685,7 @@ void PopupMenu::addPickupFilter(const std::string &name) } void PopupMenu::showPopup(const int x, const int y, - gcn::ListModel *const model) + ListModel *const model) { if (!model) return; diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index 1ce274122..7eb38dc15 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -37,6 +37,7 @@ class Button; class ChatTab; class FloorItem; class Item; +class ListModel; class MapItem; class ScrollArea; class TextCommand; @@ -45,11 +46,6 @@ class TextField; class ProgressBar; class Window; -namespace gcn -{ - class ListModel; -} - class RenameListener final : public ActionListener { public: @@ -176,7 +172,7 @@ class PopupMenu final : public Popup, public LinkHandler void showChangePos(const int x, const int y); - void showPopup(const int x, const int y, gcn::ListModel *const model); + void showPopup(const int x, const int y, ListModel *const model); void showTextFieldPopup(int x, int y, TextField *const input); diff --git a/src/gui/userpalette.h b/src/gui/userpalette.h index e37eee0ca..7bab5bed9 100644 --- a/src/gui/userpalette.h +++ b/src/gui/userpalette.h @@ -26,12 +26,12 @@ #include "gui/palette.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" /** * Class controlling the game's color palette. */ -class UserPalette final : public Palette, public gcn::ListModel +class UserPalette final : public Palette, public ListModel { public: /** List of all colors that are configurable. */ diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index e2ab3bf83..e98cee368 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -28,13 +28,13 @@ #include "gui/widgets/listbox.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include class Image; -class AvatarListModel : public gcn::ListModel +class AvatarListModel : public ListModel { public: virtual Avatar *getAvatarAt(const int i) A_WARN_UNUSED = 0; diff --git a/src/gui/widgets/colormodel.h b/src/gui/widgets/colormodel.h index 7386a856b..ba68e94e2 100644 --- a/src/gui/widgets/colormodel.h +++ b/src/gui/widgets/colormodel.h @@ -23,7 +23,7 @@ #include "utils/stringvector.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "localconsts.h" @@ -42,7 +42,7 @@ struct ColorPair const Color* color2; }; -class ColorModel : public gcn::ListModel +class ColorModel : public ListModel { public: ColorModel(); diff --git a/src/gui/widgets/colorpage.cpp b/src/gui/widgets/colorpage.cpp index 2bc085208..8196dead4 100644 --- a/src/gui/widgets/colorpage.cpp +++ b/src/gui/widgets/colorpage.cpp @@ -27,7 +27,7 @@ #include "debug.h" ColorPage::ColorPage(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin) : ListBox(widget, listModel, skin) { diff --git a/src/gui/widgets/colorpage.h b/src/gui/widgets/colorpage.h index 84a3011a9..88182e4f2 100644 --- a/src/gui/widgets/colorpage.h +++ b/src/gui/widgets/colorpage.h @@ -29,7 +29,7 @@ class ColorPage final : public ListBox { public: ColorPage(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin); A_DELETE_COPY(ColorPage) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 63f102f5a..ec9a2e22f 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -53,7 +53,7 @@ static std::string const dropdownFiles[2] = }; DropDown::DropDown(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const bool extended, const bool modal, ActionListener *const listener, @@ -232,7 +232,7 @@ void DropDown::draw(Graphics* graphics) mHighlightColor.a = alpha; mShadowColor.a = alpha; - gcn::ListModel *const model = mPopup->getListModel(); + ListModel *const model = mPopup->getListModel(); if (model && mPopup->getSelected() >= 0) { Font *const font = getFont(); @@ -418,7 +418,7 @@ void DropDown::mouseWheelMovedDown(MouseEvent& mouseEvent) void DropDown::setSelectedString(const std::string &str) { - gcn::ListModel *const listModel = mPopup->getListModel(); + ListModel *const listModel = mPopup->getListModel(); if (!listModel) return; @@ -434,7 +434,7 @@ void DropDown::setSelectedString(const std::string &str) std::string DropDown::getSelectedString() const { - gcn::ListModel *const listModel = mPopup->getListModel(); + ListModel *const listModel = mPopup->getListModel(); if (!listModel) return ""; @@ -491,7 +491,7 @@ void DropDown::setSelected(int selected) mPopup->setSelected(selected); } -void DropDown::setListModel(gcn::ListModel *const listModel) +void DropDown::setListModel(ListModel *const listModel) { mPopup->setListModel(listModel); @@ -501,7 +501,7 @@ void DropDown::setListModel(gcn::ListModel *const listModel) adjustHeight(); } -gcn::ListModel *DropDown::getListModel() +ListModel *DropDown::getListModel() { return mPopup->getListModel(); } diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 81e3b6e8f..b8c3e7150 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -34,14 +34,10 @@ #include "localconsts.h" class Image; +class ListModel; class PopupList; class Skin; -namespace gcn -{ - class ListModel; -} - /** * A drop down box from which you can select different values. * @@ -66,7 +62,7 @@ class DropDown final : public ActionListener, * @see ListModel, ScrollArea, ListBox. */ DropDown(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const bool extended = false, const bool modal = false, ActionListener *const listener = nullptr, @@ -121,9 +117,9 @@ class DropDown final : public ActionListener, void setSelected(int selected); - void setListModel(gcn::ListModel *const listModel); + void setListModel(ListModel *const listModel); - gcn::ListModel *getListModel(); + ListModel *getListModel(); void addSelectionListener(SelectionListener* listener); diff --git a/src/gui/widgets/extendedlistbox.cpp b/src/gui/widgets/extendedlistbox.cpp index 53b7c7060..c507f986c 100644 --- a/src/gui/widgets/extendedlistbox.cpp +++ b/src/gui/widgets/extendedlistbox.cpp @@ -24,14 +24,14 @@ #include "gui/font.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "render/graphics.h" #include "debug.h" ExtendedListBox::ExtendedListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin, const int rowHeight) : ListBox(widget, listModel, skin), diff --git a/src/gui/widgets/extendedlistbox.h b/src/gui/widgets/extendedlistbox.h index 9fa14fa9e..ae94cde02 100644 --- a/src/gui/widgets/extendedlistbox.h +++ b/src/gui/widgets/extendedlistbox.h @@ -48,7 +48,7 @@ class ExtendedListBox final : public ListBox * Constructor. */ ExtendedListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin, const int rowHeight = 13); diff --git a/src/gui/widgets/extendedlistmodel.h b/src/gui/widgets/extendedlistmodel.h index 0b9c4d819..c3cd26b90 100644 --- a/src/gui/widgets/extendedlistmodel.h +++ b/src/gui/widgets/extendedlistmodel.h @@ -23,9 +23,9 @@ #include "resources/image.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" -class ExtendedListModel : public gcn::ListModel +class ExtendedListModel : public ListModel { public: virtual const Image *getImageAt(int i) A_WARN_UNUSED = 0; diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index ebe1ca279..949c52455 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -32,7 +32,7 @@ #include "gui/font.h" #include "gui/gui.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "render/graphics.h" @@ -41,7 +41,7 @@ float ListBox::mAlpha = 1.0; ListBox::ListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin) : gcn::ListBox(widget, listModel), mHighlightColor(getThemeColor(Theme::HIGHLIGHT)), diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 61e1596f7..0c3a62609 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -33,13 +33,10 @@ class Skin; class KeyEvent; +class ListModel; class MouseEvent; class Widget2; -namespace gcn -{ - class ListModel; -} /** * A list box, meant to be used inside a scroll area. Same as the Guichan list * box except this one doesn't have a background, instead completely relying @@ -54,7 +51,7 @@ class ListBox : public gcn::ListBox * Constructor. */ ListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, const std::string &skin); A_DELETE_COPY(ListBox) diff --git a/src/gui/widgets/namesmodel.h b/src/gui/widgets/namesmodel.h index 5e8b47d23..4018a3755 100644 --- a/src/gui/widgets/namesmodel.h +++ b/src/gui/widgets/namesmodel.h @@ -23,11 +23,11 @@ #include "utils/stringvector.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "localconsts.h" -class NamesModel : public gcn::ListModel +class NamesModel : public ListModel { public: NamesModel(); diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 8ad4bd0c4..cfb973384 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -29,7 +29,7 @@ #include "debug.h" PopupList::PopupList(DropDown *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, bool extended, bool modal): Popup("PopupList", "popuplist.xml"), FocusListener(), @@ -112,7 +112,7 @@ int PopupList::getSelected() const return mListBox->getSelected(); } -void PopupList::setListModel(gcn::ListModel *const model) +void PopupList::setListModel(ListModel *const model) { if (mListBox) mListBox->setListModel(model); diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index a495d7c46..32a9dfc47 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -29,19 +29,15 @@ class DropDown; class ListBox; +class ListModel; class ScrollArea; -namespace gcn -{ - class ListModel; -} - class PopupList final : public Popup, public FocusListener { public: PopupList(DropDown *const widget, - gcn::ListModel *const listModel, bool extended, + ListModel *const listModel, bool extended, bool modal = false); ~PopupList(); @@ -58,9 +54,9 @@ class PopupList final : public Popup, int getSelected() const; - void setListModel(gcn::ListModel *const model); + void setListModel(ListModel *const model); - gcn::ListModel *getListModel() const + ListModel *getListModel() const { return mListModel; } void adjustSize(); @@ -74,7 +70,7 @@ class PopupList final : public Popup, void mouseReleased(MouseEvent& mouseEvent) override final; private: - gcn::ListModel *mListModel; + ListModel *mListModel; ListBox *mListBox; ScrollArea *mScrollArea; DropDown *mDropDown; diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 3e40b902e..218efe8a2 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -625,7 +625,7 @@ SetupItemDropDown::SetupItemDropDown(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), @@ -644,7 +644,7 @@ SetupItemDropDown::SetupItemDropDown(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const std::string &restrict def, const bool mainConfig) : @@ -1004,7 +1004,7 @@ SetupItemSliderList::SetupItemSliderList(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const bool onTheFly, const bool mainConfig) : SetupItem(text, description, keyName, parent, eventName, mainConfig), @@ -1024,7 +1024,7 @@ SetupItemSliderList::SetupItemSliderList(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const std::string &restrict def, const int width, const bool onTheFly, @@ -1109,7 +1109,7 @@ SetupItemSound::SetupItemSound(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const bool onTheFly, const bool mainConfig) : SetupItemSliderList(text, description, keyName, parent, eventName, @@ -1147,7 +1147,7 @@ SetupItemSliderInt::SetupItemSliderInt(const std::string &restrict text, const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int min, const int width, const bool onTheFly, diff --git a/src/gui/widgets/setupitem.h b/src/gui/widgets/setupitem.h index 18e838cdf..51f2eb94e 100644 --- a/src/gui/widgets/setupitem.h +++ b/src/gui/widgets/setupitem.h @@ -36,16 +36,12 @@ class EditDialog; class HorizontContainer; class IntTextField; class Label; +class ListModel; class SetupTabScroll; class Slider; class SliderList; class TextField; -namespace gcn -{ - class ListModel; -} - class SetupItem : public ActionListener, public Widget2 { @@ -315,7 +311,7 @@ class SetupItemDropDown final : public SetupItem const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const bool mainConfig = true); SetupItemDropDown(const std::string &restrict text, @@ -323,7 +319,7 @@ class SetupItemDropDown final : public SetupItem const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width, const std::string &restrict def, const bool mainConfig = true); @@ -341,7 +337,7 @@ class SetupItemDropDown final : public SetupItem protected: HorizontContainer *mHorizont; Label *mLabel; - gcn::ListModel *mModel; + ListModel *mModel; DropDown *mDropDown; int mWidth; }; @@ -483,7 +479,7 @@ class SetupItemSliderList : public SetupItem const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width = 150, const bool onTheFly = false, const bool mainConfig = true); @@ -492,7 +488,7 @@ class SetupItemSliderList : public SetupItem const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const std::string &restrict def, const int width = 150, const bool onTheFly = false, @@ -501,7 +497,7 @@ class SetupItemSliderList : public SetupItem HorizontContainer *mHorizont; Label *mLabel; SliderList *mSlider; - gcn::ListModel *mModel; + ListModel *mModel; int mWidth; bool mOnTheFly; }; @@ -514,7 +510,7 @@ class SetupItemSound final : public SetupItemSliderList const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int width = 150, const bool onTheFly = false, const bool mainConfig = true); @@ -537,7 +533,7 @@ class SetupItemSliderInt final : public SetupItemSliderList const std::string &restrict keyName, SetupTabScroll *restrict const parent, const std::string &restrict eventName, - gcn::ListModel *restrict const model, + ListModel *restrict const model, const int min, const int width = 150, const bool onTheFly = false, diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h index 54de95cc0..d1fa1ca98 100644 --- a/src/gui/widgets/shopitems.h +++ b/src/gui/widgets/shopitems.h @@ -23,7 +23,7 @@ #ifndef GUI_WIDGETS_SHOPITEMS_H #define GUI_WIDGETS_SHOPITEMS_H -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include #include @@ -41,7 +41,7 @@ class ShopItem; * * This functionality can be enabled in the constructor. */ -class ShopItems final : public gcn::ListModel +class ShopItems final : public ListModel { public: /** diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 28af43cec..ff45e5297 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -36,14 +36,14 @@ #include "resources/image.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "debug.h" const int ITEM_ICON_SIZE = 32; ShopListBox::ShopListBox(const Widget2 *const widget, - gcn::ListModel *const listModel) : + ListModel *const listModel) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(nullptr), @@ -60,7 +60,7 @@ ShopListBox::ShopListBox(const Widget2 *const widget, } ShopListBox::ShopListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, ShopItems *const shopListModel) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 38e209c33..17c1ed4d5 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -42,13 +42,13 @@ class ShopListBox final : public ListBox * Constructor. */ ShopListBox(const Widget2 *const widget, - gcn::ListModel *const listModel); + ListModel *const listModel); /** * Constructor with shopitems */ ShopListBox(const Widget2 *const widget, - gcn::ListModel *const listModel, + ListModel *const listModel, ShopItems *const shopListModel); A_DELETE_COPY(ShopListBox) diff --git a/src/gui/widgets/skillmodel.h b/src/gui/widgets/skillmodel.h index b1a682fd9..38e36c2f1 100644 --- a/src/gui/widgets/skillmodel.h +++ b/src/gui/widgets/skillmodel.h @@ -24,13 +24,13 @@ #define GUI_WIDGETS_SKILLMODEL_H #include "gui/widgets/skillinfo.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include #include "localconsts.h" -class SkillModel final : public gcn::ListModel +class SkillModel final : public ListModel { public: SkillModel(); diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index c5791f1c2..03f0c4ed2 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -23,7 +23,7 @@ #include "gui/font.h" #include "gui/gui.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "gui/widgets/button.h" #include "gui/widgets/label.h" @@ -35,7 +35,7 @@ static const int buttonSpace = 30; static const int sliderHeight = 30; SliderList::SliderList(const Widget2 *const widget, - gcn::ListModel *const listModel) : + ListModel *const listModel) : Container(widget), ActionListener(), MouseListener(), diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 9adba8080..84f96ebe4 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -30,11 +30,7 @@ class Button; class Label; - -namespace gcn -{ - class ListModel; -} +class ListModel; class SliderList final : public Container, public ActionListener, @@ -42,7 +38,7 @@ class SliderList final : public Container, { public: SliderList(const Widget2 *const widget, - gcn::ListModel *const listModel); + ListModel *const listModel); A_DELETE_COPY(SliderList) @@ -81,7 +77,7 @@ class SliderList final : public Container, Button *mButtons[2]; Label *mLabel; - gcn::ListModel *mListModel; + ListModel *mListModel; std::string mPrevEventId; std::string mNextEventId; int mOldWidth; diff --git a/src/gui/widgets/tabs/setup_audio.h b/src/gui/widgets/tabs/setup_audio.h index aaadebf32..b3736e814 100644 --- a/src/gui/widgets/tabs/setup_audio.h +++ b/src/gui/widgets/tabs/setup_audio.h @@ -39,7 +39,7 @@ class Setup_Audio final : public SetupTabScroll void apply() override final; private: - gcn::ListModel *mSoundModel; + ListModel *mSoundModel; SetupItemNames *mChannelsList; }; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 24bf229ef..ed371b364 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -39,7 +39,7 @@ #include "gui/widgets/scrollarea.h" #include "gui/widgets/tabstrip.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "debug.h" @@ -51,7 +51,7 @@ static const int setupGroups = 9; * * \ingroup Interface */ -class KeyListModel final : public gcn::ListModel +class KeyListModel final : public ListModel { public: KeyListModel() : diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index dd08d437b..1af4e1769 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -78,7 +78,7 @@ static const char *const RELATION_NAMES[PlayerRelation::RELATIONS_NR] = N_("Enemy") }; -class PlayerRelationListModel final : public gcn::ListModel +class PlayerRelationListModel final : public ListModel { public: ~PlayerRelationListModel() @@ -216,7 +216,7 @@ protected: /** * Class for choosing one of the various `what to do when ignoring a player' options */ -class IgnoreChoicesListModel final : public gcn::ListModel +class IgnoreChoicesListModel final : public ListModel { public: ~IgnoreChoicesListModel() diff --git a/src/gui/widgets/tabs/setup_relations.h b/src/gui/widgets/tabs/setup_relations.h index e32889008..9fc197ffc 100644 --- a/src/gui/widgets/tabs/setup_relations.h +++ b/src/gui/widgets/tabs/setup_relations.h @@ -33,15 +33,11 @@ class Button; class CheckBox; class DropDown; class GuiTable; +class ListModel; class PlayerTableModel; class ScrollArea; class StaticTableModel; -namespace gcn -{ - class ListModel; -} - class Setup_Relations final : public SetupTab, public PlayerRelationsListener { @@ -78,7 +74,7 @@ private: Button *mDeleteButton; - gcn::ListModel *mIgnoreActionChoicesModel; + ListModel *mIgnoreActionChoicesModel; DropDown *mIgnoreActionChoicesBox; }; diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index b744eb0eb..1d5f0f910 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -116,7 +116,7 @@ const char *SIZE_NAME[maxFontSizes] = N_("Huge (23)"), }; -class FontSizeChoiceListModel final : public gcn::ListModel +class FontSizeChoiceListModel final : public ListModel { public: ~FontSizeChoiceListModel() diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 4e4408ce6..b587e8d5d 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -46,7 +46,7 @@ #include "test/testmain.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include @@ -54,7 +54,7 @@ extern Graphics *mainGraphics; -class ModeListModel final : public gcn::ListModel +class ModeListModel final : public ListModel { public: ModeListModel(); @@ -159,7 +159,7 @@ int ModeListModel::getIndexOf(const std::string &widthXHeightMode) return -1; } -class OpenGLListModel final : public gcn::ListModel +class OpenGLListModel final : public ListModel { public: ~OpenGLListModel() diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index cd593bf92..ac8187fc3 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -69,7 +69,7 @@ static const char *const SORT_NAME_BUY[7] = N_("by type") }; -class SortListModelBuy final : public gcn::ListModel +class SortListModelBuy final : public ListModel { public: ~SortListModelBuy() diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index acd4c50bd..eb4a0fb44 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -177,7 +177,7 @@ const char *COLOR_NAME[14] = }; -class ColorListModel final : public gcn::ListModel +class ColorListModel final : public ListModel { public: ~ColorListModel() diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index 8907a2846..a3f649f0d 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -34,12 +34,12 @@ class ServerDialog; #include "listeners/actionlistener.h" #include "listeners/keylistener.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" /** * Server Type List Model */ -class TypeListModel : public gcn::ListModel +class TypeListModel : public ListModel { public: TypeListModel() diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 0b0e6c6de..be1487566 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -36,7 +36,7 @@ #include "gui/gui.h" #include "gui/viewport.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "gui/popups/textpopup.h" @@ -81,7 +81,7 @@ static const char *const SORT_NAME_INVENTORY[6] = N_("by type") }; -class SortListModelInv final : public gcn::ListModel +class SortListModelInv final : public ListModel { public: ~SortListModelInv() diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index c63157e27..b65d5481f 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -33,7 +33,7 @@ #include "net/net.h" #include "gui/viewport.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "gui/popups/itempopup.h" @@ -52,7 +52,7 @@ #include "debug.h" -class ItemsModal final : public gcn::ListModel +class ItemsModal final : public ListModel { public: ItemsModal() : diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index bfa20af62..ac060817d 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -84,7 +84,7 @@ const char *UPDATE_TYPE_TEXT[3] = N_("Skip"), }; -class UpdateTypeModel final : public gcn::ListModel +class UpdateTypeModel final : public ListModel { public: UpdateTypeModel() @@ -108,11 +108,11 @@ class UpdateTypeModel final : public gcn::ListModel } }; -class UpdateListModel final : public gcn::ListModel +class UpdateListModel final : public ListModel { public: explicit UpdateListModel(LoginData *const data) : - gcn::ListModel(), + ListModel(), mLoginData(data) { } diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index 3f63562f7..2d0ada344 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -34,7 +34,7 @@ #include "listeners/keylistener.h" #include "listeners/selectionlistener.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include #include @@ -48,7 +48,7 @@ class ServerDialog; /** * Server and Port List Model */ -class ServersListModel final : public gcn::ListModel +class ServersListModel final : public ListModel { public: typedef std::pair VersionString; diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 82d1c9ef6..358077021 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -27,7 +27,7 @@ #include "input/keyboardconfig.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "gui/widgets/button.h" #include "gui/widgets/dropdown.h" @@ -44,7 +44,7 @@ #include "debug.h" -class IconsModal final : public gcn::ListModel +class IconsModal final : public ListModel { public: IconsModal() : @@ -121,7 +121,7 @@ const char *MAGIC_SCHOOL_TEXT[6] = N_("Astral Magic") }; -class TargetTypeModel final : public gcn::ListModel +class TargetTypeModel final : public ListModel { public: ~TargetTypeModel() @@ -140,7 +140,7 @@ public: } }; -class MagicSchoolModel final : public gcn::ListModel +class MagicSchoolModel final : public ListModel { public: ~MagicSchoolModel() diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index 5acb11f93..e588e5eb0 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -33,7 +33,7 @@ #include "gui/widgets/listbox.h" #include "gui/widgets/scrollarea.h" -#include "gui/base/listmodel.hpp" +#include "gui/models/listmodel.h" #include "net/loginhandler.h" #include "net/net.h" @@ -47,7 +47,7 @@ extern WorldInfo **server_info; /** * The list model for the server list. */ -class WorldListModel final : public gcn::ListModel +class WorldListModel final : public ListModel { public: explicit WorldListModel(Worlds worlds) : -- cgit v1.2.3-70-g09d2