소스 검색

Hero/town lists are now scrollable with mouse wheel

Ivan Savenko 2 년 전
부모
커밋
261308b942
2개의 변경된 파일13개의 추가작업 그리고 2개의 파일을 삭제
  1. 12 2
      client/adventureMap/CList.cpp
  2. 1 0
      client/adventureMap/CList.h

+ 12 - 2
client/adventureMap/CList.cpp

@@ -31,15 +31,25 @@
 #include "../../lib/mapObjects/CGTownInstance.h"
 
 CList::CListItem::CListItem(CList * Parent)
-	: CIntObject(LCLICK | RCLICK | HOVER),
+	: CIntObject(LCLICK | RCLICK | HOVER | WHEEL),
 	parent(Parent),
 	selection()
 {
 	defActions = 255-DISPOSE;
 }
 
-CList::CListItem::~CListItem()
+CList::CListItem::~CListItem() = default;
+
+void CList::CListItem::wheelScrolled(int distance, bool inside)
 {
+	if (inside)
+	{
+		if (distance < 0)
+			parent->listBox->moveToNext();
+		if (distance > 0)
+			parent->listBox->moveToPrev();
+		parent->update();
+	}
 }
 
 void CList::CListItem::clickRight(tribool down, bool previousState)

+ 1 - 0
client/adventureMap/CList.h

@@ -35,6 +35,7 @@ protected:
 		CListItem(CList * parent);
 		~CListItem();
 
+		void wheelScrolled(int distance, bool inside) override;
 		void clickRight(tribool down, bool previousState) override;
 		void clickLeft(tribool down, bool previousState) override;
 		void hover(bool on) override;