mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Hero/town lists are now scrollable with mouse wheel
This commit is contained in:
@@ -31,15 +31,25 @@
|
|||||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||||
|
|
||||||
CList::CListItem::CListItem(CList * Parent)
|
CList::CListItem::CListItem(CList * Parent)
|
||||||
: CIntObject(LCLICK | RCLICK | HOVER),
|
: CIntObject(LCLICK | RCLICK | HOVER | WHEEL),
|
||||||
parent(Parent),
|
parent(Parent),
|
||||||
selection()
|
selection()
|
||||||
{
|
{
|
||||||
defActions = 255-DISPOSE;
|
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)
|
void CList::CListItem::clickRight(tribool down, bool previousState)
|
||||||
|
@@ -35,6 +35,7 @@ protected:
|
|||||||
CListItem(CList * parent);
|
CListItem(CList * parent);
|
||||||
~CListItem();
|
~CListItem();
|
||||||
|
|
||||||
|
void wheelScrolled(int distance, bool inside) override;
|
||||||
void clickRight(tribool down, bool previousState) override;
|
void clickRight(tribool down, bool previousState) override;
|
||||||
void clickLeft(tribool down, bool previousState) override;
|
void clickLeft(tribool down, bool previousState) override;
|
||||||
void hover(bool on) override;
|
void hover(bool on) override;
|
||||||
|
Reference in New Issue
Block a user