1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
14// Code by: Jeremy Moles (cubicool) 2007-2008
16#ifndef OSGWIDGET_TABLE
17#define OSGWIDGET_TABLE
19#include <osgWidget/Window>
23class OSGWIDGET_EXPORT Table: public Window
27 typedef std::vector<point_type> CellSizes;
29 META_Object (osgWidget, Table);
31 Table (const std::string& = "", unsigned int = 0, unsigned int = 0);
32 Table (const Table&, const osg::CopyOp&);
34 virtual bool addWidget (Widget*);
35 virtual bool addWidget (Widget*, unsigned int, unsigned int);
37 void getRowHeights (CellSizes&) const;
38 void getRowMinHeights (CellSizes&) const;
39 void getColumnWidths (CellSizes&) const;
40 void getColumnMinWidths (CellSizes&) const;
42 void addHeightToRow (unsigned int, point_type);
43 void addWidthToColumn (unsigned int, point_type);
45 bool isRowVerticallyFillable (unsigned int) const;
46 bool isColumnHorizontallyFillable (unsigned int) const;
48 Widget* getByRowCol(unsigned int row, unsigned int col)
50 return getObjects()[_calculateIndex(row, col)].get();
53 const Widget* getByRowCol(unsigned int row, unsigned int col) const
55 return getObjects()[_calculateIndex(row, col)].get();
62 unsigned int _lastRowAdd;
63 unsigned int _lastColAdd;
65 unsigned int _calculateIndex(unsigned int, unsigned int) const;
67 void _getRows (CellSizes&, Getter) const;
68 void _getColumns (CellSizes&, Getter) const;
70 virtual void _resizeImplementation(point_type, point_type);
72 virtual Sizes _getWidthImplementation () const;
73 virtual Sizes _getHeightImplementation () const;