[gtkmm] Gtk::FileChooser, Menu, ScrolledWindow: Wrap new methods



commit 8ff9a38066ba8406286b8ea426c10a63697780c3
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Mon Aug 1 10:22:47 2016 +0200

    Gtk::FileChooser, Menu, ScrolledWindow: Wrap new methods
    
    * gtk/src/filechooser.[ccg|hg]: Add the 'choice' methods.
    * gtk/src/menu.hg: Add popped_up_*() methods and signal, and new properties.
    * gtk/src/scrolledwindow.hg: Add max_content_width/height() methods and
    properties.
    * gtk/src/targetlist.hg: _IGNORE(gtk_target_list_add_table). It has been
    wrapped in a hand-coded method for a long time.

 gtk/src/filechooser.ccg   |   10 +++++++++-
 gtk/src/filechooser.hg    |   22 +++++++++++++++++++++-
 gtk/src/menu.hg           |   16 ++++++++++++++--
 gtk/src/scrolledwindow.hg |    7 +++++++
 gtk/src/targetlist.hg     |    7 +------
 5 files changed, 52 insertions(+), 10 deletions(-)
---
diff --git a/gtk/src/filechooser.ccg b/gtk/src/filechooser.ccg
index 8bfbab9..45abc10 100644
--- a/gtk/src/filechooser.ccg
+++ b/gtk/src/filechooser.ccg
@@ -18,4 +18,12 @@
 #include <glibmm/vectorutils.h>
 
 #include <gtk/gtk.h>
-//#include <gtk/gtkfilesystem.h> //We include this semi-private header just to get GTK_FILE_SYSTEM_ERROR.
+
+namespace Gtk
+{
+void FileChooser::add_choice(const Glib::ustring& id, const Glib::ustring& label)
+{
+  gtk_file_chooser_add_choice(gobj(), id.c_str(), label.c_str(), nullptr, nullptr);
+}
+
+} // namespace Gtk
diff --git a/gtk/src/filechooser.hg b/gtk/src/filechooser.hg
index a62907f..2f96257 100644
--- a/gtk/src/filechooser.hg
+++ b/gtk/src/filechooser.hg
@@ -181,6 +181,27 @@ public:
   _WRAP_METHOD(bool remove_shortcut_folder_uri(const Glib::ustring& uri), 
gtk_file_chooser_remove_shortcut_folder_uri, errthrow)
   _WRAP_METHOD(std::vector<Glib::ustring> list_shortcut_folder_uris() const, 
gtk_file_chooser_list_shortcut_folder_uris)
 
+#m4 _CONVERSION(`const std::vector<Glib::ustring>&',`const 
char**',`Glib::ArrayHandler<Glib::ustring>::vector_to_array($3).data ()')
+  _WRAP_METHOD(void add_choice(const Glib::ustring& id, const Glib::ustring& label, const 
std::vector<Glib::ustring>& options, const std::vector<Glib::ustring>& option_labels), 
gtk_file_chooser_add_choice)
+
+  /** Adds a boolean 'choice' to the file chooser.
+   * This is typically implemented as a checkbutton. You can select
+   * a value using set_boolean_choice() before the dialog is shown,
+   * and you can obtain the user-selected value in the signal_response() signal handler
+   * using get_choice().
+   *
+   * Compare set_extra_widget().
+   *
+   * @newin{3,22}
+   *
+   * @param id Id for the added choice.
+   * @param label User-visible label for the added choice.
+   */
+  void add_choice(const Glib::ustring& id, const Glib::ustring& label);
+
+  _WRAP_METHOD(void remove_choice(const Glib::ustring& id), gtk_file_chooser_remove_choice)
+  _WRAP_METHOD(void set_choice(const Glib::ustring& id, const Glib::ustring& option), 
gtk_file_chooser_set_choice)
+  _WRAP_METHOD(Glib::ustring get_choice(const Glib::ustring& id) const, gtk_file_chooser_get_choice)
 
   _WRAP_SIGNAL(void current_folder_changed(), "current_folder_changed", no_default_handler)
   _WRAP_SIGNAL(void selection_changed(), "selection_changed", no_default_handler)
@@ -189,7 +210,6 @@ public:
   _WRAP_SIGNAL(FileChooserConfirmation confirm_overwrite(), "confirm-overwrite", no_default_handler)
 
   _WRAP_PROPERTY("action", FileChooserAction)
-  //TODO: _WRAP_PROPERTY("file-system-backend", FileSystem) //FileSystem is not really public API.
   _WRAP_PROPERTY("filter", Glib::RefPtr<FileFilter>)
   _WRAP_PROPERTY("local-only", bool)
   _WRAP_PROPERTY("preview-widget", Widget*)
diff --git a/gtk/src/menu.hg b/gtk/src/menu.hg
index 9c7093d..2ca286f 100644
--- a/gtk/src/menu.hg
+++ b/gtk/src/menu.hg
@@ -18,6 +18,7 @@
 _DEFS(gtkmm,gtk)
 _PINCLUDE(gtkmm/private/menushell_p.h)
 
+#include <gdkmm/window.h>
 #include <gtkmm/menushell.h>
 #include <gtkmm/menuitem.h>
 
@@ -96,6 +97,10 @@ public:
    */
   void popup(guint button, guint32 activate_time, const Glib::RefPtr<Gdk::Device>& device = 
Glib::RefPtr<Gdk::Device>());
 
+  _WRAP_METHOD(void popup_at_rect(const Glib::RefPtr<Gdk::Window>& rect_window, const Gdk::Rectangle& rect, 
Gdk::Gravity rect_anchor, Gdk::Gravity menu_anchor, const GdkEvent* trigger_event), gtk_menu_popup_at_rect)
+  _WRAP_METHOD(void popup_at_widget(Widget* widget, Gdk::Gravity widget_anchor, Gdk::Gravity menu_anchor, 
const GdkEvent* trigger_event), gtk_menu_popup_at_widget)
+  _WRAP_METHOD(void popup_at_pointer(const GdkEvent* trigger_event), gtk_menu_popup_at_pointer)
+
   _WRAP_METHOD(void reposition(), gtk_menu_reposition)
 
   _WRAP_METHOD(void popdown(), gtk_menu_popdown)
@@ -132,6 +137,7 @@ _DEPRECATE_IFDEF_END
 
   _WRAP_METHOD(void set_monitor(int monitor_num), gtk_menu_set_monitor)
   _WRAP_METHOD(int get_monitor() const, gtk_menu_get_monitor)
+  //TODO: Wrap or ignore gtk_menu_place_on_monitor(). It's not documented. Does it mean it's private?
 
   void reorder_child(const MenuItem& child, int position);
   _IGNORE(gtk_menu_reorder_child)
@@ -149,8 +155,10 @@ _DEPRECATE_IFDEF_END
    */
   void attach_to_widget(Widget& attach_widget);
 
-  _IGNORE_SIGNAL("move_scroll")
-
+  _IGNORE_SIGNAL("move_scroll")dnl// action signal
+  // no_default_handler because the wrapped C signal has no default handler.
+#m4 _CONVERSION(`gpointer',`const Gdk::Rectangle*',`&Glib::wrap((GdkRectangle*)$3)')
+  _WRAP_SIGNAL(void popped_up(const Gdk::Rectangle* flipped_rect, const Gdk::Rectangle* final_rect, bool 
flipped_x, bool flipped_y), "popped-up", no_default_handler)
 
   _WRAP_PROPERTY("active", int)
   _WRAP_PROPERTY("accel-group", Glib::RefPtr<AccelGroup>)
@@ -160,6 +168,10 @@ _DEPRECATE_IFDEF_END
   _WRAP_PROPERTY("tearoff-state", bool, deprecated "No replacement available.")
   _WRAP_PROPERTY("monitor", int)
   _WRAP_PROPERTY("reserve-toggle-size", bool)
+  _WRAP_PROPERTY("anchor-hints", Gdk::AnchorHints)
+  _WRAP_PROPERTY("rect-anchor-dx", int)
+  _WRAP_PROPERTY("rect-anchor-dy", int)
+  _WRAP_PROPERTY("menu-type-hint", Gdk::WindowTypeHint)
 
 protected:
 
diff --git a/gtk/src/scrolledwindow.hg b/gtk/src/scrolledwindow.hg
index 31be853..ee1aa87 100644
--- a/gtk/src/scrolledwindow.hg
+++ b/gtk/src/scrolledwindow.hg
@@ -117,6 +117,11 @@ _DEPRECATE_IFDEF_END
   _WRAP_METHOD(void set_overlay_scrolling(bool overlay_scrolling = true), 
gtk_scrolled_window_set_overlay_scrolling)
   _WRAP_METHOD(bool get_overlay_scrolling() const, gtk_scrolled_window_get_overlay_scrolling)
 
+  _WRAP_METHOD(void set_max_content_width(int width), gtk_scrolled_window_set_max_content_width)
+  _WRAP_METHOD(int get_max_content_width() const, gtk_scrolled_window_get_max_content_width)
+  _WRAP_METHOD(void set_max_content_height(int height), gtk_scrolled_window_set_max_content_height)
+  _WRAP_METHOD(int get_max_content_height() const, gtk_scrolled_window_get_max_content_height)
+
   //Keybinding signals:
   _IGNORE_SIGNAL("scroll_child")
   _IGNORE_SIGNAL("move_focus_out")
@@ -136,6 +141,8 @@ _DEPRECATE_IFDEF_END
   _WRAP_PROPERTY("min-content-height", int)
   _WRAP_PROPERTY("kinetic-scrolling", bool)
   _WRAP_PROPERTY("overlay-scrolling", bool)
+  _WRAP_PROPERTY("max-content-width", int)
+  _WRAP_PROPERTY("max-content-height", int)
 };
 
 } //namespace Gtk
diff --git a/gtk/src/targetlist.hg b/gtk/src/targetlist.hg
index 3002a09..8865815 100644
--- a/gtk/src/targetlist.hg
+++ b/gtk/src/targetlist.hg
@@ -43,6 +43,7 @@ public:
 #m4 _CONVERSION(`TargetFlags', `guint', `($2)($3)')
   _WRAP_METHOD(void add(const Glib::ustring& target, TargetFlags flags = TargetFlags(0), guint info = 0), 
gtk_target_list_add)
   void add(const std::vector<TargetEntry>& targets);
+  _IGNORE(gtk_target_list_add_table)
 
   _WRAP_METHOD(void add_text_targets(guint info), gtk_target_list_add_text_targets)
   _WRAP_METHOD(void add_rich_text_targets(guint info, bool deserializable, const Glib::RefPtr<TextBuffer>& 
buffer), gtk_target_list_add_rich_text_targets)
@@ -50,12 +51,6 @@ public:
   _WRAP_METHOD(void add_image_targets(guint info, bool writable), gtk_target_list_add_image_targets)
   _WRAP_METHOD(void add_uri_targets(guint info), gtk_target_list_add_uri_targets)
 
-/* TODO:
-void           gtk_target_list_add_table (GtkTargetList        *list,
-                                          const GtkTargetEntry *targets,
-                                          guint                 ntargets);
-*/
-
   _WRAP_METHOD(void remove(const Glib::ustring& target), gtk_target_list_remove)
   _WRAP_METHOD(bool find(const Glib::ustring& target, guint* info) const, gtk_target_list_find)
 };


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