#ifndef INVENTORYMANAGER_H #define INVENTORYMANAGER_H #include #include /* QWInventoryManager * Controls everything related to inventory slots and their items. */ class QGraphicsWidget; class QWScene; class QWTrigger; class QWInventoryManager final : public QObject { Q_OBJECT Q_DISABLE_COPY_MOVE(QWInventoryManager) private: QList> list_inventory_icons; std::shared_ptr ptr_panel; QWScene *ptr_scene; QRect rect_hidden; QRect rect_visible; using Index = QList>::size_type; Index index_freepan; QGraphicsColorizeEffect *item_selected_effect; struct metadata { // the separator thinkness int length_wall; // the cell side int length_cell; // the maximum amount of items to hold int max_amount; // the left wall of first item slot int first_wall; // the color for selected items QColor clr_sel; // the color for selected items qreal clr_sth; } metadata; void reorganizeItems(Index i); public: explicit QWInventoryManager(QWScene *sc); void setInventoryPanel(const std::shared_ptr &panel) noexcept; inline int freePanel() const noexcept; inline void freePanelToRight(); inline void freePanelToLeft(); void addInventoryIcon(std::shared_ptr &inventory_icon); void removeInventoryIcon(std::shared_ptr &inventory_icon); public slots: void onClicked(); }; #endif // INVENTORYMANAGER_H