summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-02-16 13:56:14 +0300
committerAndrei Karas <akaras@inbox.ru>2014-02-16 13:56:14 +0300
commitf880384018ee23efdc5cc072789e176208956a06 (patch)
tree78726f9c32da3dbc49875392f769f082bda752e7 /src
parent9e3f92a3914e28ce01331d7df7d03c31244a843b (diff)
downloadmanaverse-f880384018ee23efdc5cc072789e176208956a06.tar.gz
manaverse-f880384018ee23efdc5cc072789e176208956a06.tar.bz2
manaverse-f880384018ee23efdc5cc072789e176208956a06.tar.xz
manaverse-f880384018ee23efdc5cc072789e176208956a06.zip
Remove useless casts with KeyEvent.
Diffstat (limited to 'src')
-rw-r--r--src/gui/widgets/button.cpp4
-rw-r--r--src/gui/widgets/checkbox.cpp2
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/guitable.cpp2
-rw-r--r--src/gui/widgets/inttextfield.cpp4
-rw-r--r--src/gui/widgets/listbox.cpp2
-rw-r--r--src/gui/widgets/radiobutton.cpp2
-rw-r--r--src/gui/widgets/slider.cpp2
-rw-r--r--src/gui/widgets/tabbedarea.cpp2
-rw-r--r--src/gui/widgets/textbox.cpp2
-rw-r--r--src/gui/widgets/textfield.cpp4
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/charselectdialog.cpp2
-rw-r--r--src/gui/windows/chatwindow.cpp2
-rw-r--r--src/gui/windows/editserverdialog.cpp3
-rw-r--r--src/gui/windows/inventorywindow.cpp10
-rw-r--r--src/gui/windows/logindialog.cpp3
-rw-r--r--src/gui/windows/quitdialog.cpp2
-rw-r--r--src/gui/windows/registerdialog.cpp3
-rw-r--r--src/gui/windows/serverdialog.cpp2
-rw-r--r--src/gui/windows/updaterwindow.cpp2
-rw-r--r--src/gui/windows/worldselectdialog.cpp3
22 files changed, 26 insertions, 36 deletions
diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp
index 10088d5f4..fecf551b2 100644
--- a/src/gui/widgets/button.cpp
+++ b/src/gui/widgets/button.cpp
@@ -592,7 +592,7 @@ void Button::setCaption(const std::string& caption)
void Button::keyPressed(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
@@ -603,7 +603,7 @@ void Button::keyPressed(KeyEvent& keyEvent)
void Button::keyReleased(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT && mKeyPressed)
{
diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp
index 2514f30d3..20310c4bc 100644
--- a/src/gui/widgets/checkbox.cpp
+++ b/src/gui/widgets/checkbox.cpp
@@ -184,7 +184,7 @@ void CheckBox::mouseExited(gcn::MouseEvent& event A_UNUSED)
void CheckBox::keyPressed(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index db3393b46..9e3bca2fa 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -315,7 +315,7 @@ void DropDown::keyPressed(KeyEvent& keyEvent)
if (keyEvent.isConsumed())
return;
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
switch (actionId)
{
case Input::KEY_GUI_SELECT:
diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp
index 1d3dc0c55..bca93e7c2 100644
--- a/src/gui/widgets/guitable.cpp
+++ b/src/gui/widgets/guitable.cpp
@@ -421,7 +421,7 @@ gcn::Rectangle GuiTable::getChildrenArea()
// -- KeyListener notifications
void GuiTable::keyPressed(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp
index 8e3713522..e693526f0 100644
--- a/src/gui/widgets/inttextfield.cpp
+++ b/src/gui/widgets/inttextfield.cpp
@@ -52,7 +52,7 @@ IntTextField::IntTextField(const Widget2 *const widget, const int def,
void IntTextField::keyPressed(KeyEvent &event)
{
- const int action = static_cast<KeyEvent*>(&event)->getActionId();
+ const int action = event.getActionId();
if (action == Input::KEY_GUI_DELETE || action == Input::KEY_GUI_BACKSPACE)
{
@@ -68,7 +68,7 @@ void IntTextField::keyPressed(KeyEvent &event)
if (val != Key::TEXTINPUT)
return;
- const std::string str = static_cast<KeyEvent*>(&event)->getText();
+ const std::string str = event->getText();
if (str.empty())
return;
const size_t sz = str.size();
diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp
index bd685632f..1e97b6e8a 100644
--- a/src/gui/widgets/listbox.cpp
+++ b/src/gui/widgets/listbox.cpp
@@ -177,7 +177,7 @@ void ListBox::draw(Graphics *graphics)
void ListBox::keyPressed(KeyEvent &keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
distributeActionEvent();
diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp
index 75ea4819a..afcd98d67 100644
--- a/src/gui/widgets/radiobutton.cpp
+++ b/src/gui/widgets/radiobutton.cpp
@@ -180,7 +180,7 @@ void RadioButton::mouseExited(gcn::MouseEvent& event A_UNUSED)
void RadioButton::keyPressed(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (action == Input::KEY_GUI_SELECT)
{
setSelected(true);
diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp
index 4513ca167..8cc454c10 100644
--- a/src/gui/widgets/slider.cpp
+++ b/src/gui/widgets/slider.cpp
@@ -343,7 +343,7 @@ void Slider::mouseWheelMovedDown(gcn::MouseEvent &mouseEvent)
void Slider::keyPressed(KeyEvent& keyEvent)
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (getOrientation() == HORIZONTAL)
{
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index bc41ba824..6a5febea6 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -689,7 +689,7 @@ void TabbedArea::keyPressed(KeyEvent& keyEvent)
if (mBlockSwitching || keyEvent.isConsumed() || !isFocused())
return;
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == Input::KEY_GUI_LEFT)
{
diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp
index 8130469b7..ecdc0e4d0 100644
--- a/src/gui/widgets/textbox.cpp
+++ b/src/gui/widgets/textbox.cpp
@@ -169,7 +169,7 @@ void TextBox::setTextWrapped(const std::string &text, const int minDimension)
void TextBox::keyPressed(KeyEvent& keyEvent)
{
const gcn::Key &key = keyEvent.getKey();
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
switch (action)
{
diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp
index 81a69e472..aa554b30f 100644
--- a/src/gui/widgets/textfield.cpp
+++ b/src/gui/widgets/textfield.cpp
@@ -204,7 +204,7 @@ void TextField::keyPressed(KeyEvent &keyEvent)
#ifdef USE_SDL2
if (val == Key::TEXTINPUT)
{
- std::string str = static_cast<KeyEvent*>(&keyEvent)->getText();
+ std::string str = keyEvent->getText();
mText.insert(mCaretPosition, str);
mCaretPosition += str.size();
keyEvent.consume();
@@ -293,7 +293,7 @@ void TextField::keyPressed(KeyEvent &keyEvent)
}
else
{
- const int action = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int action = keyEvent.getActionId();
if (!inputManager.isActionActive(static_cast<int>(
Input::KEY_GUI_CTRL)))
{
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 0d324439b..a3fdcde3a 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -667,7 +667,7 @@ void CharCreateDialog::updatePlayer()
void CharCreateDialog::keyPressed(KeyEvent &keyEvent)
{
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
switch (actionId)
{
case Input::KEY_GUI_CANCEL:
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index b18e6df5b..7c6e387a4 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -318,7 +318,7 @@ void CharSelectDialog::use(const int selected)
void CharSelectDialog::keyPressed(KeyEvent &keyEvent)
{
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
switch (actionId)
{
case Input::KEY_GUI_CANCEL:
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 11551b5cb..1e71c50ae 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -840,7 +840,7 @@ void ChatWindow::mouseDragged(gcn::MouseEvent &event)
void ChatWindow::keyPressed(KeyEvent &event)
{
const int key = event.getKey().getValue();
- const int actionId = static_cast<KeyEvent*>(&event)->getActionId();
+ const int actionId = event.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_DOWN))
{
if (mCurHist != mHistory.end())
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index 82c255863..2286a9b36 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -290,8 +290,7 @@ void EditServerDialog::keyPressed(KeyEvent &keyEvent)
if (keyEvent.isConsumed())
return;
- const int actionId = static_cast<KeyEvent*>(
- &keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
{
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp
index 24b5cdab3..a1eb83e7a 100644
--- a/src/gui/windows/inventorywindow.cpp
+++ b/src/gui/windows/inventorywindow.cpp
@@ -615,20 +615,14 @@ void InventoryWindow::mouseExited(gcn::MouseEvent &event A_UNUSED)
void InventoryWindow::keyPressed(KeyEvent &event)
{
- if (static_cast<KeyEvent*>(&event)->getActionId()
- == static_cast<int>(Input::KEY_GUI_MOD))
- {
+ if (event.getActionId() == static_cast<int>(Input::KEY_GUI_MOD))
mSplit = true;
- }
}
void InventoryWindow::keyReleased(KeyEvent &event)
{
- if (static_cast<KeyEvent*>(&event)->getActionId()
- == static_cast<int>(Input::KEY_GUI_MOD))
- {
+ if (event.getActionId() == static_cast<int>(Input::KEY_GUI_MOD))
mSplit = false;
- }
}
void InventoryWindow::valueChanged(const gcn::SelectionEvent &event A_UNUSED)
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index f9988a0c3..bfa20af62 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -327,8 +327,7 @@ void LoginDialog::keyPressed(KeyEvent &keyEvent)
return;
}
- const int actionId = static_cast<KeyEvent*>(
- &keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
{
action(ActionEvent(nullptr, mServerButton->getActionEventId()));
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index c47fb1f0e..98aa70c70 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -205,7 +205,7 @@ void QuitDialog::action(const ActionEvent &event)
void QuitDialog::keyPressed(KeyEvent &keyEvent)
{
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
int dir = 0;
switch (actionId)
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 530a33758..50344f223 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -289,8 +289,7 @@ void RegisterDialog::keyPressed(KeyEvent &keyEvent)
mRegisterButton->setEnabled(canSubmit());
return;
}
- const int actionId = static_cast<KeyEvent*>(
- &keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 6d61b3eb2..c4bd7c79f 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -447,7 +447,7 @@ void ServerDialog::action(const ActionEvent &event)
void ServerDialog::keyPressed(KeyEvent &keyEvent)
{
- switch (static_cast<KeyEvent*>(&keyEvent)->getActionId())
+ switch (keyEvent.getActionId())
{
case Input::KEY_GUI_CANCEL:
keyEvent.consume();
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 12a5cb0c4..109858a07 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -293,7 +293,7 @@ void UpdaterWindow::action(const ActionEvent &event)
void UpdaterWindow::keyPressed(KeyEvent &keyEvent)
{
- const int actionId = static_cast<KeyEvent*>(&keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp
index 03545bcc4..0d861b85c 100644
--- a/src/gui/windows/worldselectdialog.cpp
+++ b/src/gui/windows/worldselectdialog.cpp
@@ -156,8 +156,7 @@ void WorldSelectDialog::action(const ActionEvent &event)
void WorldSelectDialog::keyPressed(KeyEvent &keyEvent)
{
- const int actionId = static_cast<KeyEvent*>(
- &keyEvent)->getActionId();
+ const int actionId = keyEvent.getActionId();
if (actionId == static_cast<int>(Input::KEY_GUI_CANCEL))
{