2012-12-16 11:52:23 +00:00
|
|
|
#include "columnbase.hpp"
|
|
|
|
|
2013-08-07 07:36:05 +00:00
|
|
|
#include "columns.hpp"
|
|
|
|
|
2015-04-02 09:19:15 +00:00
|
|
|
CSMWorld::ColumnBase::ColumnBase (int columnId, Display displayType, int flags)
|
|
|
|
: mColumnId (columnId), mDisplayType (displayType), mFlags (flags)
|
2012-12-16 11:52:23 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
CSMWorld::ColumnBase::~ColumnBase() {}
|
|
|
|
|
|
|
|
bool CSMWorld::ColumnBase::isUserEditable() const
|
|
|
|
{
|
|
|
|
return isEditable();
|
2013-08-07 07:36:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
std::string CSMWorld::ColumnBase::getTitle() const
|
|
|
|
{
|
|
|
|
return Columns::getName (static_cast<Columns::ColumnId> (mColumnId));
|
2014-03-08 14:27:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int CSMWorld::ColumnBase::getId() const
|
|
|
|
{
|
|
|
|
return mColumnId;
|
2014-06-17 20:02:20 +00:00
|
|
|
}
|
2015-04-09 09:11:19 +00:00
|
|
|
|
|
|
|
void CSMWorld::NestableColumn::addColumn(CSMWorld::NestableColumn *column)
|
|
|
|
{
|
|
|
|
mNestedColumns.push_back(column);
|
|
|
|
}
|
|
|
|
|
|
|
|
const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn) const
|
|
|
|
{
|
2015-04-11 01:26:29 +00:00
|
|
|
if (mNestedColumns.empty())
|
2015-04-09 09:11:19 +00:00
|
|
|
throw std::logic_error("Tried to access nested column of the non-nest column");
|
|
|
|
|
|
|
|
return *mNestedColumns.at(subColumn);
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMWorld::NestableColumn::NestableColumn(int columnId, CSMWorld::ColumnBase::Display displayType,
|
|
|
|
int flag)
|
2015-04-11 01:26:29 +00:00
|
|
|
: CSMWorld::ColumnBase(columnId, displayType, flag)
|
2015-04-09 09:11:19 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CSMWorld::NestableColumn::~NestableColumn()
|
|
|
|
{
|
|
|
|
for (unsigned int i = 0; i < mNestedColumns.size(); ++i)
|
|
|
|
{
|
|
|
|
delete mNestedColumns[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CSMWorld::NestableColumn::hasChildren() const
|
|
|
|
{
|
2015-04-11 01:26:29 +00:00
|
|
|
return !mNestedColumns.empty();
|
2015-04-09 09:11:19 +00:00
|
|
|
}
|