porymap/include/ui/regionmaplayoutpixmapitem.h

42 lines
1.2 KiB
C
Raw Normal View History

2019-01-05 04:04:14 +00:00
#ifndef REGIONMAPLAYOUTPIXMAPITEM_H
#define REGIONMAPLAYOUTPIXMAPITEM_H
#include "tilemaptileselector.h"
#include "regionmap.h"
2019-01-05 04:04:14 +00:00
class RegionMapLayoutPixmapItem : public SelectablePixmapItem {
Q_OBJECT
public:
RegionMapLayoutPixmapItem(RegionMap *rmap, TilemapTileSelector *ts) : SelectablePixmapItem(8, 8, 1, 1) {
this->region_map = rmap;
this->tile_selector = ts;
setAcceptHoverEvents(true);
}
2019-01-14 00:27:28 +00:00
RegionMap *region_map;
2019-01-05 04:04:14 +00:00
TilemapTileSelector *tile_selector;
2019-01-14 00:27:28 +00:00
int selectedTile;
int highlightedTile;
2019-01-05 04:04:14 +00:00
void draw();
void select(int, int);
2019-01-14 00:27:28 +00:00
void select(int);
void highlight(int, int, int);
2019-01-05 04:04:14 +00:00
private:
void updateSelectedTile();
signals:
void mouseEvent(QGraphicsSceneMouseEvent *, RegionMapLayoutPixmapItem *);
void hoveredTileChanged(int);
void hoveredTileCleared();
void selectedTileChanged(int);
protected:
void hoverMoveEvent(QGraphicsSceneHoverEvent*);
void hoverLeaveEvent(QGraphicsSceneHoverEvent*);
void mousePressEvent(QGraphicsSceneMouseEvent*);
void mouseMoveEvent(QGraphicsSceneMouseEvent*);
void mouseReleaseEvent(QGraphicsSceneMouseEvent*);
};
#endif // REGIONMAPLAYOUTPIXMAPITEM_H