summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/browserbox.cpp17
-rw-r--r--src/gui/widgets/browserbox.h15
-rw-r--r--src/gui/widgets/browserbox_unittest.cc2
-rw-r--r--src/gui/widgets/desktop.cpp2
-rw-r--r--src/gui/widgets/tabs/chat/chattab.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_colors.cpp2
6 files changed, 19 insertions, 21 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index 916ce76d7..c443bf07d 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -98,7 +98,7 @@ int BrowserBox::mInstances = 0;
mColors[1][color] = getThemeColor(ThemeColorId::color##_OUTLINE)
BrowserBox::BrowserBox(const Widget2 *const widget,
- const unsigned int mode,
+ const BrowserBoxModeT mode,
const Opaque opaque,
const std::string &skin) :
Widget(widget),
@@ -409,7 +409,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
}
// Auto size mode
- if (mMode == AUTO_SIZE)
+ if (mMode == BrowserBoxMode::AUTO_SIZE)
{
std::string plain = newRow;
for (idx1 = plain.find("##");
@@ -426,7 +426,7 @@ void BrowserBox::addRow(const std::string &row, const bool atTop)
}
const int fontHeight = font->getHeight();
- if (mMode == AUTO_WRAP)
+ if (mMode == BrowserBoxMode::AUTO_WRAP)
{
unsigned int y = 0;
unsigned int nextChar;
@@ -911,8 +911,10 @@ int BrowserBox::calcHeight()
width = font->getWidth(part);
// Auto wrap mode
- if (mMode == AUTO_WRAP && wWidth > 0 && width > 0
- && (x + CAST_U32(width) + 10) > wWidth)
+ if (mMode == BrowserBoxMode::AUTO_WRAP &&
+ wWidth > 0 &&
+ width > 0 &&
+ (x + CAST_U32(width) + 10) > wWidth)
{
bool forced = false;
@@ -976,8 +978,11 @@ int BrowserBox::calcHeight()
else
width = font->getWidth(part);
- if (mMode == AUTO_WRAP && (width == 0 && !processed))
+ if (mMode == BrowserBoxMode::AUTO_WRAP &&
+ (width == 0 && !processed))
+ {
break;
+ }
x += CAST_U32(width);
if (x > mDataWidth)
diff --git a/src/gui/widgets/browserbox.h b/src/gui/widgets/browserbox.h
index 7eff1f1ea..77f103d83 100644
--- a/src/gui/widgets/browserbox.h
+++ b/src/gui/widgets/browserbox.h
@@ -28,6 +28,8 @@
#include "enums/simpletypes/opaque.h"
+#include "enums/gui/browserboxmode.h"
+
#include "gui/browserlink.h"
#include "gui/widgets/linepart.h"
@@ -49,7 +51,7 @@ class BrowserBox final : public Widget,
* Constructor.
*/
BrowserBox(const Widget2 *const widget,
- const unsigned int mode,
+ const BrowserBoxModeT mode,
const Opaque opaque,
const std::string &skin);
@@ -112,15 +114,6 @@ class BrowserBox final : public Widget,
void updateHeight();
- /**
- * BrowserBox modes.
- */
- enum
- {
- AUTO_SIZE = 0,
- AUTO_WRAP /**< Maybe it needs a fix or to be redone. */
- };
-
enum
{
RED = 0,
@@ -205,7 +198,7 @@ class BrowserBox final : public Widget,
LinkHandler *mLinkHandler;
Skin *mSkin;
- unsigned int mMode;
+ BrowserBoxModeT mMode;
unsigned int mHighMode;
int mSelectedLink;
unsigned int mMaxRows;
diff --git a/src/gui/widgets/browserbox_unittest.cc b/src/gui/widgets/browserbox_unittest.cc
index c2316eaa3..b31758cbd 100644
--- a/src/gui/widgets/browserbox_unittest.cc
+++ b/src/gui/widgets/browserbox_unittest.cc
@@ -70,7 +70,7 @@ TEST_CASE("BrowserBox tests", "browserbox")
Widget::setGlobalFont(new Font("/usr/share/fonts/truetype/"
"ttf-dejavu/DejaVuSans-Oblique.ttf", 18));
BrowserBox *const box = new BrowserBox(nullptr,
- BrowserBox::AUTO_WRAP,
+ BrowserBoxMode::AUTO_WRAP,
Opaque_true,
"");
box->setWidth(100);
diff --git a/src/gui/widgets/desktop.cpp b/src/gui/widgets/desktop.cpp
index 05a31f4ec..46bb3cba3 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, Opaque_false,
+ mVersionLabel(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_false,
"browserbox.xml")),
mSkin(nullptr),
mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND, 128)),
diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp
index 5691f063a..0a8d38355 100644
--- a/src/gui/widgets/tabs/chat/chattab.cpp
+++ b/src/gui/widgets/tabs/chat/chattab.cpp
@@ -69,7 +69,7 @@ ChatTab::ChatTab(const Widget2 *const widget,
const std::string &logName,
const ChatTabTypeT &type) :
Tab(widget),
- mTextOutput(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true,
+ mTextOutput(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true,
"browserbox.xml")),
mScrollArea(new ScrollArea(this, mTextOutput, Opaque_false)),
mChannelName(channel),
diff --git a/src/gui/widgets/tabs/setup_colors.cpp b/src/gui/widgets/tabs/setup_colors.cpp
index e0fc0b21e..9f7ad0154 100644
--- a/src/gui/widgets/tabs/setup_colors.cpp
+++ b/src/gui/widgets/tabs/setup_colors.cpp
@@ -55,7 +55,7 @@ Setup_Colors::Setup_Colors(const Widget2 *const widget) :
mColorBox(CREATEWIDGETR(ListBox, this, userPalette, "")),
mScroll(new ScrollArea(this, mColorBox,
Opaque_true, "setup_colors_background.xml")),
- mPreview(new BrowserBox(this, BrowserBox::AUTO_WRAP, Opaque_true,
+ mPreview(new BrowserBox(this, BrowserBoxMode::AUTO_WRAP, Opaque_true,
"browserbox.xml")),
mTextPreview(new TextPreview(this, gettext(rawmsg))),
mPreviewBox(new ScrollArea(this, mPreview, Opaque_true,