31 #ifndef DC_DATA_GRID_INCLUDED
32 #define DC_DATA_GRID_INCLUDED
34 #include <Dynacoe/Entity.h>
35 #include <Dynacoe/Components/Text2D.h>
36 #include <Dynacoe/Components/Shape2D.h>
37 #include <Dynacoe/Components/GUI.h>
38 #include <Dynacoe/Color.h>
66 void AddColumn(
const std::string & title,
int width,
const Color & color =
Color(
"#EFEFEF"));
100 std::string &
Get(uint32_t x, uint32_t y);
141 std::vector<std::string> rows;
146 std::vector<Column> columns;
147 std::vector<Shape2D *> visibleRows;
148 std::vector<GUI *> visibleGUI;
149 std::vector<std::vector<Text2D *>> visibleText;
150 std::vector<std::string> tooltipText;
151 Color real_backgroundEvenColor;
152 Color real_backgroundOddColor;
153 Color real_titleColor;
154 Color real_defaultTextColor;
163 const int lineHeight = 12;
168 void AddNeededView();
174 std::map<GUI *, uint32_t> rowmap;
175 static DynacoeEvent(master_click);
176 static DynacoeEvent(hover_enter);
177 static DynacoeEvent(hover_leave);
178 static DynacoeEvent(begin_scroll_drag);
void SetColumnWidth(uint32_t column, uint32_t width)
Sets the width in pixels for the specified column.
A standard object representing an RGBA color.
Definition: Color.h:47
Basic interactive object.
Definition: Entity.h:62
uint32_t GetRowsVisible()
Returns the currently viewable number of rows at a time.
Aspect2D class that handles text rendering.
Definition: Text2D.h:60
bool(*)(void *, Component *component, Entity::ID self, Entity::ID source, const std::vector< std::string > &args) EventHandler
A handler for an event.
Definition: Component.h:132
Color titleColor
Color for the title text.
Definition: DataGrid.h:57
void SetRowsVisible(uint32_t)
Will only draw display up to the given number of rows.
void AddColumn(const std::string &title, int width, const Color &color=Color("#EFEFEF"))
Adds a new column with a title, a specified width, and an optional color for the text.
std::string & Get(uint32_t x, uint32_t y)
Returns the string @ the column and row given.
uint32_t GetViewPosition()
Returns the current viewing index at the top. 0 is the default (aka the first row) ...
void SetViewPosition(uint32_t i)
Sets the initial viewing row.
void AddRow()
Appends a new row to the grid.
uint32_t GetRowCount()
Returns the number of rows.
Built-in Entity for drawing a grid of values.
Definition: DataGrid.h:44
A component that provides managed input interaction suitable for making things like buttons...
Definition: GUI.h:52
void RemoveRow(uint32_t)
removes the specified row by index.
std::string & GetTooltip(uint32_t y)
Returns the tooltip string @ the row given.
Component::EventHandler clickCallback
Callback called when a cell is clicked.
Definition: DataGrid.h:75
An aspect that can express basic 2D objects, such as images and shapes.
Definition: Shape2D.h:46
void Clear()
Clears all rows.
uint32_t Width()
Returns the row in pixels.
uint32_t GetMaxViewPosition()
Returns the maximum currently allowable viewing position based on the current DataGrid parameters...
Color backgroundOddColor
Background color for odd-count cells.
Definition: DataGrid.h:53
uint32_t RowHeight()
Returns the height of a row.
Color backgroundEvenColor
Background color for even-count cells.
Definition: DataGrid.h:49