Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/lib/gui/gl/glgui_table.h @ 10510

Last change on this file since 10510 was 9869, checked in by bensch, 18 years ago

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

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