1 | /*! |
---|
2 | * @file glgui_table.h |
---|
3 | * The gl_TABLE widget of th openglGUI |
---|
4 | * |
---|
5 | */ |
---|
6 | |
---|
7 | #ifndef _GLGUI_TABLE_H |
---|
8 | #define _GLGUI_TABLE_H |
---|
9 | |
---|
10 | #include "glgui_widget.h" |
---|
11 | #include "limited_width_text.h" |
---|
12 | #include "event.h" |
---|
13 | |
---|
14 | // FORWARD DECLARATION |
---|
15 | namespace OrxGui |
---|
16 | { |
---|
17 | |
---|
18 | //! This is Table part of the openglGUI class |
---|
19 | /** |
---|
20 | * The Table is a Widget, that displays a Line, that can be manipulated through |
---|
21 | * Writing Text on it. |
---|
22 | * |
---|
23 | * Whenever the Text is changed the textChanged signal is emitted. |
---|
24 | */ |
---|
25 | class GLGuiTable : public OrxGui::GLGuiWidget |
---|
26 | { |
---|
27 | |
---|
28 | public: |
---|
29 | GLGuiTable(unsigned int rows, unsigned int columns); |
---|
30 | virtual ~GLGuiTable(); |
---|
31 | |
---|
32 | unsigned int rowCount() const { return this->_entries.size(); }; |
---|
33 | unsigned int columnCount() const { return this->_headers.size(); }; |
---|
34 | |
---|
35 | void setRowCount(unsigned int rowCount); |
---|
36 | void setColumnCount(unsigned int columnCount); |
---|
37 | |
---|
38 | void setHeader(unsigned int number, const std::string& headerName); |
---|
39 | void setHeader(const std::vector<std::string>& headerNames); |
---|
40 | |
---|
41 | void setEntry(unsigned int column, unsigned int row, const std::string& name); |
---|
42 | |
---|
43 | void setColumnWidth(unsigned int column, float size); |
---|
44 | void setRowHeight(unsigned int row, unsigned int size); |
---|
45 | |
---|
46 | virtual void tick(float dt); |
---|
47 | virtual void draw() const; |
---|
48 | |
---|
49 | |
---|
50 | void debug() const; |
---|
51 | |
---|
52 | protected: |
---|
53 | virtual void removedFocus(); |
---|
54 | |
---|
55 | virtual void updateFrontColor(); |
---|
56 | virtual void hiding(); |
---|
57 | virtual void showing(); |
---|
58 | virtual void resize(); |
---|
59 | |
---|
60 | virtual bool processEvent(const Event& event); |
---|
61 | |
---|
62 | |
---|
63 | private: |
---|
64 | void init(); |
---|
65 | |
---|
66 | void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text); |
---|
67 | bool checkIntegrity() const; |
---|
68 | |
---|
69 | private: |
---|
70 | typedef std::vector<LimitedWidthText> TableTextList; |
---|
71 | TableTextList _headers; |
---|
72 | std::vector<TableTextList> _entries; //!< inner is by column, outer is by row. |
---|
73 | |
---|
74 | |
---|
75 | }; |
---|
76 | } |
---|
77 | |
---|
78 | #endif /* _GLGUI_TABLE_H */ |
---|