2 // Generated by gtkmmproc -- DO NOT MODIFY!
11 /* Copyright (C) 1998-2002 The gtkmm Development Team
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version.
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details.
23 * You should have received a copy of the GNU Library General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <glibmm/helperlist.h>
29 #include <gtkmm/container.h>
30 #include <gtkmm/enums.h>
31 #include <gtk/gtktable.h> /* for GtkTableChild */
34 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 typedef struct _GtkTable GtkTable;
36 typedef struct _GtkTableClass GtkTableClass;
37 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
41 { class Table_Class; } // namespace Gtk
47 namespace Table_Helpers
50 class Child : protected _GtkTableChild
53 Child& operator=(const Child&); //Not implemented.
54 Child(const Child&); //Not implemented.
57 inline _GtkTableChild* gobj() {return (this);}
58 inline const _GtkTableChild* gobj() const {return (this);}
60 Widget* get_widget() const;
62 //TODO: Which of the GtkTableChild's fields are public API?
63 //Maybe we should remove some of these get()s or add some set()s.
64 //If get_widget() is the only accessor, then we should probably make
65 //the STL-style Table list contain Widgets instead of Childs.
67 guint16 get_left_attach() const;
68 guint16 get_right_attach() const;
69 guint16 get_top_attach() const;
70 guint16 get_bottom_attach() const;
71 guint16 get_xpadding() const;
72 guint16 get_ypadding() const;
73 bool get_xexpand() const;
74 bool get_yexpand() const;
75 bool get_xshrink() const;
76 bool get_yshrink() const;
77 bool get_xfill() const;
78 bool get_yfill() const;
81 inline GtkTable* parent()
82 { return (GtkTable*) (gobj()->widget->parent); }
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 friend class Dummy_; // silence the compiler (Child has only private ctors)
90 class TableList : public Glib::HelperList< Child, Widget, Glib::List_Iterator< Child > >
94 explicit TableList(GtkTable* gparent);
95 TableList(const TableList& src);
96 virtual ~TableList() {}
98 TableList& operator=(const TableList& src);
100 typedef Glib::HelperList< Child, Widget, Glib::List_Iterator< Child > > type_base;
103 const GtkTable* gparent() const;
105 virtual GList*& glist() const; // front of list
107 virtual void erase(iterator start, iterator stop);
108 virtual iterator erase(iterator); //Implented as custom or by LIST_CONTAINER_REMOVE
109 virtual void remove(const_reference); //Implented as custom or by LIST_CONTAINER_REMOVE
111 /// This is order n. (use at own risk)
112 reference operator[](size_type l) const;
115 //Hide these because its read-only:
116 iterator insert(iterator position, element_type& e);
118 inline void pop_front();
119 inline void pop_back();
122 //The standard iterator, instead of List_Cpp_Iterator,
123 //only works because Child is derived from _GtkTableChild.
126 virtual void remove(Widget& w); //Implented as custom or by LIST_CONTAINER_REMOVE
131 } // namespace Table_Helpers
134 /** Pack widgets in regular patterns.
136 * @ingroup Containers
137 * Gtk::Table is one of the primary ways of grouping widgets together. It
138 * consists of a set of lattice points to to which widgets can be attached.
139 * There are <em>rows</em> + 1 lattice points vertically and
140 * <em>columns</em> + 1 lattice points horizontally. Lattice points
141 * start counting from 0. Lattice points can either be specified to be
142 * <em>homogeneous</em>, meaning equally spaced, or not <em>homogeneous</em>,
143 * meaning each cell should be calculated based on the widgets contained in the
144 * row and column. The <em>homogeneous</em> property defaults to false.
146 * Widgets can be attached to the table by specifying the top, bottom, left and
147 * right points corresponding to upper, lefthand lattice point and the lower,
148 * righthand lattice point which the widget should span. Widgets can either be
149 * contained in a cell or may span cells. A number of options control the
150 * resizing behavior of widgets contained in the table.
152 * @par Packing options:
153 * There are a number of packing options that can be specified when adding a
154 * widget. With <tt>Gtk::EXPAND</tt>, the lattice is allowed to grow to fill
155 * space. With <tt>Gtk::SHRINK</tt>, the lattice is allowed to shrink when
156 * resized. It is also possible to specify the behaviour of the widgets
157 * allocation within the table. The flag <tt>Gtk::FILL</tt> declares the
158 * widget should grow to fill lattice. If this is not set any extra space is
159 * used as padding. The default is <tt>(Gtk::FILL | Gtk::EXPAND)</tt>.
162 * The table size is calculated based on the size of the widgets contained
163 * within and the restrictions imposed by specified options. Padding and
164 * spacing can be used in the table. Padding is added on either side of a
165 * widget, while spacing is placed between widgets.
167 * @see Gtk::HBox, Gtk::VBox
170 class Table : public Container
173 #ifndef DOXYGEN_SHOULD_SKIP_THIS
174 typedef Table CppObjectType;
175 typedef Table_Class CppClassType;
176 typedef GtkTable BaseObjectType;
177 typedef GtkTableClass BaseClassType;
178 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
182 #ifndef DOXYGEN_SHOULD_SKIP_THIS
185 friend class Table_Class;
186 static CppClassType table_class_;
190 Table& operator=(const Table&);
193 explicit Table(const Glib::ConstructParams& construct_params);
194 explicit Table(GtkTable* castitem);
196 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
199 #ifndef DOXYGEN_SHOULD_SKIP_THIS
200 static GType get_type() G_GNUC_CONST;
201 static GType get_base_type() G_GNUC_CONST;
204 ///Provides access to the underlying C GtkObject.
205 GtkTable* gobj() { return reinterpret_cast<GtkTable*>(gobject_); }
207 ///Provides access to the underlying C GtkObject.
208 const GtkTable* gobj() const { return reinterpret_cast<GtkTable*>(gobject_); }
212 //C++ methods used to invoke GTK+ virtual functions:
213 #ifdef GLIBMM_VFUNCS_ENABLED
214 #endif //GLIBMM_VFUNCS_ENABLED
217 //GTK+ Virtual Functions (override these to change behaviour):
218 #ifdef GLIBMM_VFUNCS_ENABLED
219 #endif //GLIBMM_VFUNCS_ENABLED
221 //Default Signal Handlers::
222 #ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
223 #endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
230 explicit Table(guint n_rows = 1, guint n_columns = 1, bool homogeneous = false);
233 void attach(Widget& child,
234 guint left_attach, guint right_attach,
235 guint top_attach, guint bottom_attach,
236 AttachOptions xoptions = FILL | EXPAND, AttachOptions yoptions = FILL | EXPAND,
237 guint xpadding = 0, guint ypadding = 0);
240 void resize(guint rows, guint columns);
243 void set_row_spacing(guint row, guint spacing);
245 /** Gets the amount of space between row @a row , and
246 * row @a row + 1. See set_row_spacing().
247 * @param row A row in the table, 0 indicates the first row.
248 * @return The row spacing.
250 guint get_row_spacing(guint row) const;
253 void set_col_spacing(guint column, guint spacing);
255 /** Gets the amount of space between column @a col , and
256 * column @a col + 1. See set_col_spacing().
257 * @param column A column in the table, 0 indicates the first column.
258 * @return The column spacing.
260 guint get_col_spacing(guint column) const;
263 void set_row_spacings(guint spacing);
266 void set_col_spacings(guint spacing);
268 void set_spacings(guint spacing);
271 /** Gets the default row spacing for the table. This is
272 * the spacing that will be used for newly added rows.
273 * (See set_row_spacings())
274 * @return Value: the default row spacing.
276 guint get_default_row_spacing();
278 /** Gets the default column spacing for the table. This is
279 * the spacing that will be used for newly added columns.
280 * (See set_col_spacings())
281 * @return Value: the default column spacing.
283 guint get_default_col_spacing();
286 void set_homogeneous(bool homogeneous = true);
288 /** Returns whether the table cells are all constrained to the same
289 * width and height. (See set_homogenous())
290 * @return <tt>true</tt> if the cells are all constrained to the same size.
292 bool get_homogeneous() const;
294 typedef Table_Helpers::TableList TableList;
297 TableList& children();
298 const TableList& children() const;
300 #ifdef GLIBMM_PROPERTIES_ENABLED
301 /** The number of rows in the table.
303 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
304 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
305 * the value of the property changes.
307 Glib::PropertyProxy<guint> property_n_rows() ;
308 #endif //#GLIBMM_PROPERTIES_ENABLED
310 #ifdef GLIBMM_PROPERTIES_ENABLED
311 /** The number of rows in the table.
313 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
314 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
315 * the value of the property changes.
317 Glib::PropertyProxy_ReadOnly<guint> property_n_rows() const;
318 #endif //#GLIBMM_PROPERTIES_ENABLED
320 #ifdef GLIBMM_PROPERTIES_ENABLED
321 /** The number of columns in the table.
323 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
324 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
325 * the value of the property changes.
327 Glib::PropertyProxy<guint> property_n_columns() ;
328 #endif //#GLIBMM_PROPERTIES_ENABLED
330 #ifdef GLIBMM_PROPERTIES_ENABLED
331 /** The number of columns in the table.
333 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
334 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
335 * the value of the property changes.
337 Glib::PropertyProxy_ReadOnly<guint> property_n_columns() const;
338 #endif //#GLIBMM_PROPERTIES_ENABLED
340 #ifdef GLIBMM_PROPERTIES_ENABLED
341 /** The amount of space between two consecutive columns.
343 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
344 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
345 * the value of the property changes.
347 Glib::PropertyProxy<guint> property_column_spacing() ;
348 #endif //#GLIBMM_PROPERTIES_ENABLED
350 #ifdef GLIBMM_PROPERTIES_ENABLED
351 /** The amount of space between two consecutive columns.
353 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
354 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
355 * the value of the property changes.
357 Glib::PropertyProxy_ReadOnly<guint> property_column_spacing() const;
358 #endif //#GLIBMM_PROPERTIES_ENABLED
360 #ifdef GLIBMM_PROPERTIES_ENABLED
361 /** The amount of space between two consecutive rows.
363 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
364 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
365 * the value of the property changes.
367 Glib::PropertyProxy<guint> property_row_spacing() ;
368 #endif //#GLIBMM_PROPERTIES_ENABLED
370 #ifdef GLIBMM_PROPERTIES_ENABLED
371 /** The amount of space between two consecutive rows.
373 * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
374 * @return A PropertyProxy that allows you to get or set the property of the value, or receive notification when
375 * the value of the property changes.
377 Glib::PropertyProxy_ReadOnly<guint> property_row_spacing() const;
378 #endif //#GLIBMM_PROPERTIES_ENABLED
382 #ifndef DOXYGEN_SHOULD_SKIP_THIS
383 mutable TableList children_proxy_;
384 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
394 /** A Glib::wrap() method for this object.
396 * @param object The C instance.
397 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
398 * @result A C++ instance that wraps this C instance.
400 * @relates Gtk::Table
402 Gtk::Table* wrap(GtkTable* object, bool take_copy = false);
406 #endif /* _GTKMM_TABLE_H */