[gtksourceviewmm/devel: 5/26] Wrapped GtkSourceGutter.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtksourceviewmm/devel: 5/26] Wrapped GtkSourceGutter.
- Date: Wed, 6 Jan 2010 09:55:15 +0000 (UTC)
commit a355b0cd97c43c22c8d68a6bb2a750d3585a2224
Author: Krzesimir Nowak <qdlacz gmail com>
Date: Fri Dec 11 22:04:11 2009 +0100
Wrapped GtkSourceGutter.
* gtksourceview/src/sourcegutter.hg:
* gtksourceview/src/sourcegutter.ccg: New files with wrapped
GtkSourceGutter.
gtksourceview/src/sourcegutter.ccg | 96 ++++++++++++++++++++++++++++++++++++
gtksourceview/src/sourcegutter.hg | 73 +++++++++++++++++++++++++++
2 files changed, 169 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/src/sourcegutter.ccg b/gtksourceview/src/sourcegutter.ccg
new file mode 100644
index 0000000..7821076
--- /dev/null
+++ b/gtksourceview/src/sourcegutter.ccg
@@ -0,0 +1,96 @@
+/*
+ *
+ * Copyright (C) 2009 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.
+ */
+
+static void SignalProxy_CellData_gtk_callback(GtkSourceGutter *gutter,
+ GtkCellRenderer *cell,
+ gint line_number,
+ gboolean current_line,
+ gpointer data)
+{
+ gtksourceview::SourceGutter::SlotData* the_slot = static_cast<gtksourceview::SourceGutter::SlotData*>(user_data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ (*the_slot)(Glib::wrap(cell), line_number, current_line);
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+static void SignalProxy_CellData_gtk_callback_destroy(void* data)
+{
+ delete static_cast<gtksourceview::SourceGutter::SlotData*>(data);
+}
+
+static void SignalProxy_CellSize_gtk_callback(GtkSourceGutter *gutter,
+ GtkCellRenderer *cell,
+ gint line_number,
+ gboolean current_line,
+ gpointer data)
+{
+ gtksourceview::SourceGutter::SlotSize* the_slot = static_cast<gtksourceview::SourceGutter::SlotData*>(user_data);
+
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ try
+ {
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+ (*the_slot)(Glib::wrap(cell));
+ #ifdef GLIBMM_EXCEPTIONS_ENABLED
+ }
+ catch(...)
+ {
+ Glib::exception_handlers_invoke();
+ }
+ #endif //GLIBMM_EXCEPTIONS_ENABLED
+}
+
+static void SignalProxy_CellSize_gtk_callback_destroy(void* data)
+{
+ delete static_cast<gtksourceview::SourceGutter::SlotSize*>(data);
+}
+
+namespace gtksourceview
+{
+
+void SourceGutter::set_cell_data_func(Gtk::CellRenderer* renderer, const SlotData& slot)
+{
+ SlotData* slot_copy = new SlotData(slot);
+
+ gtk_source_gutter_set_cell_data_func(gobj(), renderer->gobj(),
+ &SignalProxy_CellData_gtk_callback, slot_copy,
+ &SignalProxy_CellData_gtk_callback_destroy);
+}
+
+void SourceGutter::set_cell_size_func(Gtk::CellRenderer& renderer, const SlotSize& slot)
+{
+ SlotSize* slot_copy = new SlotSize(slot);
+
+ gtk_source_gutter_set_cell_size_func(gobj(), renderer->gobj(),
+ &SignalProxy_CellSize_gtk_callback, slot_copy,
+ &SignalProxy_CellSize_gtk_callback_destroy);
+}
+
+}//end namespace gtksourceview
+
diff --git a/gtksourceview/src/sourcegutter.hg b/gtksourceview/src/sourcegutter.hg
new file mode 100644
index 0000000..943829a
--- /dev/null
+++ b/gtksourceview/src/sourcegutter.hg
@@ -0,0 +1,73 @@
+/* sourcegutter.h
+ *
+ * Copyright (C) 2009 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 SourceGutter class
+
+#include <gdkmm/window.h>
+#include <glibmm/object.h>
+#include <glibmm/refptr.h>
+#include <gtkmm/cellrenderer.h>
+
+_DEFS(gtksourceviewmm,gtksourceview)
+_PINCLUDE(glibmm/private/object_p.h)
+
+namespace gtksourceview
+{
+
+class SourceGutter : public Glib::Object
+{
+ _CLASS_GOBJECT(SourceGutter, GtkSourceGutter, GTK_SOURCE_GUTTER, Glib::Object, GObject)
+
+protected:
+ _CTOR_DEFAULT
+
+public:
+ _WRAP_CREATE()
+
+ _WRAP_METHOD(Glib::RefPtr<Gdk::Window> get_window(), gtk_source_gutter_get_window, refreturn)
+ _WRAP_METHOD(Glib::RefPtr<const Gdk::Window> get_window() const, gtk_source_gutter_get_window, constversion, refreturn)
+
+ _WRAP_METHOD(void insert(Gtk::CellRenderer* renderer, int position), gtk_source_gutter_insert)
+ _WRAP_METHOD(void reorder(Gtk::CellRenderer* renderer, int position), gtk_source_gutter_reorder)
+ _WRAP_METHOD(void remove(Gtk::CellRenderer* renderer), gtk_source_gutter_remove)
+
+ _WRAP_METHOD(void queue_draw(), gtk_source_gutter_queue_draw)
+
+ /// For instance,
+ /// void on_cell_data(Gtk::CellRenderer& cell, int line_number, bool current_line);
+ typedef sigc::slot<void, Gtk::CellRenderer* /* cell */, int /* line_number */, bool /* current_line */> SlotData;
+ /// For instance,
+ /// void on_cell_size(Gtk::CellRenderer& cell);
+ typedef sigc::slot<void, Gtk::CellRenderer* /* cell */> SlotSize;
+ _IGNORE(gtk_source_gutter_set_cell_data_func, gtk_source_gutter_set_cell_size_func)
+ void set_cell_data_func(Gtk::CellRenderer* renderer, const SlotData& slot);
+ void set_cell_size_func(Gtk::CellRenderer* renderer, const SlotSize& slot);
+
+ _WRAP_PROPERTY("view", SourceView*);
+ _WRAP_PROPERTY("window-type", Gtk::TextWindowType);
+
+ _WRAP_SIGNAL(void cell_activated(const Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, GdkEvent* event), "cell-activated")
+ _WRAP_SIGNAL(bool query_tooltip(const Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, const Glib::RefPtr<Tooltip>& tooltip), "query-tooltip")
+
+};
+
+} // namespace gtksourceview
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]