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