mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-12 03:36:32 +00:00
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
|
|
#include "columnbase.hpp"
|
|
|
|
#include "columns.hpp"
|
|
|
|
CSMWorld::ColumnBase::ColumnBase (int columnId, Display displayType, int flags)
|
|
: mColumnId (columnId), mDisplayType (displayType), mFlags (flags)
|
|
{}
|
|
|
|
CSMWorld::ColumnBase::~ColumnBase() {}
|
|
|
|
bool CSMWorld::ColumnBase::isUserEditable() const
|
|
{
|
|
return isEditable();
|
|
}
|
|
|
|
std::string CSMWorld::ColumnBase::getTitle() const
|
|
{
|
|
return Columns::getName (static_cast<Columns::ColumnId> (mColumnId));
|
|
}
|
|
|
|
int CSMWorld::ColumnBase::getId() const
|
|
{
|
|
return mColumnId;
|
|
}
|
|
|
|
void CSMWorld::NestableColumn::addColumn(CSMWorld::NestableColumn *column)
|
|
{
|
|
mNestedColumns.push_back(column);
|
|
mHasChildren = true;
|
|
}
|
|
|
|
const CSMWorld::ColumnBase& CSMWorld::NestableColumn::nestedColumn(int subColumn) const
|
|
{
|
|
if (!mHasChildren)
|
|
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)
|
|
: mHasChildren(false), CSMWorld::ColumnBase(columnId, displayType, flag)
|
|
{
|
|
}
|
|
|
|
CSMWorld::NestableColumn::~NestableColumn()
|
|
{
|
|
for (unsigned int i = 0; i < mNestedColumns.size(); ++i)
|
|
{
|
|
delete mNestedColumns[i];
|
|
}
|
|
}
|
|
|
|
bool CSMWorld::NestableColumn::hasChildren() const
|
|
{
|
|
return mHasChildren;
|
|
}
|