2015-12-03 03:26:50 +00:00
|
|
|
#include <LogVisor/LogVisor.hpp>
|
|
|
|
#include "Specter/Space.hpp"
|
|
|
|
#include "Specter/ViewResources.hpp"
|
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
|
|
|
static LogVisor::LogModule Log("Specter::Space");
|
|
|
|
|
|
|
|
Space::Space(ViewResources& res, View& parentView, Toolbar::Position tbPos)
|
|
|
|
: View(res, parentView), m_tbPos(tbPos)
|
|
|
|
{
|
|
|
|
commitResources(res);
|
|
|
|
m_toolbar.reset(new Toolbar(res, *this, tbPos));
|
|
|
|
}
|
|
|
|
|
|
|
|
std::unique_ptr<View> Space::setContentView(std::unique_ptr<View>&& view)
|
|
|
|
{
|
|
|
|
std::unique_ptr<View> ret;
|
|
|
|
m_contentView.swap(ret);
|
|
|
|
m_contentView = std::move(view);
|
|
|
|
updateSize();
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Space::mouseDown(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Space::mouseUp(const boo::SWindowCoord& coord, boo::EMouseButton button, boo::EModifierKey mod)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Space::mouseMove(const boo::SWindowCoord& coord)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void Space::resetResources(ViewResources& res)
|
|
|
|
{
|
|
|
|
if (m_contentView)
|
|
|
|
m_contentView->resetResources(res);
|
2015-12-04 01:35:01 +00:00
|
|
|
m_toolbar->resetResources(res);
|
2015-12-03 03:26:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Space::resized(const boo::SWindowRect& root, const boo::SWindowRect& sub)
|
|
|
|
{
|
|
|
|
View::resized(root, sub);
|
2015-12-04 01:35:01 +00:00
|
|
|
|
|
|
|
boo::SWindowRect tbRect = sub;
|
|
|
|
tbRect.size[1] = m_toolbar->gauge();
|
|
|
|
m_toolbar->resized(root, tbRect);
|
|
|
|
|
|
|
|
if (m_contentView)
|
|
|
|
{
|
|
|
|
tbRect.location[1] += tbRect.size[1];
|
|
|
|
tbRect.size[1] = sub.size[1] - tbRect.size[1];
|
|
|
|
tbRect.size[1] = std::max(tbRect.size[1], 0);
|
|
|
|
m_contentView->resized(root, tbRect);
|
|
|
|
}
|
2015-12-03 03:26:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Space::draw(boo::IGraphicsCommandQueue* gfxQ)
|
|
|
|
{
|
|
|
|
View::draw(gfxQ);
|
2015-12-04 01:35:01 +00:00
|
|
|
if (m_contentView)
|
|
|
|
m_contentView->draw(gfxQ);
|
|
|
|
m_toolbar->draw(gfxQ);
|
2015-12-03 03:26:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|