summaryrefslogtreecommitdiff
path: root/src/gui/widgets/avatarlistbox.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-03-25 23:45:27 -0600
committerJared Adams <jaxad0127@gmail.com>2010-03-26 06:53:05 -0600
commit3be9cace41bcef4b7bf55bffea5d3596bd588e7e (patch)
tree174cb77c11ddf755eaea52bba836b496d177ff91 /src/gui/widgets/avatarlistbox.cpp
parent48754058d7be3f433734cb1524e9e74cfd4fd55f (diff)
downloadmana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.gz
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.bz2
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.tar.xz
mana-3be9cace41bcef4b7bf55bffea5d3596bd588e7e.zip
Replace most dynamic_casts with static_casts
The remaining instances can't easily or safely be changed as the classes involved don't have type information like Being does. Reviewed-by: Freeyorp
Diffstat (limited to 'src/gui/widgets/avatarlistbox.cpp')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 0235d104..6ec4d1e8 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -65,11 +65,11 @@ AvatarListBox::~AvatarListBox()
void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
{
- AvatarListModel* model = dynamic_cast<AvatarListModel*>(mListModel);
-
- if (!model)
+ if (!mListModel)
return;
+ AvatarListModel* model = static_cast<AvatarListModel*>(mListModel);
+
updateAlpha();
Graphics *graphics = static_cast<Graphics*>(gcnGraphics);
@@ -140,15 +140,12 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
setSelected(y / getFont()->getHeight());
distributeActionEvent();
- if (event.getClickCount() == 2)
+ if (event.getClickCount() == 2 && mListModel)
{
int selected = getSelected();
- AvatarListModel *model = dynamic_cast<AvatarListModel*>(mListModel);
- if (model)
- {
- chatWindow->addWhisperTab(model->getAvatarAt(selected)
- ->getName(), true);
- }
+ AvatarListModel *model = static_cast<AvatarListModel*>(mListModel);
+ chatWindow->addWhisperTab(model->getAvatarAt(selected)->getName(),
+ true);
}
}
// TODO: Add support for context menu