diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-01-27 17:54:12 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-01-27 17:54:12 +0300 |
commit | f3cec08689d531cf6fe2c9edc733fa8b00032631 (patch) | |
tree | 0426309dc747b7e2aa4b95b0832e1e4e0835d3df /src/gui/widgets/browserbox.cpp | |
parent | 3a0d18fa8b8f6a78479fad7785491feff4f4f468 (diff) | |
download | mv-f3cec08689d531cf6fe2c9edc733fa8b00032631.tar.gz mv-f3cec08689d531cf6fe2c9edc733fa8b00032631.tar.bz2 mv-f3cec08689d531cf6fe2c9edc733fa8b00032631.tar.xz mv-f3cec08689d531cf6fe2c9edc733fa8b00032631.zip |
Move browserboxmode into separate file.
Also convert it to strong typed enum.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r-- | src/gui/widgets/browserbox.cpp | 17 |
1 files changed, 11 insertions, 6 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) |