[gtkmm] Add Gtk::CenterBox



commit bf07169b9845fb5d3d38a84522a4c2f04267240d
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Mon Aug 14 10:02:21 2017 +0200

    Add Gtk::CenterBox
    
    * .gitignore: Add centerbox.cc and centerbox.h.
    * gtk/gtkmm.h: Add centerbox.h.
    * gtk/src/filelist.am: Add centerbox.hg.
    * gtk/src/gtk_extra_objects.defs: Add CenterBox.
    * gtk/src/centerbox.[ccg|hg]: New files.

 .gitignore                     |    2 +
 gtk/gtkmm.h                    |    1 +
 gtk/src/centerbox.ccg          |   35 ++++++++++++++++
 gtk/src/centerbox.hg           |   89 ++++++++++++++++++++++++++++++++++++++++
 gtk/src/filelist.am            |    1 +
 gtk/src/gtk_extra_objects.defs |    6 +++
 6 files changed, 134 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f28d7d7..d078aa1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -182,6 +182,8 @@ gtk/gtkmm/cellrenderertoggle.cc
 gtk/gtkmm/cellrenderertoggle.h
 gtk/gtkmm/cellview.cc
 gtk/gtkmm/cellview.h
+gtk/gtkmm/centerbox.cc
+gtk/gtkmm/centerbox.h
 gtk/gtkmm/checkbutton.cc
 gtk/gtkmm/checkbutton.h
 gtk/gtkmm/checkmenuitem.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index a2ad51d..a0d8e56 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -128,6 +128,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/cellrendererspinner.h>
 #include <gtkmm/cellrenderertext.h>
 #include <gtkmm/cellrenderertoggle.h>
+#include <gtkmm/centerbox.h>
 #include <gtkmm/colorbutton.h>
 #include <gtkmm/colorchooser.h>
 #include <gtkmm/colorchooserdialog.h>
diff --git a/gtk/src/centerbox.ccg b/gtk/src/centerbox.ccg
new file mode 100644
index 0000000..c23b864
--- /dev/null
+++ b/gtk/src/centerbox.ccg
@@ -0,0 +1,35 @@
+/* Copyright (C) 2017 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>
+
+namespace Gtk
+{
+void CenterBox::unset_start_widget()
+{
+  gtk_center_box_set_start_widget(gobj(), nullptr);
+}
+
+void CenterBox::unset_center_widget()
+{
+  gtk_center_box_set_center_widget(gobj(), nullptr);
+}
+
+void CenterBox::unset_end_widget()
+{
+  gtk_center_box_set_end_widget(gobj(), nullptr);
+}
+} //namespace Gtk
diff --git a/gtk/src/centerbox.hg b/gtk/src/centerbox.hg
new file mode 100644
index 0000000..5a1d4cd
--- /dev/null
+++ b/gtk/src/centerbox.hg
@@ -0,0 +1,89 @@
+/* Copyright (C) 2017 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/widget.h>
+#include <gtkmm/orientable.h>
+#include <gtkmm/enums.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+namespace Gtk
+{
+
+/** A centering container.
+ *
+ * The %CenterBox widget arranges three children in a horizontal
+ * or vertical arrangement, keeping the middle child centered as well
+ * as possible.
+ *
+ * To add children to a %CenterBox, use set_start_widget(),
+ * set_center_widget() and set_end_widget().
+ *
+ * The sizing and positioning of children can be influenced with the
+ * align and expand properties of the children.
+ *
+ * In horizontal orientation, the nodes of the children are always arranged
+ * from left to right regardless of text direction. In vertical orientation,
+ * the nodes of the children are arranged from top to bottom.
+ *
+ * @newin{3,92}
+ *
+ * @see Box
+ * @ingroup Widgets
+ * @ingroup Containers
+ */
+class CenterBox : public Widget, public Orientable
+{
+  _CLASS_GTKOBJECT(CenterBox, GtkCenterBox, GTK_CENTER_BOX, Widget, GtkWidget)
+  _IMPLEMENTS_INTERFACE(Orientable)
+
+public:
+  _CTOR_DEFAULT
+
+  _WRAP_METHOD(void set_start_widget(Widget& child), gtk_center_box_set_start_widget)
+  _WRAP_METHOD(Widget* get_start_widget(), gtk_center_box_get_start_widget)
+  _WRAP_METHOD(const Widget* get_start_widget() const, gtk_center_box_get_start_widget, constversion)
+  /** Removes the start widget.
+   * @newin{3,92}
+   */
+  void unset_start_widget();
+
+  _WRAP_METHOD(void set_center_widget(Widget& child), gtk_center_box_set_center_widget)
+  _WRAP_METHOD(Widget* get_center_widget(), gtk_center_box_get_center_widget)
+  _WRAP_METHOD(const Widget* get_center_widget() const, gtk_center_box_get_center_widget, constversion)
+  /** Removes the center widget.
+   * @newin{3,92}
+   */
+  void unset_center_widget();
+
+  _WRAP_METHOD(void set_end_widget(Widget& child), gtk_center_box_set_end_widget)
+  _WRAP_METHOD(Widget* get_end_widget(), gtk_center_box_get_end_widget)
+  _WRAP_METHOD(const Widget* get_end_widget() const, gtk_center_box_get_end_widget, constversion)
+  /** Removes the end widget.
+   * @newin{3,92}
+   */
+  void unset_end_widget();
+
+  _WRAP_METHOD(void set_baseline_position(BaselinePosition position), gtk_center_box_set_baseline_position)
+  _WRAP_METHOD(BaselinePosition get_baseline_position(), gtk_center_box_get_baseline_position)
+
+  _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 1841d66..4f9673a 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -48,6 +48,7 @@ gtkmm_files_any_hg =          \
        cellrenderertext.hg     \
        cellrenderertoggle.hg   \
        cellview.hg             \
+       centerbox.hg            \
        checkbutton.hg          \
        checkmenuitem.hg        \
        clipboard.hg            \
diff --git a/gtk/src/gtk_extra_objects.defs b/gtk/src/gtk_extra_objects.defs
index 0748ce5..ce211a3 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 CenterBox
+  (in-module "Gtk")
+  (c-name "GtkCenterBox")
+  (gtype-id "GTK_TYPE_CENTER_BOX")
+)
+
 (define-object Clipboard
   (in-module "Gtk")
   (c-name "GtkClipboard")


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