From 46087564d4184b28740b0c45c1bac199ab1942ec Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 16 Mar 2014 14:14:29 +0300 Subject: Improve theme usage. Removed instance method. --- src/gui/widgets/checkbox.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index f01495bcf..c44c88980 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -106,9 +106,9 @@ CheckBox::CheckBox(const Widget2 *const widget, mForegroundColor2 = getThemeColor(Theme::CHECKBOX_OUTLINE); if (instances == 0) { - if (Theme::instance()) + if (theme) { - mSkin = Theme::instance()->load("checkbox.xml", ""); + mSkin = theme->load("checkbox.xml", ""); updateAlpha(); } } @@ -142,8 +142,8 @@ CheckBox::~CheckBox() if (instances == 0) { - if (Theme::instance()) - Theme::instance()->unload(mSkin); + if (theme) + theme->unload(mSkin); } } @@ -162,7 +162,7 @@ void CheckBox::draw(Graphics *const graphics) void CheckBox::updateAlpha() { const float alpha = std::max(client->getGuiAlpha(), - Theme::instance()->getMinimumOpacity()); + theme->getMinimumOpacity()); if (mAlpha != alpha) { -- cgit v1.2.3-70-g09d2 From 37597422a0d458a224fed0258d093f7a7e400041 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 17 Mar 2014 15:54:50 +0300 Subject: Exclude useless logic methods calls. --- src/gui/widgets/basiccontainer.cpp | 51 +++++++++++++++++++++++++++-------- src/gui/widgets/basiccontainer.h | 4 ++- src/gui/widgets/browserbox.cpp | 2 ++ src/gui/widgets/button.cpp | 1 + src/gui/widgets/checkbox.cpp | 1 + src/gui/widgets/dropdown.cpp | 1 + src/gui/widgets/emotepage.cpp | 1 + src/gui/widgets/guitable.cpp | 1 + src/gui/widgets/icon.cpp | 2 ++ src/gui/widgets/itemcontainer.cpp | 1 + src/gui/widgets/label.cpp | 1 + src/gui/widgets/playerbox.cpp | 1 + src/gui/widgets/popuplist.cpp | 2 +- src/gui/widgets/radiobutton.cpp | 1 + src/gui/widgets/shortcutcontainer.cpp | 1 + src/gui/widgets/slider.cpp | 1 + src/gui/widgets/sliderlist.cpp | 1 + src/gui/widgets/tabstrip.cpp | 2 ++ src/gui/widgets/textbox.cpp | 1 + src/gui/widgets/textfield.cpp | 1 + src/gui/widgets/textpreview.cpp | 1 + src/gui/widgets/widget.cpp | 3 ++- src/gui/widgets/widget.h | 7 ++++- src/gui/widgets/windowcontainer.cpp | 34 ++++++++++++++++------- 24 files changed, 98 insertions(+), 24 deletions(-) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp index 7032cd981..60c6ac336 100644 --- a/src/gui/widgets/basiccontainer.cpp +++ b/src/gui/widgets/basiccontainer.cpp @@ -80,6 +80,15 @@ void BasicContainer::moveToTop(Widget* widget) { mWidgets.erase(iter); mWidgets.push_back(widget); + break; + } + } + FOR_EACH (WidgetListIterator, iter, mLogicWidgets) + { + if (*iter == widget) + { + mLogicWidgets.erase(iter); + mLogicWidgets.push_back(widget); return; } } @@ -89,23 +98,32 @@ void BasicContainer::moveToBottom(Widget* widget) { WidgetListIterator iter = std::find(mWidgets.begin(), mWidgets.end(), widget); + if (iter != mWidgets.end()) + { + mWidgets.erase(iter); + mWidgets.insert(mWidgets.begin(), widget); + } - if (iter == mWidgets.end()) - return; - - mWidgets.erase(iter); - mWidgets.insert(mWidgets.begin(), widget); + WidgetListIterator iter2 = std::find(mLogicWidgets.begin(), + mLogicWidgets.end(), widget); + if (iter2 != mLogicWidgets.end()) + { + mLogicWidgets.erase(iter2); + mLogicWidgets.insert(mLogicWidgets.begin(), widget); + } } void BasicContainer::death(const Event &event) { WidgetListIterator iter = std::find(mWidgets.begin(), mWidgets.end(), event.getSource()); + if (iter != mWidgets.end()) + mWidgets.erase(iter); - if (iter == mWidgets.end()) - return; - - mWidgets.erase(iter); + WidgetListIterator iter2 = std::find(mLogicWidgets.begin(), + mLogicWidgets.end(), event.getSource()); + if (iter2 != mLogicWidgets.end()) + mLogicWidgets.erase(iter2); } Rect BasicContainer::getChildrenArea() @@ -215,9 +233,11 @@ void BasicContainer::_setFocusHandler(FocusHandler *const focusHandler) (*iter)->_setFocusHandler(focusHandler); } -void BasicContainer::add(Widget* widget) +void BasicContainer::add(Widget *const widget) { mWidgets.push_back(widget); + if (widget->isAllowLogic()) + mLogicWidgets.push_back(widget); if (!mInternalFocusHandler) widget->_setFocusHandler(_getFocusHandler()); @@ -241,6 +261,14 @@ void BasicContainer::remove(Widget* widget) return; } } + FOR_EACH (WidgetListIterator, iter, mLogicWidgets) + { + if (*iter == widget) + { + mLogicWidgets.erase(iter); + return; + } + } } void BasicContainer::clear() @@ -254,6 +282,7 @@ void BasicContainer::clear() } mWidgets.clear(); + mLogicWidgets.clear(); } void BasicContainer::drawChildren(Graphics* graphics) @@ -299,7 +328,7 @@ void BasicContainer::drawChildren(Graphics* graphics) void BasicContainer::logicChildren() { BLOCK_START("BasicContainer::logicChildren") - FOR_EACH (WidgetListConstIterator, iter, mWidgets) + FOR_EACH (WidgetListConstIterator, iter, mLogicWidgets) (*iter)->logic(); BLOCK_END("BasicContainer::logicChildren") } diff --git a/src/gui/widgets/basiccontainer.h b/src/gui/widgets/basiccontainer.h index 3e3976a70..2d8a9beee 100644 --- a/src/gui/widgets/basiccontainer.h +++ b/src/gui/widgets/basiccontainer.h @@ -140,7 +140,7 @@ class BasicContainer : public Widget, * @param widget The widget to add. * @see remove, clear */ - void add(Widget* widget); + void add(Widget *const widget); /** * Removes a widget from the basic container. @@ -199,6 +199,8 @@ class BasicContainer : public Widget, * Holds all widgets of the basic container. */ WidgetList mWidgets; + + WidgetList mLogicWidgets; }; #endif // GUI_WIDGETS_BASICCONTAINER_H diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 010d3d9f3..c344d8d41 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -83,6 +83,8 @@ BrowserBox::BrowserBox(const Widget2 *const widget, mEnableKeys(false), mEnableTabs(false) { + mAllowLogic = false; + setFocusable(true); addMouseListener(this); diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 8ac4251cf..a718fe70c 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -327,6 +327,7 @@ Button::Button(const Widget2 *const widget, void Button::init() { + mAllowLogic = false; addMouseListener(this); addKeyListener(this); addFocusListener(this); diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index c44c88980..3816fe436 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -98,6 +98,7 @@ CheckBox::CheckBox(const Widget2 *const widget, mDrawBox(true) { setCaption(caption); + mAllowLogic = false; setFocusable(true); addMouseListener(this); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 53f4a623b..7173e04b4 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -78,6 +78,7 @@ DropDown::DropDown(const Widget2 *const widget, mPushed(false), mIsDragged(false) { + mAllowLogic = false; mPopup->postInit(); mFrameSize = 2; mForegroundColor2 = getThemeColor(Theme::DROPDOWN_OUTLINE); diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 139082815..9000c147b 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -45,6 +45,7 @@ EmotePage::EmotePage(const Widget2 *const widget) : { addMouseListener(this); addWidgetListener(this); + mAllowLogic = false; } EmotePage::~EmotePage() diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index dc097c031..c7964d3c6 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -110,6 +110,7 @@ GuiTable::GuiTable(const Widget2 *const widget, mOpaque(opacity), mSelectable(true) { + mAllowLogic = false; mBackgroundColor = getThemeColor(Theme::BACKGROUND); setModel(initial_model); diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 9a86fc9bf..3ffac4a7d 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -39,6 +39,7 @@ Icon::Icon(const Widget2 *const widget, const SDL_Rect &bounds = mImage->mBounds; setSize(bounds.w, bounds.h); } + mAllowLogic = false; } Icon::Icon(const Widget2 *const widget, @@ -51,6 +52,7 @@ Icon::Icon(const Widget2 *const widget, const SDL_Rect &bounds = mImage->mBounds; setSize(bounds.w, bounds.h); } + mAllowLogic = false; } Icon::~Icon() diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index ecabc226f..3fba41750 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -196,6 +196,7 @@ ItemContainer::ItemContainer(const Widget2 *const widget, addKeyListener(this); addMouseListener(this); addWidgetListener(this); + mAllowLogic = false; } ItemContainer::~ItemContainer() diff --git a/src/gui/widgets/label.cpp b/src/gui/widgets/label.cpp index 7318fc3d1..c37308a1e 100644 --- a/src/gui/widgets/label.cpp +++ b/src/gui/widgets/label.cpp @@ -112,6 +112,7 @@ Label::~Label() void Label::init() { + mAllowLogic = false; mForegroundColor = getThemeColor(Theme::LABEL); mForegroundColor2 = getThemeColor(Theme::LABEL_OUTLINE); if (mInstances == 0) diff --git a/src/gui/widgets/playerbox.cpp b/src/gui/widgets/playerbox.cpp index 6f68f8689..6a0fbd607 100644 --- a/src/gui/widgets/playerbox.cpp +++ b/src/gui/widgets/playerbox.cpp @@ -83,6 +83,7 @@ PlayerBox::~PlayerBox() void PlayerBox::init(std::string name, std::string selectedName) { + mAllowLogic = false; setFrameSize(2); addMouseListener(this); diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index cfb973384..2636dac38 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -43,7 +43,7 @@ PopupList::PopupList(DropDown *const widget, mModal(modal) { mListBox->postInit(); - + mAllowLogic = false; setFocusable(true); mListBox->setDistributeMousePressed(true); diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 4841ececb..8abac91cf 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -98,6 +98,7 @@ RadioButton::RadioButton(const Widget2 *const widget, mSpacing(2), mHasMouse(false) { + mAllowLogic = false; setCaption(caption); setGroup(group); setSelected(marked); diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 0d9aa64a6..b1bb1e867 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -43,6 +43,7 @@ ShortcutContainer::ShortcutContainer(Widget2 *const widget) : mVertexes(new ImageCollection), mRedraw(true) { + mAllowLogic = false; } ShortcutContainer::~ShortcutContainer() diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index c9ea9e6c2..6de889249 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -142,6 +142,7 @@ Slider::~Slider() void Slider::init() { + mAllowLogic = false; setFocusable(true); setFrameSize(1); diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 03f0c4ed2..6782e789c 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -46,6 +46,7 @@ SliderList::SliderList(const Widget2 *const widget, mOldWidth(0), mSelectedIndex(0) { + mAllowLogic = false; setHeight(sliderHeight); } diff --git a/src/gui/widgets/tabstrip.cpp b/src/gui/widgets/tabstrip.cpp index 57520afce..06e2fd3b8 100644 --- a/src/gui/widgets/tabstrip.cpp +++ b/src/gui/widgets/tabstrip.cpp @@ -30,6 +30,7 @@ TabStrip::TabStrip(const Widget2 *const widget, const int spacing) : WidgetGroup(widget, group, height, spacing) { + mAllowLogic = false; } TabStrip::TabStrip(const Widget2 *const widget, @@ -37,6 +38,7 @@ TabStrip::TabStrip(const Widget2 *const widget, const int spacing) : WidgetGroup(widget, "", height, spacing) { + mAllowLogic = false; } Widget *TabStrip::createWidget(const std::string &text) const diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 5f565259b..5008da6ea 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -85,6 +85,7 @@ TextBox::TextBox(const Widget2 *const widget) : mEditable(true), mOpaque(true) { + mAllowLogic = false; setText(""); setFocusable(true); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 0a1caa0e5..98a308e37 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -113,6 +113,7 @@ TextField::TextField(const Widget2 *restrict const widget, mAllowSpecialActions(true), mSendAlwaysEvents(sendAlwaysEvents) { + mAllowLogic = false; setFocusable(true); addMouseListener(this); addKeyListener(this); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index ff0a647b8..6f358e956 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -48,6 +48,7 @@ TextPreview::TextPreview(const Widget2 *const widget, mShadow(false), mOutline(false) { + mAllowLogic = false; if (instances == 0) { if (theme) diff --git a/src/gui/widgets/widget.cpp b/src/gui/widgets/widget.cpp index d1ca474c4..cd1ac750c 100644 --- a/src/gui/widgets/widget.cpp +++ b/src/gui/widgets/widget.cpp @@ -108,7 +108,8 @@ Widget::Widget(const Widget2 *const widget) : mVisible(true), mTabIn(true), mTabOut(true), - mEnabled(true) + mEnabled(true), + mAllowLogic(true) { mWidgets.push_back(this); mWidgetsSet.insert(this); diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index beff5113b..c2b1040db 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -148,7 +148,7 @@ class Widget : public Widget2 * @see setFrameSize, getFrameSize * @since 0.8.0 */ - virtual void drawFrame(Graphics* graphics) + virtual void drawFrame(Graphics* graphics A_UNUSED) { } /** @@ -1007,6 +1007,9 @@ class Widget : public Widget2 */ virtual void showPart(const Rect &rectangle); + bool isAllowLogic() const + { return mAllowLogic; } + protected: /** * Distributes an action event to all action listeners @@ -1215,6 +1218,8 @@ class Widget : public Widget2 */ bool mEnabled; + bool mAllowLogic; + /** * Holds the global font used by the widget. */ diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index a9b556410..20c3328a7 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -64,18 +64,34 @@ void WindowContainer::moveWidgetAfter(Widget *const after, const WidgetListIterator widgetIter = std::find( mWidgets.begin(), mWidgets.end(), widget); - if (widgetIter == mWidgets.end()) - return; + if (widgetIter != mWidgets.end()) + { + WidgetListIterator afterIter = std::find( + mWidgets.begin(), mWidgets.end(), after); - WidgetListIterator afterIter = std::find( - mWidgets.begin(), mWidgets.end(), after); + if (afterIter != mWidgets.end()) + { + ++ afterIter; + mWidgets.erase(widgetIter); + mWidgets.insert(afterIter, widget); + } + } - if (afterIter == mWidgets.end()) - return; + const WidgetListIterator widgetIter2 = std::find( + mLogicWidgets.begin(), mLogicWidgets.end(), widget); - ++ afterIter; - mWidgets.erase(widgetIter); - mWidgets.insert(afterIter, widget); + if (widgetIter2 != mLogicWidgets.end()) + { + WidgetListIterator afterIter = std::find( + mLogicWidgets.begin(), mLogicWidgets.end(), after); + + if (afterIter != mLogicWidgets.end()) + { + ++ afterIter; + mLogicWidgets.erase(widgetIter2); + mLogicWidgets.insert(afterIter, widget); + } + } } #ifdef USE_PROFILER -- cgit v1.2.3-70-g09d2 From 3ed0b5f6edce152fa2eca9c84d64cbeec8ac0173 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Mar 2014 17:32:27 +0300 Subject: Add consume calls into mouse press / click handlers. --- src/gui/widgets/avatarlistbox.cpp | 1 + src/gui/widgets/characterdisplay.cpp | 1 + src/gui/widgets/checkbox.cpp | 3 +++ src/gui/widgets/dropdown.cpp | 1 + src/gui/widgets/dropshortcutcontainer.cpp | 2 ++ src/gui/widgets/emotepage.cpp | 1 + src/gui/widgets/emoteshortcutcontainer.cpp | 1 + src/gui/widgets/guitable.cpp | 1 + src/gui/widgets/itemcontainer.cpp | 1 + src/gui/widgets/itemshortcutcontainer.cpp | 2 ++ src/gui/widgets/listbox.cpp | 2 ++ src/gui/widgets/popuplist.cpp | 1 + src/gui/widgets/radiobutton.cpp | 1 + src/gui/widgets/scrollarea.cpp | 9 ++++++++- src/gui/widgets/slider.cpp | 1 + src/gui/widgets/spellshortcutcontainer.cpp | 2 ++ src/gui/widgets/tabbedarea.cpp | 1 + src/gui/widgets/textbox.cpp | 1 + src/gui/widgets/textfield.cpp | 1 + src/gui/widgets/window.cpp | 4 ++++ src/gui/windowmenu.cpp | 6 +++++- src/gui/windows/chatwindow.cpp | 1 + src/gui/windows/equipmentwindow.cpp | 2 ++ src/gui/windows/ministatuswindow.cpp | 1 + src/gui/windows/npcdialog.cpp | 1 + src/gui/windows/serverdialog.cpp | 12 ++++++++---- src/gui/windows/skilldialog.cpp | 1 + 27 files changed, 55 insertions(+), 6 deletions(-) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 01126f8ac..5ce74bfca 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -332,6 +332,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) if (!ava) return; + event.consume(); const unsigned int eventButton = event.getButton(); if (eventButton == MouseEvent::LEFT) { diff --git a/src/gui/widgets/characterdisplay.cpp b/src/gui/widgets/characterdisplay.cpp index 7bfc938de..db2f2e2de 100644 --- a/src/gui/widgets/characterdisplay.cpp +++ b/src/gui/widgets/characterdisplay.cpp @@ -145,6 +145,7 @@ void CharacterDisplay::mouseMoved(MouseEvent &event A_UNUSED) void CharacterDisplay::mousePressed(MouseEvent &event) { + event.consume(); if (event.getClickCount() == 2) distributeActionEvent(); } diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 3816fe436..0cba673b5 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -256,7 +256,10 @@ void CheckBox::adjustSize() void CheckBox::mouseClicked(MouseEvent& mouseEvent) { if (mouseEvent.getButton() == MouseEvent::LEFT) + { toggleSelected(); + mouseEvent.consume(); + } } void CheckBox::mouseDragged(MouseEvent& mouseEvent) diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 7173e04b4..a4580f596 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -356,6 +356,7 @@ void DropDown::hideDrop(bool event) void DropDown::mousePressed(MouseEvent& mouseEvent) { + mouseEvent.consume(); // If we have a mouse press on the widget. if (mouseEvent.getButton() == MouseEvent::LEFT && !mDroppedDown && mouseEvent.getSource() == this) diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp index c8e4bc2d9..d85bcccf4 100644 --- a/src/gui/widgets/dropshortcutcontainer.cpp +++ b/src/gui/widgets/dropshortcutcontainer.cpp @@ -206,6 +206,8 @@ void DropShortcutContainer::mousePressed(MouseEvent &event) if (index == -1) return; + event.consume(); + const int eventButton = event.getButton(); if (eventButton == MouseEvent::LEFT) { diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index 9000c147b..ebf504f54 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -119,6 +119,7 @@ void EmotePage::draw(Graphics *graphics) void EmotePage::mousePressed(MouseEvent &mouseEvent) { mSelectedIndex = getIndexFromGrid(mouseEvent.getX(), mouseEvent.getY()); + mouseEvent.consume(); distributeActionEvent(); } diff --git a/src/gui/widgets/emoteshortcutcontainer.cpp b/src/gui/widgets/emoteshortcutcontainer.cpp index 296f21126..c731e86d8 100644 --- a/src/gui/widgets/emoteshortcutcontainer.cpp +++ b/src/gui/widgets/emoteshortcutcontainer.cpp @@ -163,6 +163,7 @@ void EmoteShortcutContainer::mousePressed(MouseEvent &event) if (index == -1) return; + event.consume(); // Stores the selected emote if there is one. if (emoteShortcut->isEmoteSelected()) { diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index c7964d3c6..08da80322 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -480,6 +480,7 @@ void GuiTable::mousePressed(MouseEvent& mouseEvent) { mSelectedColumn = column; mSelectedRow = row; + mouseEvent.consume(); } distributeActionEvent(); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 3fba41750..1c6cf9ec3 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -403,6 +403,7 @@ void ItemContainer::mousePressed(MouseEvent &event) if (button == MouseEvent::LEFT || button == MouseEvent::RIGHT) { + event.consume(); const int index = getSlotIndex(event.getX(), event.getY()); if (index == Inventory::NO_SLOT_INDEX) return; diff --git a/src/gui/widgets/itemshortcutcontainer.cpp b/src/gui/widgets/itemshortcutcontainer.cpp index b9dc3bec8..33ae1890d 100644 --- a/src/gui/widgets/itemshortcutcontainer.cpp +++ b/src/gui/widgets/itemshortcutcontainer.cpp @@ -334,6 +334,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event) if (event.getButton() == MouseEvent::LEFT) { + event.consume(); // Stores the selected item if theirs one. if (selShortcut->isItemSelected() && inventoryWindow && (inventoryWindow->isWindowVisible() @@ -352,6 +353,7 @@ void ItemShortcutContainer::mousePressed(MouseEvent &event) } else if (event.getButton() == MouseEvent::RIGHT) { + event.consume(); if (viewport && selShortcut) { viewport->showItemPopup(selShortcut->getItem(index), diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index f2a23253e..27cc29ed1 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -275,6 +275,8 @@ void ListBox::mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED) void ListBox::mousePressed(MouseEvent &event) { mPressedIndex = getSelectionByMouse(event.getY()); + if (mPressedIndex != -1) + event.consume(); } void ListBox::mouseReleased(MouseEvent &event) diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index 2636dac38..c657cdde5 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -133,6 +133,7 @@ void PopupList::mousePressed(MouseEvent& mouseEvent) { mPressedIndex = mListBox->getSelectionByMouse( mouseEvent.getY() + mPadding); + mouseEvent.consume(); } void PopupList::mouseReleased(MouseEvent& mouseEvent) diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 8abac91cf..e83e9229a 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -276,6 +276,7 @@ void RadioButton::mouseClicked(MouseEvent& mouseEvent) if (mouseEvent.getButton() == MouseEvent::LEFT) { setSelected(true); + mouseEvent.consume(); distributeActionEvent(); } } diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 571297ace..4aeef8efb 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -739,24 +739,28 @@ void ScrollArea::mousePressed(MouseEvent& event) setVerticalScrollAmount(mVScroll - mUpButtonScrollAmount); mUpButtonPressed = true; + event.consume(); } else if (getDownButtonDimension().isPointInRect(x, y)) { setVerticalScrollAmount(mVScroll + mDownButtonScrollAmount); mDownButtonPressed = true; + event.consume(); } else if (getLeftButtonDimension().isPointInRect(x, y)) { setHorizontalScrollAmount(mHScroll - mLeftButtonScrollAmount); mLeftButtonPressed = true; + event.consume(); } else if (getRightButtonDimension().isPointInRect(x, y)) { setHorizontalScrollAmount(mHScroll + mRightButtonScrollAmount); mRightButtonPressed = true; + event.consume(); } else if (getVerticalMarkerDimension().isPointInRect(x, y)) { @@ -764,6 +768,7 @@ void ScrollArea::mousePressed(MouseEvent& event) mIsVerticalMarkerDragged = true; mVerticalMarkerDragOffset = y - getVerticalMarkerDimension().y; + event.consume(); } else if (getVerticalBarDimension().isPointInRect(x, y)) { @@ -777,13 +782,14 @@ void ScrollArea::mousePressed(MouseEvent& event) setVerticalScrollAmount(mVScroll + static_cast(getChildrenArea().height * 0.95)); } + event.consume(); } else if (getHorizontalMarkerDimension().isPointInRect(x, y)) { mIsHorizontalMarkerDragged = true; mIsVerticalMarkerDragged = false; - mHorizontalMarkerDragOffset = x - getHorizontalMarkerDimension().x; + event.consume(); } else if (getHorizontalBarDimension().isPointInRect(x, y)) { @@ -797,6 +803,7 @@ void ScrollArea::mousePressed(MouseEvent& event) setHorizontalScrollAmount(mHScroll + static_cast(getChildrenArea().width * 0.95)); } + event.consume(); } if (event.getButton() == MouseEvent::LEFT) diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index 6de889249..e7f046422 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -362,6 +362,7 @@ void Slider::mousePressed(MouseEvent &mouseEvent) if (mouseEvent.getButton() == MouseEvent::LEFT && x >= 0 && x <= width && y >= 0 && y <= height) { + mouseEvent.consume(); if (mOrientation == HORIZONTAL) setValue(markerPositionToValue(x - mMarkerLength / 2)); else diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp index ed92b62e1..add394a64 100644 --- a/src/gui/widgets/spellshortcutcontainer.cpp +++ b/src/gui/widgets/spellshortcutcontainer.cpp @@ -189,6 +189,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event) const int itemId = getItemByIndex(index); if (itemId > 0) mSpellClicked = true; + event.consume(); } else if (eventButton == MouseEvent::RIGHT) { @@ -198,6 +199,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event) if (!spellShortcut || !spellManager) return; + event.consume(); const int itemId = getItemByIndex(index); spellManager->invoke(itemId); } diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 445f17982..554bdfc66 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -379,6 +379,7 @@ void TabbedArea::mousePressed(MouseEvent &mouseEvent) if (tab) { + mouseEvent.consume(); setSelectedTab(tab); requestFocus(); } diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 5008da6ea..50e423de8 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -590,6 +590,7 @@ void TextBox::mousePressed(MouseEvent& mouseEvent) if (!height) return; + mouseEvent.consume(); mCaretRow = mouseEvent.getY() / height; const int sz = static_cast(mTextRows.size()); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 98a308e37..b822996a4 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -699,6 +699,7 @@ void TextField::mousePressed(MouseEvent &mouseEvent) if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif + mouseEvent.consume(); if (mouseEvent.getButton() == MouseEvent::RIGHT) { if (viewport) diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index dda03a438..8d457e599 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -724,6 +724,7 @@ void Window::mousePressed(MouseEvent &event) { mouseResize = 0; mMoved = 0; + event.consume(); close(); return; } @@ -735,11 +736,14 @@ void Window::mousePressed(MouseEvent &event) mouseResize = 0; mMoved = 0; mRedraw = true; + event.consume(); return; } // Handle window resizing mouseResize = getResizeHandles(event) & resizeMask; + if (mouseResize != 0) + event.consume(); if (canMove()) mMoved = !mouseResize; else diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 616afa46d..868455de5 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -239,8 +239,12 @@ void WindowMenu::mousePressed(MouseEvent &event) if (!viewport) return; - if (!mSmallWindow && event.getButton() == MouseEvent::RIGHT) + if (event.getButton() == MouseEvent::RIGHT) { + if (mSmallWindow) + return; + + event.consume(); Button *const btn = dynamic_cast(event.getSource()); if (!btn) return; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 5698973f3..c6e4182d8 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -732,6 +732,7 @@ void ChatWindow::mousePressed(MouseEvent &event) Tab *const tab = mChatTabs->getSelectedTab(); if (tab) { + event.consume(); if (inputManager.isActionActive(static_cast( Input::KEY_CHAT_MOD))) { diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index 3799015e5..b8b693fc1 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -332,6 +332,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) inBox = true; if (item) { + mouseEvent.consume(); setSelected(i); dragDrop.dragItem(item, DRAGDROP_SOURCE_EQUIPMENT); return; @@ -355,6 +356,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) const int my = y + getY(); if (viewport) { + mouseEvent.consume(); if (mForing) viewport->showUndressPopup(mx, my, mBeing, item); else diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 939bfb619..216d33f42 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -443,6 +443,7 @@ void MiniStatusWindow::mousePressed(MouseEvent &event) event.getSource()); if (!bar) return; + event.consume(); if (viewport) { viewport->showPopup(getX() + event.getX(), diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 17454b6ab..17ff9a8c1 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -969,6 +969,7 @@ void NpcDialog::mousePressed(MouseEvent &event) if (event.getButton() == MouseEvent::RIGHT && event.getSource() == mTextBox) { + event.consume(); if (viewport) viewport->showNpcDialogPopup(mNpcId); } diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 112d1588d..5b0b557dc 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -452,11 +452,15 @@ void ServerDialog::valueChanged(const SelectionEvent &) void ServerDialog::mouseClicked(MouseEvent &mouseEvent) { - if (mouseEvent.getClickCount() == 2 && - mouseEvent.getSource() == mServersList) + if (mouseEvent.getButton() == MouseEvent::LEFT) { - action(ActionEvent(mConnectButton, - mConnectButton->getActionEventId())); + mouseEvent.consume(); + if (mouseEvent.getClickCount() == 2 && + mouseEvent.getSource() == mServersList) + { + action(ActionEvent(mConnectButton, + mConnectButton->getActionEventId())); + } } } diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 21cc009bc..ebad47b98 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -215,6 +215,7 @@ class SkillListBox final : public ListBox const SkillInfo *const skill = getSkillByEvent(event); if (!skill) return; + event.consume(); mSkillClicked = true; } } -- cgit v1.2.3-70-g09d2 From 60b40c0c68e9cffbc5f48d4f672d99009488f8b1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Mar 2014 19:45:48 +0300 Subject: Rename mouseEvent variables into event. --- src/gui/gui.cpp | 26 +++++++++++++------------- src/gui/popups/itempopup.h | 2 +- src/gui/popups/spellpopup.h | 2 +- src/gui/popups/textpopup.h | 2 +- src/gui/viewport.cpp | 4 ++-- src/gui/widgets/button.cpp | 22 +++++++++++----------- src/gui/widgets/button.h | 10 +++++----- src/gui/widgets/checkbox.cpp | 10 +++++----- src/gui/widgets/checkbox.h | 4 ++-- src/gui/widgets/dropdown.cpp | 28 ++++++++++++++-------------- src/gui/widgets/dropdown.h | 10 +++++----- src/gui/widgets/emotepage.cpp | 6 +++--- src/gui/widgets/emotepage.h | 2 +- src/gui/widgets/guitable.cpp | 26 +++++++++++++------------- src/gui/widgets/guitable.h | 8 ++++---- src/gui/widgets/listbox.cpp | 10 +++++----- src/gui/widgets/listbox.h | 4 ++-- src/gui/widgets/popuplist.cpp | 12 ++++++------ src/gui/widgets/popuplist.h | 4 ++-- src/gui/widgets/radiobutton.cpp | 10 +++++----- src/gui/widgets/radiobutton.h | 4 ++-- src/gui/widgets/scrollarea.cpp | 12 ++++++------ src/gui/widgets/scrollarea.h | 4 ++-- src/gui/widgets/shoplistbox.cpp | 10 +++++----- src/gui/widgets/shoplistbox.h | 4 ++-- src/gui/widgets/slider.cpp | 26 +++++++++++++------------- src/gui/widgets/slider.h | 8 ++++---- src/gui/widgets/sliderlist.cpp | 8 ++++---- src/gui/widgets/sliderlist.h | 4 ++-- src/gui/widgets/tabbedarea.cpp | 10 +++++----- src/gui/widgets/tabbedarea.h | 2 +- src/gui/widgets/tabs/tab.cpp | 4 ++-- src/gui/widgets/tabs/tab.h | 4 ++-- src/gui/widgets/textbox.cpp | 14 +++++++------- src/gui/widgets/textbox.h | 4 ++-- src/gui/widgets/textfield.cpp | 14 +++++++------- src/gui/widgets/textfield.h | 4 ++-- src/gui/windowmenu.cpp | 2 +- src/gui/windowmenu.h | 2 +- src/gui/windows/chatwindow.cpp | 8 ++++---- src/gui/windows/chatwindow.h | 4 ++-- src/gui/windows/equipmentwindow.cpp | 28 ++++++++++++++-------------- src/gui/windows/equipmentwindow.h | 2 +- src/gui/windows/ministatuswindow.h | 2 +- src/gui/windows/serverdialog.cpp | 10 +++++----- src/gui/windows/serverdialog.h | 2 +- src/listeners/mouselistener.h | 34 +++++++++++++++++----------------- 47 files changed, 216 insertions(+), 216 deletions(-) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 5998f1321..2814de4bb 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -849,7 +849,7 @@ void Gui::distributeMouseEvent(Widget *const source, } } - MouseEvent mouseEvent(source, + MouseEvent event(source, type, button, x, y, mClickCount); @@ -869,13 +869,13 @@ void Gui::distributeMouseEvent(Widget *const source, int widgetY; widget->getAbsolutePosition(widgetX, widgetY); - mouseEvent.setX(x - widgetX); - mouseEvent.setY(y - widgetY); + event.setX(x - widgetX); + event.setY(y - widgetY); std::list mouseListeners = widget->_getMouseListeners(); - unsigned int mouseType = mouseEvent.getType(); + unsigned int mouseType = event.getType(); // Send the event to all mouse listeners of the widget. FOR_EACH (std::list::const_iterator, it, mouseListeners) @@ -883,32 +883,32 @@ void Gui::distributeMouseEvent(Widget *const source, switch (mouseType) { case MouseEvent::ENTERED: - (*it)->mouseEntered(mouseEvent); + (*it)->mouseEntered(event); break; case MouseEvent::EXITED: - (*it)->mouseExited(mouseEvent); + (*it)->mouseExited(event); break; case MouseEvent::MOVED: - (*it)->mouseMoved(mouseEvent); + (*it)->mouseMoved(event); break; case MouseEvent::PRESSED: - (*it)->mousePressed(mouseEvent); + (*it)->mousePressed(event); break; case MouseEvent::RELEASED: case 100: // manual hack for release on target after drag - (*it)->mouseReleased(mouseEvent); + (*it)->mouseReleased(event); break; case MouseEvent::WHEEL_MOVED_UP: - (*it)->mouseWheelMovedUp(mouseEvent); + (*it)->mouseWheelMovedUp(event); break; case MouseEvent::WHEEL_MOVED_DOWN: - (*it)->mouseWheelMovedDown(mouseEvent); + (*it)->mouseWheelMovedDown(event); break; case MouseEvent::DRAGGED: - (*it)->mouseDragged(mouseEvent); + (*it)->mouseDragged(event); break; case MouseEvent::CLICKED: - (*it)->mouseClicked(mouseEvent); + (*it)->mouseClicked(event); break; default: break; diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index f1cedf046..73129eaea 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -61,7 +61,7 @@ class ItemPopup final : public Popup void setItem(const Item *const item, const bool showImage = false); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mItemName; diff --git a/src/gui/popups/spellpopup.h b/src/gui/popups/spellpopup.h index cbbd53703..0352161fc 100644 --- a/src/gui/popups/spellpopup.h +++ b/src/gui/popups/spellpopup.h @@ -59,7 +59,7 @@ class SpellPopup final : public Popup */ void view(const int x, const int y); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mItemName; diff --git a/src/gui/popups/textpopup.h b/src/gui/popups/textpopup.h index eb29cba61..e1dcb95b8 100644 --- a/src/gui/popups/textpopup.h +++ b/src/gui/popups/textpopup.h @@ -72,7 +72,7 @@ class TextPopup final : public Popup void show(const int x, const int y, const std::string &str1, const std::string &str2, const std::string &str3); - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; private: Label *mText[TEXTPOPUPCOUNT]; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 1a28511ed..16112fef6 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -285,14 +285,14 @@ void Viewport::followMouse() if (mPlayerFollowMouse && (button & SDL_BUTTON(1))) { // We create a mouse event and send it to mouseDragged. - MouseEvent mouseEvent(nullptr, + MouseEvent event(nullptr, MouseEvent::DRAGGED, MouseEvent::LEFT, mMouseX, mMouseY, 0); - walkByMouse(mouseEvent); + walkByMouse(event); } } diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index a718fe70c..778d74b41 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -613,9 +613,9 @@ void Button::draw(Graphics *graphics) BLOCK_END("Button::draw") } -void Button::mouseReleased(MouseEvent& mouseEvent) +void Button::mouseReleased(MouseEvent& event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (mStick) mPressed = !mPressed; @@ -623,7 +623,7 @@ void Button::mouseReleased(MouseEvent& mouseEvent) if (mMousePressed && mHasMouse) { mMousePressed = false; - mClickCount = mouseEvent.getClickCount(); + mClickCount = event.getClickCount(); distributeActionEvent(); } else @@ -631,7 +631,7 @@ void Button::mouseReleased(MouseEvent& mouseEvent) mMousePressed = false; mClickCount = 0; } - mouseEvent.consume(); + event.consume(); } } @@ -717,26 +717,26 @@ void Button::focusLost(const Event& event A_UNUSED) mKeyPressed = false; } -void Button::mousePressed(MouseEvent& mouseEvent) +void Button::mousePressed(MouseEvent& event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { mMousePressed = true; - mouseEvent.consume(); + event.consume(); } } -void Button::mouseEntered(MouseEvent& mouseEvent A_UNUSED) +void Button::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; } -void Button::mouseExited(MouseEvent& mouseEvent A_UNUSED) +void Button::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; } -void Button::mouseDragged(MouseEvent& mouseEvent) +void Button::mouseDragged(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); } diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 6eba9b3c0..200418172 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -156,7 +156,7 @@ class Button final : public Widget, */ static void updateAlpha(); - void mouseReleased(MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& event) override final; void setDescription(std::string text) { mDescription = text; } @@ -254,13 +254,13 @@ class Button final : public Widget, void focusLost(const Event& event) override final; - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; - void mouseEntered(MouseEvent& mouseEvent) override final; + void mouseEntered(MouseEvent& event) override final; - void mouseExited(MouseEvent& mouseEvent) override final; + void mouseExited(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; enum { diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index 0cba673b5..fb639753f 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -253,18 +253,18 @@ void CheckBox::adjustSize() + getFont()->getWidth(mCaption) + mPadding); } -void CheckBox::mouseClicked(MouseEvent& mouseEvent) +void CheckBox::mouseClicked(MouseEvent& event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { toggleSelected(); - mouseEvent.consume(); + event.consume(); } } -void CheckBox::mouseDragged(MouseEvent& mouseEvent) +void CheckBox::mouseDragged(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); } void CheckBox::toggleSelected() diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 5711e766f..9882284b0 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -168,9 +168,9 @@ class CheckBox final : public Widget, void setCaption(const std::string& caption) { mCaption = caption; } - void mouseClicked(MouseEvent& mouseEvent) override final; + void mouseClicked(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; private: void toggleSelected(); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index a4580f596..ba2ffe58d 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -354,12 +354,12 @@ void DropDown::hideDrop(bool event) mPopup->setVisible(false); } -void DropDown::mousePressed(MouseEvent& mouseEvent) +void DropDown::mousePressed(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); // If we have a mouse press on the widget. - if (mouseEvent.getButton() == MouseEvent::LEFT - && !mDroppedDown && mouseEvent.getSource() == this) + if (event.getButton() == MouseEvent::LEFT + && !mDroppedDown && event.getSource() == this) { mPushed = true; dropDown(); @@ -372,14 +372,14 @@ void DropDown::mousePressed(MouseEvent& mouseEvent) } } -void DropDown::mouseReleased(MouseEvent &mouseEvent) +void DropDown::mouseReleased(MouseEvent &event) { if (mIsDragged) mPushed = false; - const int button = mouseEvent.getButton(); - const int x = mouseEvent.getX(); - const int y = mouseEvent.getY(); + const int button = event.getButton(); + const int x = event.getX(); + const int y = event.getY(); // Released outside of widget. Can happen when we have modal // input focus. if ((0 > y || y >= mDimension.height || x < 0 || x >= mDimension.width) @@ -396,22 +396,22 @@ void DropDown::mouseReleased(MouseEvent &mouseEvent) mIsDragged = false; } -void DropDown::mouseDragged(MouseEvent &mouseEvent) +void DropDown::mouseDragged(MouseEvent &event) { mIsDragged = true; - mouseEvent.consume(); + event.consume(); } -void DropDown::mouseWheelMovedUp(MouseEvent& mouseEvent) +void DropDown::mouseWheelMovedUp(MouseEvent& event) { setSelected(getSelected() - 1); - mouseEvent.consume(); + event.consume(); } -void DropDown::mouseWheelMovedDown(MouseEvent& mouseEvent) +void DropDown::mouseWheelMovedDown(MouseEvent& event) { setSelected(getSelected() + 1); - mouseEvent.consume(); + event.consume(); } void DropDown::setSelectedString(const std::string &str) diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 2208880b3..a4d1fde1e 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -87,15 +87,15 @@ class DropDown final : public ActionListener, // Inherited from MouseListener - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; - void mouseReleased(MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; - void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; void setSelectedString(const std::string &str); diff --git a/src/gui/widgets/emotepage.cpp b/src/gui/widgets/emotepage.cpp index ebf504f54..c0fcb8ecf 100644 --- a/src/gui/widgets/emotepage.cpp +++ b/src/gui/widgets/emotepage.cpp @@ -116,10 +116,10 @@ void EmotePage::draw(Graphics *graphics) BLOCK_END("EmotePage::draw") } -void EmotePage::mousePressed(MouseEvent &mouseEvent) +void EmotePage::mousePressed(MouseEvent &event) { - mSelectedIndex = getIndexFromGrid(mouseEvent.getX(), mouseEvent.getY()); - mouseEvent.consume(); + mSelectedIndex = getIndexFromGrid(event.getX(), event.getY()); + event.consume(); distributeActionEvent(); } diff --git a/src/gui/widgets/emotepage.h b/src/gui/widgets/emotepage.h index 2ce50f1fc..769e004bc 100644 --- a/src/gui/widgets/emotepage.h +++ b/src/gui/widgets/emotepage.h @@ -41,7 +41,7 @@ class EmotePage final : public Widget, void draw(Graphics *graphics) override final; - void mousePressed(MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &event) override final; int getIndexFromGrid(const int x, const int y) const; diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 08da80322..44248037c 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -465,56 +465,56 @@ void GuiTable::keyPressed(KeyEvent& keyEvent) } // -- MouseListener notifications -void GuiTable::mousePressed(MouseEvent& mouseEvent) +void GuiTable::mousePressed(MouseEvent& event) { if (!mModel || !mSelectable) return; - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { - const int row = getRowForY(mouseEvent.getY()); - const int column = getColumnForX(mouseEvent.getX()); + const int row = getRowForY(event.getY()); + const int column = getColumnForX(event.getX()); if (row > -1 && column > -1 && row < mModel->getRows() && column < mModel->getColumns()) { mSelectedColumn = column; mSelectedRow = row; - mouseEvent.consume(); + event.consume(); } distributeActionEvent(); } } -void GuiTable::mouseWheelMovedUp(MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedUp(MouseEvent& event) { if (isFocused()) { const int selRow = getSelectedRow(); if (selRow > 0 || (selRow == 0 && mWrappingEnabled)) setSelectedRow(selRow - 1); - mouseEvent.consume(); + event.consume(); } } -void GuiTable::mouseWheelMovedDown(MouseEvent& mouseEvent) +void GuiTable::mouseWheelMovedDown(MouseEvent& event) { if (isFocused()) { setSelectedRow(getSelectedRow() + 1); - mouseEvent.consume(); + event.consume(); } } -void GuiTable::mouseDragged(MouseEvent& mouseEvent) +void GuiTable::mouseDragged(MouseEvent& event) { - if (mouseEvent.getButton() != MouseEvent::LEFT) + if (event.getButton() != MouseEvent::LEFT) return; // Make table selection update on drag - const int x = std::max(0, mouseEvent.getX()); - const int y = std::max(0, mouseEvent.getY()); + const int x = std::max(0, event.getX()); + const int y = std::max(0, event.getY()); setSelectedRow(getRowForY(y)); setSelectedColumn(getColumnForX(x)); diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 42664fd77..9beb866cf 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -144,13 +144,13 @@ public: { return mOpaque; } // Inherited from MouseListener - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; - void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; // Constraints inherited from TableModelListener void modelUpdated(const bool completed) override final; diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 27cc29ed1..1df21af20 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -264,11 +264,11 @@ void ListBox::keyPressed(KeyEvent &keyEvent) // Don't do anything on scrollwheel. ScrollArea will deal with that. -void ListBox::mouseWheelMovedUp(MouseEvent &mouseEvent A_UNUSED) +void ListBox::mouseWheelMovedUp(MouseEvent &event A_UNUSED) { } -void ListBox::mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED) +void ListBox::mouseWheelMovedDown(MouseEvent &event A_UNUSED) { } @@ -314,11 +314,11 @@ void ListBox::mouseReleased(MouseEvent &event) mPressedIndex = -2; } -void ListBox::mouseReleased1(const MouseEvent &mouseEvent) +void ListBox::mouseReleased1(const MouseEvent &event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { - setSelected(std::max(0, getSelectionByMouse(mouseEvent.getY()))); + setSelected(std::max(0, getSelectionByMouse(event.getY()))); distributeActionEvent(); } } diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index f784b3237..9a398dfa2 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -123,9 +123,9 @@ class ListBox : public Widget, // Inherited from MouseListener - void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; void mousePressed(MouseEvent &event) override; diff --git a/src/gui/widgets/popuplist.cpp b/src/gui/widgets/popuplist.cpp index c657cdde5..fa0616fd2 100644 --- a/src/gui/widgets/popuplist.cpp +++ b/src/gui/widgets/popuplist.cpp @@ -129,24 +129,24 @@ void PopupList::adjustSize() mListBox->setWidth(width); } -void PopupList::mousePressed(MouseEvent& mouseEvent) +void PopupList::mousePressed(MouseEvent& event) { mPressedIndex = mListBox->getSelectionByMouse( - mouseEvent.getY() + mPadding); - mouseEvent.consume(); + event.getY() + mPadding); + event.consume(); } -void PopupList::mouseReleased(MouseEvent& mouseEvent) +void PopupList::mouseReleased(MouseEvent& event) { if (mPressedIndex != mListBox->getSelectionByMouse( - mouseEvent.getY() + mPadding)) + event.getY() + mPadding)) { mPressedIndex = -2; return; } mPressedIndex = -2; - if (mouseEvent.getSource() == mScrollArea) + if (event.getSource() == mScrollArea) return; if (mDropDown) mDropDown->updateSelection(); diff --git a/src/gui/widgets/popuplist.h b/src/gui/widgets/popuplist.h index 32a9dfc47..b60e93b7f 100644 --- a/src/gui/widgets/popuplist.h +++ b/src/gui/widgets/popuplist.h @@ -65,9 +65,9 @@ class PopupList final : public Popup, void focusLost(const Event& event A_UNUSED) override final; - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; - void mouseReleased(MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& event) override final; private: ListModel *mListModel; diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index e83e9229a..549e8823e 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -271,19 +271,19 @@ void RadioButton::setSelected(const bool selected) mSelected = selected; } -void RadioButton::mouseClicked(MouseEvent& mouseEvent) +void RadioButton::mouseClicked(MouseEvent& event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { setSelected(true); - mouseEvent.consume(); + event.consume(); distributeActionEvent(); } } -void RadioButton::mouseDragged(MouseEvent& mouseEvent) +void RadioButton::mouseDragged(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); } void RadioButton::setGroup(const std::string &group) diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index 5aa0d9289..a0d32dd9d 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -164,9 +164,9 @@ class RadioButton final : public Widget, void setCaption(const std::string &caption) { mCaption = caption; } - void mouseClicked(MouseEvent& mouseEvent) override final; + void mouseClicked(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; /** * Sets the group the radio button should belong to. Note that diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 4aeef8efb..95323a170 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -1309,26 +1309,26 @@ void ScrollArea::setDimension(const Rect& dimension) checkPolicies(); } -void ScrollArea::mouseWheelMovedUp(MouseEvent& mouseEvent) +void ScrollArea::mouseWheelMovedUp(MouseEvent& event) { - if (mouseEvent.isConsumed()) + if (event.isConsumed()) return; setVerticalScrollAmount(getVerticalScrollAmount() - getChildrenArea().height / 8); - mouseEvent.consume(); + event.consume(); } -void ScrollArea::mouseWheelMovedDown(MouseEvent& mouseEvent) +void ScrollArea::mouseWheelMovedDown(MouseEvent& event) { - if (mouseEvent.isConsumed()) + if (event.isConsumed()) return; setVerticalScrollAmount(getVerticalScrollAmount() + getChildrenArea().height / 8); - mouseEvent.consume(); + event.consume(); } void ScrollArea::checkPolicies() diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 0b0cae2c3..d3d71b65a 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -420,9 +420,9 @@ class ScrollArea final : public BasicContainer, void setDimension(const Rect& dimension); - void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; protected: enum BUTTON_DIR diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 007dc6442..ce2aa5aae 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -221,12 +221,12 @@ void ShopListBox::mouseMoved(MouseEvent &event) } } -void ShopListBox::mouseReleased(MouseEvent& mouseEvent) +void ShopListBox::mouseReleased(MouseEvent& event) { - ListBox::mouseReleased(mouseEvent); - if (mouseEvent.getButton() == MouseEvent::RIGHT) + ListBox::mouseReleased(event); + if (event.getButton() == MouseEvent::RIGHT) { - setSelected(std::max(0, getSelectionByMouse(mouseEvent.getY()))); + setSelected(std::max(0, getSelectionByMouse(event.getY()))); if (mSelected < 0 || mSelected >= mShopItems->getNumberOfElements()) return; @@ -236,7 +236,7 @@ void ShopListBox::mouseReleased(MouseEvent& mouseEvent) } } -void ShopListBox::mouseExited(MouseEvent& mouseEvent A_UNUSED) +void ShopListBox::mouseExited(MouseEvent& event A_UNUSED) { if (!mItemPopup) return; diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index 17c1ed4d5..ddb4407c7 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -76,9 +76,9 @@ class ShopListBox final : public ListBox void mouseMoved(MouseEvent &event) override final; - void mouseReleased(MouseEvent& mouseEvent) override final; + void mouseReleased(MouseEvent& event) override final; - void mouseExited(MouseEvent& mouseEvent) override final; + void mouseExited(MouseEvent& event) override final; void setProtectItems(bool p) { mProtectItems = p; } diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index e7f046422..c4ff2d2bc 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -352,17 +352,17 @@ void Slider::mouseExited(MouseEvent& event A_UNUSED) mRedraw = true; } -void Slider::mousePressed(MouseEvent &mouseEvent) +void Slider::mousePressed(MouseEvent &event) { - const int x = mouseEvent.getX(); - const int y = mouseEvent.getY(); + const int x = event.getX(); + const int y = event.getY(); const int width = mDimension.width; const int height = mDimension.height; - if (mouseEvent.getButton() == MouseEvent::LEFT + if (event.getButton() == MouseEvent::LEFT && x >= 0 && x <= width && y >= 0 && y <= height) { - mouseEvent.consume(); + event.consume(); if (mOrientation == HORIZONTAL) setValue(markerPositionToValue(x - mMarkerLength / 2)); else @@ -372,35 +372,35 @@ void Slider::mousePressed(MouseEvent &mouseEvent) } } -void Slider::mouseDragged(MouseEvent &mouseEvent) +void Slider::mouseDragged(MouseEvent &event) { if (mOrientation == HORIZONTAL) { - setValue(markerPositionToValue(mouseEvent.getX() - mMarkerLength / 2)); + setValue(markerPositionToValue(event.getX() - mMarkerLength / 2)); } else { setValue(markerPositionToValue( - mDimension.height - mouseEvent.getY() - mMarkerLength / 2)); + mDimension.height - event.getY() - mMarkerLength / 2)); } distributeActionEvent(); - mouseEvent.consume(); + event.consume(); } -void Slider::mouseWheelMovedUp(MouseEvent &mouseEvent) +void Slider::mouseWheelMovedUp(MouseEvent &event) { setValue(mValue + mStepLength); distributeActionEvent(); - mouseEvent.consume(); + event.consume(); } -void Slider::mouseWheelMovedDown(MouseEvent &mouseEvent) +void Slider::mouseWheelMovedDown(MouseEvent &event) { setValue(mValue - mStepLength); distributeActionEvent(); - mouseEvent.consume(); + event.consume(); } void Slider::keyPressed(KeyEvent& keyEvent) diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 23d06de48..5ee81dd10 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -135,13 +135,13 @@ class Slider final : public Widget, */ void mouseExited(MouseEvent& event) override final; - void mousePressed(MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &event) override final; - void mouseDragged(MouseEvent &mouseEvent) override final; + void mouseDragged(MouseEvent &event) override final; - void mouseWheelMovedUp(MouseEvent &mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent &event) override final; - void mouseWheelMovedDown(MouseEvent &mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent &event) override final; void keyPressed(KeyEvent& keyEvent) override final; diff --git a/src/gui/widgets/sliderlist.cpp b/src/gui/widgets/sliderlist.cpp index 6782e789c..76e6b54c3 100644 --- a/src/gui/widgets/sliderlist.cpp +++ b/src/gui/widgets/sliderlist.cpp @@ -82,16 +82,16 @@ void SliderList::updateAlpha() Button::updateAlpha(); } -void SliderList::mouseWheelMovedUp(MouseEvent& mouseEvent) +void SliderList::mouseWheelMovedUp(MouseEvent& event) { setSelected(mSelectedIndex - 1); - mouseEvent.consume(); + event.consume(); } -void SliderList::mouseWheelMovedDown(MouseEvent& mouseEvent) +void SliderList::mouseWheelMovedDown(MouseEvent& event) { setSelected(mSelectedIndex + 1); - mouseEvent.consume(); + event.consume(); } void SliderList::resize() diff --git a/src/gui/widgets/sliderlist.h b/src/gui/widgets/sliderlist.h index 84f96ebe4..dac7beabd 100644 --- a/src/gui/widgets/sliderlist.h +++ b/src/gui/widgets/sliderlist.h @@ -49,9 +49,9 @@ class SliderList final : public Container, void updateAlpha(); - void mouseWheelMovedUp(MouseEvent& mouseEvent) override final; + void mouseWheelMovedUp(MouseEvent& event) override final; - void mouseWheelMovedDown(MouseEvent& mouseEvent) override final; + void mouseWheelMovedDown(MouseEvent& event) override final; void resize(); diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 554bdfc66..410112c55 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -366,20 +366,20 @@ void TabbedArea::logic() BLOCK_END("TabbedArea::logic") } -void TabbedArea::mousePressed(MouseEvent &mouseEvent) +void TabbedArea::mousePressed(MouseEvent &event) { - if (mouseEvent.isConsumed()) + if (event.isConsumed()) return; - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { Widget *const widget = mTabContainer->getWidgetAt( - mouseEvent.getX(), mouseEvent.getY()); + event.getX(), event.getY()); Tab *const tab = dynamic_cast(widget); if (tab) { - mouseEvent.consume(); + event.consume(); setSelectedTab(tab); requestFocus(); } diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 0e7a032f0..710db31f2 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -195,7 +195,7 @@ class TabbedArea final : public ActionListener, // Inherited from MouseListener - void mousePressed(MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &event) override final; void enableScrollButtons(const bool enable); diff --git a/src/gui/widgets/tabs/tab.cpp b/src/gui/widgets/tabs/tab.cpp index 1e5733a2b..32d0cf2a6 100644 --- a/src/gui/widgets/tabs/tab.cpp +++ b/src/gui/widgets/tabs/tab.cpp @@ -371,12 +371,12 @@ const std::string &Tab::getCaption() const return mLabel->getCaption(); } -void Tab::mouseEntered(MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseEntered(MouseEvent& event A_UNUSED) { mHasMouse = true; } -void Tab::mouseExited(MouseEvent& mouseEvent A_UNUSED) +void Tab::mouseExited(MouseEvent& event A_UNUSED) { mHasMouse = false; } diff --git a/src/gui/widgets/tabs/tab.h b/src/gui/widgets/tabs/tab.h index 246d90650..a0afa6fcd 100644 --- a/src/gui/widgets/tabs/tab.h +++ b/src/gui/widgets/tabs/tab.h @@ -189,9 +189,9 @@ class Tab : public BasicContainer, const std::string &getCaption() const A_WARN_UNUSED; - void mouseEntered(MouseEvent &mouseEvent) override final; + void mouseEntered(MouseEvent &event) override final; - void mouseExited(MouseEvent &mouseEvent) override final; + void mouseExited(MouseEvent &event) override final; void setImage(Image *const image); diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 50e423de8..39e585279 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -582,29 +582,29 @@ void TextBox::addRow(const std::string &row) adjustSize(); } -void TextBox::mousePressed(MouseEvent& mouseEvent) +void TextBox::mousePressed(MouseEvent& event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { const int height = getFont()->getHeight(); if (!height) return; - mouseEvent.consume(); - mCaretRow = mouseEvent.getY() / height; + event.consume(); + mCaretRow = event.getY() / height; const int sz = static_cast(mTextRows.size()); if (mCaretRow >= sz) mCaretRow = sz - 1; mCaretColumn = getFont()->getStringIndexAt( - mTextRows[mCaretRow], mouseEvent.getX()); + mTextRows[mCaretRow], event.getX()); } } -void TextBox::mouseDragged(MouseEvent& mouseEvent) +void TextBox::mouseDragged(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); } void TextBox::drawCaret(Graphics *const graphics, const int x, const int y) diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index e5cfbc7c9..056f6a0d3 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -272,9 +272,9 @@ class TextBox final : public Widget, void fontChanged() override final { adjustSize(); } - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; private: /** diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b822996a4..d7d73f78a 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -693,14 +693,14 @@ void TextField::fontChanged() fixScroll(); } -void TextField::mousePressed(MouseEvent &mouseEvent) +void TextField::mousePressed(MouseEvent &event) { #ifdef ANDROID if (!client->isKeyboardVisible()) inputManager.executeAction(Input::KEY_SHOW_KEYBOARD); #endif - mouseEvent.consume(); - if (mouseEvent.getButton() == MouseEvent::RIGHT) + event.consume(); + if (event.getButton() == MouseEvent::RIGHT) { if (viewport) { @@ -722,10 +722,10 @@ void TextField::mousePressed(MouseEvent &mouseEvent) } } } - else if (mouseEvent.getButton() == MouseEvent::LEFT) + else if (event.getButton() == MouseEvent::LEFT) { mCaretPosition = getFont()->getStringIndexAt( - mText, mouseEvent.getX() + mXScroll); + mText, event.getX() + mXScroll); fixScroll(); } } @@ -750,7 +750,7 @@ void TextField::setText(const std::string& text) mText = text; } -void TextField::mouseDragged(MouseEvent& mouseEvent) +void TextField::mouseDragged(MouseEvent& event) { - mouseEvent.consume(); + event.consume(); } diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 93ae155be..2b0762e86 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -162,7 +162,7 @@ class TextField : public Widget, void setCaretPosition(unsigned int position); - void mousePressed(MouseEvent &mouseEvent) override final; + void mousePressed(MouseEvent &event) override final; void handlePaste(); @@ -219,7 +219,7 @@ class TextField : public Widget, unsigned int getCaretPosition() const { return mCaretPosition; } - void mouseDragged(MouseEvent& mouseEvent) override final; + void mouseDragged(MouseEvent& event) override final; protected: void drawCaret(Graphics* graphics, int x); diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 868455de5..2431a35ea 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -295,7 +295,7 @@ void WindowMenu::mouseMoved(MouseEvent &event) } } -void WindowMenu::mouseExited(MouseEvent& mouseEvent A_UNUSED) +void WindowMenu::mouseExited(MouseEvent& event A_UNUSED) { mHaveMouse = false; if (!mTextPopup) diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index a1ed66a7d..9eb520bff 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -94,7 +94,7 @@ class WindowMenu final : public Container, void mouseMoved(MouseEvent &event) override final; - void mouseExited(MouseEvent& mouseEvent A_UNUSED) override final; + void mouseExited(MouseEvent& event A_UNUSED) override final; std::map &getButtonNames() A_WARN_UNUSED { return mButtonNames; } diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index c6e4182d8..0a5480520 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1858,16 +1858,16 @@ void ChatWindow::mouseMoved(MouseEvent &event) Window::mouseMoved(event); } -void ChatWindow::mouseEntered(MouseEvent& mouseEvent) +void ChatWindow::mouseEntered(MouseEvent& event) { mHaveMouse = true; - Window::mouseEntered(mouseEvent); + Window::mouseEntered(event); } -void ChatWindow::mouseExited(MouseEvent& mouseEvent) +void ChatWindow::mouseExited(MouseEvent& event) { updateVisibility(); - Window::mouseExited(mouseEvent); + Window::mouseExited(event); } void ChatWindow::draw(Graphics* graphics) diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index bd5374c56..e755e43f2 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -274,11 +274,11 @@ class ChatWindow final : public Window, void optionChanged(const std::string &name) override final; - void mouseEntered(MouseEvent& mouseEvent) override final; + void mouseEntered(MouseEvent& event) override final; void mouseMoved(MouseEvent &event) override final; - void mouseExited(MouseEvent& mouseEvent A_UNUSED) override final; + void mouseExited(MouseEvent& event A_UNUSED) override final; void draw(Graphics* graphics) override final; diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index b8b693fc1..47e7e8b7d 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -295,22 +295,22 @@ Item *EquipmentWindow::getItem(const int x, const int y) const return nullptr; } -void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) +void EquipmentWindow::mousePressed(MouseEvent& event) { if (!mEquipment) { - Window::mousePressed(mouseEvent); + Window::mousePressed(event); return; } - const int x = mouseEvent.getX(); - const int y = mouseEvent.getY(); + const int x = event.getX(); + const int y = event.getY(); - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { if (mForing) { - Window::mousePressed(mouseEvent); + Window::mousePressed(event); return; } // Checks if any of the presses were in the equip boxes. @@ -332,7 +332,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) inBox = true; if (item) { - mouseEvent.consume(); + event.consume(); setSelected(i); dragDrop.dragItem(item, DRAGDROP_SOURCE_EQUIPMENT); return; @@ -342,7 +342,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) return; } } - else if (mouseEvent.getButton() == MouseEvent::RIGHT) + else if (event.getButton() == MouseEvent::RIGHT) { if (Item *const item = getItem(x, y)) { @@ -356,7 +356,7 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) const int my = y + getY(); if (viewport) { - mouseEvent.consume(); + event.consume(); if (mForing) viewport->showUndressPopup(mx, my, mBeing, item); else @@ -365,12 +365,12 @@ void EquipmentWindow::mousePressed(MouseEvent& mouseEvent) } } } - Window::mousePressed(mouseEvent); + Window::mousePressed(event); } -void EquipmentWindow::mouseReleased(MouseEvent &mouseEvent) +void EquipmentWindow::mouseReleased(MouseEvent &event) { - Window::mouseReleased(mouseEvent); + Window::mouseReleased(event); const DragDropSource src = dragDrop.getSource(); if (dragDrop.isEmpty() || (src != DRAGDROP_SOURCE_INVENTORY && src != DRAGDROP_SOURCE_EQUIPMENT)) @@ -399,8 +399,8 @@ void EquipmentWindow::mouseReleased(MouseEvent &mouseEvent) { if (item->isEquipment()) { - const int x = mouseEvent.getX(); - const int y = mouseEvent.getY(); + const int x = event.getX(); + const int y = event.getY(); for (std::vector::const_iterator it = mBoxes.begin(), it_end = mBoxes.end(); it != it_end; ++ it) diff --git a/src/gui/windows/equipmentwindow.h b/src/gui/windows/equipmentwindow.h index 245328b8e..45d4246e3 100644 --- a/src/gui/windows/equipmentwindow.h +++ b/src/gui/windows/equipmentwindow.h @@ -86,7 +86,7 @@ class EquipmentWindow final : public Window, void action(const ActionEvent &event) override final; - void mousePressed(MouseEvent& mouseEvent) override final; + void mousePressed(MouseEvent& event) override final; const Item* getEquipment(const int i) const A_WARN_UNUSED { return mEquipment ? mEquipment->getEquipment(i) : nullptr; } diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index ee20ef69b..feabb82d0 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -71,7 +71,7 @@ class MiniStatusWindow final : public Popup, void draw(Graphics *graphics) override final; - void mouseMoved(MouseEvent &mouseEvent) override final; + void mouseMoved(MouseEvent &event) override final; void mousePressed(MouseEvent &event) override final; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 5b0b557dc..ec4bbebbb 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -450,13 +450,13 @@ void ServerDialog::valueChanged(const SelectionEvent &) mDeleteButton->setEnabled(true); } -void ServerDialog::mouseClicked(MouseEvent &mouseEvent) +void ServerDialog::mouseClicked(MouseEvent &event) { - if (mouseEvent.getButton() == MouseEvent::LEFT) + if (event.getButton() == MouseEvent::LEFT) { - mouseEvent.consume(); - if (mouseEvent.getClickCount() == 2 && - mouseEvent.getSource() == mServersList) + event.consume(); + if (event.getClickCount() == 2 && + event.getSource() == mServersList) { action(ActionEvent(mConnectButton, mConnectButton->getActionEventId())); diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index 7c3a05ab3..60b84f089 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -81,7 +81,7 @@ class ServerDialog final : public Window, */ void valueChanged(const SelectionEvent &event) override final; - void mouseClicked(MouseEvent &mouseEvent) override final; + void mouseClicked(MouseEvent &event) override final; void logic() override final; diff --git a/src/listeners/mouselistener.h b/src/listeners/mouselistener.h index 9a2a4ef04..e3c7c7ccb 100644 --- a/src/listeners/mouselistener.h +++ b/src/listeners/mouselistener.h @@ -86,20 +86,20 @@ class MouseListener /** * Called when the mouse has entered into the widget area. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseEntered(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseEntered(MouseEvent &event A_UNUSED) { } /** * Called when the mouse has exited the widget area. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseExited(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseExited(MouseEvent &event A_UNUSED) { } @@ -109,20 +109,20 @@ class MouseListener * NOTE: A mouse press is NOT equal to a mouse click. * Use mouseClickMessage to check for mouse clicks. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mousePressed(MouseEvent &mouseEvent A_UNUSED) + virtual void mousePressed(MouseEvent &event A_UNUSED) { } /** * Called when a mouse button has been released on the widget area. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseReleased(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseReleased(MouseEvent &event A_UNUSED) { } @@ -130,20 +130,20 @@ class MouseListener * Called when a mouse button is pressed and released (clicked) on * the widget area. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseClicked(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseClicked(MouseEvent &event A_UNUSED) { } /** * Called when the mouse wheel has moved up on the widget area. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedUp(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseWheelMovedUp(MouseEvent &event A_UNUSED) { } @@ -153,7 +153,7 @@ class MouseListener * @param mousEvent Describes the event. * @since 0.6.0 */ - virtual void mouseWheelMovedDown(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseWheelMovedDown(MouseEvent &event A_UNUSED) { } @@ -161,10 +161,10 @@ class MouseListener * Called when the mouse has moved in the widget area and no mouse button * has been pressed (i.e no widget is being dragged). * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseMoved(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseMoved(MouseEvent &event A_UNUSED) { } @@ -172,10 +172,10 @@ class MouseListener * Called when the mouse has moved and the mouse has previously been * pressed on the widget. * - * @param mouseEvent Describes the event. + * @param event Describes the event. * @since 0.6.0 */ - virtual void mouseDragged(MouseEvent &mouseEvent A_UNUSED) + virtual void mouseDragged(MouseEvent &event A_UNUSED) { } -- cgit v1.2.3-70-g09d2 From ba931a717cb5a2549ecdaa1f924dbbf5f896a21b Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Mar 2014 22:22:47 +0300 Subject: Rename keyEvent variables into event. --- src/gui/gui.cpp | 44 +++++++++++++++++------------------ src/gui/gui.h | 8 +++---- src/gui/widgets/button.cpp | 12 +++++----- src/gui/widgets/button.h | 4 ++-- src/gui/widgets/checkbox.cpp | 6 ++--- src/gui/widgets/checkbox.h | 2 +- src/gui/widgets/dropdown.cpp | 8 +++---- src/gui/widgets/dropdown.h | 2 +- src/gui/widgets/guitable.cpp | 18 +++++++------- src/gui/widgets/guitable.h | 2 +- src/gui/widgets/listbox.cpp | 14 +++++------ src/gui/widgets/listbox.h | 2 +- src/gui/widgets/radiobutton.cpp | 6 ++--- src/gui/widgets/radiobutton.h | 2 +- src/gui/widgets/slider.cpp | 12 +++++----- src/gui/widgets/slider.h | 2 +- src/gui/widgets/tabbedarea.cpp | 10 ++++---- src/gui/widgets/tabbedarea.h | 2 +- src/gui/widgets/textbox.cpp | 8 +++---- src/gui/widgets/textbox.h | 2 +- src/gui/widgets/textfield.cpp | 18 +++++++------- src/gui/widgets/textfield.h | 2 +- src/gui/windows/charcreatedialog.cpp | 6 ++--- src/gui/windows/charcreatedialog.h | 2 +- src/gui/windows/charselectdialog.cpp | 18 +++++++------- src/gui/windows/charselectdialog.h | 2 +- src/gui/windows/editserverdialog.cpp | 6 ++--- src/gui/windows/editserverdialog.h | 2 +- src/gui/windows/itemamountwindow.cpp | 2 +- src/gui/windows/itemamountwindow.h | 2 +- src/gui/windows/logindialog.cpp | 6 ++--- src/gui/windows/logindialog.h | 2 +- src/gui/windows/quitdialog.cpp | 4 ++-- src/gui/windows/quitdialog.h | 2 +- src/gui/windows/registerdialog.cpp | 6 ++--- src/gui/windows/registerdialog.h | 2 +- src/gui/windows/serverdialog.cpp | 12 +++++----- src/gui/windows/serverdialog.h | 2 +- src/gui/windows/updaterwindow.cpp | 4 ++-- src/gui/windows/updaterwindow.h | 2 +- src/gui/windows/worldselectdialog.cpp | 4 ++-- src/gui/windows/worldselectdialog.h | 2 +- src/listeners/keylistener.h | 8 +++---- 43 files changed, 141 insertions(+), 141 deletions(-) (limited to 'src/gui/widgets/checkbox.cpp') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2814de4bb..275103a25 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -424,21 +424,21 @@ bool Gui::handleKeyInput() { const KeyInput keyInput = guiInput->dequeueKeyInput(); - KeyEvent keyEventToGlobalKeyListeners(nullptr, + KeyEvent eventToGlobalKeyListeners(nullptr, keyInput.getType(), keyInput.getActionId(), keyInput.getKey()); #ifdef USE_SDL2 if (!keyInput.getText().empty()) - keyEventToGlobalKeyListeners.setText(keyInput.getText()); + eventToGlobalKeyListeners.setText(keyInput.getText()); #endif distributeKeyEventToGlobalKeyListeners( - keyEventToGlobalKeyListeners); + eventToGlobalKeyListeners); // If a global key listener consumes the event it will not be // sent further to the source of the event. - if (keyEventToGlobalKeyListeners.isConsumed()) + if (eventToGlobalKeyListeners.isConsumed()) { consumed = true; continue; @@ -446,33 +446,33 @@ bool Gui::handleKeyInput() if (mFocusHandler) { - bool keyEventConsumed = false; + bool eventConsumed = false; // Send key inputs to the focused widgets if (mFocusHandler->getFocused()) { - KeyEvent keyEvent(getKeyEventSource(), + KeyEvent event(getKeyEventSource(), keyInput.getType(), keyInput.getActionId(), keyInput.getKey()); #ifdef USE_SDL2 if (!keyInput.getText().empty()) - keyEvent.setText(keyInput.getText()); + event.setText(keyInput.getText()); #endif if (!mFocusHandler->getFocused()->isFocusable()) mFocusHandler->focusNone(); else - distributeKeyEvent(keyEvent); + distributeKeyEvent(event); - keyEventConsumed = keyEvent.isConsumed(); - if (keyEventConsumed) + eventConsumed = event.isConsumed(); + if (eventConsumed) consumed = true; } // If the key event hasn't been consumed and // tabbing is enable check for tab press and // change focus. - if (!keyEventConsumed && keyInput.getActionId() + if (!eventConsumed && keyInput.getActionId() == static_cast(Input::KEY_GUI_TAB) && keyInput.getType() == KeyInput::PRESSED) { @@ -1247,10 +1247,10 @@ Widget* Gui::getKeyEventSource() const return widget; } -void Gui::distributeKeyEvent(KeyEvent &keyEvent) const +void Gui::distributeKeyEvent(KeyEvent &event) const { - Widget* parent = keyEvent.getSource(); - Widget* widget = keyEvent.getSource(); + Widget* parent = event.getSource(); + Widget* widget = event.getSource(); if (mFocusHandler->getModalFocused() && !widget->isModalFocused()) return; @@ -1275,7 +1275,7 @@ void Gui::distributeKeyEvent(KeyEvent &keyEvent) const std::list keyListeners = widget->_getKeyListeners(); - const unsigned int eventType = keyEvent.getType(); + const unsigned int eventType = event.getType(); // Send the event to all key listeners of the source widget. FOR_EACH (std::list::const_iterator, it, keyListeners) @@ -1283,10 +1283,10 @@ void Gui::distributeKeyEvent(KeyEvent &keyEvent) const switch (eventType) { case KeyEvent::PRESSED: - (*it)->keyPressed(keyEvent); + (*it)->keyPressed(event); break; case KeyEvent::RELEASED: - (*it)->keyReleased(keyEvent); + (*it)->keyReleased(event); break; default: break; @@ -1305,24 +1305,24 @@ void Gui::distributeKeyEvent(KeyEvent &keyEvent) const } } -void Gui::distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEvent) +void Gui::distributeKeyEventToGlobalKeyListeners(KeyEvent& event) { - const unsigned int eventType = keyEvent.getType(); + const unsigned int eventType = event.getType(); FOR_EACH (KeyListenerListIterator, it, mKeyListeners) { switch (eventType) { case KeyEvent::PRESSED: - (*it)->keyPressed(keyEvent); + (*it)->keyPressed(event); break; case KeyEvent::RELEASED: - (*it)->keyReleased(keyEvent); + (*it)->keyReleased(event); break; default: break; } - if (keyEvent.isConsumed()) + if (event.isConsumed()) break; } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 7ecb56b21..723c653ca 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -368,20 +368,20 @@ class Gui final /** * Distributes a key event. * - * @param keyEvent The key event to distribute. + * @param event The key event to distribute. * @since 0.6.0 */ - void distributeKeyEvent(KeyEvent &keyEvent) const; + void distributeKeyEvent(KeyEvent &event) const; /** * Distributes a key event to the global key listeners. * - * @param keyEvent The key event to distribute. + * @param event The key event to distribute. * * @since 0.6.0 */ - void distributeKeyEventToGlobalKeyListeners(KeyEvent& keyEvent); + void distributeKeyEventToGlobalKeyListeners(KeyEvent& event); /** * Handles modal mouse input focus. Modal mouse input focus needs diff --git a/src/gui/widgets/button.cpp b/src/gui/widgets/button.cpp index 778d74b41..dffcc7814 100644 --- a/src/gui/widgets/button.cpp +++ b/src/gui/widgets/button.cpp @@ -673,20 +673,20 @@ void Button::adjustSize() } } -void Button::keyPressed(KeyEvent& keyEvent) +void Button::keyPressed(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT) { mKeyPressed = true; - keyEvent.consume(); + event.consume(); } } -void Button::keyReleased(KeyEvent& keyEvent) +void Button::keyReleased(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT && mKeyPressed) { @@ -694,7 +694,7 @@ void Button::keyReleased(KeyEvent& keyEvent) if (mStick) mPressed = !mPressed; distributeActionEvent(); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/button.h b/src/gui/widgets/button.h index 200418172..57a024195 100644 --- a/src/gui/widgets/button.h +++ b/src/gui/widgets/button.h @@ -189,9 +189,9 @@ class Button final : public Widget, void adjustSize(); - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; - void keyReleased(KeyEvent &keyEvent) override final; + void keyReleased(KeyEvent &event) override final; bool isPressed2() const A_WARN_UNUSED; diff --git a/src/gui/widgets/checkbox.cpp b/src/gui/widgets/checkbox.cpp index fb639753f..06dcecab0 100644 --- a/src/gui/widgets/checkbox.cpp +++ b/src/gui/widgets/checkbox.cpp @@ -235,14 +235,14 @@ void CheckBox::mouseExited(MouseEvent& event A_UNUSED) mHasMouse = false; } -void CheckBox::keyPressed(KeyEvent& keyEvent) +void CheckBox::keyPressed(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT) { toggleSelected(); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/checkbox.h b/src/gui/widgets/checkbox.h index 9882284b0..41f168048 100644 --- a/src/gui/widgets/checkbox.h +++ b/src/gui/widgets/checkbox.h @@ -126,7 +126,7 @@ class CheckBox final : public Widget, */ void mouseExited(MouseEvent& event) override final; - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; void adjustSize(); diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index ba2ffe58d..8b636c04d 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -307,12 +307,12 @@ void DropDown::drawButton(Graphics *graphics) } } -void DropDown::keyPressed(KeyEvent& keyEvent) +void DropDown::keyPressed(KeyEvent& event) { - if (keyEvent.isConsumed()) + if (event.isConsumed()) return; - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); switch (actionId) { case Input::KEY_GUI_SELECT: @@ -344,7 +344,7 @@ void DropDown::keyPressed(KeyEvent& keyEvent) return; } - keyEvent.consume(); + event.consume(); } void DropDown::hideDrop(bool event) diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index a4d1fde1e..cf42cce11 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -83,7 +83,7 @@ class DropDown final : public ActionListener, // Inherited from KeyListener - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; // Inherited from MouseListener diff --git a/src/gui/widgets/guitable.cpp b/src/gui/widgets/guitable.cpp index 44248037c..35e09ce93 100644 --- a/src/gui/widgets/guitable.cpp +++ b/src/gui/widgets/guitable.cpp @@ -421,46 +421,46 @@ Rect GuiTable::getChildrenArea() } // -- KeyListener notifications -void GuiTable::keyPressed(KeyEvent& keyEvent) +void GuiTable::keyPressed(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT) { distributeActionEvent(); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_UP) { setSelectedRow(mSelectedRow - 1); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_DOWN) { setSelectedRow(mSelectedRow + 1); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_LEFT) { setSelectedColumn(mSelectedColumn - 1); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_RIGHT) { setSelectedColumn(mSelectedColumn + 1); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_HOME) { setSelectedRow(0); setSelectedColumn(0); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_END && mModel) { setSelectedRow(mModel->getRows() - 1); setSelectedColumn(mModel->getColumns() - 1); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/guitable.h b/src/gui/widgets/guitable.h index 9beb866cf..ec3bab728 100644 --- a/src/gui/widgets/guitable.h +++ b/src/gui/widgets/guitable.h @@ -123,7 +123,7 @@ public: void _setFocusHandler(FocusHandler *const focusHandler) override final; // Inherited from KeyListener - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; /** * Sets the table to be opaque, that is sets the table diff --git a/src/gui/widgets/listbox.cpp b/src/gui/widgets/listbox.cpp index 1df21af20..c41e32854 100644 --- a/src/gui/widgets/listbox.cpp +++ b/src/gui/widgets/listbox.cpp @@ -225,13 +225,13 @@ void ListBox::draw(Graphics *graphics) BLOCK_END("ListBox::draw") } -void ListBox::keyPressed(KeyEvent &keyEvent) +void ListBox::keyPressed(KeyEvent &event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT) { distributeActionEvent(); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_UP) { @@ -239,7 +239,7 @@ void ListBox::keyPressed(KeyEvent &keyEvent) setSelected(mSelected - 1); else if (mSelected == 0 && mWrappingEnabled && getListModel()) setSelected(getListModel()->getNumberOfElements() - 1); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_DOWN) { @@ -248,17 +248,17 @@ void ListBox::keyPressed(KeyEvent &keyEvent) setSelected(mSelected + 1); else if (mSelected == num && mWrappingEnabled) setSelected(0); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_HOME) { setSelected(0); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_END && getListModel()) { setSelected(getListModel()->getNumberOfElements() - 1); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/listbox.h b/src/gui/widgets/listbox.h index 9a398dfa2..e425b48ca 100644 --- a/src/gui/widgets/listbox.h +++ b/src/gui/widgets/listbox.h @@ -119,7 +119,7 @@ class ListBox : public Widget, // Inherited from KeyListener - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; // Inherited from MouseListener diff --git a/src/gui/widgets/radiobutton.cpp b/src/gui/widgets/radiobutton.cpp index 549e8823e..643517f77 100644 --- a/src/gui/widgets/radiobutton.cpp +++ b/src/gui/widgets/radiobutton.cpp @@ -235,14 +235,14 @@ void RadioButton::mouseExited(MouseEvent& event A_UNUSED) mHasMouse = false; } -void RadioButton::keyPressed(KeyEvent& keyEvent) +void RadioButton::keyPressed(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (action == Input::KEY_GUI_SELECT) { setSelected(true); distributeActionEvent(); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index a0d32dd9d..ec1450f66 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -120,7 +120,7 @@ class RadioButton final : public Widget, */ void mouseExited(MouseEvent& event) override final; - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; void updateAlpha(); diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index c4ff2d2bc..cf9aad03d 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -403,9 +403,9 @@ void Slider::mouseWheelMovedDown(MouseEvent &event) event.consume(); } -void Slider::keyPressed(KeyEvent& keyEvent) +void Slider::keyPressed(KeyEvent& event) { - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (mOrientation == HORIZONTAL) { @@ -413,13 +413,13 @@ void Slider::keyPressed(KeyEvent& keyEvent) { setValue(mValue + mStepLength); distributeActionEvent(); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_LEFT) { setValue(mValue - mStepLength); distributeActionEvent(); - keyEvent.consume(); + event.consume(); } } else @@ -428,13 +428,13 @@ void Slider::keyPressed(KeyEvent& keyEvent) { setValue(mValue + mStepLength); distributeActionEvent(); - keyEvent.consume(); + event.consume(); } else if (action == Input::KEY_GUI_DOWN) { setValue(mValue - mStepLength); distributeActionEvent(); - keyEvent.consume(); + event.consume(); } } } diff --git a/src/gui/widgets/slider.h b/src/gui/widgets/slider.h index 5ee81dd10..164048020 100644 --- a/src/gui/widgets/slider.h +++ b/src/gui/widgets/slider.h @@ -143,7 +143,7 @@ class Slider final : public Widget, void mouseWheelMovedDown(MouseEvent &event) override final; - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; /** * Sets the scale of the slider. diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 410112c55..3cb6cb302 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -727,12 +727,12 @@ void TabbedArea::setDimension(const Rect &dimension) adjustSize(); } -void TabbedArea::keyPressed(KeyEvent& keyEvent) +void TabbedArea::keyPressed(KeyEvent& event) { - if (mBlockSwitching || keyEvent.isConsumed() || !isFocused()) + if (mBlockSwitching || event.isConsumed() || !isFocused()) return; - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == Input::KEY_GUI_LEFT) { @@ -744,7 +744,7 @@ void TabbedArea::keyPressed(KeyEvent& keyEvent) else setSelectedTab(mTabs[index].first); - keyEvent.consume(); + event.consume(); } else if (actionId == Input::KEY_GUI_RIGHT) { @@ -756,7 +756,7 @@ void TabbedArea::keyPressed(KeyEvent& keyEvent) else setSelectedTab(mTabs[index].first); - keyEvent.consume(); + event.consume(); } } diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 710db31f2..578128abf 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -211,7 +211,7 @@ class TabbedArea final : public ActionListener, bool getFollowDownScroll() const A_WARN_UNUSED { return mFollowDownScroll; } - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; void setBlockSwitching(const bool b) { mBlockSwitching = b; } diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index 39e585279..b1849e801 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -248,10 +248,10 @@ void TextBox::setText(const std::string& text) adjustSize(); } -void TextBox::keyPressed(KeyEvent& keyEvent) +void TextBox::keyPressed(KeyEvent& event) { - const Key &key = keyEvent.getKey(); - const int action = keyEvent.getActionId(); + const Key &key = event.getKey(); + const int action = event.getActionId(); switch (action) { @@ -430,7 +430,7 @@ void TextBox::keyPressed(KeyEvent& keyEvent) adjustSize(); scrollToCaret(); - keyEvent.consume(); + event.consume(); } void TextBox::draw(Graphics* graphics) diff --git a/src/gui/widgets/textbox.h b/src/gui/widgets/textbox.h index 056f6a0d3..e8c1d3840 100644 --- a/src/gui/widgets/textbox.h +++ b/src/gui/widgets/textbox.h @@ -105,7 +105,7 @@ class TextBox final : public Widget, int getMinWidth() const A_WARN_UNUSED { return mMinWidth; } - void keyPressed(KeyEvent& keyEvent) override final; + void keyPressed(KeyEvent& event) override final; void draw(Graphics* graphics) override final; diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index d7d73f78a..d1f19785f 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -245,16 +245,16 @@ int TextField::getValue() const return value; } -void TextField::keyPressed(KeyEvent &keyEvent) +void TextField::keyPressed(KeyEvent &event) { - const int val = keyEvent.getKey().getValue(); + const int val = event.getKey().getValue(); #ifdef USE_SDL2 if (val == Key::TEXTINPUT) { - std::string str = keyEvent.getText(); + std::string str = event.getText(); mText.insert(mCaretPosition, str); mCaretPosition += str.size(); - keyEvent.consume(); + event.consume(); fixScroll(); if (mSendAlwaysEvents) distributeActionEvent(); @@ -273,7 +273,7 @@ void TextField::keyPressed(KeyEvent &keyEvent) buf[1] = 0; mText.insert(mCaretPosition, std::string(buf)); mCaretPosition += 1; - keyEvent.consume(); + event.consume(); fixScroll(); if (mSendAlwaysEvents) distributeActionEvent(); @@ -305,7 +305,7 @@ void TextField::keyPressed(KeyEvent &keyEvent) mText.insert(mCaretPosition, std::string(buf, buf + len)); mCaretPosition += len; - keyEvent.consume(); + event.consume(); fixScroll(); if (mSendAlwaysEvents) distributeActionEvent(); @@ -323,14 +323,14 @@ void TextField::keyPressed(KeyEvent &keyEvent) bool consumed(false); #endif - const int action = keyEvent.getActionId(); + const int action = event.getActionId(); if (!inputManager.isActionActive(static_cast( Input::KEY_GUI_CTRL))) { if (!handleNormalKeys(action, consumed)) { if (consumed) - keyEvent.consume(); + event.consume(); return; } } @@ -343,7 +343,7 @@ void TextField::keyPressed(KeyEvent &keyEvent) distributeActionEvent(); if (consumed) - keyEvent.consume(); + event.consume(); fixScroll(); } diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index 2b0762e86..1af5978b1 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -134,7 +134,7 @@ class TextField : public Widget, /** * Processes one keypress. */ - void keyPressed(KeyEvent &keyEvent) override; + void keyPressed(KeyEvent &event) override; /** * Set the minimum value for a range diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 1df282189..53b4b55ff 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -655,13 +655,13 @@ void CharCreateDialog::updatePlayer() } } -void CharCreateDialog::keyPressed(KeyEvent &keyEvent) +void CharCreateDialog::keyPressed(KeyEvent &event) { - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); switch (actionId) { case Input::KEY_GUI_CANCEL: - keyEvent.consume(); + event.consume(); action(ActionEvent(mCancelButton, mCancelButton->getActionEventId())); break; diff --git a/src/gui/windows/charcreatedialog.h b/src/gui/windows/charcreatedialog.h index 6342450ec..652254776 100644 --- a/src/gui/windows/charcreatedialog.h +++ b/src/gui/windows/charcreatedialog.h @@ -78,7 +78,7 @@ class CharCreateDialog final : public Window, void updatePlayer(); - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; private: int getDistributedPoints() const A_WARN_UNUSED; diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 4480f06af..887937232 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -317,20 +317,20 @@ void CharSelectDialog::use(const int selected) } } -void CharSelectDialog::keyPressed(KeyEvent &keyEvent) +void CharSelectDialog::keyPressed(KeyEvent &event) { - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); switch (actionId) { case Input::KEY_GUI_CANCEL: - keyEvent.consume(); + event.consume(); action(ActionEvent(mSwitchLoginButton, mSwitchLoginButton->getActionEventId())); break; case Input::KEY_GUI_RIGHT: { - keyEvent.consume(); + event.consume(); int idx = mCharacterView->getSelected(); if (idx >= 0) { @@ -345,7 +345,7 @@ void CharSelectDialog::keyPressed(KeyEvent &keyEvent) case Input::KEY_GUI_LEFT: { - keyEvent.consume(); + event.consume(); int idx = mCharacterView->getSelected(); if (idx >= 0) { @@ -360,7 +360,7 @@ void CharSelectDialog::keyPressed(KeyEvent &keyEvent) case Input::KEY_GUI_UP: { - keyEvent.consume(); + event.consume(); int idx = mCharacterView->getSelected(); if (idx >= 0) { @@ -375,7 +375,7 @@ void CharSelectDialog::keyPressed(KeyEvent &keyEvent) case Input::KEY_GUI_DOWN: { - keyEvent.consume(); + event.consume(); int idx = mCharacterView->getSelected(); if (idx >= 0) { @@ -390,7 +390,7 @@ void CharSelectDialog::keyPressed(KeyEvent &keyEvent) case Input::KEY_GUI_DELETE: { - keyEvent.consume(); + event.consume(); const int idx = mCharacterView->getSelected(); if (idx >= 0 && mCharacterEntries[idx] && mCharacterEntries[idx]->getCharacter()) @@ -402,7 +402,7 @@ void CharSelectDialog::keyPressed(KeyEvent &keyEvent) case Input::KEY_GUI_SELECT: { - keyEvent.consume(); + event.consume(); use(mCharacterView->getSelected()); break; } diff --git a/src/gui/windows/charselectdialog.h b/src/gui/windows/charselectdialog.h index 38c307f30..cf44f30b9 100644 --- a/src/gui/windows/charselectdialog.h +++ b/src/gui/windows/charselectdialog.h @@ -62,7 +62,7 @@ class CharSelectDialog final : public Window, void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; enum SelectAction { diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 316a7051b..6a25a2d77 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -242,12 +242,12 @@ void EditServerDialog::action(const ActionEvent &event) } } -void EditServerDialog::keyPressed(KeyEvent &keyEvent) +void EditServerDialog::keyPressed(KeyEvent &event) { - if (keyEvent.isConsumed()) + if (event.isConsumed()) return; - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == static_cast(Input::KEY_GUI_CANCEL)) { diff --git a/src/gui/windows/editserverdialog.h b/src/gui/windows/editserverdialog.h index b70d1031b..98f5e07fd 100644 --- a/src/gui/windows/editserverdialog.h +++ b/src/gui/windows/editserverdialog.h @@ -59,7 +59,7 @@ class EditServerDialog final : public Window, */ void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; private: TextField *mServerAddressField; diff --git a/src/gui/windows/itemamountwindow.cpp b/src/gui/windows/itemamountwindow.cpp index ec581a96e..7db944695 100644 --- a/src/gui/windows/itemamountwindow.cpp +++ b/src/gui/windows/itemamountwindow.cpp @@ -388,7 +388,7 @@ void ItemAmountWindow::close() scheduleDelete(); } -void ItemAmountWindow::keyReleased(KeyEvent &keyEvent A_UNUSED) +void ItemAmountWindow::keyReleased(KeyEvent &event A_UNUSED) { mItemAmountSlide->setValue(mItemAmountTextField->getValue()); } diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index 2a414bb24..d2dca064e 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -82,7 +82,7 @@ class ItemAmountWindow final : public Window, */ void close(); - void keyReleased(KeyEvent &keyEvent) override final; + void keyReleased(KeyEvent &event) override final; /** * Creates the dialog, or bypass it if there aren't enough items. diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 71abf153a..4db58e911 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -256,15 +256,15 @@ void LoginDialog::action(const ActionEvent &event) } } -void LoginDialog::keyPressed(KeyEvent &keyEvent) +void LoginDialog::keyPressed(KeyEvent &event) { - if (keyEvent.isConsumed()) + if (event.isConsumed()) { mLoginButton->setEnabled(canSubmit()); return; } - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == static_cast(Input::KEY_GUI_CANCEL)) { action(ActionEvent(nullptr, mServerButton->getActionEventId())); diff --git a/src/gui/windows/logindialog.h b/src/gui/windows/logindialog.h index 7150b62c1..1813e1817 100644 --- a/src/gui/windows/logindialog.h +++ b/src/gui/windows/logindialog.h @@ -71,7 +71,7 @@ class LoginDialog final : public Window, /** * Called when a key is pressed in one of the text fields. */ - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; void close() override final; diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp index 98aa70c70..560968311 100644 --- a/src/gui/windows/quitdialog.cpp +++ b/src/gui/windows/quitdialog.cpp @@ -203,9 +203,9 @@ void QuitDialog::action(const ActionEvent &event) scheduleDelete(); } -void QuitDialog::keyPressed(KeyEvent &keyEvent) +void QuitDialog::keyPressed(KeyEvent &event) { - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); int dir = 0; switch (actionId) diff --git a/src/gui/windows/quitdialog.h b/src/gui/windows/quitdialog.h index 8ce60d06c..ffcea4122 100644 --- a/src/gui/windows/quitdialog.h +++ b/src/gui/windows/quitdialog.h @@ -64,7 +64,7 @@ class QuitDialog final : public Window, */ void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; private: void placeOption(ContainerPlacer &placer, diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index 50344f223..9c74cbc0d 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -282,14 +282,14 @@ void RegisterDialog::action(const ActionEvent &event) } } -void RegisterDialog::keyPressed(KeyEvent &keyEvent) +void RegisterDialog::keyPressed(KeyEvent &event) { - if (keyEvent.isConsumed()) + if (event.isConsumed()) { mRegisterButton->setEnabled(canSubmit()); return; } - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == static_cast(Input::KEY_GUI_CANCEL)) { action(ActionEvent(nullptr, mCancelButton->getActionEventId())); diff --git a/src/gui/windows/registerdialog.h b/src/gui/windows/registerdialog.h index 1d5b5e48b..90087b5e2 100644 --- a/src/gui/windows/registerdialog.h +++ b/src/gui/windows/registerdialog.h @@ -87,7 +87,7 @@ class RegisterDialog final : public Window, /** * Called when a key is pressed in one of the text fields. */ - void keyPressed(KeyEvent &keyEvent) override; + void keyPressed(KeyEvent &event) override; void close() override; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index ec4bbebbb..33b6f1599 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -389,18 +389,18 @@ void ServerDialog::action(const ActionEvent &event) } } -void ServerDialog::keyPressed(KeyEvent &keyEvent) +void ServerDialog::keyPressed(KeyEvent &event) { - switch (keyEvent.getActionId()) + switch (event.getActionId()) { case Input::KEY_GUI_CANCEL: - keyEvent.consume(); + event.consume(); client->setState(STATE_EXIT); return; case Input::KEY_GUI_SELECT: case Input::KEY_GUI_SELECT2: - keyEvent.consume(); + event.consume(); action(ActionEvent(nullptr, mConnectButton->getActionEventId())); return; @@ -435,8 +435,8 @@ void ServerDialog::keyPressed(KeyEvent &keyEvent) default: break; } - if (!keyEvent.isConsumed()) - mServersList->keyPressed(keyEvent); + if (!event.isConsumed()) + mServersList->keyPressed(event); } void ServerDialog::valueChanged(const SelectionEvent &) diff --git a/src/gui/windows/serverdialog.h b/src/gui/windows/serverdialog.h index 60b84f089..88b6a7caf 100644 --- a/src/gui/windows/serverdialog.h +++ b/src/gui/windows/serverdialog.h @@ -74,7 +74,7 @@ class ServerDialog final : public Window, */ void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; /** * Called when the selected value changed in the servers list box. diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 247ef8707..70af8e7ea 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -292,9 +292,9 @@ void UpdaterWindow::action(const ActionEvent &event) } } -void UpdaterWindow::keyPressed(KeyEvent &keyEvent) +void UpdaterWindow::keyPressed(KeyEvent &event) { - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == static_cast(Input::KEY_GUI_CANCEL)) { action(ActionEvent(nullptr, mCancelButton->getActionEventId())); diff --git a/src/gui/windows/updaterwindow.h b/src/gui/windows/updaterwindow.h index 39e1e84f3..4874ba8ba 100644 --- a/src/gui/windows/updaterwindow.h +++ b/src/gui/windows/updaterwindow.h @@ -121,7 +121,7 @@ class UpdaterWindow final : public Window, void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; void logic() override final; diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp index 58c1aaee8..963da8f22 100644 --- a/src/gui/windows/worldselectdialog.cpp +++ b/src/gui/windows/worldselectdialog.cpp @@ -118,9 +118,9 @@ void WorldSelectDialog::action(const ActionEvent &event) } } -void WorldSelectDialog::keyPressed(KeyEvent &keyEvent) +void WorldSelectDialog::keyPressed(KeyEvent &event) { - const int actionId = keyEvent.getActionId(); + const int actionId = event.getActionId(); if (actionId == static_cast(Input::KEY_GUI_CANCEL)) { diff --git a/src/gui/windows/worldselectdialog.h b/src/gui/windows/worldselectdialog.h index 9d06ac25e..b91beeece 100644 --- a/src/gui/windows/worldselectdialog.h +++ b/src/gui/windows/worldselectdialog.h @@ -65,7 +65,7 @@ class WorldSelectDialog final : public Window, */ void action(const ActionEvent &event) override final; - void keyPressed(KeyEvent &keyEvent) override final; + void keyPressed(KeyEvent &event) override final; private: WorldListModel *mWorldListModel; diff --git a/src/listeners/keylistener.h b/src/listeners/keylistener.h index efc387300..7a2bdd2c9 100644 --- a/src/listeners/keylistener.h +++ b/src/listeners/keylistener.h @@ -89,17 +89,17 @@ class KeyListener * If a key is held down the widget will generate multiple key * presses. * - * @param keyEvent Discribes the event. + * @param event Discribes the event. */ - virtual void keyPressed(KeyEvent &keyEvent A_UNUSED) + virtual void keyPressed(KeyEvent &event A_UNUSED) { } /** * Called if a key is released when the widget has keyboard focus. * - * @param keyEvent Discribes the event. + * @param event Discribes the event. */ - virtual void keyReleased(KeyEvent &keyEvent A_UNUSED) + virtual void keyReleased(KeyEvent &event A_UNUSED) { } protected: -- cgit v1.2.3-70-g09d2