summaryrefslogtreecommitdiff
path: root/src/gui/widgets/browserbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-09 14:00:56 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-09 14:00:56 +0300
commite6ea187d2ec2fb94c525158127c2736729b79b50 (patch)
tree4bcac784a3ed8e5e0b2bd19c1ce72cddfac8f35d /src/gui/widgets/browserbox.cpp
parentd189d362ba4b1b7c7963e925638eb5f12baba882 (diff)
downloadmanaplus-e6ea187d2ec2fb94c525158127c2736729b79b50.tar.gz
manaplus-e6ea187d2ec2fb94c525158127c2736729b79b50.tar.bz2
manaplus-e6ea187d2ec2fb94c525158127c2736729b79b50.tar.xz
manaplus-e6ea187d2ec2fb94c525158127c2736729b79b50.zip
add theme attribute "itemPadding" into browserbox.
Diffstat (limited to 'src/gui/widgets/browserbox.cpp')
-rw-r--r--src/gui/widgets/browserbox.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index df0fd5705..a2bee9219 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -70,6 +70,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget,
mUpdateTime(-1),
mPadding(0),
mNewLinePadding(15),
+ mItemPadding(0),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mHyperLinkColor(getThemeColor(Theme::HYPERLINK)),
mOpaque(opaque),
@@ -100,6 +101,7 @@ BrowserBox::BrowserBox(const Widget2 *const widget,
{
mPadding = mSkin->getPadding();
mNewLinePadding = mSkin->getOption("newLinePadding", 15);
+ mItemPadding = mSkin->getOption("itemPadding");
}
mColors[0][BLACK] = getThemeColor(Theme::BLACK);
@@ -525,7 +527,7 @@ int BrowserBox::calcHeight()
return 1;
const gcn::Font *const font = getFont();
- const int fontHeight = font->getHeight();
+ const int fontHeight = font->getHeight() + 2 * mItemPadding;
const int fontWidthMinus = font->getWidth("-");
const char *const hyphen = "~";
const int hyphenWidth = font->getWidth(hyphen);
@@ -549,7 +551,7 @@ int BrowserBox::calcHeight()
const int dashWidth = fontWidthMinus;
for (x = mPadding; x < wWidth; x ++)
{
- mLineParts.push_back(LinePart(x, y,
+ mLineParts.push_back(LinePart(x, y + mItemPadding,
selColor[0], selColor[1], "-", false));
x += dashWidth - 2;
}
@@ -567,7 +569,7 @@ int BrowserBox::calcHeight()
if (img)
{
img->incRef();
- mLineParts.push_back(LinePart(x, y,
+ mLineParts.push_back(LinePart(x, y + mItemPadding,
selColor[0], selColor[1], img));
y += img->getHeight() + 2;
moreHeight += img->getHeight();
@@ -735,7 +737,8 @@ int BrowserBox::calcHeight()
Image *const img = mEmotes->get(cid);
if (img)
{
- mLineParts.push_back(LinePart(x, y,
+ mLineParts.push_back(LinePart(
+ x, y + mItemPadding,
selColor[0], selColor[1], img));
x += 18;
}
@@ -803,8 +806,9 @@ int BrowserBox::calcHeight()
if (forced)
{
x -= hyphenWidth; // Remove the wrap-notifier accounting
- mLineParts.push_back(LinePart(wWidth - hyphenWidth,
- y, selColor[0], selColor[1], hyphen, bold));
+ mLineParts.push_back(LinePart(
+ wWidth - hyphenWidth, y + mItemPadding,
+ selColor[0], selColor[1], hyphen, bold));
end++; // Skip to the next character
}
else
@@ -816,8 +820,8 @@ int BrowserBox::calcHeight()
wrappedLines++;
}
- mLineParts.push_back(LinePart(x, y, selColor[0], selColor[1],
- part.c_str(), bold));
+ mLineParts.push_back(LinePart(x, y + mItemPadding,
+ selColor[0], selColor[1], part.c_str(), bold));
if (bold)
width = boldFont->getWidth(part);