From e9fb9da5bf17d3402781eb5205be7d2f794887ee Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 17 Sep 2016 19:07:25 +0300 Subject: Add strong typed bool Opaque. --- src/gui/widgets/basiccontainer2.cpp | 6 +++--- src/gui/widgets/basiccontainer2.h | 8 +++++--- src/gui/widgets/browserbox.cpp | 4 ++-- src/gui/widgets/browserbox.h | 8 +++++--- src/gui/widgets/container.cpp | 2 +- src/gui/widgets/desktop.cpp | 2 +- src/gui/widgets/guitable.cpp | 6 +++--- src/gui/widgets/guitable.h | 10 ++++++---- src/gui/widgets/popuplist.cpp | 2 +- src/gui/widgets/scrollarea.cpp | 14 +++++++------- src/gui/widgets/scrollarea.h | 10 ++++++---- src/gui/widgets/selldialog.cpp | 3 ++- src/gui/widgets/statspage.cpp | 2 +- src/gui/widgets/statspagebasic.cpp | 2 +- src/gui/widgets/tabbedarea.cpp | 6 +++--- src/gui/widgets/tabbedarea.h | 6 +++--- src/gui/widgets/tabs/chat/chattab.cpp | 6 +++--- src/gui/widgets/tabs/setup_colors.cpp | 14 +++++++------- src/gui/widgets/tabs/setup_input.cpp | 2 +- src/gui/widgets/tabs/setup_relations.cpp | 2 +- src/gui/widgets/tabs/setup_video.cpp | 2 +- src/gui/widgets/tabs/setuptab.cpp | 2 +- src/gui/widgets/tabs/setuptabscroll.cpp | 2 +- src/gui/widgets/tabs/socialattacktab.h | 2 +- src/gui/widgets/tabs/socialfriendstab.h | 2 +- src/gui/widgets/tabs/socialguildtab.h | 2 +- src/gui/widgets/tabs/socialguildtab2.h | 2 +- src/gui/widgets/tabs/socialnavigationtab.h | 2 +- src/gui/widgets/tabs/socialpartytab.h | 2 +- src/gui/widgets/tabs/socialpickuptab.h | 2 +- src/gui/widgets/tabs/socialplayerstab.h | 2 +- src/gui/widgets/tabs/socialtab.h | 2 +- src/gui/widgets/textbox.cpp | 6 +++--- src/gui/widgets/textbox.h | 8 +++++--- src/gui/widgets/textpreview.cpp | 4 ++-- src/gui/widgets/textpreview.h | 8 +++++--- 36 files changed, 89 insertions(+), 76 deletions(-) (limited to 'src/gui/widgets') 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; }; -- cgit v1.2.3-70-g09d2