diff --git a/client/lobby/SelectionTab.cpp b/client/lobby/SelectionTab.cpp index 9cecc612e..6b85b8f9d 100644 --- a/client/lobby/SelectionTab.cpp +++ b/client/lobby/SelectionTab.cpp @@ -457,10 +457,21 @@ void SelectionTab::updateListItems() } } -int SelectionTab::getLine() +bool SelectionTab::receiveEvent(const Point & position, int eventType) const +{ + // FIXME: widget should instead have well-defined pos so events will be filtered using standard routine + return getLine(position) != -1; +} + +int SelectionTab::getLine() const +{ + Point clickPos = GH.getCursorPosition() - pos.topLeft(); + return getLine(clickPos); +} + +int SelectionTab::getLine(const Point & clickPos) const { int line = -1; - Point clickPos = GH.getCursorPosition() - pos.topLeft(); // Ignore clicks on save name area int maxPosY; diff --git a/client/lobby/SelectionTab.h b/client/lobby/SelectionTab.h index 48e79f991..6484c802d 100644 --- a/client/lobby/SelectionTab.h +++ b/client/lobby/SelectionTab.h @@ -67,8 +67,8 @@ public: void clickLeft(tribool down, bool previousState) override; void keyPressed(EShortcut key) override; - void clickDouble() override; + bool receiveEvent(const Point & position, int eventType) const override; void filter(int size, bool selectFirst = false); //0 - all void sortBy(int criteria); @@ -77,7 +77,8 @@ public: void selectAbs(int position); //position: absolute position in curItems vector void sliderMove(int slidPos); void updateListItems(); - int getLine(); + int getLine() const; + int getLine(const Point & position) const; void selectFileName(std::string fname); std::shared_ptr getSelectedMapInfo() const; void rememberCurrentSelection();