| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 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 GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
// To exclude this file from the documentation when build-deprecated-api=false. |
| 18 |
_CONFIGINCLUDE(gtkmmconfig.h) |
| 19 |
|
| 20 |
_DEFS(gtkmm,gtk) |
| 21 |
_PINCLUDE(gtkmm/private/container_p.h) |
| 22 |
|
| 23 |
#m4 _PUSH(SECTION_CC_PRE_INCLUDES) |
| 24 |
#undef GTK_DISABLE_DEPRECATED |
| 25 |
#define GDK_DISABLE_DEPRECATION_WARNINGS 1 |
| 26 |
#m4 _POP() |
| 27 |
|
| 28 |
#include <gtkmm/container.h> |
| 29 |
#include <gtkmm/enums.h> |
| 30 |
|
| 31 |
|
| 32 |
namespace Gtk |
| 33 |
{ |
| 34 |
|
| 35 |
/** Pack widgets in regular patterns. |
| 36 |
* @ingroup Widgets |
| 37 |
* @ingroup Containers |
| 38 |
* Gtk::Table is one of the primary ways of grouping widgets together. It |
| 39 |
* consists of a set of lattice points to to which widgets can be attached. |
| 40 |
* There are <em>rows</em> + 1 lattice points vertically and |
| 41 |
* <em>columns</em> + 1 lattice points horizontally. Lattice points |
| 42 |
* start counting from 0. Lattice points can either be specified to be |
| 43 |
* <em>homogeneous</em>, meaning equally spaced, or not <em>homogeneous</em>, |
| 44 |
* meaning each cell should be calculated based on the widgets contained in the |
| 45 |
* row and column. The <em>homogeneous</em> property defaults to false. |
| 46 |
* |
| 47 |
* Widgets can be attached to the table by specifying the top, bottom, left and |
| 48 |
* right points corresponding to upper, lefthand lattice point and the lower, |
| 49 |
* righthand lattice point which the widget should span. Widgets can either be |
| 50 |
* contained in a cell or may span cells. A number of options control the |
| 51 |
* resizing behavior of widgets contained in the table. |
| 52 |
* |
| 53 |
* @par Packing options: |
| 54 |
* There are a number of packing options that can be specified when adding a |
| 55 |
* widget. With <tt>Gtk::EXPAND</tt>, the lattice is allowed to grow to fill |
| 56 |
* space. With <tt>Gtk::SHRINK</tt>, the lattice is allowed to shrink when |
| 57 |
* resized. It is also possible to specify the behaviour of the widgets |
| 58 |
* allocation within the table. The flag <tt>Gtk::FILL</tt> declares the |
| 59 |
* widget should grow to fill lattice. If this is not set any extra space is |
| 60 |
* used as padding. The default is <tt>(Gtk::FILL | Gtk::EXPAND)</tt>. |
| 61 |
* |
| 62 |
* @par Table sizing: |
| 63 |
* The table size is calculated based on the size of the widgets contained |
| 64 |
* within and the restrictions imposed by specified options. Padding and |
| 65 |
* spacing can be used in the table. Padding is added on either side of a |
| 66 |
* widget, while spacing is placed between widgets. |
| 67 |
* |
| 68 |
* A Table widget looks like this: |
| 69 |
* @image html table1.png |
| 70 |
* |
| 71 |
* @deprecated Use Gtk::Grid instead. It provides the same |
| 72 |
* capabilities as Gtk::Table for arranging widgets in a rectangular grid, but |
| 73 |
* does support height-for-width geometry management. |
| 74 |
* |
| 75 |
* @see Gtk::HBox, Gtk::VBox |
| 76 |
*/ |
| 77 |
class GTKMM_API Table : public Container |
| 78 |
{ |
| 79 |
_CLASS_GTKOBJECT(Table,GtkTable,GTK_TABLE,Gtk::Container,GtkContainer,,,GTKMM_API) |
| 80 |
_IS_DEPRECATED |
| 81 |
_IGNORE(gtk_table_attach_defaults) |
| 82 |
public: |
| 83 |
_WRAP_CTOR(Table(guint n_rows = 1, guint n_columns = 1, bool homogeneous = false), gtk_table_new) |
| 84 |
|
| 85 |
_WRAP_METHOD( |
| 86 |
void attach(Widget& child, |
| 87 |
guint left_attach, guint right_attach, |
| 88 |
guint top_attach, guint bottom_attach, |
| 89 |
AttachOptions xoptions = FILL | EXPAND, AttachOptions yoptions = FILL | EXPAND, |
| 90 |
guint xpadding = 0, guint ypadding = 0), |
| 91 |
gtk_table_attach) |
| 92 |
|
| 93 |
|
| 94 |
_WRAP_METHOD(void resize(guint rows, guint columns), gtk_table_resize) |
| 95 |
|
| 96 |
|
| 97 |
_WRAP_METHOD(void set_row_spacing(guint row, guint spacing), gtk_table_set_row_spacing) |
| 98 |
_WRAP_METHOD(guint get_row_spacing(guint row) const, gtk_table_get_row_spacing) |
| 99 |
|
| 100 |
_WRAP_METHOD(void set_col_spacing(guint column, guint spacing), gtk_table_set_col_spacing) |
| 101 |
_WRAP_METHOD(guint get_col_spacing(guint column) const, gtk_table_get_col_spacing) |
| 102 |
|
| 103 |
_WRAP_METHOD(void set_row_spacings(guint spacing), gtk_table_set_row_spacings) |
| 104 |
|
| 105 |
_WRAP_METHOD(void set_col_spacings(guint spacing), gtk_table_set_col_spacings) |
| 106 |
|
| 107 |
void set_spacings(guint spacing); |
| 108 |
|
| 109 |
_WRAP_METHOD(guint get_default_row_spacing(), gtk_table_get_default_row_spacing) |
| 110 |
_WRAP_METHOD(guint get_default_col_spacing(), gtk_table_get_default_col_spacing) |
| 111 |
|
| 112 |
_WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_table_set_homogeneous) |
| 113 |
_WRAP_METHOD(bool get_homogeneous() const, gtk_table_get_homogeneous) |
| 114 |
|
| 115 |
_WRAP_METHOD(void get_size(guint& rows, guint& columns) const, gtk_table_get_size) |
| 116 |
|
| 117 |
_WRAP_PROPERTY("n-rows", guint) |
| 118 |
_WRAP_PROPERTY("n-columns", guint) |
| 119 |
_WRAP_PROPERTY("column-spacing", guint) |
| 120 |
_WRAP_PROPERTY("row-spacing", guint) |
| 121 |
_WRAP_PROPERTY("homogeneous", bool) |
| 122 |
}; |
| 123 |
|
| 124 |
} // namespace Gtk |