summaryrefslogtreecommitdiff
path: root/src/gui/widgets/dropdown.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-27 22:30:19 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-27 22:30:19 +0000
commitd61fdaf1932724f86a68484c4a05195ca270646e (patch)
treec5b9fb13007679401ed0b0937660fac491b69a5c /src/gui/widgets/dropdown.cpp
parent88b3f92061c703fdf6cf0f970684fb77de6d8795 (diff)
downloadmana-client-d61fdaf1932724f86a68484c4a05195ca270646e.tar.gz
mana-client-d61fdaf1932724f86a68484c4a05195ca270646e.tar.bz2
mana-client-d61fdaf1932724f86a68484c4a05195ca270646e.tar.xz
mana-client-d61fdaf1932724f86a68484c4a05195ca270646e.zip
Removed useless yet costly dynamic casts.
Diffstat (limited to 'src/gui/widgets/dropdown.cpp')
-rw-r--r--src/gui/widgets/dropdown.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 0bf0e673..1176ef2a 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -145,7 +145,7 @@ void DropDown::draw(gcn::Graphics* graphics)
graphics->setColor(highlightColor);
graphics->drawLine(0, h, getWidth(), h);
graphics->setColor(shadowColor);
- graphics->drawLine(0, h + 1,getWidth(),h + 1);
+ graphics->drawLine(0, h + 1, getWidth(), h + 1);
}
}
@@ -156,34 +156,13 @@ void DropDown::drawBorder(gcn::Graphics *graphics)
w = getWidth() + bs * 2;
h = getHeight() + bs * 2;
- dynamic_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin);
+ static_cast<Graphics*>(graphics)->drawImageRect(0, 0, w, h, skin);
}
void DropDown::drawButton(gcn::Graphics *graphics)
{
+ int height = mDroppedDown ? mOldH : getHeight();
- unsigned short state = 0;
- unsigned short dir = 0;
- gcn::Rectangle dim;
-
- if (mPushed)
- state = 1;
-
- if (mDroppedDown)
- dir = 1;
-
- int height;
- if (mDroppedDown)
- {
- height = mOldH;
- }
- else
- {
- height = getHeight();
- }
- int x = getWidth() - height;
- int y = 0;
-
- dynamic_cast<Graphics*>(graphics)->drawImage(
- buttons[dir][state], x, y + 1);
+ static_cast<Graphics*>(graphics)->
+ drawImage(buttons[mDroppedDown][mPushed], getWidth() - height, 1);
}