Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain.old/src/lib/gui/gl/glgui_table.h @ 10635

Last change on this file since 10635 was 8717, checked in by bensch, 19 years ago

merged the gui back

File size: 2.3 KB
Line 
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
15namespace 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 row, unsigned int column, 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 draw() const;
47
48
49    void debug() const;
50
51  protected:
52    virtual void removedFocus();
53
54    virtual void updateFrontColor();
55    virtual void hiding();
56    virtual void showing();
57    virtual void resize();
58
59    virtual bool processEvent(const Event& event);
60
61  private:
62    void init();
63
64    void pixelPositionToElement(const Vector2D& pixelPosition, int* row, int* column);
65    void repositionText(unsigned int fromLeft, unsigned int fromTop);
66    void applyTextSettings(unsigned int row, unsigned int column, LimitedWidthText* text);
67    bool checkIntegrity() const;
68
69  private:
70    typedef struct Entry {
71      Entry(int row, int column) :row(row), column(column) {};
72      int  row;
73      int  column;
74    };
75
76    typedef std::vector<LimitedWidthText> TableTextList;
77    TableTextList                _headers;
78    std::vector<float>           _columnWidths;
79    std::vector<float>           _rowHeights;
80
81    std::vector<TableTextList>   _entries;     //!< inner is by column, outer is by row.
82
83    Entry                        _selected;
84    Entry                        _focused;
85
86
87  };
88}
89
90#endif /* _GLGUI_TABLE_H */
Note: See TracBrowser for help on using the repository browser.