50 lines
1.3 KiB
C
50 lines
1.3 KiB
C
|
#ifndef SCENEINVENTORYPANEL_H
|
||
|
#define SCENEINVENTORYPANEL_H
|
||
|
|
||
|
#include <QPainter>
|
||
|
#include "qw_abstractscenecontrol.h"
|
||
|
|
||
|
/* SceneInventoryPanel
|
||
|
* The view for inventory and all its items on the scene. */
|
||
|
|
||
|
class SceneInventoryPanel : public QWAbstractSceneControl, public std::enable_shared_from_this<SceneInventoryPanel>
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
private:
|
||
|
QPixmap pix_rect;
|
||
|
|
||
|
struct metadata
|
||
|
{
|
||
|
// path to panel pixmap
|
||
|
QString pixmap_path;
|
||
|
// rect when panel is hidden
|
||
|
QRect on_hid;
|
||
|
// rect when panel is shown
|
||
|
QRect on_shw;
|
||
|
} metadata;
|
||
|
|
||
|
protected:
|
||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *,
|
||
|
QWidget *) override
|
||
|
{
|
||
|
painter->fillRect(rect(), QBrush(pix_rect));
|
||
|
}
|
||
|
|
||
|
public:
|
||
|
explicit SceneInventoryPanel();
|
||
|
virtual ~SceneInventoryPanel() override {}
|
||
|
void onClick() override;
|
||
|
void onConnect(std::unique_ptr<GameFeatures> &game_features) override;
|
||
|
void onBuildingStateMachine(QWStateMachine *state_machine, std::unique_ptr<GameFeatures> &game_features) override;
|
||
|
|
||
|
////////////////////////
|
||
|
|
||
|
inline void setPixmap(const QPixmap &pix) noexcept;
|
||
|
inline QPixmap pixmap() const noexcept;
|
||
|
|
||
|
signals:
|
||
|
void signalOnInventory();
|
||
|
};
|
||
|
|
||
|
#endif // SCENEINVENTORYPANEL_H
|