[gtksourceviewmm] Quick and dirty SourceGutterRenderer wrapper.



commit bb9bc0ebf62766f468d75f6ce64fa00d0d9d3cdc
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Tue Nov 30 21:53:31 2010 +0100

    Quick and dirty SourceGutterRenderer wrapper.
    
    * gtksourceview/src/sourcegutterrenderer.ccg:
    * gtksourceview/src/sourcegutterrenderer.hg: New wrapper.
    * codegen/m4/convert_gtksourceview.m4: Added new conversions.
    * configure.ac: Bumped required GtkSourceView version to the one introducing
    GtkSourceGutterRenderer.
    * gtksourceview/gtksourceviewmm/.gitignore: Updated.
    * gtksourceview/src/filelist.am: Added new files to the build.

 codegen/m4/convert_gtksourceview.m4        |    2 +
 configure.ac                               |    2 +-
 gtksourceview/gtksourceviewmm/.gitignore   |    1 +
 gtksourceview/src/filelist.am              |    1 +
 gtksourceview/src/sourcegutterrenderer.ccg |   30 ++++++
 gtksourceview/src/sourcegutterrenderer.hg  |  140 ++++++++++++++++++++++++++++
 6 files changed, 175 insertions(+), 1 deletions(-)
---
diff --git a/codegen/m4/convert_gtksourceview.m4 b/codegen/m4/convert_gtksourceview.m4
index 4d2584b..9240e1c 100644
--- a/codegen/m4/convert_gtksourceview.m4
+++ b/codegen/m4/convert_gtksourceview.m4
@@ -108,3 +108,5 @@ _CONV_ENUM(Gtk,SourceSmartHomeEndType)
 _CONV_ENUM(Gtk,SourceDrawSpacesFlags)
 _CONV_ENUM(Gtk,SourceCompletionActivation)
 _CONV_ENUM(Gtk,SourceBracketMatchType)
+_CONV_ENUM(Gtk,SourceGutterRendererState)
+_CONV_ENUM(Gtk,SourceGutterRendererAlignmentMode)
diff --git a/configure.ac b/configure.ac
index f9deace..8fb5d91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AC_SUBST([GTKSOURCEVIEWMM_SO_VERSION], [0:0:0])
 LT_INIT([win32-dll disable-static])
 AC_PROG_CXX
 
-AC_SUBST([GTKSOURCEVIEWMM_MODULES], ['gtkmm-3.0 >= 2.91.2 gtksourceview-3.0 >= 2.91.1'])
+AC_SUBST([GTKSOURCEVIEWMM_MODULES], ['gtkmm-3.0 >= 2.91.2 gtksourceview-3.0 >= 2.91.2'])
 PKG_CHECK_MODULES([GTKSOURCEVIEWMM], [$GTKSOURCEVIEWMM_MODULES])
 
 MM_PKG_CONFIG_SUBST([GTHREAD_CFLAGS], [--cflags-only-other gthread-2.0])
diff --git a/gtksourceview/gtksourceviewmm/.gitignore b/gtksourceview/gtksourceviewmm/.gitignore
index 3f67f01..e399485 100644
--- a/gtksourceview/gtksourceviewmm/.gitignore
+++ b/gtksourceview/gtksourceviewmm/.gitignore
@@ -8,6 +8,7 @@
 /sourcecompletionprovider.*
 /sourcecompletionwords.*
 /sourcegutter.*
+/sourcegutterrenderer.*
 /sourcelanguage.*
 /sourcelanguagemanager.*
 /sourcemark.*
diff --git a/gtksourceview/src/filelist.am b/gtksourceview/src/filelist.am
index 879c2d1..c507359 100644
--- a/gtksourceview/src/filelist.am
+++ b/gtksourceview/src/filelist.am
@@ -19,6 +19,7 @@ files_hg =				\
 	sourcecompletionprovider.hg	\
 	sourcecompletionwords.hg        \
 	sourcegutter.hg			\
+	sourcegutterrenderer.hg		\
 	sourcelanguage.hg		\
 	sourcelanguagemanager.hg	\
 	sourcemark.hg			\
diff --git a/gtksourceview/src/sourcegutterrenderer.ccg b/gtksourceview/src/sourcegutterrenderer.ccg
new file mode 100644
index 0000000..b283e53
--- /dev/null
+++ b/gtksourceview/src/sourcegutterrenderer.ccg
@@ -0,0 +1,30 @@
+/* sourcegutterrenderer.cc
+ *
+ * Copyright (C) 2009, 2010 Krzesimir Nowak
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <gtksourceview/gtksourcegutterrenderer.h>
+
+namespace Gsv
+{
+
+bool SourceGutterRenderer::is_background_set() const
+{
+  return gtk_source_gutter_renderer_get_background(const_cast<GtkSourceGutterRenderer*>(gobj()), 0);
+}
+
+} // namespace Gsv
diff --git a/gtksourceview/src/sourcegutterrenderer.hg b/gtksourceview/src/sourcegutterrenderer.hg
new file mode 100644
index 0000000..ba02d3d
--- /dev/null
+++ b/gtksourceview/src/sourcegutterrenderer.hg
@@ -0,0 +1,140 @@
+/* sourcegutterrenderer.h
+ *
+ * Copyright (C) 2010 Krzesimir Nowak
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+/// \file
+/// \brief SourceGutterRenderer class
+
+#include <gtkmm/object.h>
+#include <gtksourceviewmm/sourceview.h>
+
+_DEFS(gtksourceviewmm,gtksourceview)
+_PINCLUDE(gtkmm/private/object_p.h)
+
+namespace Gsv
+{
+
+_WRAP_ENUM(SourceGutterRendererState, GtkSourceGutterRendererState)
+
+_WRAP_ENUM(SourceGutterRendererAlignmentMode, GtkSourceGutterRendererAlignmentMode)
+
+// TODO: write docs.
+class SourceGutterRenderer : public Gtk::Object
+{
+  _CLASS_GTKOBJECT(SourceGutterRenderer, GtkSourceGutterRenderer, GTK_SOURCE_GUTTER_RENDERER, Gtk::Object, GInitiallyUnowned)
+public:
+#m4 _CONVERSION(`const Cairo::RefPtr<Cairo::Context>&', `cairo_t*', `(($3) ? ($3)->cobj() : 0)')
+#m4 _CONVERSION(`const Gdk::Rectangle&',`const GdkRectangle*',($3).gobj())
+#m4 _CONVERSION(`Gtk::TextIter&',`GtkTextIter*',($3).gobj())
+  _WRAP_METHOD(void begin(
+                  const Cairo::RefPtr<Cairo::Context>& cr,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  Gtk::TextIter& start,
+                  Gtk::TextIter& end), gtk_source_gutter_renderer_begin)
+
+  _WRAP_METHOD(void draw(
+                  const Cairo::RefPtr<Cairo::Context>& cr,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  Gtk::TextIter& start,
+                  Gtk::TextIter& end,
+                  SourceGutterRendererState), gtk_source_gutter_renderer_draw)
+
+  _WRAP_METHOD(void end(), gtk_source_gutter_renderer_end)
+
+  _WRAP_METHOD(int get_size() const, gtk_source_gutter_renderer_get_size)
+
+  _WRAP_METHOD(void set_size(int size), gtk_source_gutter_renderer_set_size)
+
+  _WRAP_METHOD(bool get_visible() const, gtk_source_gutter_renderer_get_visible)
+
+  _WRAP_METHOD(void set_visible(bool visible), gtk_source_gutter_renderer_set_visible)
+
+// TODO: write padding class. krnowak
+
+  _WRAP_METHOD(void get_padding(int& xpad, int& ypad) const, gtk_source_gutter_renderer_get_padding)
+
+  _WRAP_METHOD(void set_padding(int xpad, int ypad), gtk_source_gutter_renderer_set_padding)
+
+// TODO: write alignment class. krnowak
+
+  _WRAP_METHOD(void get_alignment(float& xalign, float& yalign) const, gtk_source_gutter_renderer_get_alignment)
+
+  _WRAP_METHOD(void set_alignment(float xalign, float yalign), gtk_source_gutter_renderer_set_alignment)
+
+  _WRAP_METHOD(SourceGutterRendererAlignmentMode get_alignment_mode() const, gtk_source_gutter_renderer_get_alignment_mode)
+
+  _WRAP_METHOD(void set_alignment_mode(SourceGutterRendererAlignmentMode mode), gtk_source_gutter_renderer_set_alignment_mode)
+
+  _WRAP_METHOD(Gtk::TextWindowType get_window_type() const, gtk_source_gutter_renderer_get_window_type)
+
+#m4 _CONVERSION(GtkTextView*, Gtk::TextView*, Glib::wrap($3))
+  _WRAP_METHOD(Gtk::TextView* get_view(), gtk_source_gutter_renderer_get_view)
+
+  _WRAP_METHOD(const Gtk::TextView* get_view() const, gtk_source_gutter_renderer_get_view, constversion)
+
+// TODO: use std::pair? krnowak
+
+#m4 _CONVERSION(`Gdk::Color&',`GdkColor*',`($3).gobj()')
+  _WRAP_METHOD(bool get_background(Gdk::Color& color) const, gtk_source_gutter_renderer_get_background)
+
+  bool is_background_set() const;
+
+#m4 _CONVERSION(`const Gdk::Color&',`const GdkColor*',`($3).gobj()')
+  _WRAP_METHOD(void set_background(const Gdk::Color& color), gtk_source_gutter_renderer_set_background)
+
+  _IGNORE(gtk_source_gutter_renderer_activate, gtk_source_gutter_renderer_query_activatable, gtk_source_gutter_renderer_query_tooltip, gtk_source_gutter_renderer_query_data)
+
+  _WRAP_METHOD(void queue_draw(), gtk_source_gutter_renderer_queue_draw)
+
+protected:
+  _CTOR_DEFAULT()
+
+#m4begin
+dnl This extra conversion does the extra reference, often needed by code for vfuncs and signal.
+_CONVERSION(`cairo_t*',`const Cairo::RefPtr<Cairo::Context>&',`Cairo::RefPtr<Cairo::Context>(new Cairo::Context($3, false /* has_reference */))')
+#m4end
+
+#m4 _CONVERSION(`const GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
+#m4 _CONVERSION(`GdkRectangle*',`const Gdk::Rectangle&',`Glib::wrap($3)')
+#m4 _CONVERSION(`GtkTextIter*',`Gtk::TextIter&',`Glib::wrap($3)')
+
+  _WRAP_VFUNC(void begin(
+                  const Cairo::RefPtr<Cairo::Context>& cr,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  Gtk::TextIter& start,
+                  Gtk::TextIter& end), begin)
+
+  _WRAP_VFUNC(void draw(
+                  const Cairo::RefPtr<Cairo::Context>& cr,
+                  const Gdk::Rectangle& background_area,
+                  const Gdk::Rectangle& cell_area,
+                  Gtk::TextIter& start,
+                  Gtk::TextIter& end,
+                  SourceGutterRendererState), draw)
+
+  _WRAP_VFUNC(void end(), end)
+
+public:
+};
+
+} // namespace Gsv
+
+



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