diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-19 18:28:37 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-20 13:55:42 +0300 |
commit | df5cd98862d5328c6765b992a3a6e1b3458a1d8a (patch) | |
tree | 281949dceabbc4894474f4f5c6cb398f3dd15998 | |
parent | 2bf115745f111215b651b87288eb9d15ceb333be (diff) | |
download | manaverse-df5cd98862d5328c6765b992a3a6e1b3458a1d8a.tar.gz manaverse-df5cd98862d5328c6765b992a3a6e1b3458a1d8a.tar.bz2 manaverse-df5cd98862d5328c6765b992a3a6e1b3458a1d8a.tar.xz manaverse-df5cd98862d5328c6765b992a3a6e1b3458a1d8a.zip |
Derive all widgets from Widget2 class.
46 files changed, 181 insertions, 26 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8fdf8bbab..4279ef743 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -218,6 +218,8 @@ SET(SRCS gui/widgets/vertcontainer.h gui/widgets/whispertab.cpp gui/widgets/whispertab.h + gui/widgets/widget2.cpp + gui/widgets/widget2.h gui/widgets/widgetgroup.cpp gui/widgets/widgetgroup.h gui/widgets/window.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 45df21458..e3bec2b9d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -220,6 +220,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/vertcontainer.h \ gui/widgets/whispertab.cpp \ gui/widgets/whispertab.h \ + gui/widgets/widget2.cpp \ + gui/widgets/widget2.h \ gui/widgets/widgetgroup.cpp \ gui/widgets/widgetgroup.h \ gui/widgets/window.cpp \ diff --git a/src/gui/buydialog.h b/src/gui/buydialog.h index f00672042..c3f061af4 100644 --- a/src/gui/buydialog.h +++ b/src/gui/buydialog.h @@ -42,7 +42,8 @@ class Slider; * * \ingroup Interface */ -class BuyDialog final : public Window, public gcn::ActionListener, +class BuyDialog final : public Window, + public gcn::ActionListener, public gcn::SelectionListener { public: diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 8c27d7b23..7d6dc3f13 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -47,6 +47,7 @@ BrowserBox::BrowserBox(const unsigned int mode, const bool opaque) : gcn::Widget(), + Widget2(), gcn::MouseListener(), mLinkHandler(nullptr), mMode(mode), diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index ec7b15585..b6d504a15 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -24,6 +24,8 @@ #ifndef BROWSERBOX_H #define BROWSERBOX_H +#include "gui/widgets/widget2.h" + #include <guichan/mouselistener.hpp> #include <guichan/widget.hpp> @@ -75,6 +77,7 @@ class LinePart final * parent conteiner. */ class BrowserBox final : public gcn::Widget, + public Widget2, public gcn::MouseListener { public: diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 235f72f5c..2ea528a8e 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -147,6 +147,7 @@ Button::Button(const std::string &imageName, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(""), + Widget2(), gcn::WidgetListener(), mDescription(""), mClickCount(0), diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index fbcc941ed..3519a5fc7 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -23,6 +23,8 @@ #ifndef BUTTON_H #define BUTTON_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/button.hpp> #include <guichan/mouseevent.hpp> #include <guichan/widgetlistener.hpp> @@ -42,7 +44,9 @@ const std::string BUTTON_PLAY = "buttonplay.png"; * * \ingroup GUI */ -class Button final : public gcn::Button, public gcn::WidgetListener +class Button final : public gcn::Button, + public Widget2, + public gcn::WidgetListener { public: /** diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index f3e5993b0..8ffb4e7bb 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -46,6 +46,7 @@ CheckBox::CheckBox(const std::string &caption, const bool selected, gcn::ActionListener *const listener, const std::string &eventId) : gcn::CheckBox(caption, selected), + Widget2(), mHasMouse(false), mPadding(0), mImagePadding(0), diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 0ca579d3b..4bb675f65 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -23,6 +23,8 @@ #ifndef CHECKBOX_H #define CHECKBOX_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/checkbox.hpp> #include "localconsts.h" @@ -35,7 +37,8 @@ class Skin; * * \ingroup GUI */ -class CheckBox final : public gcn::CheckBox +class CheckBox final : public gcn::CheckBox, + public Widget2 { public: /** diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 3ac0cf0e3..074f6f53d 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -25,7 +25,8 @@ #include "debug.h" Container::Container() : - gcn::Container() + gcn::Container(), + Widget2() { setOpaque(false); } diff --git a/src/gui/widgets/container.h b/src/gui/widgets/container.h index 26706722b..9ecbbf145 100644 --- a/src/gui/widgets/container.h +++ b/src/gui/widgets/container.h @@ -23,6 +23,8 @@ #ifndef GUI_CONTAINER_H #define GUI_CONTAINER_H +#include "gui/widgets/widget2.h" + #include <guichan/widget.hpp> #include <guichan/widgets/container.hpp> @@ -39,7 +41,8 @@ typedef std::list<gcn::Widget *>::const_iterator WidgetListConstIterator; * * This container is also non-opaque by default. */ -class Container : public gcn::Container +class Container : public gcn::Container, + public Widget2 { public: Container(); diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 9e9851f24..102263ffb 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -23,6 +23,8 @@ #ifndef DROPDOWN_H #define DROPDOWN_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/dropdown.hpp> #include "localconsts.h" @@ -38,7 +40,8 @@ class Skin; * DropDown you must give DropDown an implemented ListModel which represents * your list. */ -class DropDown final : public gcn::DropDown +class DropDown final : public gcn::DropDown, + public Widget2 { public: /** diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index e5e56cbf3..c0e5e888e 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -94,6 +94,7 @@ void GuiTableActionListener::action(const gcn::ActionEvent GuiTable::GuiTable(TableModel *const initial_model, const bool opacity) : gcn::Widget(), + Widget2(), gcn::MouseListener(), gcn::KeyListener(), mLinewiseMode(false), diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index edbaecef3..f7d5addb5 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -26,6 +26,7 @@ #include "localconsts.h" #include "gui/widgets/tablemodel.h" +#include "gui/widgets/widget2.h" #include <guichan/keylistener.hpp> #include <guichan/mouselistener.hpp> @@ -45,6 +46,7 @@ class GuiTableActionListener; * \ingroup GUI */ class GuiTable final : public gcn::Widget, + public Widget2, public gcn::MouseListener, public gcn::KeyListener, public TableModelListener diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index e8893a5f7..4b7ab9b98 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -31,6 +31,7 @@ Icon::Icon(const std::string &file) : gcn::Widget(), + Widget2(), mImage(ResourceManager::getInstance()->getImage(file)) { if (mImage) diff --git a/src/gui/widgets/icon.h b/src/gui/widgets/icon.h index d04b12d4a..e0cabf3d9 100644 --- a/src/gui/widgets/icon.h +++ b/src/gui/widgets/icon.h @@ -23,6 +23,8 @@ #ifndef ICON_H #define ICON_H +#include "gui/widgets/widget2.h" + #include <guichan/widget.hpp> #include "localconsts.h" @@ -34,7 +36,8 @@ class Image; * * \ingroup GUI */ -class Icon final : public gcn::Widget +class Icon final : public gcn::Widget, + public Widget2 { public: /** diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index d950b28c6..26b9ae74a 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -154,6 +154,7 @@ class SortItemTypeFunctor final ItemContainer::ItemContainer(Inventory *const inventory, const bool forceQuantity) : gcn::Widget(), + Widget2(), gcn::KeyListener(), gcn::MouseListener(), gcn::WidgetListener(), diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index f2c6163d2..7801e0cc9 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -23,6 +23,8 @@ #ifndef ITEMCONTAINER_H #define ITEMCONTAINER_H +#include "gui/widgets/widget2.h" + #include <guichan/keylistener.hpp> #include <guichan/mouselistener.hpp> #include <guichan/widget.hpp> @@ -49,6 +51,7 @@ namespace gcn * \ingroup GUI */ class ItemContainer final : public gcn::Widget, + public Widget2, public gcn::KeyListener, public gcn::MouseListener, public gcn::WidgetListener diff --git a/src/gui/widgets/label.h b/src/gui/widgets/label.h index 09f193436..d249bdf54 100644 --- a/src/gui/widgets/label.h +++ b/src/gui/widgets/label.h @@ -22,6 +22,8 @@ #ifndef LABEL_H #define LABEL_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/label.hpp> #include "localconsts.h" @@ -34,7 +36,7 @@ class Skin; * * \ingroup GUI */ -class Label final : public gcn::Label +class Label final : public gcn::Label, public Widget2 { public: /** diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 47011976c..1a8692309 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -45,6 +45,7 @@ int ListBox::mInstances = 0; ListBox::ListBox(gcn::ListModel *const listModel): gcn::ListBox(listModel), + Widget2(), mHighlightColor(Theme::getThemeColor(Theme::HIGHLIGHT)), mDistributeMousePressed(true), mOldSelected(-1), diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 0512183d1..11d1871c4 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -23,6 +23,8 @@ #ifndef LISTBOX_H #define LISTBOX_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/listbox.hpp> #include "localconsts.h" @@ -37,7 +39,8 @@ class Skin; * * \ingroup GUI */ -class ListBox : public gcn::ListBox +class ListBox : public gcn::ListBox, + public Widget2 { public: /** diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 0fdaa87c3..5156b4bb6 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -37,6 +37,7 @@ PlayerBox::PlayerBox(Being *const being, const std::string &skin) : ScrollArea(), + Widget2(), mBeing(being), mAlpha(1.0), mSkin(nullptr), diff --git a/src/gui/widgets/playerbox.h b/src/gui/widgets/playerbox.h index 5f9d3c54a..9f9a784ec 100644 --- a/src/gui/widgets/playerbox.h +++ b/src/gui/widgets/playerbox.h @@ -23,6 +23,8 @@ #ifndef PLAYERBOX_H #define PLAYERBOX_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/scrollarea.hpp> #include "graphics.h" @@ -38,7 +40,8 @@ class Skin; * * \ingroup GUI */ -class PlayerBox final : public gcn::ScrollArea +class PlayerBox final : public gcn::ScrollArea, + public Widget2 { public: /** diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 7667d399e..05dd80233 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -44,6 +44,7 @@ ProgressBar::ProgressBar(float progress, const int width, const int height, const int color): gcn::Widget(), + Widget2(), gcn::WidgetListener(), mProgress(progress), mProgressToGo(progress), diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index d306f58cb..646aec97f 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -23,12 +23,13 @@ #ifndef PROGRESSBAR_H #define PROGRESSBAR_H +#include "gui/widgets/widget2.h" + #include <guichan/widget.hpp> +#include <guichan/widgetlistener.hpp> #include <string> -#include <guichan/widgetlistener.hpp> - #include "localconsts.h" class Graphics; @@ -41,7 +42,9 @@ class Skin; * * \ingroup GUI */ -class ProgressBar final : public gcn::Widget, public gcn::WidgetListener +class ProgressBar final : public gcn::Widget, + public Widget2, + public gcn::WidgetListener { public: /** diff --git a/src/gui/widgets/progressindicator.h b/src/gui/widgets/progressindicator.h index d96cc8f8c..56f2daff5 100644 --- a/src/gui/widgets/progressindicator.h +++ b/src/gui/widgets/progressindicator.h @@ -22,6 +22,8 @@ #ifndef PROGRESSINDICATOR_H #define PROGRESSINDICATOR_H +#include "gui/widgets/widget2.h" + #include <guichan/widget.hpp> #include "localconsts.h" @@ -32,7 +34,8 @@ class SimpleAnimation; * A widget that indicates progress. Suitable to use instead of a progress bar * in cases where it is unknown how long something is going to take. */ -class ProgressIndicator final : public gcn::Widget +class ProgressIndicator final : public gcn::Widget, + public Widget2 { public: ProgressIndicator(); diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index ecf6862ed..a511a806f 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -23,6 +23,8 @@ #ifndef RADIOBUTTON_H #define RADIOBUTTON_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/radiobutton.hpp> #include "localconsts.h" @@ -33,7 +35,8 @@ class Skin; /** * Guichan based RadioButton with custom look */ -class RadioButton final : public gcn::RadioButton +class RadioButton final : public gcn::RadioButton, + public Widget2 { public: /** diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index c457afc8a..d771819e6 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -23,6 +23,8 @@ #ifndef SCROLLAREA_H #define SCROLLAREA_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/scrollarea.hpp> #include <guichan/widgetlistener.hpp> @@ -41,7 +43,9 @@ class ImageRect; * * \ingroup GUI */ -class ScrollArea final : public gcn::ScrollArea, public gcn::WidgetListener +class ScrollArea final : public gcn::ScrollArea, + public Widget2, + public gcn::WidgetListener { public: /** diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 13c20790a..ba3ad3325 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -32,6 +32,7 @@ float ShortcutContainer::mAlpha = 1.0; ShortcutContainer::ShortcutContainer() : gcn::Widget(), + Widget2(), gcn::WidgetListener(), gcn::MouseListener(), mBackgroundImg(nullptr), diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 62e06db58..ac80bf1b1 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -23,12 +23,13 @@ #ifndef SHORTCUTCONTAINER_H #define SHORTCUTCONTAINER_H +#include "gui/widgets/tab.h" +#include "gui/widgets/widget2.h" + #include <guichan/mouselistener.hpp> #include <guichan/widget.hpp> #include <guichan/widgetlistener.hpp> -#include "gui/widgets/tab.h" - class Image; /** @@ -37,6 +38,7 @@ class Image; * \ingroup GUI */ class ShortcutContainer : public gcn::Widget, + public Widget2, public gcn::WidgetListener, public gcn::MouseListener { diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index edc215b07..380ece104 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -45,6 +45,7 @@ static std::string const data[2] = Slider::Slider(const double scaleEnd) : gcn::Slider(scaleEnd), + Widget2(), mHasMouse(false) { init(); @@ -52,6 +53,7 @@ Slider::Slider(const double scaleEnd) : Slider::Slider(const double scaleStart, const double scaleEnd) : gcn::Slider(scaleStart, scaleEnd), + Widget2(), mHasMouse(false) { init(); diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index fafa6c4cd..018269ea4 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -23,6 +23,8 @@ #ifndef SLIDER_H #define SLIDER_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/slider.hpp> #include "localconsts.h" @@ -35,7 +37,8 @@ class ImageRect; * * \ingroup GUI */ -class Slider final : public gcn::Slider +class Slider final : public gcn::Slider, + public Widget2 { public: /** diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index b6133af0e..0834b8550 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -62,6 +62,7 @@ Skin *Tab::tabImg[TAB_COUNT]; Tab::Tab() : gcn::BasicContainer(), + Widget2(), gcn::MouseListener(), gcn::WidgetListener(), mLabel(new Label), diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index fe9fd3b32..9aca4f4dc 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -23,6 +23,8 @@ #ifndef TAB_H #define TAB_H +#include "gui/widgets/widget2.h" + #include <guichan/basiccontainer.hpp> #include <guichan/mouselistener.hpp> #include <guichan/widgetlistener.hpp> @@ -37,10 +39,10 @@ class TabbedArea; class Theme; /** - * A tab, the same as the Guichan tab in 0.8, but extended to allow - * transparency. + * A tab, the same as the Guichan tab in 0.8, but extended */ class Tab : public gcn::BasicContainer, + public Widget2, public gcn::MouseListener, public gcn::WidgetListener { diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index d41af4542..ab48113bd 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -35,6 +35,7 @@ #include "debug.h" TabbedArea::TabbedArea() : + Widget2(), gcn::ActionListener(), gcn::BasicContainer(), gcn::KeyListener(), diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index e27f879f7..40d3458e9 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -23,6 +23,8 @@ #ifndef TABBEDAREA_H #define TABBEDAREA_H +#include "gui/widgets/widget2.h" + #include <guichan/actionlistener.hpp> #include <guichan/widget.hpp> #include <guichan/widgetlistener.hpp> @@ -37,7 +39,8 @@ class Tab; /** * A tabbed area, the same as the guichan tabbed area in 0.8, but extended */ -class TabbedArea final : public gcn::ActionListener, +class TabbedArea final : public Widget2, + public gcn::ActionListener, public gcn::BasicContainer, public gcn::KeyListener, public gcn::MouseListener, diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index cbefa4006..d66bbced6 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -35,6 +35,7 @@ TextBox::TextBox() : gcn::TextBox(), + Widget2(), mMinWidth(getWidth()) { mForegroundColor = Theme::getThemeColor(Theme::TEXTBOX); diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 300a9d771..335ef777a 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -23,6 +23,8 @@ #ifndef TEXTBOX_H #define TEXTBOX_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/textbox.hpp> #include "localconsts.h" @@ -34,7 +36,8 @@ * * \ingroup GUI */ -class TextBox final : public gcn::TextBox +class TextBox final : public gcn::TextBox, + public Widget2 { public: /** diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index ac29eac25..690bddcd9 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -51,6 +51,7 @@ TextField::TextField(const std::string &text, const bool loseFocusOnTab, gcn::ActionListener *const listener, std::string eventId, const bool sendAlwaysEvents): gcn::TextField(text), + Widget2(), mSendAlwaysEvents(sendAlwaysEvents), mNumeric(false), mMinimum(0), diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index f231dfb77..713895da4 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -23,6 +23,8 @@ #ifndef TEXTFIELD_H #define TEXTFIELD_H +#include "gui/widgets/widget2.h" + #include <guichan/widgets/textfield.hpp> #include "localconsts.h" @@ -35,7 +37,8 @@ class TextField; * * \ingroup GUI */ -class TextField : public gcn::TextField +class TextField : public gcn::TextField, + public Widget2 { public: /** diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index a8591b22a..17630cbec 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -35,6 +35,7 @@ float TextPreview::mAlpha = 1.0; TextPreview::TextPreview(const std::string &text) : gcn::Widget(), + Widget2(), mFont(gui->getFont()), mText(text), mTextColor(&Theme::getThemeColor(Theme::TEXT)), diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index e9b23006d..c2a46930e 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -23,6 +23,8 @@ #ifndef TEXTPREVIEW_H #define TEXTPREVIEW_H +#include "gui/widgets/widget2.h" + #include <guichan/color.hpp> #include <guichan/font.hpp> #include <guichan/widget.hpp> @@ -32,7 +34,8 @@ /** * Preview widget for particle colors, etc. */ -class TextPreview final : public gcn::Widget +class TextPreview final : public gcn::Widget, + public Widget2 { public: TextPreview(const std::string &text); diff --git a/src/gui/widgets/widget2.cpp b/src/gui/widgets/widget2.cpp new file mode 100644 index 000000000..6b38b0cf5 --- /dev/null +++ b/src/gui/widgets/widget2.cpp @@ -0,0 +1,31 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012 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 "gui/widgets/widget2.h" + +#include "debug.h" + +Widget2::Widget2() +{ +} + +Widget2::~Widget2() +{ +} diff --git a/src/gui/widgets/widget2.h b/src/gui/widgets/widget2.h new file mode 100644 index 000000000..68a45ae30 --- /dev/null +++ b/src/gui/widgets/widget2.h @@ -0,0 +1,32 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012 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 GUI_WIDGET2_H +#define GUI_WIDGET2_H + +class Widget2 +{ + public: + Widget2(); + + ~Widget2(); +}; + +#endif diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index a975f2db1..dbf1e747d 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -50,6 +50,7 @@ int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, Window *const parent, std::string skin) : gcn::Window(caption), + Widget2(), gcn::WidgetListener(), mSkin(nullptr), mGrip(nullptr), diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 00a72660e..e758a4d99 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -26,6 +26,8 @@ #include "graphics.h" #include "localconsts.h" +#include "gui/widgets/widget2.h" + #include <guichan/widgetlistener.hpp> #include <guichan/widgets/window.hpp> @@ -44,7 +46,9 @@ class WindowContainer; * * \ingroup GUI */ -class Window : public gcn::Window, private gcn::WidgetListener +class Window : public gcn::Window, + public Widget2, + private gcn::WidgetListener { public: /** |