[gtkmm] Add Gtk::Shortcuts* widgets



commit 0cd7f919bfb3cc06350d81e0ebc3d466d2bd42df
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Mar 3 14:11:32 2016 +0100

    Add Gtk::Shortcuts* widgets
    
    * .gitignore: Add new generated .h and .cc files.
    * gtk/gtkmm.h: Add new .h files.
    * gtk/src/filelist.am: Add new .hg files.
    * tools/m4/convert_gtk.m4: Add conversions for the ShortcutType enum and
    the ShortcutsWindow widget.
    * gtk/src/shortcuts*.[hg|ccg]: New files.

 .gitignore                    |    8 +++++
 gtk/gtkmm.h                   |    4 ++
 gtk/src/filelist.am           |    4 ++
 gtk/src/shortcutsgroup.ccg    |   26 ++++++++++++++++
 gtk/src/shortcutsgroup.hg     |   58 ++++++++++++++++++++++++++++++++++++
 gtk/src/shortcutssection.ccg  |   21 +++++++++++++
 gtk/src/shortcutssection.hg   |   56 +++++++++++++++++++++++++++++++++++
 gtk/src/shortcutsshortcut.ccg |   21 +++++++++++++
 gtk/src/shortcutsshortcut.hg  |   56 +++++++++++++++++++++++++++++++++++
 gtk/src/shortcutswindow.ccg   |   26 ++++++++++++++++
 gtk/src/shortcutswindow.hg    |   65 +++++++++++++++++++++++++++++++++++++++++
 tools/m4/convert_gtk.m4       |    5 +++
 12 files changed, 350 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 5d2a5d4..d6a068d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -446,6 +446,14 @@ gtk/gtkmm/separatortoolitem.cc
 gtk/gtkmm/separatortoolitem.h
 gtk/gtkmm/settings.cc
 gtk/gtkmm/settings.h
+gtk/gtkmm/shortcutsgroup.cc
+gtk/gtkmm/shortcutsgroup.h
+gtk/gtkmm/shortcutssection.cc
+gtk/gtkmm/shortcutssection.h
+gtk/gtkmm/shortcutsshortcut.cc
+gtk/gtkmm/shortcutsshortcut.h
+gtk/gtkmm/shortcutswindow.cc
+gtk/gtkmm/shortcutswindow.h
 gtk/gtkmm/sizegroup.cc
 gtk/gtkmm/sizegroup.h
 gtk/gtkmm/socket.cc
diff --git a/gtk/gtkmm.h b/gtk/gtkmm.h
index 7e64304..28fe76c 100644
--- a/gtk/gtkmm.h
+++ b/gtk/gtkmm.h
@@ -260,6 +260,10 @@ extern const int gtkmm_micro_version;
 #include <gtkmm/separatormenuitem.h>
 #include <gtkmm/separatortoolitem.h>
 #include <gtkmm/settings.h>
+#include <gtkmm/shortcutsgroup.h>
+#include <gtkmm/shortcutssection.h>
+#include <gtkmm/shortcutsshortcut.h>
+#include <gtkmm/shortcutswindow.h>
 #include <gtkmm/sizegroup.h>
 #include <gtkmm/spinbutton.h>
 #include <gtkmm/spinner.h>
diff --git a/gtk/src/filelist.am b/gtk/src/filelist.am
index 11e131a..901d833 100644
--- a/gtk/src/filelist.am
+++ b/gtk/src/filelist.am
@@ -164,6 +164,10 @@ gtkmm_files_any_hg =               \
        separatormenuitem.hg    \
        separatortoolitem.hg    \
        settings.hg             \
+       shortcutsgroup.hg               \
+       shortcutssection.hg             \
+       shortcutsshortcut.hg            \
+       shortcutswindow.hg              \
        sizegroup.hg            \
        spinbutton.hg           \
        spinner.hg              \
diff --git a/gtk/src/shortcutsgroup.ccg b/gtk/src/shortcutsgroup.ccg
new file mode 100644
index 0000000..fb45782
--- /dev/null
+++ b/gtk/src/shortcutsgroup.ccg
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 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 ShortcutsGroup::unset_view()
+{
+  // Set gtk+'s char* to nullptr.
+  property_view().reset_value();
+}
+} //namespace Gtk
diff --git a/gtk/src/shortcutsgroup.hg b/gtk/src/shortcutsgroup.hg
new file mode 100644
index 0000000..2f3360d
--- /dev/null
+++ b/gtk/src/shortcutsgroup.hg
@@ -0,0 +1,58 @@
+/* Copyright (C) 2016 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/box.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+namespace Gtk
+{
+
+/** Represents a group of shortcuts in a ShortcutsWindow.
+ *
+ * A ShortcutsGroup represents a group of related keyboard shortcuts
+ * or gestures. The group has a title. It may optionally be associated with
+ * a view of the application, which can be used to show only relevant shortcuts
+ * depending on the application context.
+ *
+ * This widget is only meant to be used with ShortcutsWindow.
+ *
+ * @newin{3,20}
+ *
+ * @ingroup Widgets
+ */
+class ShortcutsGroup : public Box
+{
+  _CLASS_GTKOBJECT(ShortcutsGroup, GtkShortcutsGroup, GTK_SHORTCUTS_GROUP, Box, GtkBox)
+
+public:
+  _CTOR_DEFAULT
+
+  /** Unsets the property_view() of this shortcuts group.
+   * The group will then always be visible, regardless of the value of
+   * Gtk::ShortcutsWindow::property_view_name().
+   *
+   * This is a convenience method that calls property_view().reset_value().
+   */
+  void unset_view();
+
+  _WRAP_PROPERTY("title", Glib::ustring)
+  _WRAP_PROPERTY("view", Glib::ustring)
+  _IGNORE_PROPERTY("accel-size-group", "title-size-group", "height")dnl// Internal properties
+};
+
+} // namespace Gtk
diff --git a/gtk/src/shortcutssection.ccg b/gtk/src/shortcutssection.ccg
new file mode 100644
index 0000000..70a465b
--- /dev/null
+++ b/gtk/src/shortcutssection.ccg
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 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
+{
+} //namespace Gtk
diff --git a/gtk/src/shortcutssection.hg b/gtk/src/shortcutssection.hg
new file mode 100644
index 0000000..51b8d2d
--- /dev/null
+++ b/gtk/src/shortcutssection.hg
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016 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/box.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+namespace Gtk
+{
+
+/** Represents an application mode in a ShortcutsWindow.
+ *
+ * A ShortcutsSection collects all the keyboard shortcuts and gestures
+ * for a major application mode. If your application needs multiple sections,
+ * you should give each section a unique section_name and
+ * a title that can be shown in the section selector of the ShortcutsWindow.
+ *
+ * The max_height property can be used to influence how
+ * the groups in the section are distributed over pages and columns.
+ *
+ * This widget is only meant to be used with ShortcutsWindow.
+ *
+ * @newin{3,20}
+ *
+ * @ingroup Widgets
+ */
+class ShortcutsSection : public Box
+{
+  _CLASS_GTKOBJECT(ShortcutsSection, GtkShortcutsSection, GTK_SHORTCUTS_SECTION, Box, GtkBox)
+
+public:
+  _CTOR_DEFAULT
+
+  _IGNORE_SIGNAL("change-current-page")dnl// Internal signal
+
+  _WRAP_PROPERTY("section-name", Glib::ustring)
+  _WRAP_PROPERTY("title", Glib::ustring)
+  _WRAP_PROPERTY("max-height", unsigned int)
+  _IGNORE_PROPERTY("view-name")dnl// Use ShortcutsWindow::property_view_name()
+};
+
+} // namespace Gtk
diff --git a/gtk/src/shortcutsshortcut.ccg b/gtk/src/shortcutsshortcut.ccg
new file mode 100644
index 0000000..70a465b
--- /dev/null
+++ b/gtk/src/shortcutsshortcut.ccg
@@ -0,0 +1,21 @@
+/* Copyright (C) 2016 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
+{
+} //namespace Gtk
diff --git a/gtk/src/shortcutsshortcut.hg b/gtk/src/shortcutsshortcut.hg
new file mode 100644
index 0000000..e6d8904
--- /dev/null
+++ b/gtk/src/shortcutsshortcut.hg
@@ -0,0 +1,56 @@
+/* Copyright (C) 2016 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/box.h>
+#include <gtkmm/enums.h>
+#include <giomm/icon.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/box_p.h)
+
+namespace Gtk
+{
+_WRAP_ENUM(ShortcutType, GtkShortcutType)
+
+/** Represents a keyboard shortcut in a ShortcutsWindow.
+ *
+ * A ShortcutsShortcut represents a single keyboard shortcut or gesture
+ * with a short text. This widget is only meant to be used with ShortcutsWindow.
+ *
+ * @newin{3,20}
+ *
+ * @ingroup Widgets
+ */
+class ShortcutsShortcut : public Box
+{
+  _CLASS_GTKOBJECT(ShortcutsShortcut, GtkShortcutsShortcut, GTK_SHORTCUTS_SHORTCUT, Box, GtkBox)
+
+public:
+  _CTOR_DEFAULT
+
+  _WRAP_PROPERTY("accelerator", Glib::ustring)
+  _WRAP_PROPERTY("icon", Glib::RefPtr<Gio::Icon>)
+  _WRAP_PROPERTY("icon-set", bool)
+  _WRAP_PROPERTY("title", Glib::ustring)
+  _WRAP_PROPERTY("subtitle", Glib::ustring)
+  _WRAP_PROPERTY("subtitle-set", bool)
+  _WRAP_PROPERTY("direction", TextDirection)
+  _WRAP_PROPERTY("shortcut-type", ShortcutType)
+
+  _IGNORE_PROPERTY("accel-size-group", "title-size-group")dnl// Internal properties
+};
+
+} // namespace Gtk
diff --git a/gtk/src/shortcutswindow.ccg b/gtk/src/shortcutswindow.ccg
new file mode 100644
index 0000000..97d468a
--- /dev/null
+++ b/gtk/src/shortcutswindow.ccg
@@ -0,0 +1,26 @@
+/* Copyright (C) 2016 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 ShortcutsWindow::unset_view_name()
+{
+  // Set gtk+'s char* to nullptr.
+  property_view_name().reset_value();
+}
+} //namespace Gtk
diff --git a/gtk/src/shortcutswindow.hg b/gtk/src/shortcutswindow.hg
new file mode 100644
index 0000000..b2d9665
--- /dev/null
+++ b/gtk/src/shortcutswindow.hg
@@ -0,0 +1,65 @@
+/* Copyright (C) 2016 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/window.h>
+
+_DEFS(gtkmm,gtk)
+_PINCLUDE(gtkmm/private/window_p.h)
+
+namespace Gtk
+{
+
+/** Toplevel which shows help for shortcuts.
+ *
+ * A ShortcutsWindow shows brief information about the keyboard shortcuts
+ * and gestures of an application. The shortcuts can be grouped, and you can
+ * have multiple sections in this window, corresponding to the major modes of
+ * your application.
+ *
+ * Additionally, the shortcuts can be filtered by the current view, to avoid
+ * showing information that is not relevant in the current application context.
+ *
+ * The recommended way to construct a ShortcutsWindow is with Builder,
+ * by populating a ShortcutsWindow with one or more ShortcutsSection
+ * objects, which contain ShortcutsGroup objects that in turn contain objects
+ * of class ShortcutsShortcut.
+ *
+ * @newin{3,20}
+ *
+ * @ingroup Widgets
+ */
+class ShortcutsWindow : public Window
+{
+  _CLASS_GTKOBJECT(ShortcutsWindow, GtkShortcutsWindow, GTK_SHORTCUTS_WINDOW, Window, GtkWindow)
+  _UNMANAGEABLE
+
+public:
+  _CTOR_DEFAULT
+
+  /** Unsets the property_view_name().
+   * All groups will then be shown.
+   *
+   * This is a convenience method that calls property_view_name().reset_value().
+   */
+  void unset_view_name();
+
+  _IGNORE_SIGNAL(close, search)dnl// keybinding signals
+
+  _WRAP_PROPERTY("section-name", Glib::ustring)
+  _WRAP_PROPERTY("view-name", Glib::ustring)
+};
+
+} // namespace Gtk
diff --git a/tools/m4/convert_gtk.m4 b/tools/m4/convert_gtk.m4
index c2bcb64..1b95676 100644
--- a/tools/m4/convert_gtk.m4
+++ b/tools/m4/convert_gtk.m4
@@ -109,6 +109,7 @@ _CONV_ENUM(Gtk,RevealerTransitionType)
 _CONV_ENUM(Gtk,ScrollType)
 _CONV_ENUM(Gtk,SelectionMode)
 _CONV_ENUM(Gtk,ShadowType)
+_CONV_ENUM(Gtk,ShortcutType)
 _CONV_ENUM(Gtk,SizeGroupMode)
 _CONV_ENUM(Gtk,SortType)
 _CONV_ENUM(Gtk,SpinButtonUpdatePolicy)
@@ -583,6 +584,10 @@ _CONVERSION(`const Border&',`const GtkBorder*',__FR2P)
 _CONVERSION(`Border&',`GtkBorder*',__FR2P)
 _CONVERSION(`const GtkBorder*',`Border',`Glib::wrap(const_cast<GtkBorder*>($3))')
 
+_CONVERSION(`GtkShortcutsWindow*',`ShortcutsWindow*',__RP2P)
+_CONVERSION(`GtkShortcutsWindow*',`const ShortcutsWindow*',__RP2P)
+_CONVERSION(`ShortcutsWindow&',`GtkShortcutsWindow*',__FR2P)
+
 #FlowBoxChild
 _CONVERSION(`GtkFlowBoxChild*',`FlowBoxChild*',__RP2P)
 _CONVERSION(`GtkFlowBoxChild*',`const FlowBoxChild*',__RP2P)


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