mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-20 16:59:12 +00:00
Initial TableView
This commit is contained in:
@@ -17,6 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
View* m_contentView = nullptr;
|
||||
int m_scroll[2] = {};
|
||||
|
||||
public:
|
||||
ScrollView(ViewResources& res, View& parentView);
|
||||
@@ -25,6 +26,11 @@ public:
|
||||
m_contentView = v;
|
||||
updateSize();
|
||||
}
|
||||
|
||||
void scroll(const boo::SWindowCoord& coord, const boo::SScrollDelta& scroll);
|
||||
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "View.hpp"
|
||||
#include "ScrollView.hpp"
|
||||
#include "TextView.hpp"
|
||||
|
||||
namespace Specter
|
||||
{
|
||||
@@ -36,10 +37,26 @@ class Table : public View
|
||||
ITableDataBinding* m_data;
|
||||
ITableStateBinding* m_state;
|
||||
|
||||
size_t m_rows = 0;
|
||||
size_t m_columns = 0;
|
||||
struct CellView : public View
|
||||
{
|
||||
Table& m_t;
|
||||
std::unique_ptr<TextView> m_text;
|
||||
CellView(Table& t, ViewResources& res);
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
std::vector<std::unique_ptr<CellView>> m_headerViews;
|
||||
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;
|
||||
|
||||
@@ -47,19 +64,25 @@ class Table : public View
|
||||
{
|
||||
Table& m_t;
|
||||
RowsView(Table& t, ViewResources& res) : View(res, t), m_t(t) {}
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
int nominalHeight() const;
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
|
||||
const boo::SWindowRect& scissor);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
} m_rowsView;
|
||||
|
||||
public:
|
||||
Table(ViewResources& res, View& parentView, ITableDataBinding* data, ITableStateBinding* state=nullptr);
|
||||
|
||||
void setMultiplyColor(const Zeus::CColor& color);
|
||||
|
||||
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&);
|
||||
void scroll(const boo::SWindowCoord&, const boo::SScrollDelta&);
|
||||
|
||||
void updateData();
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
@@ -166,6 +166,7 @@ public:
|
||||
|
||||
View& parentView() {return m_parentView;}
|
||||
RootView& rootView() {return m_rootView;}
|
||||
const RootView& rootView() const {return m_rootView;}
|
||||
const boo::SWindowRect& subRect() const {return m_subRect;}
|
||||
int width() const {return m_subRect.size[0];}
|
||||
int height() const {return m_subRect.size[1];}
|
||||
@@ -205,6 +206,8 @@ public:
|
||||
virtual void modKeyUp(boo::EModifierKey) {}
|
||||
|
||||
virtual void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
virtual void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub,
|
||||
const boo::SWindowRect& scissor) {resized(root, sub);}
|
||||
virtual void think() {}
|
||||
virtual void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
|
||||
@@ -43,6 +43,9 @@ class ThemeData
|
||||
Zeus::CColor m_textfieldSelection = {0.2725, 0.2725, 0.2725, 1.0};
|
||||
Zeus::CColor m_textfieldMarkSelection = {1.0, 1.0, 0.2725, 1.0};
|
||||
|
||||
Zeus::CColor m_tableCellBg1 = {0.1725, 0.1725, 0.1725, 0.75};
|
||||
Zeus::CColor m_tableCellBg2 = {0.2425, 0.2425, 0.2425, 0.75};
|
||||
|
||||
public:
|
||||
virtual const Zeus::CColor& uiText() const {return m_uiText;}
|
||||
virtual const Zeus::CColor& fieldText() const {return m_fieldText;}
|
||||
@@ -74,6 +77,9 @@ public:
|
||||
virtual const Zeus::CColor& textfield2Disabled() const {return m_textfield2Disabled;}
|
||||
virtual const Zeus::CColor& textfieldSelection() const {return m_textfieldSelection;}
|
||||
virtual const Zeus::CColor& textfieldMarkSelection() const {return m_textfieldMarkSelection;}
|
||||
|
||||
virtual const Zeus::CColor& tableCellBg1() const {return m_tableCellBg1;}
|
||||
virtual const Zeus::CColor& tableCellBg2() const {return m_tableCellBg2;}
|
||||
};
|
||||
|
||||
class ViewResources
|
||||
|
||||
Reference in New Issue
Block a user