2015-12-15 21:53:15 +00:00
|
|
|
#include "Specter/Table.hpp"
|
2015-12-23 00:25:46 +00:00
|
|
|
#include "Specter/ViewResources.hpp"
|
2015-12-15 21:53:15 +00:00
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
|
|
|
|
2015-12-23 00:25:46 +00:00
|
|
|
Table::Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state)
|
|
|
|
: View(res, parentView), m_data(data), m_state(state), m_rowsView(*this, res)
|
2015-12-15 21:53:15 +00:00
|
|
|
{
|
2015-12-23 00:25:46 +00:00
|
|
|
m_vertsBuf = res.m_factory->newDynamicBuffer(boo::BufferUse::Vertex, sizeof(SolidShaderVert),
|
|
|
|
SPECTER_TABLE_MAX_ROWS * 6);
|
|
|
|
|
|
|
|
if (!res.m_viewRes.m_texVtxFmt)
|
|
|
|
{
|
|
|
|
boo::VertexElementDescriptor vdescs[] =
|
|
|
|
{
|
|
|
|
{m_vertsBuf, nullptr, boo::VertexSemantic::Position4},
|
|
|
|
{m_vertsBuf, nullptr, boo::VertexSemantic::Color}
|
|
|
|
};
|
|
|
|
m_vtxFmt = res.m_factory->newVertexFormat(2, vdescs);
|
|
|
|
boo::IGraphicsBuffer* bufs[] = {m_viewVertBlockBuf};
|
|
|
|
m_shaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader,
|
|
|
|
m_vtxFmt, m_vertsBuf, nullptr,
|
|
|
|
nullptr, 1, bufs, 0, nullptr);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
boo::IGraphicsBuffer* bufs[] = {m_viewVertBlockBuf};
|
|
|
|
m_shaderBinding = res.m_factory->newShaderDataBinding(res.m_viewRes.m_solidShader,
|
|
|
|
res.m_viewRes.m_texVtxFmt,
|
|
|
|
m_vertsBuf, nullptr,
|
|
|
|
nullptr, 1, bufs, 0, nullptr);
|
|
|
|
}
|
2015-12-22 01:33:27 +00:00
|
|
|
commitResources(res);
|
2015-12-23 00:25:46 +00:00
|
|
|
|
|
|
|
m_scroll.m_view.reset(new ScrollView(res, *this));
|
|
|
|
m_scroll.m_view->setContentView(&m_rowsView);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
|
|
|
m_scroll.mouseDown(coord, button, mod);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
|
|
|
m_scroll.mouseUp(coord, button, mod);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::mouseEnter(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
m_scroll.mouseEnter(coord);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::mouseLeave(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
m_scroll.mouseLeave(coord);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll)
|
|
|
|
{
|
|
|
|
m_scroll.scroll(coord, scroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|
|
|
{
|
|
|
|
boo::SWindowRect rowsRect = sub;
|
|
|
|
m_scroll.m_view->resized(root, rowsRect);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::RowsView::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|
|
|
{
|
|
|
|
m_scroll.m_view->draw(gfxQ);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Table::RowsView::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|
|
|
{
|
2015-12-15 21:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|