diff options
Diffstat (limited to 'src/gui/widgets')
35 files changed, 95 insertions, 37 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index fded0cbe7..9c281de86 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(), + MouseListener(), mLinkHandler(nullptr), mMode(mode), mHighMode(UNDERLINE | BACKGROUND), diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 3f253932b..5d0a36f32 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -65,6 +65,8 @@ static std::string const data[BUTTON_COUNT] = ImageRect Button::button[BUTTON_COUNT]; Button::Button() : + gcn::Button(), + WidgetListener(), mDescription(""), mClickCount(0), mTag(0), mVertexes(new GraphicsVertexes()), @@ -74,6 +76,8 @@ Button::Button() : mYOffset(0), mImages(nullptr), mImageSet(nullptr), + mImageWidth(0), + mImageHeight(0), mStick(false), mPressed(false) { @@ -84,6 +88,7 @@ Button::Button() : Button::Button(const std::string &caption, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(caption), + WidgetListener(), mDescription(""), mClickCount(0), mTag(0), @@ -141,6 +146,7 @@ Button::Button(const std::string &imageName, const std::string &actionEventId, gcn::ActionListener *const listener) : gcn::Button(""), + WidgetListener(), mDescription(""), mClickCount(0), mTag(0), diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 2a15c3044..3ac0cf0e3 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -24,7 +24,8 @@ #include "debug.h" -Container::Container() +Container::Container() : + gcn::Container() { setOpaque(false); } diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 01002640a..7cf6b2608 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -39,6 +39,8 @@ #include "debug.h" Desktop::Desktop() : + Container(), + WidgetListener(), mWallpaper(nullptr), mBackgroundColor(Theme::getThemeColor(Theme::BACKGROUND, 128)), mBackgroundGrayColor(Theme::getThemeColor(Theme::BACKGROUND_GRAY)) diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index 7302a039b..240ec41f7 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -24,8 +24,12 @@ #include "debug.h" FlowContainer::FlowContainer(const int boxWidth, const int boxHeight) : - mBoxWidth(boxWidth), mBoxHeight(boxHeight), - mGridWidth(1), mGridHeight(1) + Container(), + WidgetListener(), + mBoxWidth(boxWidth), + mBoxHeight(boxHeight), + mGridWidth(1), + mGridHeight(1) { addWidgetListener(this); if (!mBoxWidth) diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 4ffe8221f..dc158b95f 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -60,6 +60,7 @@ protected: GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *widget, int row, int column) : + ActionListener(), mTable(table), mRow(row), mColumn(column), diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index f00a3cbf3..77abfdd4b 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -177,9 +177,6 @@ private: int mSelectedRow; int mSelectedColumn; - /** Number of frames to skip upwards when drawing the selected widget. */ - int mPopFramesNr; - /** If someone moves a fresh widget to the top, we must display it. */ gcn::Widget *mTopWidget; diff --git a/src/gui/widgets/horizontcontainer.cpp b/src/gui/widgets/horizontcontainer.cpp index 91632bf55..83a430b47 100644 --- a/src/gui/widgets/horizontcontainer.cpp +++ b/src/gui/widgets/horizontcontainer.cpp @@ -24,6 +24,8 @@ #include "debug.h" HorizontContainer::HorizontContainer(const int height, const int spacing) : + Container(), + WidgetListener(), mSpacing(spacing), mCount(0), mLastX(spacing) diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index e7404ad93..e43f85af0 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -29,15 +29,17 @@ #include "debug.h" -Icon::Icon(const std::string &file) - : mImage(ResourceManager::getInstance()->getImage(file)) +Icon::Icon(const std::string &file) : + Widget(), + mImage(ResourceManager::getInstance()->getImage(file)) { if (mImage) setSize(mImage->mBounds.w, mImage->mBounds.h); } -Icon::Icon(Image *const image) - : mImage(image) +Icon::Icon(Image *const image) : + Widget(), + mImage(image) { if (mImage) setSize(mImage->mBounds.w, mImage->mBounds.h); diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index bb7de3a13..d8612cc96 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -34,6 +34,8 @@ IntTextField::IntTextField(const int def, const int min, const int max, const bool enabled, const int width) : TextField(toString(def)), + mMin(0), + mMax(0), mDefault(def), mValue(def) { diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index d0331fb37..08c26d152 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -156,6 +156,10 @@ class SortItemTypeFunctor ItemContainer::ItemContainer(Inventory *const inventory, const bool forceQuantity) : + Widget(), + KeyListener(), + MouseListener(), + WidgetListener(), mInventory(inventory), mGridColumns(1), mGridRows(1), @@ -167,6 +171,8 @@ ItemContainer::ItemContainer(Inventory *const inventory, mForceQuantity(forceQuantity), mSwapItems(false), mDescItems(false), + mDragPosX(0), + mDragPosY(0), mTag(0), mSortType(0), mItemPopup(new ItemPopup), diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index f39af8d7e..02309ebc9 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -194,7 +194,8 @@ class ItemContainer : public gcn::Widget, bool mForceQuantity; bool mSwapItems; bool mDescItems; - int mDragPosX, mDragPosY; + int mDragPosX; + int mDragPosY; int mTag; int mSortType; std::string mName; diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index c0d708975..2e17b7d80 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -25,7 +25,8 @@ #include "debug.h" -Label::Label() +Label::Label() : + gcn::Label() { setForegroundColor(Theme::getThemeColor(Theme::LABEL)); } diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index bfb190e41..6ad1bb71b 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -364,7 +364,9 @@ void LayoutArray::reflow(const int nx, const int ny, } } -Layout::Layout(): mComputed(false) +Layout::Layout() : + LayoutCell(), + mComputed(false) { getArray(); setPadding(6); diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index e0dc82b8f..c3b219415 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -25,6 +25,7 @@ #include "debug.h" LayoutHelper::LayoutHelper(gcn::Container *const container) : + WidgetListener(), mContainer(container) { mContainer->addWidgetListener(this); diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 745e37e31..0b0e548b2 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -36,6 +36,7 @@ #include "debug.h" PlayerBox::PlayerBox(Being *const being, const std::string &skin) : + ScrollArea(), mBeing(being), mAlpha(1.0), mSkin(nullptr), @@ -44,7 +45,8 @@ PlayerBox::PlayerBox(Being *const being, const std::string &skin) : init(skin); } -PlayerBox::PlayerBox(std::string skin): +PlayerBox::PlayerBox(std::string skin) : + ScrollArea(), mBeing(nullptr), mAlpha(1.0), mSkin(nullptr), diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 8c0e938ba..fe3b63bf2 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -36,7 +36,10 @@ #include "debug.h" -Popup::Popup(const std::string &name, std::string skin): +Popup::Popup(const std::string &name, std::string skin) : + Container(), + MouseListener(), + WidgetListener(), mPopupName(name), mMinWidth(100), mMinHeight(40), diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp index 3980d0330..c85eb6220 100644 --- a/src/gui/widgets/progressbar.cpp +++ b/src/gui/widgets/progressbar.cpp @@ -45,6 +45,9 @@ ProgressBar::ProgressBar(float progress, const int width, const int height, const int color): gcn::Widget(), + WidgetListener(), + mProgress(progress), + mProgressToGo(progress), mSmoothProgress(true), mProgressPalette(color), mSmoothColorChange(true), @@ -55,14 +58,9 @@ ProgressBar::ProgressBar(float progress, if (progress > 1.0f || progress < 0.0f) progress = 1.0f; - mProgress = progress; - mProgressToGo = progress; - mColor = Theme::getProgressColor(color >= 0 ? color : 0, mProgress); mColorToGo = mColor; - addWidgetListener(this); - setSize(width, height); if (mInstances == 0) diff --git a/src/gui/widgets/progressbar.h b/src/gui/widgets/progressbar.h index 5a188c0d0..0b4927cc9 100644 --- a/src/gui/widgets/progressbar.h +++ b/src/gui/widgets/progressbar.h @@ -137,7 +137,8 @@ class ProgressBar : public gcn::Widget, public gcn::WidgetListener void widgetMoved(const gcn::Event &event); private: - float mProgress, mProgressToGo; + float mProgress; + float mProgressToGo; bool mSmoothProgress; int mProgressPalette; /** < Entry in ProgressPalette or -1 for none. */ diff --git a/src/gui/widgets/progressindicator.cpp b/src/gui/widgets/progressindicator.cpp index 27fb104c7..565d83da7 100644 --- a/src/gui/widgets/progressindicator.cpp +++ b/src/gui/widgets/progressindicator.cpp @@ -34,7 +34,8 @@ #include "debug.h" -ProgressIndicator::ProgressIndicator() +ProgressIndicator::ProgressIndicator() : + gcn::Widget() { ImageSet *const images = Theme::getImageSetFromTheme( "progress-indicator.png", 32, 32); diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 53254193d..d1c9ee8a9 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -38,7 +38,8 @@ Image *ResizeGrip::gripImage = nullptr; int ResizeGrip::mInstances = 0; float ResizeGrip::mAlpha = 1.0; -ResizeGrip::ResizeGrip(const std::string &image) +ResizeGrip::ResizeGrip(const std::string &image) : + gcn::Widget() { if (mInstances == 0) { diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 28532927b..c290a720a 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -49,6 +49,7 @@ static std::string const buttonFiles[2] = ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : gcn::ScrollArea(), + gcn::WidgetListener(), mX(0), mY(0), mClickX(0), @@ -69,6 +70,7 @@ ScrollArea::ScrollArea(const bool opaque, const std::string &skin) : ScrollArea::ScrollArea(gcn::Widget *const widget, const bool opaque, const std::string &skin) : gcn::ScrollArea(widget), + gcn::WidgetListener(), mX(0), mY(0), mClickX(0), diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index f569fddb5..618011dee 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -50,6 +50,7 @@ SetupItem::SetupItem(std::string text, std::string description, std::string keyName, SetupTabScroll *const parent, std::string eventName, const bool mainConfig) : + ActionListener(), mText(text), mDescription(description), mKeyName(keyName), @@ -68,6 +69,7 @@ SetupItem::SetupItem(std::string text, std::string description, std::string keyName, SetupTabScroll *const parent, std::string eventName, std::string def, const bool mainConfig) : + ActionListener(), mText(text), mDescription(description), mKeyName(keyName), diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp index d4ae46eb8..9f2560134 100644 --- a/src/gui/widgets/setuptab.cpp +++ b/src/gui/widgets/setuptab.cpp @@ -24,7 +24,9 @@ #include "debug.h" -SetupTab::SetupTab() +SetupTab::SetupTab() : + Container(), + gcn::ActionListener() { setOpaque(false); } diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index b54364ebd..97c4d1b7d 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -30,7 +30,10 @@ float ShortcutContainer::mAlpha = 1.0; -ShortcutContainer::ShortcutContainer(): +ShortcutContainer::ShortcutContainer() : + gcn::Widget(), + gcn::WidgetListener(), + gcn::MouseListener(), mBackgroundImg(nullptr), mMaxItems(0), mBoxWidth(1), diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index dd27cfbe5..ad7fde18f 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -42,6 +42,9 @@ static const int sliderHeight = 30; SliderList::SliderList(gcn::ListModel *const listModel, gcn::ActionListener *const listener, std::string eventId) : + Container(), + gcn::ActionListener(), + gcn::MouseListener(), mLabel(new Label), mListModel(listModel), mOldWidth(0), diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index 2a3799ca8..7b02b3281 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -48,6 +48,7 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : ShortcutContainer(), mSpellClicked(false), mSpellMoved(nullptr), + mSpellPopup(new SpellPopup), mNumber(number) { mBoxWidth = mBoxWidth; @@ -55,8 +56,6 @@ SpellShortcutContainer::SpellShortcutContainer(const unsigned number) : addMouseListener(this); addWidgetListener(this); - mSpellPopup = new SpellPopup; - mBackgroundImg = Theme::getImageFromThemeXml( "item_shortcut_background.xml", "background.xml"); if (spellShortcut) diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 479735e7c..0999dc7a9 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -63,6 +63,7 @@ ImageRect Tab::tabImg[TAB_COUNT]; Tab::Tab() : gcn::Tab(), + gcn::WidgetListener(), mTabColor(&Theme::getThemeColor(Theme::TAB)), mTabHighlightedColor(&Theme::getThemeColor(Theme::TAB_HIGHLIGHTED)), mTabSelectedColor(&Theme::getThemeColor(Theme::TAB_SELECTED)), diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index ae5f92fd9..06af8a83a 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -36,6 +36,7 @@ TabbedArea::TabbedArea() : gcn::TabbedArea(), + gcn::WidgetListener(), mTabsWidth(0), mVisibleTabsWidth(0), mTabScrollIndex(0), diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index f43622a9c..59cd58ba7 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -64,6 +64,7 @@ void TableModel::signalAfterUpdate() #define DYN_SIZE(h) ((h) >= 0) StaticTableModel::StaticTableModel(const int row, const int column) : + TableModel(), mRows(row), mColumns(column), mHeight(1) diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 5079b8bf2..541308e5e 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -34,11 +34,12 @@ #include "debug.h" TextBox::TextBox() : + gcn::TextBox(), + mMinWidth(getWidth()), mTextColor(&Theme::getThemeColor(Theme::TEXTBOX)) { setOpaque(false); setFrameSize(0); - mMinWidth = getWidth(); } void TextBox::setTextWrapped(const std::string &text, const int minDimension) diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index f78d4a4b7..43b81b2ce 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -35,7 +35,8 @@ float TextPreview::mAlpha = 1.0; -TextPreview::TextPreview(const std::string &text): +TextPreview::TextPreview(const std::string &text) : + gcn::Widget(), mFont(gui->getFont()), mText(text), mTextColor(&Theme::getThemeColor(Theme::TEXT)), diff --git a/src/gui/widgets/vertcontainer.cpp b/src/gui/widgets/vertcontainer.cpp index 46ea86c0e..a6a4748f3 100644 --- a/src/gui/widgets/vertcontainer.cpp +++ b/src/gui/widgets/vertcontainer.cpp @@ -24,7 +24,9 @@ #include "debug.h" VertContainer::VertContainer(const int verticalItemSize, const bool resizable, - const int leftSpacing): + const int leftSpacing) : + Container(), + gcn::WidgetListener(), mVerticalItemSize(verticalItemSize), mCount(0), mNextY(0), diff --git a/src/gui/widgets/widgetgroup.cpp b/src/gui/widgets/widgetgroup.cpp index 104d319a0..aacabd0f1 100644 --- a/src/gui/widgets/widgetgroup.cpp +++ b/src/gui/widgets/widgetgroup.cpp @@ -26,6 +26,9 @@ WidgetGroup::WidgetGroup(const std::string &group, const int height, const int spacing) : + Container(), + gcn::WidgetListener(), + gcn::ActionListener(), mSpacing(spacing), mCount(0), mGroup(group), diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 58247870f..f2266dfd1 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -46,8 +46,10 @@ int Window::instances = 0; int Window::mouseResize = 0; Window::Window(const std::string &caption, const bool modal, - Window *const parent, std::string skin): + Window *const parent, std::string skin) : gcn::Window(caption), + gcn::WidgetListener(), + mSkin(nullptr), mGrip(nullptr), mParent(parent), mLayout(nullptr), @@ -64,12 +66,17 @@ Window::Window(const std::string &caption, const bool modal, mMinWinHeight(40), mMaxWinWidth(mainGraphics->mWidth), mMaxWinHeight(mainGraphics->mHeight), + mDefaultX(0), + mDefaultY(0), + mDefaultWidth(0), + mDefaultHeight(0), mVertexes(new GraphicsVertexes()), mCaptionOffsetX(7), mCaptionOffsetY(5), mCaptionAlign(gcn::Graphics::LEFT), mTitlePadding(4), - mRedraw(true) + mRedraw(true), + mCaptionFont(getFont()) { logger->log("Window::Window(\"%s\")", caption.c_str()); @@ -108,10 +115,6 @@ Window::Window(const std::string &caption, const bool modal, } } } - else - { - mSkin = nullptr; - } // Add this window to the window container windowContainer->add(this); @@ -126,7 +129,6 @@ Window::Window(const std::string &caption, const bool modal, setVisible(false); addWidgetListener(this); - mCaptionFont = getFont(); setForegroundColor(Theme::getThemeColor(Theme::WINDOW)); } |