2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-17 20:45:23 +00:00

Working scroll wheel functionality

This commit is contained in:
Jack Andersen
2015-12-29 12:58:09 -10:00
parent 725990da45
commit 4866ac6d4c
5 changed files with 169 additions and 51 deletions

View File

@@ -108,8 +108,18 @@ class FileBrowser : public ModalWindow
std::string m_sizeCol = "Size";
std::vector<std::string> m_sizes = {"s1", "s2", "s3"};
TableDataBind()
{
for (int i=0 ; i<100 ; ++i)
{
m_names.push_back(HECL::Format("%d", i));
m_types.push_back(HECL::Format("%d", i));
m_sizes.push_back(HECL::Format("%d", i));
}
}
size_t columnCount() const {return 3;}
size_t rowCount() const {return 3;}
size_t rowCount() const {return 103;}
const std::string* header(size_t cIdx) const
{

View File

@@ -18,6 +18,7 @@ public:
private:
View* m_contentView = nullptr;
int m_scroll[2] = {};
int m_targetScroll[2] = {};
public:
ScrollView(ViewResources& res, View& parentView);
@@ -28,7 +29,13 @@ public:
}
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll);
int getScrollX() const {return m_scroll[0];}
int getScrollY() const {return m_scroll[1];}
int nominalWidth() const {return subRect().size[0];}
int nominalHeight() const {return subRect().size[1];}
void think();
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);
};

View File

@@ -51,20 +51,24 @@ class Table : public View
std::vector<std::vector<std::unique_ptr<CellView>>> m_cellViews;
bool m_header = false;
SolidShaderVert m_verts[SPECTER_TABLE_MAX_ROWS * 6];
boo::IGraphicsBufferD* m_vertsBuf = nullptr;
boo::IVertexFormat* m_vtxFmt = nullptr; /* OpenGL only */
boo::IShaderDataBinding* m_shaderBinding = nullptr;
size_t m_visibleRows = 0;
void _setRowVerts(const boo::SWindowRect& rowsRect);
ViewChild<std::unique_ptr<ScrollView>> m_scroll;
struct RowsView : public View
{
Table& m_t;
RowsView(Table& t, ViewResources& res) : View(res, t), m_t(t) {}
SolidShaderVert m_verts[SPECTER_TABLE_MAX_ROWS * 6];
boo::IGraphicsBufferD* m_vertsBuf = nullptr;
boo::IVertexFormat* m_vtxFmt = nullptr; /* OpenGL only */
boo::IShaderDataBinding* m_shaderBinding = nullptr;
size_t m_visibleStart = 0;
size_t m_visibleRows = 0;
boo::SWindowRect m_scissorRect;
void _setRowVerts(const boo::SWindowRect& rowsRect, const boo::SWindowRect& scissor);
RowsView(Table& t, ViewResources& res);
int nominalHeight() const;
int nominalWidth() const {return m_t.m_scroll.m_view->nominalWidth();}
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
const boo::SWindowRect& scissor);
void draw(boo::IGraphicsCommandQueue* gfxQ);
@@ -82,6 +86,7 @@ public:
void mouseLeave(const boo::SWindowCoord&);
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&);
void think();
void updateData();
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
void draw(boo::IGraphicsCommandQueue* gfxQ);