2015-12-02 01:32:15 +00:00
|
|
|
#ifndef SPECTER_SPLITVIEW_HPP
|
|
|
|
#define SPECTER_SPLITVIEW_HPP
|
|
|
|
|
|
|
|
#include "Specter/View.hpp"
|
|
|
|
|
|
|
|
namespace Specter
|
|
|
|
{
|
2016-01-12 00:44:54 +00:00
|
|
|
struct ISplitSpaceController;
|
2015-12-02 01:32:15 +00:00
|
|
|
|
|
|
|
class SplitView : public View
|
|
|
|
{
|
2016-01-12 00:44:54 +00:00
|
|
|
friend class RootView;
|
2016-02-01 01:12:30 +00:00
|
|
|
friend class Space;
|
2015-12-02 01:32:15 +00:00
|
|
|
public:
|
|
|
|
class Resources
|
|
|
|
{
|
|
|
|
friend class ViewResources;
|
|
|
|
friend class SplitView;
|
|
|
|
boo::ITextureS* m_shadingTex;
|
|
|
|
|
2016-01-10 06:40:23 +00:00
|
|
|
void init(boo::IGraphicsDataFactory* factory, const IThemeData& theme);
|
2015-12-02 01:32:15 +00:00
|
|
|
};
|
|
|
|
|
2016-01-31 01:07:52 +00:00
|
|
|
enum class ArrowDir
|
|
|
|
{
|
|
|
|
Up,
|
|
|
|
Down,
|
|
|
|
Left,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
enum class Axis
|
|
|
|
{
|
|
|
|
Horizontal,
|
|
|
|
Vertical
|
|
|
|
};
|
|
|
|
private:
|
2016-01-12 00:44:54 +00:00
|
|
|
ISplitSpaceController* m_controller;
|
2015-12-02 01:32:15 +00:00
|
|
|
Axis m_axis;
|
|
|
|
float m_slide = 0.5;
|
2016-01-10 06:40:23 +00:00
|
|
|
void _setSplit(float slide);
|
2015-12-02 01:32:15 +00:00
|
|
|
bool m_dragging = false;
|
|
|
|
|
2015-12-20 21:59:23 +00:00
|
|
|
ViewChild<View*> m_views[2];
|
2015-12-03 03:26:50 +00:00
|
|
|
ViewBlock m_splitBlock;
|
2015-12-02 01:32:15 +00:00
|
|
|
boo::IGraphicsBufferD* m_splitBlockBuf;
|
2015-12-05 00:42:46 +00:00
|
|
|
TexShaderVert m_splitVerts[4];
|
2015-12-02 01:32:15 +00:00
|
|
|
|
2015-12-22 01:33:27 +00:00
|
|
|
int m_clearanceA, m_clearanceB;
|
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
void setHorizontalVerts(int width)
|
|
|
|
{
|
2015-12-02 06:13:43 +00:00
|
|
|
m_splitVerts[0].m_pos.assign(0, 2, 0);
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitVerts[0].m_uv.assign(0, 0);
|
|
|
|
m_splitVerts[1].m_pos.assign(0, -1, 0);
|
|
|
|
m_splitVerts[1].m_uv.assign(1, 0);
|
2015-12-02 06:13:43 +00:00
|
|
|
m_splitVerts[2].m_pos.assign(width, 2, 0);
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitVerts[2].m_uv.assign(0, 0);
|
|
|
|
m_splitVerts[3].m_pos.assign(width, -1, 0);
|
|
|
|
m_splitVerts[3].m_uv.assign(1, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
void setVerticalVerts(int height)
|
|
|
|
{
|
|
|
|
m_splitVerts[0].m_pos.assign(-1, height, 0);
|
|
|
|
m_splitVerts[0].m_uv.assign(0, 0);
|
|
|
|
m_splitVerts[1].m_pos.assign(-1, 0, 0);
|
|
|
|
m_splitVerts[1].m_uv.assign(0, 0);
|
2015-12-02 06:13:43 +00:00
|
|
|
m_splitVerts[2].m_pos.assign(2, height, 0);
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitVerts[2].m_uv.assign(1, 0);
|
2015-12-02 06:13:43 +00:00
|
|
|
m_splitVerts[3].m_pos.assign(2, 0, 0);
|
2015-12-02 01:32:15 +00:00
|
|
|
m_splitVerts[3].m_uv.assign(1, 0);
|
|
|
|
}
|
|
|
|
|
2016-01-08 00:06:21 +00:00
|
|
|
VertexBufferBinding m_splitVertsBinding;
|
2016-01-31 01:07:52 +00:00
|
|
|
|
2015-12-02 01:32:15 +00:00
|
|
|
public:
|
2016-01-12 00:44:54 +00:00
|
|
|
SplitView(ViewResources& res, View& parentView, ISplitSpaceController* controller,
|
|
|
|
Axis axis, float split, int clearanceA=-1, int clearanceB=-1);
|
2015-12-10 03:14:38 +00:00
|
|
|
View* setContentView(int slot, View* view);
|
2016-01-12 00:44:54 +00:00
|
|
|
void setSplit(float split);
|
2016-01-11 01:46:58 +00:00
|
|
|
void setAxis(Axis axis);
|
2016-01-12 00:44:54 +00:00
|
|
|
Axis axis() const {return m_axis;}
|
|
|
|
float split() const {return m_slide;}
|
|
|
|
bool testSplitHover(const boo::SWindowCoord& coord);
|
2016-02-01 01:12:30 +00:00
|
|
|
bool testJoinArrowHover(const boo::SWindowCoord& coord, int& origSlotOut,
|
|
|
|
SplitView*& splitOut, int& slotOut,
|
|
|
|
boo::SWindowRect& rectOut, ArrowDir& dirOut, int forceSlot=-1);
|
2016-01-31 01:07:52 +00:00
|
|
|
void getJoinArrowHover(int slot, boo::SWindowRect& rectOut, ArrowDir& dirOut);
|
|
|
|
bool testSplitLineHover(const boo::SWindowCoord& coord, int& slotOut, boo::SWindowRect& rectOut, float& splitOut, Axis& axisOut);
|
|
|
|
void getSplitLineHover(int slot, boo::SWindowRect& rectOut, Axis& axisOut);
|
2016-01-10 06:40:23 +00:00
|
|
|
void startDragSplit(const boo::SWindowCoord& coord);
|
2016-01-12 00:44:54 +00:00
|
|
|
void endDragSplit();
|
|
|
|
void moveDragSplit(const boo::SWindowCoord& coord);
|
2015-12-02 01:32:15 +00:00
|
|
|
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&);
|
|
|
|
void resized(const boo::SWindowRect& rootView, const boo::SWindowRect& sub);
|
2015-12-02 01:32:15 +00:00
|
|
|
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
2015-12-22 01:33:27 +00:00
|
|
|
|
|
|
|
void setMultiplyColor(const Zeus::CColor& color)
|
|
|
|
{
|
|
|
|
View::setMultiplyColor(color);
|
|
|
|
m_splitBlock.m_color = color;
|
|
|
|
m_splitBlockBuf->load(&m_splitBlock, sizeof(m_splitBlock));
|
2016-01-04 23:58:38 +00:00
|
|
|
|
|
|
|
if (m_views[0].m_view)
|
|
|
|
m_views[0].m_view->setMultiplyColor(color);
|
|
|
|
if (m_views[1].m_view)
|
|
|
|
m_views[1].m_view->setMultiplyColor(color);
|
2015-12-22 01:33:27 +00:00
|
|
|
}
|
2015-12-02 01:32:15 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // SPECTER_SPLITVIEW_HPP
|