summaryrefslogtreecommitdiff
path: root/src/guichan/widgets/radiobutton.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-05-31 01:27:37 +0300
committerAndrei Karas <akaras@inbox.ru>2011-05-31 01:27:37 +0300
commit9d3b975bcb84ad1c61d628de2804751c0d0707dd (patch)
treefe7494b1ecd561a40dc96d088c77d69b6d4ce13e /src/guichan/widgets/radiobutton.cpp
parent1d0044cbc81e547ad688a295288910d58e1a3fb1 (diff)
downloadmv-9d3b975bcb84ad1c61d628de2804751c0d0707dd.tar.gz
mv-9d3b975bcb84ad1c61d628de2804751c0d0707dd.tar.bz2
mv-9d3b975bcb84ad1c61d628de2804751c0d0707dd.tar.xz
mv-9d3b975bcb84ad1c61d628de2804751c0d0707dd.zip
Fix code style and missing members initialisations.
Diffstat (limited to 'src/guichan/widgets/radiobutton.cpp')
-rw-r--r--src/guichan/widgets/radiobutton.cpp55
1 files changed, 14 insertions, 41 deletions
diff --git a/src/guichan/widgets/radiobutton.cpp b/src/guichan/widgets/radiobutton.cpp
index 31fdec94d..2b2ae7315 100644
--- a/src/guichan/widgets/radiobutton.cpp
+++ b/src/guichan/widgets/radiobutton.cpp
@@ -88,38 +88,32 @@ namespace gcn
void RadioButton::draw(Graphics* graphics)
{
- graphics->pushClipArea(Rectangle(1,
- 1,
- getWidth() - 1,
- getHeight() - 1));
+ graphics->pushClipArea(Rectangle(1, 1,
+ getWidth() - 1, getHeight() - 1));
+
drawBox(graphics);
graphics->popClipArea();
-
graphics->setFont(getFont());
graphics->setColor(getForegroundColor());
if (isFocused())
{
int fh;
-
- if (getHeight()%2 == 0)
- {
+
+ if (getHeight() % 2 == 0)
fh = getHeight() - 4;
- }
else
- {
fh = getHeight() - 3;
- }
int hh = (fh + 1) / 2;
-
+
graphics->drawLine(0, hh + 1, hh + 1, 0);
graphics->drawLine(hh + 2, 1, fh + 2, hh + 1);
graphics->drawLine(fh + 1, hh + 2, hh + 1, fh + 2);
- graphics->drawLine(hh + 1, fh + 2, 1, hh + 2);
+ graphics->drawLine(hh + 1, fh + 2, 1, hh + 2);
}
-
+
int h = getHeight() + getHeight() / 2;
graphics->drawText(getCaption(), h - 2, 0);
@@ -129,14 +123,10 @@ namespace gcn
{
int h;
- if (getHeight()%2 == 0)
- {
+ if (getHeight() % 2 == 0)
h = getHeight() - 4;
- }
else
- {
h = getHeight() - 3;
- }
int alpha = getBaseColor().a;
Color faceColor = getBaseColor();
@@ -152,20 +142,10 @@ namespace gcn
int hh = (h + 1) / 2;
for (i = 1; i <= hh; ++i)
- {
- graphics->drawLine(hh - i + 1,
- i,
- hh + i - 1,
- i);
- }
+ graphics->drawLine(hh - i + 1, i, hh + i - 1, i);
for (i = 1; i < hh; ++i)
- {
- graphics->drawLine(hh - i + 1,
- h - i,
- hh + i - 1,
- h - i);
- }
+ graphics->drawLine(hh - i + 1, h - i, hh + i - 1, h - i);
graphics->setColor(shadowColor);
graphics->drawLine(hh, 0, 0, hh);
@@ -181,14 +161,9 @@ namespace gcn
if (mSelected)
{
for (i = 0; i < hhh; ++i)
- {
graphics->drawLine(hh - i, 4 + i, hh + i, 4 + i);
- }
for (i = 0; i < hhh; ++i)
- {
graphics->drawLine(hh - i, h - 4 - i, hh + i, h - 4 - i);
- }
-
}
}
@@ -206,12 +181,10 @@ namespace gcn
for (iter = mGroupMap.lower_bound(mGroup);
iter != iterEnd;
- iter++)
+ ++ iter)
{
if (iter->second->isSelected())
- {
iter->second->setSelected(false);
- }
}
}
@@ -264,7 +237,7 @@ namespace gcn
for (iter = mGroupMap.lower_bound(mGroup);
iter != iterEnd;
- iter++)
+ ++ iter)
{
if (iter->second == this)
{
@@ -293,6 +266,6 @@ namespace gcn
int height = getFont()->getHeight();
setHeight(height);
- setWidth(getFont()->getWidth(getCaption()) + height + height/2);
+ setWidth(getFont()->getWidth(getCaption()) + height + height / 2);
}
}