diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-09-17 19:07:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-09-17 19:07:25 +0300 |
commit | e9fb9da5bf17d3402781eb5205be7d2f794887ee (patch) | |
tree | 729a7932fab668bcc2de180ebfe287e811f8e136 /src | |
parent | 00ec60c1c0c3db8e3602e85dd152106f59f0c0e2 (diff) | |
download | manaplus-e9fb9da5bf17d3402781eb5205be7d2f794887ee.tar.gz manaplus-e9fb9da5bf17d3402781eb5205be7d2f794887ee.tar.bz2 manaplus-e9fb9da5bf17d3402781eb5205be7d2f794887ee.tar.xz manaplus-e9fb9da5bf17d3402781eb5205be7d2f794887ee.zip |
Add strong typed bool Opaque.
Diffstat (limited to 'src')
66 files changed, 201 insertions, 134 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9666e881a..8a7757c7f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1262,6 +1262,7 @@ SET(SRCS enums/simpletypes/npcnames.h enums/simpletypes/online.h enums/simpletypes/onthefly.h + enums/simpletypes/opaque.h enums/simpletypes/protected.h enums/simpletypes/separator.h enums/simpletypes/sfx.h diff --git a/src/Makefile.am b/src/Makefile.am index 40ad1f30a..3a8b8172f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -703,6 +703,7 @@ SRC += events/actionevent.h \ enums/simpletypes/npcnames.h \ enums/simpletypes/online.h \ enums/simpletypes/onthefly.h \ + enums/simpletypes/opaque.h \ enums/simpletypes/protected.h \ enums/simpletypes/separator.h \ enums/simpletypes/sfx.h \ diff --git a/src/dyetool/gui/viewport.cpp b/src/dyetool/gui/viewport.cpp index d61d33998..029d011bf 100644 --- a/src/dyetool/gui/viewport.cpp +++ b/src/dyetool/gui/viewport.cpp @@ -64,7 +64,7 @@ Viewport::Viewport() : mMouseClicked(false), mPlayerFollowMouse(false) { - setOpaque(false); + setOpaque(Opaque_false); addMouseListener(this); config.addListener("ScrollLaziness", this); diff --git a/src/enums/simpletypes/opaque.h b/src/enums/simpletypes/opaque.h new file mode 100644 index 000000000..f4b2ce75e --- /dev/null +++ b/src/enums/simpletypes/opaque.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2016 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 ENUMS_SIMPLETYPES_OPAQUE_H +#define ENUMS_SIMPLETYPES_OPAQUE_H + +#include "enums/simpletypes/booldefines.h" + +PRAGMA6(GCC diagnostic push) +PRAGMA6(GCC diagnostic ignored "-Wunused-const-variable") + +defBoolEnum(Opaque); + +PRAGMA6(GCC diagnostic pop) + +#endif // ENUMS_SIMPLETYPES_OPAQUE_H diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 32f042ad2..8f643282b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -164,7 +164,7 @@ void Gui::postInit(Graphics *const graphics) WindowContainer *const guiTop = new WindowContainer(nullptr); guiTop->setFocusable(true); guiTop->setSize(graphics->mWidth, graphics->mHeight); - guiTop->setOpaque(false); + guiTop->setOpaque(Opaque_false); Window::setWindowContainer(guiTop); setTop(guiTop); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 393d2374a..5eb9d5813 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -104,7 +104,7 @@ PopupMenu *popupMenu = nullptr; PopupMenu::PopupMenu() : Popup("PopupMenu", "popupmenu.xml"), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "popupbrowserbox.xml")), mScrollArea(nullptr), mBeingId(BeingId_zero), @@ -129,14 +129,14 @@ PopupMenu::PopupMenu() : mY(0), mAllowCleanMenu(true) { - mBrowserBox->setOpaque(false); + mBrowserBox->setOpaque(Opaque_false); mBrowserBox->setLinkHandler(this); mRenameListener.setMapItem(nullptr); mRenameListener.setDialog(nullptr); mPlayerListener.setNick(""); mPlayerListener.setDialog(nullptr); mPlayerListener.setType(ActorType::Unknown); - mScrollArea = new ScrollArea(this, mBrowserBox, false); + mScrollArea = new ScrollArea(this, mBrowserBox, Opaque_false); mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); addMouseListener(this); } diff --git a/src/gui/popups/speechbubble.cpp b/src/gui/popups/speechbubble.cpp index 39a751dbe..0909df225 100644 --- a/src/gui/popups/speechbubble.cpp +++ b/src/gui/popups/speechbubble.cpp @@ -39,7 +39,7 @@ SpeechBubble::SpeechBubble() : mText(), mSpacing(mSkin ? mSkin->getOption("spacing") : 2), mCaption(new Label(this)), - mSpeechBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mSpeechBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "speechbrowserbox.xml")) { setContentSize(140, 46); @@ -47,7 +47,7 @@ SpeechBubble::SpeechBubble() : setMinHeight(8); mCaption->setFont(boldFont); - mSpeechBox->setOpaque(false); + mSpeechBox->setOpaque(Opaque_false); mSpeechBox->setForegroundColorAll(getThemeColor(ThemeColorId::BUBBLE_TEXT), getThemeColor(ThemeColorId::BUBBLE_TEXT_OUTLINE)); } diff --git a/src/gui/popups/textboxpopup.cpp b/src/gui/popups/textboxpopup.cpp index a03fd9497..ec237d34c 100644 --- a/src/gui/popups/textboxpopup.cpp +++ b/src/gui/popups/textboxpopup.cpp @@ -45,7 +45,7 @@ void TextBoxPopup::postInit() const int fontHeight = getFont()->getHeight(); setMinHeight(fontHeight); mTextBox->setEditable(false); - mTextBox->setOpaque(false); + mTextBox->setOpaque(Opaque_false); add(mTextBox); addMouseListener(this); } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index ba42ee2a2..42a6aff98 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -95,7 +95,7 @@ Viewport::Viewport() : mMouseClicked(false), mPlayerFollowMouse(false) { - setOpaque(false); + setOpaque(Opaque_false); addMouseListener(this); config.addListener("ScrollLaziness", this); diff --git a/src/gui/widgets/basiccontainer2.cpp b/src/gui/widgets/basiccontainer2.cpp index 8ce16487b..6317a725b 100644 --- a/src/gui/widgets/basiccontainer2.cpp +++ b/src/gui/widgets/basiccontainer2.cpp @@ -73,7 +73,7 @@ BasicContainer2::BasicContainer2(const Widget2 *const widget) : BasicContainer(widget), - mOpaque(true) + mOpaque(Opaque_true) { } @@ -84,7 +84,7 @@ BasicContainer2::~BasicContainer2() void BasicContainer2::draw(Graphics *const graphics) { BLOCK_START("BasicContainer2::draw") - if (mOpaque) + if (mOpaque == Opaque_true) { graphics->setColor(mBaseColor); graphics->fillRectangle(Rect(0, 0, @@ -98,7 +98,7 @@ void BasicContainer2::draw(Graphics *const graphics) void BasicContainer2::safeDraw(Graphics *const graphics) { BLOCK_START("BasicContainer2::draw") - if (isOpaque()) + if (mOpaque == Opaque_true) { graphics->setColor(mBaseColor); graphics->fillRectangle(Rect(0, 0, diff --git a/src/gui/widgets/basiccontainer2.h b/src/gui/widgets/basiccontainer2.h index f08592ed3..853b3cc07 100644 --- a/src/gui/widgets/basiccontainer2.h +++ b/src/gui/widgets/basiccontainer2.h @@ -66,6 +66,8 @@ #include "gui/widgets/basiccontainer.h" +#include "enums/simpletypes/opaque.h" + /** * An implementation of a container able to contain other widgets. A widget's * position in the container is relative to the container itself and not the screen. @@ -102,7 +104,7 @@ class BasicContainer2: public BasicContainer * @param opaque True if the container should be opaque, false otherwise. * @see isOpaque */ - void setOpaque(bool opaque) + void setOpaque(Opaque opaque) { mOpaque = opaque; } /** @@ -112,7 +114,7 @@ class BasicContainer2: public BasicContainer * @see setOpaque */ bool isOpaque() const - { return mOpaque; } + { return mOpaque == Opaque_true; } /** * Adds a widget to the container. @@ -145,7 +147,7 @@ class BasicContainer2: public BasicContainer /** * True if the container is opaque, false otherwise. */ - bool mOpaque; + Opaque mOpaque; }; #endif // GUI_WIDGETS_BASICCONTAINER2_H diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 483d4e09e..7aeeda6a8 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -86,7 +86,7 @@ int BrowserBox::mInstances = 0; BrowserBox::BrowserBox(const Widget2 *const widget, const unsigned int mode, - const bool opaque, + const Opaque opaque, const std::string &skin) : Widget(widget), MouseListener(), @@ -506,7 +506,7 @@ void BrowserBox::draw(Graphics *const graphics) if (mDimension.width != mWidth) updateHeight(); - if (mOpaque) + if (mOpaque == Opaque_true) { graphics->setColor(mBackgroundColor); graphics->fillRectangle(Rect(0, 0, diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h index 74acc8847..c578c2633 100644 --- a/src/gui/widgets/browserbox.h +++ b/src/gui/widgets/browserbox.h @@ -26,6 +26,8 @@ #include "listeners/mouselistener.h" +#include "enums/simpletypes/opaque.h" + #include "gui/widgets/linepart.h" #include "gui/widgets/widget.h" @@ -66,7 +68,7 @@ class BrowserBox final : public Widget, */ BrowserBox(const Widget2 *const widget, const unsigned int mode, - const bool opaque, + const Opaque opaque, const std::string &skin); A_DELETE_COPY(BrowserBox) @@ -84,7 +86,7 @@ class BrowserBox final : public Widget, /** * Sets the BrowserBox opacity. */ - void setOpaque(bool opaque) + void setOpaque(Opaque opaque) { mOpaque = opaque; } /** @@ -238,7 +240,7 @@ class BrowserBox final : public Widget, Color mHyperLinkColor; Color mColors[2][COLORS_MAX]; - bool mOpaque; + Opaque mOpaque; bool mUseLinksAndUserColors; bool mUseEmotes; bool mAlwaysUpdate; diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 042f51ff4..9015a21f6 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -29,7 +29,7 @@ Container::Container(const Widget2 *const widget) : BasicContainer2(widget) { - setOpaque(false); + setOpaque(Opaque_false); } Container::~Container() diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp index 253dd58ab..178931dc8 100644 --- a/src/gui/widgets/desktop.cpp +++ b/src/gui/widgets/desktop.cpp @@ -52,7 +52,7 @@ Desktop::Desktop(const Widget2 *const widget) : LinkHandler(), WidgetListener(), mWallpaper(nullptr), - mVersionLabel(new BrowserBox(this, BrowserBox::AUTO_WRAP, false, + mVersionLabel(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_false, "browserbox.xml")), mSkin(nullptr), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND, 128)), diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 7ab9674c5..9009b914c 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -41,7 +41,7 @@ float GuiTable::mAlpha = 1.0; GuiTable::GuiTable(const Widget2 *const widget, TableModel *const initial_model, - const bool opacity) : + const Opaque opacity) : Widget(widget), MouseListener(), KeyListener(), @@ -235,7 +235,7 @@ void GuiTable::draw(Graphics *const graphics) const int width = rect.width; const int height = rect.height; const int y = rect.y; - if (mOpaque) + if (mOpaque == Opaque_true) { mBackgroundColor.a = CAST_U32(mAlpha * 255.0F); graphics->setColor(mBackgroundColor); @@ -353,7 +353,7 @@ void GuiTable::safeDraw(Graphics *const graphics) const int width = rect.width; const int height = rect.height; const int y = rect.y; - if (mOpaque) + if (mOpaque == Opaque_true) { mBackgroundColor.a = CAST_U32(mAlpha * 255.0F); graphics->setColor(mBackgroundColor); diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 35000ccff..b411eff79 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -25,6 +25,8 @@ #include "localconsts.h" +#include "enums/simpletypes/opaque.h" + #include "listeners/keylistener.h" #include "listeners/mouselistener.h" #include "listeners/tablemodellistener.h" @@ -54,7 +56,7 @@ class GuiTable final : public Widget, public: GuiTable(const Widget2 *const widget, TableModel *const initial_model, - const bool opacity = true); + const Opaque opacity = Opaque_true); A_DELETE_COPY(GuiTable) @@ -131,7 +133,7 @@ class GuiTable final : public Widget, * * @param opaque True if the table should be opaque, false otherwise. */ - void setOpaque(bool opaque) + void setOpaque(Opaque opaque) { mOpaque = opaque; } /** @@ -141,7 +143,7 @@ class GuiTable final : public Widget, * @return True if the table is opaque, false otherwise. */ bool isOpaque() const A_WARN_UNUSED - { return mOpaque; } + { return mOpaque == Opaque_true; } // Inherited from MouseListener void mousePressed(MouseEvent& event) override final; @@ -198,7 +200,7 @@ class GuiTable final : public Widget, bool mLinewiseMode; bool mWrappingEnabled; - bool mOpaque; + Opaque mOpaque; bool mSelectable; }; diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 3477ef653..35eced4c2 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -42,7 +42,7 @@ PopupList::PopupList(DropDown *const widget, widget, listModel, "extendedlistbox.xml", 0) : CREATEWIDGETR(ListBox, widget, listModel, "popuplistbox.xml")), - mScrollArea(new ScrollArea(this, mListBox, false)), + mScrollArea(new ScrollArea(this, mListBox, Opaque_false)), mDropDown(widget), mPressedIndex(-2), mModal(modal) diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index bd386f820..18b99527d 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -103,7 +103,7 @@ static std::string const buttonFiles[2] = ScrollArea::ScrollArea(Widget2 *const widget2, Widget *const widget, - const bool opaque, + const Opaque opaque, const std::string &skin) : BasicContainer(widget2), MouseListener(), @@ -137,7 +137,7 @@ ScrollArea::ScrollArea(Widget2 *const widget2, mRightButtonPressed(false), mIsVerticalMarkerDragged(false), mIsHorizontalMarkerDragged(false), - mOpaque(true), + mOpaque(Opaque_true), mHasMouse(false) { setContent(widget); @@ -320,7 +320,7 @@ void ScrollArea::draw(Graphics *const graphics) BLOCK_START("ScrollArea::draw") if (mVBarVisible || mHBarVisible) { - if (!mOpaque) + if (mOpaque == Opaque_false) updateCalcFlag(graphics); // need add caching or remove calc calls. // if (mRedraw) @@ -430,7 +430,7 @@ void ScrollArea::updateCalcFlag(const Graphics *const graphics) void ScrollArea::drawFrame(Graphics *const graphics) { BLOCK_START("ScrollArea::drawFrame") - if (mOpaque) + if (mOpaque == Opaque_true) { const int bs = mFrameSize * 2; const int w = mDimension.width + bs; @@ -455,7 +455,7 @@ void ScrollArea::drawFrame(Graphics *const graphics) void ScrollArea::safeDrawFrame(Graphics *const graphics) { BLOCK_START("ScrollArea::drawFrame") - if (mOpaque) + if (mOpaque == Opaque_true) { const int bs = mFrameSize * 2; const int w = mDimension.width + bs; @@ -469,10 +469,10 @@ void ScrollArea::safeDrawFrame(Graphics *const graphics) BLOCK_END("ScrollArea::drawFrame") } -void ScrollArea::setOpaque(bool opaque) +void ScrollArea::setOpaque(Opaque opaque) { mOpaque = opaque; - setFrameSize(mOpaque ? 2 : 0); + setFrameSize(mOpaque == Opaque_true ? 2 : 0); } Image *ScrollArea::getImageByState(Rect &dim, const BUTTON_DIR dir) diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 3432c34d8..4392f4bcf 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -68,6 +68,8 @@ #include "gui/widgets/basiccontainer.h" +#include "enums/simpletypes/opaque.h" + #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" @@ -113,7 +115,7 @@ class ScrollArea final : public BasicContainer, */ ScrollArea(Widget2 *const widget2, Widget *const widget, - const bool opaque = true, + const Opaque opaque = Opaque_true, const std::string &skin = ""); A_DELETE_COPY(ScrollArea) @@ -152,13 +154,13 @@ class ScrollArea final : public BasicContainer, /** * Sets whether the widget should draw its background or not. */ - void setOpaque(bool opaque); + void setOpaque(Opaque opaque); /** * Returns whether the widget draws its background or not. */ bool isOpaque() const A_WARN_UNUSED - { return mOpaque; } + { return mOpaque == Opaque_true; } /** * Called when the mouse moves in the widget area. @@ -591,7 +593,7 @@ class ScrollArea final : public BasicContainer, * True if the scroll area should be opaque (that is * display its background), false otherwise. */ - bool mOpaque; + Opaque mOpaque; bool mHasMouse; }; diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index dbeab87ca..e7513dd89 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -100,7 +100,8 @@ void SellDialog::postInit() ShopListBoxType::Unknown); mShopItemList->setProtectItems(true); mScrollArea = new ScrollArea(this, mShopItemList, - getOptionBool("showbackground"), "sell_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "sell_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mSellButton = new Button(this, diff --git a/src/gui/widgets/statspage.cpp b/src/gui/widgets/statspage.cpp index 0aab870e6..556240d17 100644 --- a/src/gui/widgets/statspage.cpp +++ b/src/gui/widgets/statspage.cpp @@ -37,7 +37,7 @@ StatsPage::StatsPage(const Widget2 *const widget, StatListener(), mAttrs(), mAttrCont(new VertContainer(this, 32)), - mAttrScroll(new ScrollArea(this, mAttrCont, false)) + mAttrScroll(new ScrollArea(this, mAttrCont, Opaque_false)) { addWidgetListener(this); diff --git a/src/gui/widgets/statspagebasic.cpp b/src/gui/widgets/statspagebasic.cpp index 1e2ff3cac..7885f6d90 100644 --- a/src/gui/widgets/statspagebasic.cpp +++ b/src/gui/widgets/statspagebasic.cpp @@ -41,7 +41,7 @@ StatsPageBasic::StatsPageBasic(const Widget2 *const widget) : StatListener(), mAttrs(), mAttrCont(new VertContainer(this, 32)), - mAttrScroll(new ScrollArea(this, mAttrCont, false)), + mAttrScroll(new ScrollArea(this, mAttrCont, Opaque_false)), mCharacterPointsLabel(new Label(this, "C")) { addWidgetListener(this); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 2a1f59bbf..fa874133b 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -91,7 +91,7 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : mVisibleTabsWidth(0), mTabScrollIndex(0), mRightMargin(0), - mOpaque(false), + mOpaque(Opaque_false), mEnableScrollButtons(false), mFollowDownScroll(false), mBlockSwitching(true), @@ -104,12 +104,12 @@ TabbedArea::TabbedArea(const Widget2 *const widget) : void TabbedArea::postInit() { - mTabContainer->setOpaque(false); + mTabContainer->setOpaque(Opaque_false); add(mTabContainer); add(mWidgetContainer); - mWidgetContainer->setOpaque(false); + mWidgetContainer->setOpaque(Opaque_false); addWidgetListener(this); mArrowButton[0] = new Button(this, "<", "shift_left", this); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 083f178f7..3a34fc6a6 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -174,11 +174,11 @@ class TabbedArea final : public ActionListener, Tab* getSelectedTab() const A_WARN_UNUSED { return mSelectedTab; } - void setOpaque(const bool opaque) + void setOpaque(const Opaque opaque) { mOpaque = opaque; } bool isOpaque() const A_WARN_UNUSED - { return mOpaque; } + { return mOpaque == Opaque_true; } void adjustSize(); @@ -283,7 +283,7 @@ class TabbedArea final : public ActionListener, unsigned int mTabScrollIndex; int mRightMargin; - bool mOpaque; + Opaque mOpaque; bool mEnableScrollButtons; bool mFollowDownScroll; bool mBlockSwitching; diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index 67b97dd99..fad52cfb4 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -69,9 +69,9 @@ ChatTab::ChatTab(const Widget2 *const widget, const std::string &logName, const ChatTabTypeT &type) : Tab(widget), - mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, + mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, "browserbox.xml")), - mScrollArea(new ScrollArea(this, mTextOutput, false)), + mScrollArea(new ScrollArea(this, mTextOutput, Opaque_false)), mChannelName(channel), mLogName(logName), mType(type), @@ -82,7 +82,7 @@ ChatTab::ChatTab(const Widget2 *const widget, { setCaption(name); - mTextOutput->setOpaque(false); + mTextOutput->setOpaque(Opaque_false); mTextOutput->setMaxRow(config.getIntValue("ChatLogLength")); if (chatWindow) mTextOutput->setLinkHandler(chatWindow->mItemLinkHandler); diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp index 9036356ba..f7aed22fb 100644 --- a/src/gui/widgets/tabs/setup_colors.cpp +++ b/src/gui/widgets/tabs/setup_colors.cpp @@ -54,11 +54,11 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : SelectionListener(), mColorBox(CREATEWIDGETR(ListBox, this, userPalette, "")), mScroll(new ScrollArea(this, mColorBox, - true, "setup_colors_background.xml")), - mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, + Opaque_true, "setup_colors_background.xml")), + mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, "browserbox.xml")), mTextPreview(new TextPreview(this, gettext(rawmsg))), - mPreviewBox(new ScrollArea(this, mPreview, true, + mPreviewBox(new ScrollArea(this, mPreview, Opaque_true, "setup_colors_preview_background.xml")), mSelected(-1), // TRANSLATORS: colors tab. label. @@ -86,7 +86,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : setName(_("Colors")); mColorBox->addSelectionListener(this); mScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); - mPreview->setOpaque(false); + mPreview->setOpaque(Opaque_false); // don't do anything with links mPreview->setLinkHandler(nullptr); @@ -170,7 +170,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) : mBlueSlider->addActionListener(this); mBlueSlider->setEnabled(false); - setOpaque(false); + setOpaque(Opaque_false); // Do the layout LayoutHelper h(this); @@ -281,7 +281,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) mTextPreview->setFont(boldFont); mTextPreview->setTextColor(col); mTextPreview->setTextBGColor(nullptr); - mTextPreview->setOpaque(false); + mTextPreview->setOpaque(Opaque_false); mTextPreview->setShadow(true); mTextPreview->setOutline(true); mTextPreview->useTextAlpha(false); @@ -302,7 +302,7 @@ void Setup_Colors::valueChanged(const SelectionEvent &event A_UNUSED) case UserColorId::ROAD_POINT: case UserColorId::NET: mTextPreview->setBGColor(col); - mTextPreview->setOpaque(true); + mTextPreview->setOpaque(Opaque_true); mTextPreview->setOutline(false); mTextPreview->setShadow(false); break; diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 545952e2d..408bd0e83 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -71,7 +71,7 @@ Setup_Input::Setup_Input(const Widget2 *const widget) : mResetKeysButton(new Button(this, _("Reset all keys"), "resetkeys", this)), mTabs(new TabStrip(this, config.getIntValue("fontSize") + 10)), mScrollArea(new ScrollArea(this, mKeyList, - true, "setup_input_background.xml")), + Opaque_true, "setup_input_background.xml")), mKeySetting(false), mActionDataSize(new int [SETUP_PAGES]) { diff --git a/src/gui/widgets/tabs/setup_relations.cpp b/src/gui/widgets/tabs/setup_relations.cpp index 844532278..bccea1d86 100644 --- a/src/gui/widgets/tabs/setup_relations.cpp +++ b/src/gui/widgets/tabs/setup_relations.cpp @@ -82,7 +82,7 @@ Setup_Relations::Setup_Relations(const Widget2 *const widget) : // TRANSLATORS: relation dialog name setName(_("Relations")); - mPlayerTable->setOpaque(false); + mPlayerTable->setOpaque(Opaque_false); mPlayerTableTitleModel->fixColumnWidth(NAME_COLUMN, NAME_COLUMN_WIDTH); mPlayerTableTitleModel->fixColumnWidth(RELATION_CHOICE_COLUMN, diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index a6abf6b3b..3797884a3 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -110,7 +110,7 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : setName(_("Video")); ScrollArea *const scrollArea = new ScrollArea(this, mModeList, - true, "setup_video_background.xml"); + Opaque_true, "setup_video_background.xml"); scrollArea->setWidth(150); scrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/widgets/tabs/setuptab.cpp b/src/gui/widgets/tabs/setuptab.cpp index 5c8e7c3a1..6ece24f46 100644 --- a/src/gui/widgets/tabs/setuptab.cpp +++ b/src/gui/widgets/tabs/setuptab.cpp @@ -30,7 +30,7 @@ SetupTab::SetupTab(const Widget2 *const widget) : WidgetListener(), mName() { - setOpaque(false); + setOpaque(Opaque_false); addWidgetListener(this); } diff --git a/src/gui/widgets/tabs/setuptabscroll.cpp b/src/gui/widgets/tabs/setuptabscroll.cpp index 7a3c68cd5..277009182 100644 --- a/src/gui/widgets/tabs/setuptabscroll.cpp +++ b/src/gui/widgets/tabs/setuptabscroll.cpp @@ -31,7 +31,7 @@ SetupTabScroll::SetupTabScroll(const Widget2 *const widget) : SetupTab(widget), mContainer(new VertContainer(this, 25, false, 8)), - mScroll(new ScrollArea(this, mContainer, false)), + mScroll(new ScrollArea(this, mContainer, Opaque_false)), mItems(), mAllItems(), mPreferredFirstItemSize(200) diff --git a/src/gui/widgets/tabs/socialattacktab.h b/src/gui/widgets/tabs/socialattacktab.h index d83df7d14..b543cf8d5 100644 --- a/src/gui/widgets/tabs/socialattacktab.h +++ b/src/gui/widgets/tabs/socialattacktab.h @@ -38,7 +38,7 @@ class SocialAttackTab final : public SocialTab { public: SocialAttackTab(const Widget2 *const widget, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), mBeings(new BeingsListModel) { diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h index 12ea761d3..abfe4eadc 100644 --- a/src/gui/widgets/tabs/socialfriendstab.h +++ b/src/gui/widgets/tabs/socialfriendstab.h @@ -43,7 +43,7 @@ class SocialFriendsTab final : public SocialTab public: SocialFriendsTab(const Widget2 *const widget, std::string name, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), mBeings(new BeingsListModel), mFriendSorter() diff --git a/src/gui/widgets/tabs/socialguildtab.h b/src/gui/widgets/tabs/socialguildtab.h index 3ea77d529..41e83f670 100644 --- a/src/gui/widgets/tabs/socialguildtab.h +++ b/src/gui/widgets/tabs/socialguildtab.h @@ -40,7 +40,7 @@ class SocialGuildTab final : public SocialTab, public: SocialGuildTab(const Widget2 *const widget, Guild *const guild, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), ActionListener(), mGuild(guild) diff --git a/src/gui/widgets/tabs/socialguildtab2.h b/src/gui/widgets/tabs/socialguildtab2.h index cc887cd32..6a2aae990 100644 --- a/src/gui/widgets/tabs/socialguildtab2.h +++ b/src/gui/widgets/tabs/socialguildtab2.h @@ -40,7 +40,7 @@ class SocialGuildTab2 final : public SocialTab, public: SocialGuildTab2(const Widget2 *const widget, Guild *const guild, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), ActionListener() { diff --git a/src/gui/widgets/tabs/socialnavigationtab.h b/src/gui/widgets/tabs/socialnavigationtab.h index 839e2cc3e..569d501d7 100644 --- a/src/gui/widgets/tabs/socialnavigationtab.h +++ b/src/gui/widgets/tabs/socialnavigationtab.h @@ -49,7 +49,7 @@ class SocialNavigationTab final : public SocialTab { public: SocialNavigationTab(const Widget2 *const widget, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), mBeings(new BeingsListModel) { diff --git a/src/gui/widgets/tabs/socialpartytab.h b/src/gui/widgets/tabs/socialpartytab.h index 00a66a9b9..1fe36a414 100644 --- a/src/gui/widgets/tabs/socialpartytab.h +++ b/src/gui/widgets/tabs/socialpartytab.h @@ -42,7 +42,7 @@ class SocialPartyTab final : public SocialTab, public: SocialPartyTab(const Widget2 *const widget, Party *const party, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), ActionListener(), mParty(party) diff --git a/src/gui/widgets/tabs/socialpickuptab.h b/src/gui/widgets/tabs/socialpickuptab.h index fab754ec8..dae786470 100644 --- a/src/gui/widgets/tabs/socialpickuptab.h +++ b/src/gui/widgets/tabs/socialpickuptab.h @@ -38,7 +38,7 @@ class SocialPickupTab final : public SocialTab { public: SocialPickupTab(const Widget2 *const widget, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), mBeings(new BeingsListModel) { diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h index fcd01b6a3..d7d467ba8 100644 --- a/src/gui/widgets/tabs/socialplayerstab.h +++ b/src/gui/widgets/tabs/socialplayerstab.h @@ -44,7 +44,7 @@ class SocialPlayersTab final : public SocialTab public: SocialPlayersTab(const Widget2 *const widget, std::string name, - const bool showBackground) : + const Opaque showBackground) : SocialTab(widget), mBeings(new BeingsListModel) { diff --git a/src/gui/widgets/tabs/socialtab.h b/src/gui/widgets/tabs/socialtab.h index 9d8469321..38b393e07 100644 --- a/src/gui/widgets/tabs/socialtab.h +++ b/src/gui/widgets/tabs/socialtab.h @@ -104,7 +104,7 @@ class SocialTab notfinal : public Tab } void createControls(AvatarListModel *const listModel, - const bool showBackground) + const Opaque showBackground) { CREATEWIDGETV(mList, AvatarListBox, this, listModel); mScroll = new ScrollArea(this, mList, showBackground, diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index c9720072f..479349503 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -84,7 +84,7 @@ TextBox::TextBox(const Widget2 *const widget) : mCaretRow(0), mMinWidth(getWidth()), mEditable(true), - mOpaque(true) + mOpaque(Opaque_true) { mAllowLogic = false; setText(""); @@ -95,7 +95,7 @@ TextBox::TextBox(const Widget2 *const widget) : adjustSize(); mForegroundColor = getThemeColor(ThemeColorId::TEXTBOX); - setOpaque(false); + setOpaque(Opaque_false); setFrameSize(0); } @@ -445,7 +445,7 @@ void TextBox::keyPressed(KeyEvent& event) void TextBox::draw(Graphics *const graphics) { BLOCK_START("TextBox::draw") - if (mOpaque) + if (mOpaque == Opaque_true) { graphics->setColor(mBackgroundColor); graphics->fillRectangle(Rect(0, 0, getWidth(), getHeight())); diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 355a2fb47..097c772b8 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -68,6 +68,8 @@ #include "gui/widgets/widget.h" +#include "enums/simpletypes/opaque.h" + #include "listeners/keylistener.h" #include "listeners/mouselistener.h" @@ -258,7 +260,7 @@ class TextBox final : public Widget, * @see setOpaque */ bool isOpaque() const - { return mOpaque; } + { return mOpaque == Opaque_true; } /** * Sets the text box to be opaque or not. An opaque text box will draw @@ -268,7 +270,7 @@ class TextBox final : public Widget, * @param opaque True if the text box should be opaque, false otherwise. * @see isOpaque */ - void setOpaque(const bool opaque) + void setOpaque(const Opaque opaque) { mOpaque = opaque; } void fontChanged() override final @@ -321,7 +323,7 @@ class TextBox final : public Widget, /** * True if the text box is editable, false otherwise. */ - bool mOpaque; + Opaque mOpaque; }; #endif // GUI_WIDGETS_TEXTBOX_H diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index 12992fab5..6d2e38920 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -48,7 +48,7 @@ TextPreview::TextPreview(const Widget2 *const widget, mTextBGColor(nullptr), mPadding(0), mTextAlpha(false), - mOpaque(false), + mOpaque(Opaque_false), mShadow(false), mOutline(false) { @@ -93,7 +93,7 @@ void TextPreview::draw(Graphics *const graphics) const int intAlpha = CAST_S32(mAlpha * 255.0F); const int alpha = mTextAlpha ? intAlpha : 255; - if (mOpaque) + if (mOpaque == Opaque_true) { graphics->setColor(Color(CAST_S32(mBGColor->r), CAST_S32(mBGColor->g), diff --git a/src/gui/widgets/textpreview.h b/src/gui/widgets/textpreview.h index e32b911e7..ccd552a57 100644 --- a/src/gui/widgets/textpreview.h +++ b/src/gui/widgets/textpreview.h @@ -25,6 +25,8 @@ #include "gui/widgets/widget.h" +#include "enums/simpletypes/opaque.h" + #include "localconsts.h" /** @@ -110,7 +112,7 @@ class TextPreview final : public Widget * * @param opaque Whether the widget should be opaque or not */ - void setOpaque(const bool opaque) + void setOpaque(const Opaque opaque) { mOpaque = opaque; } /** @@ -118,7 +120,7 @@ class TextPreview final : public Widget * is shown below the widget) */ bool isOpaque() const A_WARN_UNUSED - { return mOpaque; } + { return mOpaque == Opaque_true; } void adjustSize(); @@ -134,7 +136,7 @@ class TextPreview final : public Widget static float mAlpha; static Skin *mSkin; bool mTextAlpha; - bool mOpaque; + Opaque mOpaque; bool mShadow; bool mOutline; }; diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index f2e5cc46d..a85db2af4 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -277,7 +277,8 @@ void BuyDialog::init() CREATEWIDGETV(mShopItemList, ShopListBox, this, mShopItems, mShopItems, ShopListBoxType::Unknown); mScrollArea = new ScrollArea(this, mShopItemList, - getOptionBool("showbackground"), "buy_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mSlider = new Slider(this, 1.0, 1.0); diff --git a/src/gui/windows/confirmdialog.cpp b/src/gui/windows/confirmdialog.cpp index 4a0936c0c..473c46eb0 100644 --- a/src/gui/windows/confirmdialog.cpp +++ b/src/gui/windows/confirmdialog.cpp @@ -45,7 +45,7 @@ ConfirmDialog::ConfirmDialog(const std::string &restrict title, mIgnore(ignore) { mTextBox->setEditable(false); - mTextBox->setOpaque(false); + mTextBox->setOpaque(Opaque_false); mTextBox->setTextWrapped(msg, 260); soundManager.playGuiSound(soundEvent); } diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index 1737010cc..db9352243 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -52,10 +52,10 @@ DidYouKnowWindow::DidYouKnowWindow() : // TRANSLATORS: did you know window name Window(_("Did You Know?"), Modal_false, nullptr, "didyouknow.xml"), ActionListener(), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, - true, "didyouknow_background.xml")), + Opaque_true, "didyouknow_background.xml")), // TRANSLATORS: did you know window button mButtonPrev(new Button(this, _("< Previous"), "prev", this)), // TRANSLATORS: did you know window button @@ -76,7 +76,7 @@ DidYouKnowWindow::DidYouKnowWindow() : setupWindow->registerWindowForReset(this); setDefaultSize(500, 400, ImagePosition::CENTER); - mBrowserBox->setOpaque(false); + mBrowserBox->setOpaque(Opaque_false); // TRANSLATORS: did you know window button Button *const okButton = new Button(this, _("Close"), "close", this); diff --git a/src/gui/windows/emotewindow.cpp b/src/gui/windows/emotewindow.cpp index d0d215522..f50028a57 100644 --- a/src/gui/windows/emotewindow.cpp +++ b/src/gui/windows/emotewindow.cpp @@ -58,10 +58,12 @@ EmoteWindow::EmoteWindow() : mEmotePage(new EmotePage(this)), mColorModel(ColorModel::createDefault(this)), mColorPage(CREATEWIDGETR(ColorPage, this, mColorModel, "colorpage.xml")), - mScrollColorPage(new ScrollArea(this, mColorPage, false, "emotepage.xml")), + mScrollColorPage(new ScrollArea(this, mColorPage, Opaque_false, + "emotepage.xml")), mFontModel(new NamesModel), mFontPage(CREATEWIDGETR(ListBox, this, mFontModel, "")), - mScrollFontPage(new ScrollArea(this, mFontPage, false, "fontpage.xml")), + mScrollFontPage(new ScrollArea(this, mFontPage, Opaque_false, + "fontpage.xml")), mImageSet(Theme::getImageSetFromThemeXml("emotetabs.xml", "", 17, 16)) { setShowTitle(false); diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 63123d56b..54172e1ed 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -54,10 +54,10 @@ HelpWindow::HelpWindow() : ActionListener(), // TRANSLATORS: help window. button. mDYKButton(new Button(this, _("Did you know..."), "DYK", this)), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, - true, "help_background.xml")), + Opaque_true, "help_background.xml")), mTagFileMap() { setMinWidth(300); @@ -73,7 +73,7 @@ HelpWindow::HelpWindow() : setDefaultSize(500, 400, ImagePosition::CENTER); - mBrowserBox->setOpaque(false); + mBrowserBox->setOpaque(Opaque_false); mBrowserBox->setLinkHandler(this); if (gui) diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index d265a42b3..fe096971d 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -171,7 +171,8 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : mItems->addSelectionListener(this); ScrollArea *const invenScroll = new ScrollArea(this, mItems, - getOptionBool("showbackground"), "inventory_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "inventory_background.xml"); invenScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); const int size = config.getIntValue("fontSize"); diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index d0e5e2f31..381c1d800 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -70,7 +70,8 @@ MailEditWindow::MailEditWindow() : mInventory(new Inventory(InventoryType::Mail, 1)), mItemContainer(new ItemContainer(this, mInventory)), mItemScrollArea(new ScrollArea(this, mItemContainer, - getOptionBool("showitemsbackground"), "mailedit_listbackground.xml")) + fromBool(getOptionBool("showitemsbackground"), Opaque), + "mailedit_listbackground.xml")) { setWindowName("MailEdit"); setCloseButton(true); diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index 87b732bf8..7345f8266 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -57,7 +57,8 @@ MailWindow::MailWindow() : mListBox(CREATEWIDGETR(ExtendedListBox, this, mMailModel, "extendedlistbox.xml")), mListScrollArea(new ScrollArea(this, mListBox, - getOptionBool("showlistbackground"), "mail_listbackground.xml")), + fromBool(getOptionBool("showlistbackground"), Opaque), + "mail_listbackground.xml")), // TRANSLATORS: mail window button mRefreshButton(new Button(this, _("Refresh"), "refresh", this)), // TRANSLATORS: mail window button diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index ccb52f8c4..00ba8061d 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -99,19 +99,22 @@ NpcDialog::NpcDialog(const BeingId npcId) : mNpcId(npcId), mDefaultInt(0), mDefaultString(), - mTextBox(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, + mTextBox(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mTextBox, - getOptionBool("showtextbackground"), "npc_textbackground.xml")), + fromBool(getOptionBool("showtextbackground"), Opaque), + "npc_textbackground.xml")), mText(), mNewText(), mItemList(CREATEWIDGETR(ExtendedListBox, this, this, "extendedlistbox.xml")), mListScrollArea(new ScrollArea(this, mItemList, - getOptionBool("showlistbackground"), "npc_listbackground.xml")), + fromBool(getOptionBool("showlistbackground"), Opaque), + "npc_listbackground.xml")), mSkinContainer(new Container(this)), mSkinScrollArea(new ScrollArea(this, mSkinContainer, - getOptionBool("showlistbackground"), "npc_listbackground.xml")), + fromBool(getOptionBool("showlistbackground"), Opaque), + "npc_listbackground.xml")), mItems(), mImages(), mItemLinkHandler(new ItemLinkHandler), @@ -135,7 +138,8 @@ NpcDialog::NpcDialog(const BeingId npcId) : mItemContainer(new ItemContainer(this, mInventory, 10000, ShowEmptyRows_true)), mItemScrollArea(new ScrollArea(this, mItemContainer, - getOptionBool("showitemsbackground"), "npc_listbackground.xml")), + fromBool(getOptionBool("showitemsbackground"), Opaque), + "npc_listbackground.xml")), mInputState(NPC_INPUT_NONE), mActionState(NPC_ACTION_WAIT), mSkinControls(), @@ -165,7 +169,7 @@ NpcDialog::NpcDialog(const BeingId npcId) : mPlayerBox->setHeight(100); // Setup output text box - mTextBox->setOpaque(false); + mTextBox->setOpaque(Opaque_false); mTextBox->setMaxRow(config.getIntValue("ChatLogLength")); mTextBox->setLinkHandler(mItemLinkHandler); mTextBox->setProcessVars(true); @@ -1289,9 +1293,9 @@ void NpcDialog::createSkinControls() const NpcTextInfo *const info = *it; BrowserBox *box = new BrowserBox(this, BrowserBox::AUTO_WRAP, - true, + Opaque_true, "browserbox.xml"); - box->setOpaque(false); + box->setOpaque(Opaque_false); box->setMaxRow(config.getIntValue("ChatLogLength")); box->setLinkHandler(mItemLinkHandler); box->setProcessVars(true); diff --git a/src/gui/windows/okdialog.cpp b/src/gui/windows/okdialog.cpp index d687976ed..dfee80a99 100644 --- a/src/gui/windows/okdialog.cpp +++ b/src/gui/windows/okdialog.cpp @@ -46,7 +46,7 @@ OkDialog::OkDialog(const std::string &restrict title, mTextBox(new TextBox(this)) { mTextBox->setEditable(false); - mTextBox->setOpaque(false); + mTextBox->setOpaque(Opaque_false); mTextBox->setTextWrapped(msg, minWidth); // TRANSLATORS: ok dialog button diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index a8c86e097..fd6678e55 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -68,11 +68,14 @@ QuestsWindow::QuestsWindow() : mQuestsListBox(CREATEWIDGETR(ExtendedListBox, this, mQuestsModel, "extendedlistbox.xml")), mQuestScrollArea(new ScrollArea(this, mQuestsListBox, - getOptionBool("showlistbackground"), "quests_list_background.xml")), + fromBool(getOptionBool("showlistbackground"), Opaque), + "quests_list_background.xml")), mItemLinkHandler(new ItemLinkHandler), - mText(new BrowserBox(this, BrowserBox::AUTO_WRAP, true, "browserbox.xml")), + mText(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true, + "browserbox.xml")), mTextScrollArea(new ScrollArea(this, mText, - getOptionBool("showtextbackground"), "quests_text_background.xml")), + fromBool(getOptionBool("showtextbackground"), Opaque), + "quests_text_background.xml")), // TRANSLATORS: quests window button mCloseButton(new Button(this, _("Close"), "close", this)), mCompleteIcon(Theme::getImageFromThemeXml("complete_icon.xml", "")), @@ -104,7 +107,7 @@ QuestsWindow::QuestsWindow() : mQuestsListBox->addActionListener(this); mQuestScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); - mText->setOpaque(false); + mText->setOpaque(Opaque_false); mText->setLinkHandler(mItemLinkHandler); mTextScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mQuestsListBox->setWidth(500); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 509b04fda..68de46288 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -141,7 +141,8 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, mServersList->addMouseListener(this); ScrollArea *const usedScroll = new ScrollArea(this, mServersList, - getOptionBool("showbackground"), "server_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "server_background.xml"); usedScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mServersList->addSelectionListener(this); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index a2793640c..6ec422505 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -113,7 +113,8 @@ ShopWindow::ShopWindow() : this, mSellShopItems, mSellShopItems, ShopListBoxType::SellShop)), mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, - getOptionBool("showbuybackground"), "shop_buy_background.xml")), + fromBool(getOptionBool("showbuybackground"), Opaque), + "shop_buy_background.xml")), // TRANSLATORS: shop window label mAddButton(new Button(this, _("Add"), "add", this)), // TRANSLATORS: shop window label diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index ba3b97b46..9d4b34b6d 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -52,7 +52,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title, int width, int height) : Window("Window", Modal_false, nullptr, skinFile), mItems(content), - mScrollArea(new ScrollArea(this, mItems, false)), + mScrollArea(new ScrollArea(this, mItems, Opaque_false)), mTabs(nullptr), mPages(), mButtonIndex(0) @@ -169,7 +169,7 @@ void ShortcutWindow::addTab(const std::string &name, { if (!content || !mTabs) return; - ScrollArea *const scroll = new ScrollArea(this, content, false); + ScrollArea *const scroll = new ScrollArea(this, content, Opaque_false); scroll->setPosition(SCROLL_PADDING, SCROLL_PADDING); scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); content->setWidget2(this); diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index b973c09be..9cf1a1132 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -341,7 +341,9 @@ void SkillDialog::loadXmlFile(const std::string &fileName, SkillListBox *const listbox = new SkillListBox(this, model); listbox->setActionEventId("sel"); listbox->addActionListener(this); - ScrollArea *const scroll = new ScrollArea(this, listbox, false); + ScrollArea *const scroll = new ScrollArea(this, + listbox, + Opaque_false); scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index d98fec4f1..bfdab1a31 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -63,12 +63,12 @@ SocialWindow::SocialWindow() : mPickupFilter(nullptr), // TRANSLATORS: here P is title for visible players tab in social window mPlayers(new SocialPlayersTab(this, _("P"), - getOptionBool("showtabbackground"))), + fromBool(getOptionBool("showtabbackground"), Opaque))), mNavigation(new SocialNavigationTab(this, - getOptionBool("showtabbackground"))), + fromBool(getOptionBool("showtabbackground"), Opaque))), // TRANSLATORS: here F is title for friends tab in social window mFriends(new SocialFriendsTab(this, _("F"), - getOptionBool("showtabbackground"))), + fromBool(getOptionBool("showtabbackground"), Opaque))), // TRANSLATORS: social window button mMenuButton(new Button(this, _("Menu"), "menu", this)), mCountLabel(new Label(this, "1000 / 1000")), @@ -113,7 +113,7 @@ void SocialWindow::postInit() if (config.getBoolValue("enableAttackFilter")) { mAttackFilter = new SocialAttackTab(this, - getOptionBool("showtabbackground")); + fromBool(getOptionBool("showtabbackground"), Opaque)); mTabs->addTab(mAttackFilter, mAttackFilter->mScroll); } else @@ -124,7 +124,7 @@ void SocialWindow::postInit() if (config.getBoolValue("enablePickupFilter")) { mPickupFilter = new SocialPickupTab(this, - getOptionBool("showtabbackground")); + fromBool(getOptionBool("showtabbackground"), Opaque)); mTabs->addTab(mPickupFilter, mPickupFilter->mScroll); } else @@ -192,13 +192,13 @@ bool SocialWindow::addTab(Guild *const guild) if (guild->getServerGuild()) { tab = new SocialGuildTab(this, guild, - getOptionBool("showtabbackground")); + fromBool(getOptionBool("showtabbackground"), Opaque)); } #ifdef TMWA_SUPPORT else { tab = new SocialGuildTab2(this, guild, - getOptionBool("showtabbackground")); + fromBool(getOptionBool("showtabbackground"), Opaque)); } #endif // TMWA_SUPPORT @@ -234,7 +234,7 @@ bool SocialWindow::addTab(Party *const party) return false; SocialPartyTab *const tab = new SocialPartyTab(this, party, - getOptionBool("showtabbackground")); + fromBool(getOptionBool("showtabbackground"), Opaque)); mParties[party] = tab; mTabs->addTab(tab, tab->mScroll); diff --git a/src/gui/windows/textselectdialog.cpp b/src/gui/windows/textselectdialog.cpp index ebbee9528..d533f3838 100644 --- a/src/gui/windows/textselectdialog.cpp +++ b/src/gui/windows/textselectdialog.cpp @@ -78,7 +78,8 @@ void TextSelectDialog::postInit() mModel, "listbox.xml"); mScrollArea = new ScrollArea(this, mItemList, - getOptionBool("showbackground"), "sell_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "sell_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mSelectButton = new Button(this, diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 6cf601b38..6a2f27b44 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -119,14 +119,14 @@ TradeWindow::TradeWindow() : mMyItemContainer->addSelectionListener(this); ScrollArea *const myScroll = new ScrollArea(this, mMyItemContainer, - true, "trade_background.xml"); + Opaque_true, "trade_background.xml"); myScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); mPartnerItemContainer->addSelectionListener(this); ScrollArea *const partnerScroll = new ScrollArea(this, mPartnerItemContainer, - true, "trade_background.xml"); + Opaque_true, "trade_background.xml"); partnerScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); // TRANSLATORS: trade window money label diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 8dd88f9c6..b2adf2be3 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -193,10 +193,10 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, mProgressBar(new ProgressBar(this, 0.0, 310, 0, ProgressColorId::PROG_UPDATE, "updateprogressbar.xml", "updateprogressbar_fill.xml")), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "browserbox.xml")), mScrollArea(new ScrollArea(this, mBrowserBox, - true, "update_background.xml")), + Opaque_true, "update_background.xml")), mDownloadStatus(UpdateDownloadStatus::UPDATE_NEWS), mDownloadedBytes(0), mUpdateIndex(0), @@ -216,7 +216,7 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, setMinHeight(220); mProgressBar->setSmoothProgress(false); - mBrowserBox->setOpaque(false); + mBrowserBox->setOpaque(Opaque_false); mBrowserBox->setLinkHandler(this); mBrowserBox->setProcessVars(true); mBrowserBox->setEnableKeys(true); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 7fb6caa1d..a676df0ea 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -98,9 +98,9 @@ WhoIsOnline::WhoIsOnline() : mThread(nullptr), mMemoryBuffer(nullptr), mCurlError(new char[CURL_ERROR_SIZE]), - mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, true, + mBrowserBox(new BrowserBox(this, BrowserBox::AUTO_SIZE, Opaque_true, "onlinebrowserbox.xml")), - mScrollArea(new ScrollArea(this, mBrowserBox, false)), + mScrollArea(new ScrollArea(this, mBrowserBox, Opaque_false)), // TRANSLATORS: who is online. button. mUpdateButton(new Button(this, _("Update"), "update", this)), mOnlinePlayers(), @@ -142,7 +142,7 @@ void WhoIsOnline::postInit() mUpdateButton->setEnabled(false); mUpdateButton->setDimension(Rect(5, 5, w - 10, 20 + 5)); - mBrowserBox->setOpaque(false); + mBrowserBox->setOpaque(Opaque_false); mScrollArea->setDimension(Rect(5, 20 + 10, w - 10, h - 10 - 30)); mScrollArea->setSize(w - 10, h - 10 - 30); mBrowserBox->setLinkHandler(this); diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index e1aeb28b4..912be2d5f 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -55,7 +55,8 @@ WorldSelectDialog::WorldSelectDialog(Worlds worlds) : mChooseWorld(new Button(this, _("Choose World"), "world", this)) { ScrollArea *const worldsScroll = new ScrollArea(this, mWorldList, - getOptionBool("showbackground"), "world_background.xml"); + fromBool(getOptionBool("showbackground"), Opaque), + "world_background.xml"); worldsScroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); |