2015-12-03 03:26:50 +00:00
|
|
|
#ifndef SPECTER_TOOLBAR_HPP
|
|
|
|
#define SPECTER_TOOLBAR_HPP
|
|
|
|
|
|
|
|
#include "Specter/View.hpp"
|
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
2016-01-12 00:44:54 +00:00
|
|
|
#define SPECTER_TOOLBAR_GAUGE 28
|
2015-12-03 03:26:50 +00:00
|
|
|
|
|
|
|
class Toolbar : public View
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
class Resources
|
|
|
|
{
|
|
|
|
friend class ViewResources;
|
|
|
|
friend class Toolbar;
|
|
|
|
boo::ITextureS* m_shadingTex;
|
|
|
|
|
2016-01-10 06:40:23 +00:00
|
|
|
void init(boo::IGraphicsDataFactory* factory, const IThemeData& theme);
|
2015-12-03 03:26:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum class Position
|
|
|
|
{
|
2016-01-07 00:39:18 +00:00
|
|
|
None,
|
2015-12-03 03:26:50 +00:00
|
|
|
Bottom,
|
|
|
|
Top
|
|
|
|
};
|
|
|
|
private:
|
|
|
|
Position m_tbPos;
|
2015-12-20 21:59:23 +00:00
|
|
|
std::vector<ViewChild<View*>> m_children;
|
2015-12-03 03:26:50 +00:00
|
|
|
|
2015-12-04 01:35:01 +00:00
|
|
|
ViewBlock m_tbBlock;
|
2015-12-03 03:26:50 +00:00
|
|
|
boo::IGraphicsBufferD* m_tbBlockBuf;
|
2015-12-05 00:42:46 +00:00
|
|
|
TexShaderVert m_tbVerts[10];
|
2015-12-05 05:57:51 +00:00
|
|
|
int m_nomHeight = 25;
|
2015-12-05 00:42:46 +00:00
|
|
|
int m_padding = 10;
|
2015-12-03 03:26:50 +00:00
|
|
|
|
|
|
|
void setHorizontalVerts(int width)
|
|
|
|
{
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[0].m_pos.assign(0, 1 + m_nomHeight, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[0].m_uv.assign(0, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[1].m_pos.assign(0, -1 + m_nomHeight, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[1].m_uv.assign(0.5, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[2].m_pos.assign(width, 1 + m_nomHeight, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[2].m_uv.assign(0, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[3].m_pos.assign(width, -1 + m_nomHeight, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[3].m_uv.assign(0.5, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[4].m_pos.assign(width, -1 + m_nomHeight, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[4].m_uv.assign(0.5, 0);
|
|
|
|
|
|
|
|
m_tbVerts[5].m_pos.assign(0, 1, 0);
|
|
|
|
m_tbVerts[5].m_uv.assign(0.5, 0);
|
|
|
|
m_tbVerts[6].m_pos.assign(0, 1, 0);
|
|
|
|
m_tbVerts[6].m_uv.assign(0.5, 0);
|
|
|
|
m_tbVerts[7].m_pos.assign(0, -1, 0);
|
|
|
|
m_tbVerts[7].m_uv.assign(1, 0);
|
|
|
|
m_tbVerts[8].m_pos.assign(width, 1, 0);
|
|
|
|
m_tbVerts[8].m_uv.assign(0.5, 0);
|
|
|
|
m_tbVerts[9].m_pos.assign(width, -1, 0);
|
|
|
|
m_tbVerts[9].m_uv.assign(1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setVerticalVerts(int height)
|
|
|
|
{
|
|
|
|
m_tbVerts[0].m_pos.assign(-1, height, 0);
|
|
|
|
m_tbVerts[0].m_uv.assign(0, 0);
|
|
|
|
m_tbVerts[1].m_pos.assign(-1, 0, 0);
|
|
|
|
m_tbVerts[1].m_uv.assign(0, 0);
|
|
|
|
m_tbVerts[2].m_pos.assign(1, height, 0);
|
|
|
|
m_tbVerts[2].m_uv.assign(0.5, 0);
|
|
|
|
m_tbVerts[3].m_pos.assign(1, 0, 0);
|
|
|
|
m_tbVerts[3].m_uv.assign(0.5, 0);
|
|
|
|
m_tbVerts[4].m_pos.assign(1, 0, 0);
|
|
|
|
m_tbVerts[4].m_uv.assign(0.5, 0);
|
|
|
|
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[5].m_pos.assign(-1 + m_nomHeight, height, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[5].m_uv.assign(0.5, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[6].m_pos.assign(-1 + m_nomHeight, height, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[6].m_uv.assign(0.5, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[7].m_pos.assign(-1 + m_nomHeight, 0, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[7].m_uv.assign(0.5, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[8].m_pos.assign(1 + m_nomHeight, height, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[8].m_uv.assign(1, 0);
|
2015-12-05 05:57:51 +00:00
|
|
|
m_tbVerts[9].m_pos.assign(1 + m_nomHeight, 0, 0);
|
2015-12-03 03:26:50 +00:00
|
|
|
m_tbVerts[9].m_uv.assign(1, 0);
|
|
|
|
}
|
|
|
|
|
2016-01-08 00:06:21 +00:00
|
|
|
VertexBufferBinding m_vertsBinding;
|
|
|
|
|
2015-12-03 03:26:50 +00:00
|
|
|
public:
|
|
|
|
Toolbar(ViewResources& res, View& parentView, Position toolbarPos);
|
|
|
|
void mouseDown(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
|
|
|
void mouseUp(const boo::SWindowCoord&, boo::EMouseButton, boo::EModifierKey);
|
|
|
|
void mouseMove(const boo::SWindowCoord&);
|
2015-12-05 00:42:46 +00:00
|
|
|
void mouseEnter(const boo::SWindowCoord&);
|
|
|
|
void mouseLeave(const boo::SWindowCoord&coord);
|
|
|
|
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
2015-12-03 03:26:50 +00:00
|
|
|
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
2015-12-04 01:35:01 +00:00
|
|
|
|
2015-12-05 05:57:51 +00:00
|
|
|
int nominalHeight() const {return m_nomHeight;}
|
2015-12-05 00:42:46 +00:00
|
|
|
|
|
|
|
void clear() {m_children.clear();}
|
2015-12-20 21:59:23 +00:00
|
|
|
void push_back(View* v)
|
|
|
|
{
|
|
|
|
m_children.emplace_back();
|
|
|
|
m_children.back().m_view = v;
|
|
|
|
}
|
2015-12-03 03:26:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SPECTER_TOOLBAR_HPP
|