[gtkmm] Add Gtk::PopoverMenuBar



commit 9b8fa29bad96f6e95985eeb7af888946daae58ff
Author: Kjell Ahlstedt <kjellahlstedt gmail com>
Date:   Sun Jan 12 16:23:48 2020 +0100

    Add Gtk::PopoverMenuBar
    
    Replaces the removed MenuBar.

 gtk/gtkmm.h                               |  1 +
 gtk/src/filelist.am                       |  1 +
 gtk/src/gtk_signals.defs                  | 11 ++++++
 gtk/src/popovermenubar.ccg                | 17 ++++++++++
 gtk/src/popovermenubar.hg                 | 56 +++++++++++++++++++++++++++++++
 tools/extra_defs_gen/generate_defs_gtk.cc |  1 +
 6 files changed, 87 insertions(+)
---
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 89437aee..5242910e 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -210,6 +210,7 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/picture.h>
 #include <gtkmm/popover.h>
 #include <gtkmm/popovermenu.h>
+#include <gtkmm/popovermenubar.h>
 #include <gtkmm/printcontext.h>
 #ifndef G_OS_WIN32
 # include <gtkmm/printer.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index c262cefc..afe7c7a9 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -144,6 +144,7 @@ gtkmm_files_any_hg =                \
        picture.hg      \
        popover.hg      \
        popovermenu.hg  \
+       popovermenubar.hg \
        printcontext.hg         \
        printoperation.hg       \
        printoperationpreview.hg\
diff --git a/gtk/src/gtk_signals.defs b/gtk/src/gtk_signals.defs
index 2f02281b..29b0899b 100644
--- a/gtk/src/gtk_signals.defs
+++ b/gtk/src/gtk_signals.defs
@@ -6919,6 +6919,17 @@
   (construct-only #f)
 )
 
+;; From GtkPopoverMenuBar
+
+(define-property menu-model
+  (of-object "GtkPopoverMenuBar")
+  (prop-type "GParamObject")
+  (docs "The model from which the bar is made.")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From GtkPrinter
 
 (define-signal details-acquired
diff --git a/gtk/src/popovermenubar.ccg b/gtk/src/popovermenubar.ccg
new file mode 100644
index 00000000..57b87fdc
--- /dev/null
+++ b/gtk/src/popovermenubar.ccg
@@ -0,0 +1,17 @@
+/* Copyright (C) 2020 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/popovermenubar.hg b/gtk/src/popovermenubar.hg
new file mode 100644
index 00000000..0611ca5f
--- /dev/null
+++ b/gtk/src/popovermenubar.hg
@@ -0,0 +1,56 @@
+/* Copyright (C) 2020 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 <giomm/menumodel.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/widget_p.h)
+
+namespace Gtk
+{
+/** A menu bar with popovers.
+ *
+ * %Gtk::PopoverMenuBar presents a horizontal bar of items that pop
+ * up popover menus when clicked.
+ *
+ * The only way to create instances of %PopoverMenuBar is from a Gio::MenuModel.
+ *
+ * @see Popover, PopoverMenu, Gio::MenuModel
+ *
+ * @newin{3,96}
+ *
+ * @ingroup Widgets
+ * @ingroup Containers
+ * @ingroup Menus
+ */
+class PopoverMenuBar : public Widget
+{
+  _CLASS_GTKOBJECT(PopoverMenuBar, GtkPopoverMenuBar, GTK_POPOVER_MENU_BAR, Gtk::Widget, GtkWidget)
+
+public:
+  _WRAP_CTOR(PopoverMenuBar(const Glib::RefPtr<Gio::MenuModel>& menu_model = {}), 
gtk_popover_menu_bar_new_from_model)
+
+  _WRAP_METHOD(void set_menu_model(const Glib::RefPtr<Gio::MenuModel>& model), 
gtk_popover_menu_bar_set_menu_model)
+  _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_menu_model(), gtk_popover_menu_bar_get_menu_model, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_menu_model() const, 
gtk_popover_menu_bar_get_menu_model, refreturn, constversion)
+
+  _WRAP_PROPERTY("menu-model", Glib::RefPtr<Gio::MenuModel>)
+
+  // PopoverMenuBar has no signals nor vfuncs.
+};
+
+} //namespace Gtk
diff --git a/tools/extra_defs_gen/generate_defs_gtk.cc b/tools/extra_defs_gen/generate_defs_gtk.cc
index 40c7f3b9..e2823281 100644
--- a/tools/extra_defs_gen/generate_defs_gtk.cc
+++ b/tools/extra_defs_gen/generate_defs_gtk.cc
@@ -158,6 +158,7 @@ int main(int /* argc */, char** /* argv */)
             << get_defs( GTK_TYPE_PICTURE )
             << get_defs( GTK_TYPE_POPOVER )
             << get_defs( GTK_TYPE_POPOVER_MENU )
+            << get_defs( GTK_TYPE_POPOVER_MENU_BAR )
 #if !defined(G_OS_WIN32)
             << get_defs( GTK_TYPE_PRINTER )
             << get_defs( GTK_TYPE_PRINT_JOB )


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