[gtksourceviewmm/devel: 4/26] Partially update SourceView.



commit 845fddf05df52bbc2a97a3932b7aebed83fb88e5
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Fri Dec 11 21:53:33 2009 +0100

    Partially update SourceView.
    
    * gtksourceview/src/sourceview.hg:
    * gtksourceview/src/sourceview.ccg: Wrapped new methods
    and signals, deprecated some old ones.

 gtksourceview/src/sourceview.ccg |   43 ++++++++++++++++++++++++++++++++++++++
 gtksourceview/src/sourceview.hg  |   34 ++++++++++++++++++++++++-----
 2 files changed, 71 insertions(+), 6 deletions(-)
---
diff --git a/gtksourceview/src/sourceview.ccg b/gtksourceview/src/sourceview.ccg
index c2220a0..914686b 100644
--- a/gtksourceview/src/sourceview.ccg
+++ b/gtksourceview/src/sourceview.ccg
@@ -22,6 +22,31 @@
 #include <gtksourceview/gtksourceview.h>
 #include <gtksourceview/gtksourceview-typebuiltins.h>
 
+static gchar* SignalProxy_MarkTooltip_gtk_callback(GtkSourceMark* mark, gpointer user_data)
+{
+  gtksourceview::SourceView::SlotMarkTooltip* the_slot = static_cast<gtksourceview::SourceView::SlotMarkTooltip*>(user_data);
+
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  try
+  {
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+    return g_strdup((*the_slot)(Glib::wrap(mark)).c_str());
+  #ifdef GLIBMM_EXCEPTIONS_ENABLED
+  }
+  catch(...)
+  {
+    Glib::exception_handlers_invoke();
+  }
+
+  return NULL; //An arbitary default, just to avoid the compiler warning.
+  #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+static void SignalProxy_MarkTooltip_gtk_callback_destroy(void* data)
+{
+  delete static_cast<gtksourceview::SourceView::SlotMarkTooltip*>(data);
+}
+
 namespace gtksourceview
 {
 
@@ -66,5 +91,23 @@ SourceView::set_source_buffer (const Glib::RefPtr<SourceBuffer> &source_buffer)
     set_buffer (source_buffer) ;
 }
 
+void SourceView::set_mark_category_tooltip_func(const SlotMarkTooltip& slot)
+{
+  SlotMarkTooltip* slot_copy = new SlotMarkTooltip(slot);
+
+  gtk_source_view_set_mark_category_tooltip_func(gobj(),
+      &SignalProxy_MarkTooltip_gtk_callback, slot_copy,
+      &SignalProxy_MarkTooltip_gtk_callback_destroy);
+}
+
+void SourceView::set_mark_category_tooltip_markup_func(const SlotMarkTooltip& slot)
+{
+  SlotMarkTooltip* slot_copy = new SlotMarkTooltip(slot);
+
+  gtk_source_view_set_mark_category_tooltip_markup_func(gobj(),
+      &SignalProxy_MarkTooltip_gtk_callback, slot_copy,
+      &SignalProxy_MarkTooltip_gtk_callback_destroy);
+}
+
 }//end namespace gtksourceview
 
diff --git a/gtksourceview/src/sourceview.hg b/gtksourceview/src/sourceview.hg
index 2838917..02254e9 100644
--- a/gtksourceview/src/sourceview.hg
+++ b/gtksourceview/src/sourceview.hg
@@ -1,4 +1,4 @@
-/* sourceview.hg
+/* sourceview.h
  * 
  * Copyright (C) 2004-2005 Jae Jang
  * Copyright (C) 2005-2006 Rob Page
@@ -32,6 +32,7 @@ namespace gtksourceview
 {
 
 _WRAP_ENUM(SourceSmartHomeEndType, GtkSourceSmartHomeEndType)
+// TODO: wrap it by hand, because last enum value is not wrapped.
 _WRAP_ENUM(SourceDrawSpacesFlags, GtkSourceDrawSpacesFlags)
 
 /// \brief Multi-line source editing widget.
@@ -211,32 +212,53 @@ public:
   ///
   /// \param category a mark category.
   /// \param pixbuf the pixbuf to associate the mark category to.
-  _WRAP_METHOD(void set_mark_category_pixbuf(const Glib::ustring& category, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_source_view_set_mark_category_pixbuf)
+  _WRAP_METHOD(void set_mark_category_pixbuf(const Glib::ustring& category, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_source_view_set_mark_category_pixbuf, deprecated)
   /// \brief Gets the pixbuf which is associated with the given mark category.
   ///
   /// \param category a mark category.
   /// \return the associated GdkPixbuf, or NULL if not found.
-  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category), gtk_source_view_get_mark_category_pixbuf, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category), gtk_source_view_get_mark_category_pixbuf, refreturn, deprecated)
 
   /// \brief Gets the pixbuf which is associated with the given mark category.
   ///
   /// \param category a mark category.
   /// \return the associated GdkPixbuf, or NULL if not found.
-  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category) const, gtk_source_view_get_mark_category_pixbuf, refreturn, constversion)
-  
+  _WRAP_METHOD(Glib::RefPtr<const Gdk::Pixbuf> get_mark_category_pixbuf(const Glib::ustring& category) const, gtk_source_view_get_mark_category_pixbuf, refreturn, constversion, deprecated)
+
+  _WRAP_METHOD(void set_mark_category_icon(const Glib::ustring& category, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf), gtk_source_view_set_mark_category_icon_from_pixbuf)
+  _WRAP_METHOD(void set_mark_category_icon(const Glib::ustring& category, const Gtk::StockID& stock_id), gtk_source_view_set_mark_category_icon_from_stock)
+  _WRAP_METHOD(void set_mark_category_icon(const Glib::ustring& category, const Glib::ustring& icon_name), gtk_source_view_set_mark_category_icon_from_icon_name)
+
+#m4 _CONVERSION(`const Gdk::Color&',`const GdkColor*',`($3).gobj()')
+  _WRAP_METHOD(void set_mark_category_background(const Glib::ustring& category, const Gdk::Color& color), gtk_source_view_set_mark_category_background)
+#m4 _CONVERSION(`Gdk::Color&',`GdkColor*',`($3).gobj()')
+  _WRAP_METHOD(bool set_mark_category_background(const Glib::ustring& category, Gdk::Color& dest) const, gtk_source_view_get_mark_category_background)
   /// \brief Set if and how the spaces should be visualized/
   ///
   /// \param flags specifing how white spaces should be displayed.
-  _WRAP_METHOD(void set_draw_spaces(SourceDrawSpacesFlags flags = static_cast<SourceDrawSpacesFlags>(SOURCE_DRAW_SPACES_ALL)), gtk_source_view_set_draw_spaces)
+  _WRAP_METHOD(void set_draw_spaces(SourceDrawSpacesFlags flags = SOURCE_DRAW_SPACES_ALL), gtk_source_view_set_draw_spaces)
   
   /// \brief Returns the SourceDrawSpacesFlags specifying if and how
   /// spaces should be displayed for this view 
   ///
   /// \return flags the SourceDrawSpacesFlags, 0 if no spaces should be drawn.
   _WRAP_METHOD(SourceDrawSpacesFlags get_draw_spaces() const, gtk_source_view_get_draw_spaces)
+  
+  /// For instance,
+  /// Glib::ustring on_mark_tooltip(const Glib::RefPtr<SourceMark>& mark);
+  typedef sigc::slot<Glib::ustring, const Glib::RefPtr<SourceMark>& /* mark */> SlotMarkTooltip;
+  
+  _IGNORE(gtk_source_view_set_mark_category_tooltip_func, gtk_source_view_set_mark_category_tooltip_markup_func)
+  void set_mark_category_tooltip_func(const SlotMarkTooltip& slot);
+  void set_mark_category_tooltip_markup_func(const SlotMarkTooltip& slot);
 
   _WRAP_SIGNAL(void redo(), "redo")
   _WRAP_SIGNAL(void undo(), "undo")
+  _WRAP_SIGNAL(void show_completion(), "show-completion", no_default_handler)
+#m4 _CONVERSION(`GtkTextIter*',`const Gtk::TextIter&',`Glib::wrap($3)')
+#m4 _CONVERSION(`gpointer',`GdkEvent*',`static_cast<GdkEvent*>($3)')
+  _WRAP_SIGNAL(void line_mark_activated(const Gtk::TextIter& mark, GdkEvent* event), "line-mark-activated", no_default_handler)
+  
 
   /// \brief Whether to display line numbers
   ///



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