From 30ba8a737da8b1811397786106085f2c13167803 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 27 Dec 2017 00:43:20 +0300 Subject: Remove default parameters from window. --- src/gui/widgets/selldialog.cpp | 4 ++-- src/gui/widgets/window.cpp | 24 ++++++++++++------------ src/gui/widgets/window.h | 31 +++++++++++++++++++------------ 3 files changed, 33 insertions(+), 26 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index d60e10803..c573ad392 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -87,7 +87,7 @@ void SellDialog::postInit() setStickyButtonLock(true); setMinWidth(260); setMinHeight(220); - setDefaultSize(260, 230, ImagePosition::CENTER); + setDefaultSize(260, 230, ImagePosition::CENTER, 0, 0); if (setupWindow != nullptr) setupWindow->registerWindowForReset(this); @@ -106,7 +106,7 @@ void SellDialog::postInit() ShopListBoxType::Unknown); mShopItemList->setProtectItems(true); mScrollArea = new ScrollArea(this, mShopItemList, - fromBool(getOptionBool("showbackground"), Opaque), + fromBool(getOptionBool("showbackground", false), Opaque), "sell_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 3b34a7347..132b3f561 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -187,35 +187,35 @@ Window::Window(const std::string &caption, if (mSkin != nullptr) { setPadding(mSkin->getPadding()); - if (getOptionBool("titlebarBold")) + if (getOptionBool("titlebarBold", false)) mCaptionFont = boldFont; mTitlePadding = mSkin->getTitlePadding(); - mGripPadding = getOption("resizePadding"); - mCaptionOffsetX = getOption("captionoffsetx"); + mGripPadding = getOption("resizePadding", 0); + mCaptionOffsetX = getOption("captionoffsetx", 0); if (mCaptionOffsetX == 0) mCaptionOffsetX = 7; - mCaptionOffsetY = getOption("captionoffsety"); + mCaptionOffsetY = getOption("captionoffsety", 0); if (mCaptionOffsetY == 0) mCaptionOffsetY = 5; mCaptionAlign = static_cast( - getOption("captionalign")); + getOption("captionalign", 0)); if (mCaptionAlign < Graphics::LEFT || mCaptionAlign > Graphics::RIGHT) { mCaptionAlign = Graphics::LEFT; } setTitleBarHeight(CAST_U32( - getOption("titlebarHeight"))); + getOption("titlebarHeight", 0))); if (mTitleBarHeight == 0u) mTitleBarHeight = mCaptionFont->getHeight() + mPadding; - mTitleBarHeight += getOption("titlebarHeightRelative"); - setPalette(getOption("palette")); - childPalette = getOption("childPalette"); + mTitleBarHeight += getOption("titlebarHeightRelative", 0); + setPalette(getOption("palette", 0)); + childPalette = getOption("childPalette", 0); mShowTitle = getOptionBool("showTitle", true); - mClosePadding = getOption("closePadding"); - mStickySpacing = getOption("stickySpacing"); - mStickyPadding = getOption("stickyPadding"); + mClosePadding = getOption("closePadding", 0); + mStickySpacing = getOption("stickySpacing", 0); + mStickyPadding = getOption("stickyPadding", 0); } } diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index d089680af..cffc2f17d 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -111,10 +111,10 @@ class Window notfinal : public BasicContainer2, * a window will never go below its parent window. * @param skin The location where the window's skin XML can be found. */ - explicit Window(const std::string &caption = "Window", - const Modal modal = Modal_false, - Window *const parent = nullptr, - std::string skin = ""); + Window(const std::string &caption, + const Modal modal, + Window *const parent, + std::string skin); A_DELETE_COPY(Window) @@ -155,7 +155,8 @@ class Window notfinal : public BasicContainer2, * Sets the location relative to the given enumerated position. */ void setLocationRelativeTo(const ImagePosition::Type &position, - int offsetX = 0, int offsetY = 0); + int offsetX, + int offsetY); /** * Sets whether or not the window can be resized. @@ -392,9 +393,11 @@ class Window notfinal : public BasicContainer2, * This version of setDefaultSize sets the window's position based * on a relative enumerated position, rather than a coordinate position. */ - void setDefaultSize(const int defaultWidth, const int defaultHeight, + void setDefaultSize(const int defaultWidth, + const int defaultHeight, const ImagePosition::Type &position, - const int offsetx = 0, const int offsetY = 0); + const int offsetx, + const int offsetY); /** * Reset the win pos and size to default. Don't forget to set defaults @@ -428,13 +431,17 @@ class Window notfinal : public BasicContainer2, * @param h if non-zero, force the window to this height. * @note This function is meant to be called with fixed-size windows. */ - void reflowLayout(int w = 0, int h = 0); + void reflowLayout(int w, + int h); /** * Adds a widget to the window and sets it at given cell. */ - LayoutCell &place(const int x, const int y, Widget *const wg, - const int w = 1, const int h = 1); + LayoutCell &place(const int x, + const int y, + Widget *const wg, + const int w, + const int h); /** * Returns a proxy for adding widgets in an inner table of the layout. @@ -583,10 +590,10 @@ class Window notfinal : public BasicContainer2, bool canMove() const A_WARN_UNUSED; int getOption(const std::string &name, - const int def = 0) const A_WARN_UNUSED; + const int def) const A_WARN_UNUSED; bool getOptionBool(const std::string &name, - const bool def = false) const A_WARN_UNUSED; + const bool def) const A_WARN_UNUSED; void setTitlePadding(const int p) noexcept2 { mTitlePadding = p; } -- cgit v1.2.3-70-g09d2