[gtkmm] Add the Grid container widget.



commit ec44e066460cc2d6e5b296d183e46c4e11b15806
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Nov 8 10:47:57 2010 +0100

    Add the Grid container widget.
    
      * tools/extra_defs_gen/generate_defs_gtk.cc: Mention GTK_TYPE_GRID.
      * gtk/src/gtk_signals.defs: Added the generated part for GtkGrid.
      * gtk/src/filelist.am:
    * gtk/src/grid.[hg|ccg]:
    * gtk/gtkmm.h: Added the Grid container widget.

 ChangeLog                                 |   10 +
 gtk/gtkmm.h                               |    1 +
 gtk/src/filelist.am                       |    1 +
 gtk/src/grid.ccg                          |   25 ++
 gtk/src/grid.hg                           |   79 ++++++
 gtk/src/gtk_signals.defs                  |  389 +++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gtk.cc |    1 +
 7 files changed, 506 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c7922ec..d3bb845 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-08  Murray Cumming  <murrayc murrayc com>
+
+	Add the Grid container widget.
+
+  * tools/extra_defs_gen/generate_defs_gtk.cc: Mention GTK_TYPE_GRID.
+  * gtk/src/gtk_signals.defs: Added the generated part for GtkGrid.
+  * gtk/src/filelist.am:
+	* gtk/src/grid.[hg|ccg]:
+	* gtk/gtkmm.h: Added the Grid container widget.
+
 2010-11-05  José Alburquerque  <jaalburqu svn gnome org>
 
 	Style: Fix the clone_vfunc() implementation.
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 8d03191..9cab04c 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -142,6 +142,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/fontbutton.h>
 #include <gtkmm/fontselection.h>
 #include <gtkmm/frame.h>
+#include <gtkmm/grid.h>
 //#include <gtkmm/rc.h>
 #include <gtkmm/handlebox.h>
 #include <gtkmm/iconset.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 09bbe7a..2f654d8 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -72,6 +72,7 @@ gtkmm_files_any_hg =		\
 	fontbutton.hg		\
 	fontselection.hg	\
 	frame.hg		\
+	grid.hg \
 	handlebox.hg		\
 	iconfactory.hg		\
 	iconinfo.hg		\
diff --git a/gtk/src/grid.ccg b/gtk/src/grid.ccg
new file mode 100644
index 0000000..59162e7
--- /dev/null
+++ b/gtk/src/grid.ccg
@@ -0,0 +1,25 @@
+/*
+ *
+ * Copyright 2010 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtk/gtk.h>
+
+namespace Gtk
+{
+
+} /* namespace Gtk */
diff --git a/gtk/src/grid.hg b/gtk/src/grid.hg
new file mode 100644
index 0000000..292a35a
--- /dev/null
+++ b/gtk/src/grid.hg
@@ -0,0 +1,79 @@
+/* $Id: table.hg,v 1.3 2006/05/16 14:16:08 jjongsma Exp $ */
+
+/* Copyright (C) 1998-2002 The gtkmm Development Team
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtkmm/container.h>
+#include <gtkmm/orientable.h>
+#include <gtkmm/enums.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/container_p.h)
+
+namespace Gtk
+{
+
+//TODO: Is this comparison with Table and Child still useful? Don't they support h-for-w properly now?
+
+/** A container which arranges its child widgets in rows and columns.
+ * It is a very similar to Table and Box,
+ * but it consistently uses Widget's margin and expand
+ * properties instead of custom child properties, and it fully supports
+ * height-for-width geometry management.
+ *
+ * Children are added using attach(). They can span multiple
+ * rows or columns. It is also possible to add a child next to an
+ * existing child, using attach_next_to().
+ *
+ * Grid can be used like a Box by just using Gtk::Container::add(),
+ * which will place children next to each other in the direction determined
+ * by the orientation property.
+ *
+ * @ingroup Widgets
+ * @ingroup Containers
+ *
+ * @newin{3,0}
+ */
+class Grid
+  : public Container,
+    public Orientable
+{
+  _CLASS_GTKOBJECT(Grid, GtkGrid, GTK_GRID, Gtk::Container, GtkContainer)
+  _IMPLEMENTS_INTERFACE(Orientable)
+public:
+  _CTOR_DEFAULT
+
+  _WRAP_METHOD(void attach(Widget& child, int left, int top, int width, int height), gtk_grid_attach)
+  _WRAP_METHOD(void attach_next_to(Widget& child, Widget& sibling, PositionType side, int width, int height), gtk_grid_attach_next_to)
+
+  _WRAP_METHOD(void set_row_homogeneous(bool homogeneous = true), gtk_grid_set_row_homogeneous)
+  _WRAP_METHOD(bool get_row_homogeneous() const, gtk_grid_get_row_homogeneous)
+  _WRAP_METHOD(void set_row_spacing(guint spacing), gtk_grid_set_row_spacing)
+  _WRAP_METHOD(guint get_row_spacing() const, gtk_grid_get_row_spacing)
+  _WRAP_METHOD(void set_column_homogeneous(bool homogeneous), gtk_grid_set_column_homogeneous)
+  _WRAP_METHOD(bool get_column_homogeneous() const, gtk_grid_get_column_homogeneous)
+  _WRAP_METHOD(void set_column_spacing(guint spacing), gtk_grid_set_column_spacing)
+  _WRAP_METHOD(guint get_column_spacing() const, gtk_grid_get_column_spacing)
+
+  _WRAP_PROPERTY("orientation", Orientation)
+  _WRAP_PROPERTY("row-spacing", guint)
+  _WRAP_PROPERTY("column-spacing", guint)
+  _WRAP_PROPERTY("row-homogeneous", bool)
+  _WRAP_PROPERTY("column-homogeneous", bool)
+};
+
+} // namespace Gtk
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index 08b19c0..e9e52af 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -19960,6 +19960,395 @@
   (construct-only #f)
 )
 
+;; From GtkGrid
+
+(define-property orientation
+  (of-object "GtkGrid")
+  (prop-type "GParamEnum")
+  (docs "The orientation of the orientable")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property name
+  (of-object "GtkGrid")
+  (prop-type "GParamString")
+  (docs "The name of the widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property parent
+  (of-object "GtkGrid")
+  (prop-type "GParamObject")
+  (docs "The parent widget of this widget. Must be a Container widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property width-request
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Override for width request of the widget, or -1 if natural request should be used")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property height-request
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Override for height request of the widget, or -1 if natural request should be used")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property visible
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget is visible")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property sensitive
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget responds to input")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property app-paintable
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the application will paint directly on the widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property can-focus
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget can accept the input focus")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property has-focus
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget has the input focus")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property is-focus
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget is the focus widget within the toplevel")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property can-default
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget can be the default widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property has-default
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget is the default widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property receives-default
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "If TRUE, the widget will receive the default action when it is focused")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property composite-child
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget is part of a composite widget")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property style
+  (of-object "GtkGrid")
+  (prop-type "GParamObject")
+  (docs "The style of the widget, which contains information about how it will look (colors etc)")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property events
+  (of-object "GtkGrid")
+  (prop-type "GParamFlags")
+  (docs "The event mask that decides what kind of GdkEvents this widget gets")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property extension-events
+  (of-object "GtkGrid")
+  (prop-type "GParamEnum")
+  (docs "The mask that decides what kind of extension events this widget gets")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property no-show-all
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether gtk_widget_show_all() should not affect this widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property has-tooltip
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether this widget has a tooltip")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property tooltip-markup
+  (of-object "GtkGrid")
+  (prop-type "GParamString")
+  (docs "The contents of the tooltip for this widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property tooltip-text
+  (of-object "GtkGrid")
+  (prop-type "GParamString")
+  (docs "The contents of the tooltip for this widget")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property window
+  (of-object "GtkGrid")
+  (prop-type "GParamObject")
+  (docs "The widget's window if it is realized")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
+(define-property double-buffered
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether the widget is double buffered")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property halign
+  (of-object "GtkGrid")
+  (prop-type "GParamEnum")
+  (docs "How to position in extra horizontal space")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property valign
+  (of-object "GtkGrid")
+  (prop-type "GParamEnum")
+  (docs "How to position in extra vertical space")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property margin-left
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Pixels of extra space on the left side")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property margin-right
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Pixels of extra space on the right side")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property margin-top
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Pixels of extra space on the top side")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property margin-bottom
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Pixels of extra space on the bottom side")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property margin
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "Pixels of extra space on all four sides")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property hexpand
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether widget wants more horizontal space")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property vexpand
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether widget wants more vertical space")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property hexpand-set
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether to use the hexpand property")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property vexpand-set
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether to use the vexpand property")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property expand
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "Whether widget wants to expand in both directions")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property border-width
+  (of-object "GtkGrid")
+  (prop-type "GParamUInt")
+  (docs "The width of the empty border outside the containers children")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property resize-mode
+  (of-object "GtkGrid")
+  (prop-type "GParamEnum")
+  (docs "Specify how resize events are handled")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property child
+  (of-object "GtkGrid")
+  (prop-type "GParamObject")
+  (docs "Can be used to add a new child to the container")
+  (readable #f)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property row-spacing
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "The amount of space between two consecutive rows")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property column-spacing
+  (of-object "GtkGrid")
+  (prop-type "GParamInt")
+  (docs "The amount of space between two consecutive columns")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property row-homogeneous
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "If TRUE, the rows are all the same height")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property column-homogeneous
+  (of-object "GtkGrid")
+  (prop-type "GParamBoolean")
+  (docs "If TRUE, the columns are all the same width")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From GtkHandleBox
 
 (define-signal child-detached
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index bb97010..c825d4c 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -106,6 +106,7 @@ int main(int argc, char** argv)
             << get_defs( GTK_TYPE_FONT_SELECTION )
             << get_defs( GTK_TYPE_FONT_SELECTION_DIALOG )
             << get_defs( GTK_TYPE_FRAME )
+            << get_defs( GTK_TYPE_GRID )
             << get_defs( GTK_TYPE_HANDLE_BOX )
             << get_defs( GTK_TYPE_ICON_THEME )
             << get_defs( GTK_TYPE_IMAGE )



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]