1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 15:35:23 +00:00
OpenMW/apps/opencs/model/world/tablemimedata.hpp

68 lines
2.0 KiB
C++
Raw Normal View History

#ifndef TABLEMIMEDATA_H
#define TABLEMIMEDATA_H
#include <vector>
2014-02-09 15:33:00 +01:00
#include <QtCore/QMimeData>
2014-02-04 11:40:48 +01:00
#include <QStringList>
#include "universalid.hpp"
2014-02-13 10:21:49 +01:00
#include "columnbase.hpp"
2014-02-04 11:40:48 +01:00
namespace CSMDoc
{
class Document;
}
namespace CSMWorld
{
2014-02-14 14:04:36 +01:00
/// \brief Subclass of QmimeData, augmented to contain and transport UniversalIds.
///
/// This class provides way to construct mimedata object holding the universalid copy
/// Universalid is used in the majority of the tables to store type, id, argument types.
2016-04-07 11:55:49 +02:00
/// This way universalid grants a way to retrieve record from the concrete table.
2014-02-14 14:04:36 +01:00
/// Please note, that tablemimedata object can hold multiple universalIds in the vector.
class TableMimeData : public QMimeData
{
2014-03-21 12:13:54 +01:00
std::vector<UniversalId> mUniversalId;
QStringList mObjectsFormats;
const CSMDoc::Document& mDocument;
public:
TableMimeData(UniversalId id, const CSMDoc::Document& document);
TableMimeData(const std::vector<UniversalId>& id, const CSMDoc::Document& document);
~TableMimeData();
virtual QStringList formats() const;
std::string getIcon() const;
std::vector<UniversalId> getData() const;
2014-02-13 10:21:49 +01:00
bool holdsType(UniversalId::Type type) const;
bool holdsType(CSMWorld::ColumnBase::Display type) const;
bool fromDocument(const CSMDoc::Document& document) const;
2014-02-13 10:21:49 +01:00
UniversalId returnMatching(UniversalId::Type type) const;
2014-03-13 16:50:04 +01:00
const CSMDoc::Document* getDocumentPtr() const;
UniversalId returnMatching(CSMWorld::ColumnBase::Display type) const;
2014-02-19 11:22:47 +01:00
static CSMWorld::UniversalId::Type convertEnums(CSMWorld::ColumnBase::Display type);
2014-05-01 12:34:54 +02:00
static CSMWorld::ColumnBase::Display convertEnums(CSMWorld::UniversalId::Type type);
2014-02-19 11:22:47 +01:00
static bool isReferencable(CSMWorld::UniversalId::Type type);
private:
2014-03-21 12:13:54 +01:00
bool isReferencable(CSMWorld::ColumnBase::Display type) const;
2014-02-15 13:23:51 +01:00
};
}
#endif // TABLEMIMEDATA_H