[gtkmm] Gtk: Add GridLayout and GridLayoutChild



commit 48447ad769122a2b856f33f859abb3ada89f0ea7
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Apr 7 14:51:59 2019 +0200

    Gtk: Add GridLayout and GridLayoutChild

 .gitignore                     |  4 +++
 gtk/gtkmm.h                    |  2 ++
 gtk/src/filelist.am            |  2 ++
 gtk/src/gridlayout.ccg         | 18 ++++++++++
 gtk/src/gridlayout.hg          | 78 ++++++++++++++++++++++++++++++++++++++++++
 gtk/src/gridlayoutchild.ccg    | 17 +++++++++
 gtk/src/gridlayoutchild.hg     | 76 ++++++++++++++++++++++++++++++++++++++++
 gtk/src/gtk_extra_objects.defs |  6 ++++
 8 files changed, 203 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index b190d52e..0c210c69 100644
--- a/.gitignore
+++ b/.gitignore
@@ -305,6 +305,10 @@ gtk/gtkmm/glarea.cc
 gtk/gtkmm/glarea.h
 gtk/gtkmm/grid.cc
 gtk/gtkmm/grid.h
+gtk/gtkmm/gridlayout.cc
+gtk/gtkmm/gridlayout.h
+gtk/gtkmm/gridlayoutchild.cc
+gtk/gtkmm/gridlayoutchild.h
 gtk/gtkmm/headerbar.cc
 gtk/gtkmm/headerbar.h
 gtk/gtkmm/iconinfo.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 7b6c9cb0..3cacde6c 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -172,6 +172,8 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/gesturezoom.h>
 #include <gtkmm/glarea.h>
 #include <gtkmm/grid.h>
+#include <gtkmm/gridlayout.h>
+#include <gtkmm/gridlayoutchild.h>
 #include <gtkmm/headerbar.h>
 #include <gtkmm/icontheme.h>
 #include <gtkmm/iconview.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index cd5edc10..5f710fcf 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -99,6 +99,8 @@ gtkmm_files_any_hg =          \
        gesturezoom.hg  \
        glarea.hg                       \
        grid.hg                 \
+       gridlayout.hg \
+       gridlayoutchild.hg \
        headerbar.hg    \
        iconinfo.hg             \
        icontheme.hg            \
diff --git a/gtk/src/gridlayout.ccg b/gtk/src/gridlayout.ccg
new file mode 100644
index 00000000..54221cb5
--- /dev/null
+++ b/gtk/src/gridlayout.ccg
@@ -0,0 +1,18 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
+
diff --git a/gtk/src/gridlayout.hg b/gtk/src/gridlayout.hg
new file mode 100644
index 00000000..50dff2b0
--- /dev/null
+++ b/gtk/src/gridlayout.hg
@@ -0,0 +1,78 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/layoutmanager.h>
+#include <gtkmm/enums.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/layoutmanager_p.h)
+
+namespace Gtk
+{
+
+/** Layout manager for grid-like widgets.
+ *
+ * %Gtk::GridLayout is a layout manager which arranges child widgets in
+ * rows and columns, with arbitrary positions and horizontal/vertical spans.
+ *
+ * Children have an "attach point" defined by the horizontal and vertical
+ * index of the cell they occupy; children can span multiple rows or columns.
+ * The layout properties for setting the attach points and spans are set
+ * using the Gtk::GridLayoutChild associated to each child widget.
+ *
+ * The behaviour of Gtk::Grid when several children occupy the same grid cell
+ * is undefined.
+ *
+ * %Gtk::GridLayout can be used like a Gtk::BoxLayout if all children are attached
+ * to the same row or column; however, if you only ever need a single row or
+ * column, you should consider using Gtk::BoxLayout.
+ *
+ * @newin{3,96}
+ */
+class GridLayout : public LayoutManager
+{
+  _CLASS_GOBJECT(GridLayout, GtkGridLayout, GTK_GRID_LAYOUT, LayoutManager, GtkLayoutManager)
+  _STRUCT_NOT_HIDDEN
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(void set_row_homogeneous(bool homogeneous = true), gtk_grid_layout_set_row_homogeneous)
+  _WRAP_METHOD(bool get_row_homogeneous() const, gtk_grid_layout_get_row_homogeneous)
+  _WRAP_METHOD(void set_row_spacing(guint spacing), gtk_grid_layout_set_row_spacing)
+  _WRAP_METHOD(guint get_row_spacing() const, gtk_grid_layout_get_row_spacing)
+  _WRAP_METHOD(void set_column_homogeneous(bool homogeneous = true), gtk_grid_layout_set_column_homogeneous)
+  _WRAP_METHOD(bool get_column_homogeneous() const, gtk_grid_layout_get_column_homogeneous)
+  _WRAP_METHOD(void set_column_spacing(guint spacing), gtk_grid_layout_set_column_spacing)
+  _WRAP_METHOD(guint get_column_spacing() const, gtk_grid_layout_get_column_spacing)
+  _WRAP_METHOD(void set_row_baseline_position(int row, BaselinePosition pos), 
gtk_grid_layout_set_row_baseline_position)
+  _WRAP_METHOD(BaselinePosition get_row_baseline_position(int row) const, 
gtk_grid_layout_get_row_baseline_position)
+  _WRAP_METHOD(void set_baseline_row(int row), gtk_grid_layout_set_baseline_row)
+  _WRAP_METHOD(int get_baseline_row() const, gtk_grid_layout_get_baseline_row)
+
+  _WRAP_PROPERTY("row-spacing", int)
+  _WRAP_PROPERTY("column-spacing", int)
+  _WRAP_PROPERTY("row-homogeneous", bool)
+  _WRAP_PROPERTY("column-homogeneous", bool)
+  _WRAP_PROPERTY("baseline-row", int)
+
+  // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/gridlayoutchild.ccg b/gtk/src/gridlayoutchild.ccg
new file mode 100644
index 00000000..3663c616
--- /dev/null
+++ b/gtk/src/gridlayoutchild.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtk/gtk.h>
diff --git a/gtk/src/gridlayoutchild.hg b/gtk/src/gridlayoutchild.hg
new file mode 100644
index 00000000..d0a3e307
--- /dev/null
+++ b/gtk/src/gridlayoutchild.hg
@@ -0,0 +1,76 @@
+/* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <gtkmm/layoutchild.h>
+#include <gtk/gtk.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/layoutchild_p.h)
+
+namespace Gtk
+{
+
+/** Layout properties for children of Gtk::GridLayout.
+ *
+ * %Gtk::GridLayoutChild instances are created by Gtk::GridLayout.
+ * To create or get a %Gtk::GridLayoutChild instance, call Gtk::LayoutManager::get_layout_child()
+ * from a Gtk::GridLayout instance.
+ * @code
+ * Glib::RefPtr<Gtk::LayoutChild> layout_child =
+ *   grid_layout->get_layout_child(child);
+ * Glib::RefPtr<Gtk::GridLayoutChild> grid_layout_child =
+ *   std::dynamic_pointer_cast<Gtk::GridLayoutChild>(layout_child);
+ * if (grid_layout_child)
+ *   // Do something with grid_layout_child
+ * @endcode
+ *
+ * @newin{3,96}
+ */
+class GridLayoutChild : public LayoutChild
+{
+  _CLASS_GOBJECT(GridLayoutChild, GtkGridLayoutChild, GTK_GRID_LAYOUT_CHILD, LayoutChild, GtkLayoutChild)
+  _STRUCT_NOT_HIDDEN
+
+protected:
+  /** Default constructor.
+   *
+   * There is no create() method that corresponds to this constructor.
+   * To create or get a %Gtk::GridLayoutChild instance, call Gtk::LayoutManager::get_layout_child()
+   * from a Gtk::GridLayout instance.
+   */
+  _CTOR_DEFAULT
+
+public:
+  // No create() method. Use Gtk::LayoutManager::get_layout_child().
+
+  _WRAP_METHOD(void set_top_attach(int attach), gtk_grid_layout_child_set_top_attach)
+  _WRAP_METHOD(int get_top_attach() const, gtk_grid_layout_child_get_top_attach)
+  _WRAP_METHOD(void set_left_attach(int attach), gtk_grid_layout_child_set_left_attach)
+  _WRAP_METHOD(int get_left_attach() const, gtk_grid_layout_child_get_left_attach)
+  _WRAP_METHOD(void set_column_span(int span), gtk_grid_layout_child_set_column_span)
+  _WRAP_METHOD(int get_column_span() const, gtk_grid_layout_child_get_column_span)
+  _WRAP_METHOD(void set_row_span(int span), gtk_grid_layout_child_set_row_span)
+  _WRAP_METHOD(int get_row_span() const, gtk_grid_layout_child_get_row_span)
+
+  _WRAP_PROPERTY("left-attach", int)
+  _WRAP_PROPERTY("top-attach", int)
+  _WRAP_PROPERTY("column-span", int)
+  _WRAP_PROPERTY("row-span", int)
+
+  // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/gtk_extra_objects.defs b/gtk/src/gtk_extra_objects.defs
index 0bea35a5..f25d9de6 100644
--- a/gtk/src/gtk_extra_objects.defs
+++ b/gtk/src/gtk_extra_objects.defs
@@ -142,6 +142,12 @@
   (gtype-id "GTK_TYPE_GESTURE_ZOOM")
 )
 
+(define-object GridLayout
+  (in-module "Gtk")
+  (c-name "GtkGridLayout")
+  (gtype-id "GTK_TYPE_GRID_LAYOUT")
+)
+
 (define-object IconInfo
   (in-module "Gtk")
   (c-name "GtkIconInfo")


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