From 9d3b975bcb84ad1c61d628de2804751c0d0707dd Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 31 May 2011 01:27:37 +0300 Subject: Fix code style and missing members initialisations. --- src/guichan/widgets/radiobutton.cpp | 55 ++++++++++--------------------------- 1 file changed, 14 insertions(+), 41 deletions(-) (limited to 'src/guichan/widgets/radiobutton.cpp') 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); } } -- cgit v1.2.3-70-g09d2