[gtkmm] Gtk: Add BinLayout and BoxLayout
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm] Gtk: Add BinLayout and BoxLayout
- Date: Tue, 2 Apr 2019 07:21:20 +0000 (UTC)
commit e43ce888aaa57f05ed66b8734bbf02f6d5855dc9
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date: Tue Apr 2 09:18:57 2019 +0200
Gtk: Add BinLayout and BoxLayout
.gitignore | 4 +++
gtk/gtkmm.h | 2 ++
gtk/src/binlayout.ccg | 18 +++++++++++
gtk/src/binlayout.hg | 49 ++++++++++++++++++++++++++++
gtk/src/boxlayout.ccg | 18 +++++++++++
gtk/src/boxlayout.hg | 73 ++++++++++++++++++++++++++++++++++++++++++
gtk/src/filelist.am | 2 ++
gtk/src/gtk_extra_objects.defs | 6 ++++
8 files changed, 172 insertions(+)
---
diff --git a/.gitignore b/.gitignore
index b4d07944..851206e5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -161,10 +161,14 @@ gtk/gtkmm/assistantpage.cc
gtk/gtkmm/assistantpage.h
gtk/gtkmm/bin.cc
gtk/gtkmm/bin.h
+gtk/gtkmm/binlayout.cc
+gtk/gtkmm/binlayout.h
gtk/gtkmm/border.cc
gtk/gtkmm/border.h
gtk/gtkmm/box.cc
gtk/gtkmm/box.h
+gtk/gtkmm/boxlayout.cc
+gtk/gtkmm/boxlayout.h
gtk/gtkmm/buildable.cc
gtk/gtkmm/buildable.h
gtk/gtkmm/builder.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index e95703dc..2343d923 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -105,8 +105,10 @@ extern const int gtkmm_micro_version;
#include <gtkmm/aspectframe.h>
#include <gtkmm/assistant.h>
#include <gtkmm/bin.h>
+#include <gtkmm/binlayout.h>
#include <gtkmm/border.h>
#include <gtkmm/box.h>
+#include <gtkmm/boxlayout.h>
#include <gtkmm/builder.h>
#include <gtkmm/button.h>
#include <gtkmm/cellarea.h>
diff --git a/gtk/src/binlayout.ccg b/gtk/src/binlayout.ccg
new file mode 100644
index 00000000..54221cb5
--- /dev/null
+++ b/gtk/src/binlayout.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/binlayout.hg b/gtk/src/binlayout.hg
new file mode 100644
index 00000000..cdf9abf6
--- /dev/null
+++ b/gtk/src/binlayout.hg
@@ -0,0 +1,49 @@
+/* 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>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/layoutmanager_p.h)
+
+namespace Gtk
+{
+
+/** A layout manager for bin-like widgets.
+ *
+ * %Gtk::BinLayout is a Gtk::LayoutManager subclass useful for creating "bins" of
+ * widgets. %Gtk::BinLayout will stack each child of a widget on top of each
+ * other, using Gtk::Widget::property_hexpand(), Gtk::Widget::property_vexpand(),
+ * Gtk::Widget::property_halign(), and Gtk::Widget::property_valign() of each
+ * child to determine where they should be positioned.
+ *
+ * @newin{3,96}
+ */
+class BinLayout : public LayoutManager
+{
+ _CLASS_GOBJECT(BinLayout, GtkBinLayout, GTK_BIN_LAYOUT, LayoutManager, GtkLayoutManager)
+ _STRUCT_NOT_HIDDEN
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_CREATE()
+
+ // There are no signals, properties or vfuncs, and create() is the only method.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/boxlayout.ccg b/gtk/src/boxlayout.ccg
new file mode 100644
index 00000000..54221cb5
--- /dev/null
+++ b/gtk/src/boxlayout.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/boxlayout.hg b/gtk/src/boxlayout.hg
new file mode 100644
index 00000000..637d9a34
--- /dev/null
+++ b/gtk/src/boxlayout.hg
@@ -0,0 +1,73 @@
+/* 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/orientable.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/layoutmanager_p.h)
+
+namespace Gtk
+{
+
+/** %Layout manager for placing all children in a single row or column.
+ *
+ * A %Gtk::BoxLayout is a layout manager that arranges the children of any
+ * widget using it into a single row or column, depending on the value
+ * of its Gtk::Orientable::property_orientation(). Within the other dimension
+ * all children all allocated the same size. The %Gtk::BoxLayout will respect
+ * Gtk::Widget::property_halign() and Gtk::Widget::property_valign() of each
+ * child widget.
+ *
+ * If you want all children to be assigned the same size, you can use
+ * property_homogeneous().
+ *
+ * If you want to specify the amount of space placed between each child,
+ * you can use the property_spacing().
+ *
+ * @newin{3,96}
+ */
+class BoxLayout : public LayoutManager, public Orientable
+{
+ _CLASS_GOBJECT(BoxLayout, GtkBoxLayout, GTK_BOX_LAYOUT, LayoutManager, GtkLayoutManager)
+ _IMPLEMENTS_INTERFACE(Orientable)
+ _STRUCT_NOT_HIDDEN
+
+protected:
+ _WRAP_CTOR(BoxLayout(Orientation orientation = Orientation::HORIZONTAL), gtk_box_layout_new)
+
+public:
+ _WRAP_CREATE(Orientation orientation = Orientation::HORIZONTAL)
+
+ _WRAP_METHOD(void set_homogeneous(bool homogeneous = true), gtk_box_layout_set_homogeneous)
+ _WRAP_METHOD(bool get_homogeneous() const, gtk_box_layout_get_homogeneous)
+
+ _WRAP_METHOD(void set_spacing(guint spacing), gtk_box_layout_set_spacing)
+ _WRAP_METHOD(guint get_spacing() const, gtk_box_layout_get_spacing)
+
+ _WRAP_METHOD(void set_baseline_position(BaselinePosition position), gtk_box_layout_set_baseline_position)
+ _WRAP_METHOD(BaselinePosition get_baseline_position() const, gtk_box_layout_get_baseline_position)
+
+ // spacing is int in property_spacing(), but guint in set/get_spacing().
+ // That's how it's done in gtk.
+ _WRAP_PROPERTY("homogeneous", bool)
+ _WRAP_PROPERTY("spacing", int)
+ _WRAP_PROPERTY("baseline-position", BaselinePosition)
+
+ // There are no signals or vfuncs.
+};
+
+} // namespace Gtk
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index e86f8a9f..df457c34 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -27,8 +27,10 @@ gtkmm_files_any_hg = \
assistant.hg \
assistantpage.hg \
bin.hg \
+ binlayout.hg \
border.hg \
box.hg \
+ boxlayout.hg \
buildable.hg \
builder.hg \
button.hg \
diff --git a/gtk/src/gtk_extra_objects.defs b/gtk/src/gtk_extra_objects.defs
index 681fd53d..0bea35a5 100644
--- a/gtk/src/gtk_extra_objects.defs
+++ b/gtk/src/gtk_extra_objects.defs
@@ -24,6 +24,12 @@
(gtype-id "GTK_TYPE_APP_CHOOSER")
)
+(define-object BoxLayout
+ (in-module "Gtk")
+ (c-name "GtkBoxLayout")
+ (gtype-id "GTK_TYPE_BOX_LAYOUT")
+)
+
(define-object CenterBox
(in-module "Gtk")
(c-name "GtkCenterBox")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]