Sfoglia il codice sorgente

move to EventReceiver

Laserlicht 2 anni fa
parent
commit
05a9f0fe39

+ 0 - 10
client/gui/CIntObject.cpp

@@ -258,16 +258,6 @@ void CIntObject::redraw()
 	}
 }
 
-void CIntObject::clickPressed(const Point & cursorPosition, bool lastActivated)
-{
-	AEventsReceiver::clickPressed(cursorPosition);
-}
-
-void CIntObject::clickReleased(const Point & cursorPosition, bool lastActivated)
-{
-	AEventsReceiver::clickReleased(cursorPosition);
-}
-
 bool CIntObject::receiveEvent(const Point & position, int eventType) const
 {
 	return pos.isInside(position);

+ 0 - 5
client/gui/CIntObject.h

@@ -98,11 +98,6 @@ public:
 	void showAll(Canvas & to) override;
 	//request complete redraw of this object
 	void redraw() override;
-
-	// events are overloaded
-	void clickPressed(const Point & cursorPosition, bool lastActivated) override;
-	void clickReleased(const Point & cursorPosition, bool lastActivated) override;
-
 	/// returns true if this element is a popup window
 	/// called only for windows
 	bool isPopupWindow() const override;

+ 10 - 0
client/gui/EventsReceiver.cpp

@@ -68,3 +68,13 @@ void AEventsReceiver::deactivateEvents(ui16 what)
 //	if (!(activeState & HOVER))
 //		hoveredState = false;
 }
+
+void AEventsReceiver::clickPressed(const Point & cursorPosition, bool lastActivated)
+{
+	clickPressed(cursorPosition);
+}
+
+void AEventsReceiver::clickReleased(const Point & cursorPosition, bool lastActivated)
+{
+	clickReleased(cursorPosition);
+}

+ 2 - 2
client/gui/EventsReceiver.h

@@ -45,8 +45,8 @@ protected:
 public:
 	virtual void clickPressed(const Point & cursorPosition) {}
 	virtual void clickReleased(const Point & cursorPosition) {}
-	virtual void clickPressed(const Point & cursorPosition, bool lastActivated) {}
-	virtual void clickReleased(const Point & cursorPosition, bool lastActivated) {}
+	virtual void clickPressed(const Point & cursorPosition, bool lastActivated);
+	virtual void clickReleased(const Point & cursorPosition, bool lastActivated);
 	virtual void clickCancel(const Point & cursorPosition) {}
 	virtual void showPopupWindow(const Point & cursorPosition) {}
 	virtual void clickDouble(const Point & cursorPosition) {}