#ifndef CTYPESINSTANCEMODEL_H #define CTYPESINSTANCEMODEL_H #include "CWorldEditor.h" #include #include #include #include #include class CInstancesModel : public QAbstractItemModel { Q_OBJECT public: enum EIndexType { eRootIndex, eNodeTypeIndex, eObjectTypeIndex, eInstanceIndex }; enum ENodeType { eScriptType = 0x0, eLightType = 0x1, eInvalidType = 0xFF }; enum EInstanceModelType { eLayers, eTypes }; private: CWorldEditor *mpEditor; CScene *mpScene; TResPtr mpArea; CMasterTemplate *mpCurrentMaster; EInstanceModelType mModelType; QList mTemplateList; QStringList mBaseItems; bool mShowColumnEnabled; bool mChangingLayout; public: explicit CInstancesModel(QObject *pParent = 0); ~CInstancesModel(); QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &child) const; int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; void SetEditor(CWorldEditor *pEditor); void SetMaster(CMasterTemplate *pMaster); void SetArea(CGameArea *pArea); void SetModelType(EInstanceModelType type); void SetShowColumnEnabled(bool Enabled); CScriptLayer* IndexLayer(const QModelIndex& index) const; CScriptTemplate* IndexTemplate(const QModelIndex& index) const; CScriptObject* IndexObject(const QModelIndex& index) const; public slots: void NodeAboutToBeCreated(); void NodeCreated(CSceneNode *pNode); void NodeAboutToBeDeleted(CSceneNode *pNode); void NodeDeleted(); void PropertyModified(CScriptObject *pInst, IProperty *pProp); void InstancesLayerPreChange(); void InstancesLayerPostChange(const QList& rkInstanceList); // Static static EIndexType IndexType(const QModelIndex& index); static ENodeType IndexNodeType(const QModelIndex& index); private: void GenerateList(); }; #endif // CTYPESINSTANCEMODEL_H