metaforce/specter/include/Specter/ScrollView.hpp

71 lines
1.8 KiB
C++
Raw Normal View History

2015-11-29 02:55:30 +00:00
#ifndef SPECTER_SCROLLVIEW_HPP
#define SPECTER_SCROLLVIEW_HPP
#include "View.hpp"
namespace Specter
{
class ViewResources;
2015-11-29 02:55:30 +00:00
class ScrollView : public View
{
public:
enum class Style
{
Plain,
ThinIndicator
};
private:
Style m_style;
View* m_contentView = nullptr;
2015-12-29 02:02:43 +00:00
int m_scroll[2] = {};
2015-12-29 22:58:09 +00:00
int m_targetScroll[2] = {};
2016-01-01 00:12:19 +00:00
size_t m_consecutiveIdx = 0;
double m_consecutiveScroll[16][2] = {};
bool m_drawInd = false;
SolidShaderVert m_verts[4];
boo::IGraphicsBufferD* m_vertsBuf = nullptr;
boo::IVertexFormat* m_vtxFmt = nullptr; /* OpenGL only */
boo::IShaderDataBinding* m_shaderBinding = nullptr;
2015-12-30 22:04:58 +00:00
bool _scroll(const boo::SScrollDelta& scroll);
public:
ScrollView(ViewResources& res, View& parentView, Style style);
void setContentView(View* v)
{
m_contentView = v;
updateSize();
}
2015-12-29 02:02:43 +00:00
2016-01-01 00:12:19 +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&);
void mouseEnter(const boo::SWindowCoord&);
void mouseLeave(const boo::SWindowCoord&);
2015-12-29 02:02:43 +00:00
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll);
2015-12-29 22:58:09 +00:00
int getScrollX() const {return m_scroll[0];}
int getScrollY() const {return m_scroll[1];}
2015-12-29 02:02:43 +00:00
2015-12-29 22:58:09 +00:00
int nominalWidth() const {return subRect().size[0];}
int nominalHeight() const {return subRect().size[1];}
void setMultiplyColor(const Zeus::CColor& color)
{
View::setMultiplyColor(color);
if (m_contentView)
m_contentView->setMultiplyColor(color);
}
2015-12-29 22:58:09 +00:00
void think();
2015-12-29 02:02:43 +00:00
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
2015-11-29 02:55:30 +00:00
};
}
#endif // SPECTER_SCROLLVIEW_HPP