[libchamplainmm] Wrap ChamplainViewport



commit 1c2effe4365023f520a729355db52ee258a28d07
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sun Aug 3 17:32:43 2014 +0200

    Wrap ChamplainViewport
    
        * champlain/champlainmm.h: Add viewport.h.
        * champlain/champlainmm/.gitignore: Ignore viewport.*.
        * champlain/src/champlain_signals.defs: Add "relocated" signal;
        add "x-origin", "y-origin", "hadjustment", and "vadjustment"
        properties.
        * champlain/src/filelist.am: Add viewport.hg.
        * champlain/src/viewport.[hg|ccg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_VIEWPORT, and include specific header.
        * tools/m4/convert_libchamplain.m4: Add conversion from 'const
        Glib::RefPtr<Adjustment>&' to 'ChamplainAdjustment*'.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |   44 +++++++++++++
 champlain/src/filelist.am                          |    3 +-
 champlain/src/viewport.ccg                         |   36 ++++++++++
 champlain/src/viewport.hg                          |   69 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    2 +
 tools/m4/convert_libchamplain.m4                   |    3 +
 8 files changed, 158 insertions(+), 1 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index e139d93..fdd522f 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -53,5 +53,6 @@
 #include <champlainmm/tile-cache.h>
 #include <champlainmm/tile-source.h>
 #include <champlainmm/view.h>
+#include <champlainmm/viewport.h>
 
 #endif /* !CHAMPLAINMM_H_INCLUDED */
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index 5d7768b..08dac94 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -28,5 +28,6 @@ tile.*
 tile-cache.*
 tile-source.*
 view.*
+viewport.*
 wrap_init.cc
 private
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index 420bb50..2f93091 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -931,3 +931,47 @@
   (construct-only #f)
 )
 
+;; From ChamplainViewport
+
+(define-signal relocated
+  (of-object "ChamplainViewport")
+  (return-type "void")
+  (when "last")
+)
+
+(define-property x-origin
+  (of-object "ChamplainViewport")
+  (prop-type "GParamInt")
+  (docs "Origin's X coordinate in pixels")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property y-origin
+  (of-object "ChamplainViewport")
+  (prop-type "GParamInt")
+  (docs "Origin's Y coordinate in pixels")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property hadjustment
+  (of-object "ChamplainViewport")
+  (prop-type "GParamObject")
+  (docs "Horizontal adjustment")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property vadjustment
+  (of-object "ChamplainViewport")
+  (prop-type "GParamObject")
+  (docs "Vertical adjustment")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index fdc6cd2..8f8d956 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -39,6 +39,7 @@ files_hg  =                                   \
        tile.hg                                 \
        tile-cache.hg                                   \
        tile-source.hg                                  \
-       view.hg
+       view.hg                                 \
+       viewport.hg
 
 files_ccg = $(files_hg:.hg=.ccg)
diff --git a/champlain/src/viewport.ccg b/champlain/src/viewport.ccg
new file mode 100644
index 0000000..e84315a
--- /dev/null
+++ b/champlain/src/viewport.ccg
@@ -0,0 +1,36 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlain/champlain.h>
+#include <champlain/champlain-viewport.h>
+
+namespace Champlain
+{
+
+void Viewport::get_adjustments(Glib::RefPtr<Adjustment>& hadjustment, Glib::RefPtr<Adjustment>& vadjustment) 
const
+{
+  ChamplainAdjustment* hadjustment_c = NULL;
+  ChamplainAdjustment* vadjustment_c = NULL;
+
+  champlain_viewport_get_adjustments(const_cast<ChamplainViewport*>(gobj()), &hadjustment_c, &vadjustment_c);
+
+  hadjustment = Glib::wrap(hadjustment_c);
+  vadjustment = Glib::wrap(vadjustment_c);
+}
+
+} // namespace Champlain
diff --git a/champlain/src/viewport.hg b/champlain/src/viewport.hg
new file mode 100644
index 0000000..aadd065
--- /dev/null
+++ b/champlain/src/viewport.hg
@@ -0,0 +1,69 @@
+/* Copyright (c) 2014  Juan R. García Blanco <juanrgar gmail com>
+ *
+ * This file is part of libchamplainmm.
+ *
+ * libchamplainmm 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.
+ *
+ * libchamplainmm 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 program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <champlainmm/adjustment.h>
+#include <cluttermm/actor.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(cluttermm/private/actor_p.h)
+
+namespace Champlain
+{
+
+/** A renderer that renders tiles from binary image data.
+ *
+ * ImageRenderer renders tiles from binary image data. The rendering
+ * is performed using Gdk::PixbufLoader so the set of supported image
+ * formats is equal to the set of formats supported by Gdk::PixbufLoader.
+ *
+ * @newin{0,8}
+ */
+class Viewport : public Clutter::Actor
+{
+  _CLASS_GOBJECT(Viewport, ChamplainViewport, CHAMPLAIN_VIEWPORT, Clutter::Actor, ClutterActor)
+
+protected:
+  _CTOR_DEFAULT
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(void set_origin(double x, double y), champlain_viewport_set_origin)
+  _WRAP_METHOD(void get_origin(double& x, double& y) const, champlain_viewport_get_origin)
+
+  _WRAP_METHOD(void stop(), champlain_viewport_stop)
+
+  _WRAP_METHOD_DOCS_ONLY(champlain_viewport_get_adjustments)
+  void get_adjustments(Glib::RefPtr<Adjustment>& hadjustment, Glib::RefPtr<Adjustment>& vadjustment) const;
+  _WRAP_METHOD(void set_adjustments(const Glib::RefPtr<Adjustment>& hadjustment, const 
Glib::RefPtr<Adjustment>& vadjustment), champlain_viewport_set_adjustments)
+
+  _WRAP_METHOD(void set_child(const Glib::RefPtr<Clutter::Actor>& child), champlain_viewport_set_child)
+
+  _WRAP_METHOD(void get_anchor(int& x, int& y) const, champlain_viewport_get_anchor)
+
+  _WRAP_METHOD(void set_actor_position(const Glib::RefPtr<Clutter::Actor>& actor, double x, double y), 
champlain_viewport_set_actor_position)
+
+  _WRAP_PROPERTY("x-origin", int)
+  _WRAP_PROPERTY("y-origin", int)
+  _WRAP_PROPERTY("hadjustment", Glib::RefPtr<Adjustment>)
+  _WRAP_PROPERTY("vadjustment", Glib::RefPtr<Adjustment>)
+
+  _WRAP_SIGNAL(void relocated(), "relocated", no_default_handler)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index 2e6581a..46dadb7 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -21,6 +21,7 @@
 #include <glibmm_generate_extra_defs/generate_extra_defs.h>
 #include <champlain/champlain.h>
 #include <champlain/champlain-adjustment.h>
+#include <champlain/champlain-viewport.h>
 
 int
 main(int argc, char *argv[])
@@ -55,6 +56,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_TILE_CACHE)
             << get_defs(CHAMPLAIN_TYPE_TILE_SOURCE)
             << get_defs(CHAMPLAIN_TYPE_VIEW)
+            << get_defs(CHAMPLAIN_TYPE_VIEWPORT)
             ;
 
   return 0;
diff --git a/tools/m4/convert_libchamplain.m4 b/tools/m4/convert_libchamplain.m4
index c00013f..bfdc70c 100644
--- a/tools/m4/convert_libchamplain.m4
+++ b/tools/m4/convert_libchamplain.m4
@@ -13,6 +13,9 @@ _CONV_ENUM(Pango,EllipsizeMode)
 _CONVERSION(`const GTimeVal*',`Glib::TimeVal',`$2(*$3)')
 _CONVERSION(`const Glib::TimeVal&', `const GTimeVal*', static_cast<$2>(&$3))
 
+# Adjustment
+_CONVERSION(`const Glib::RefPtr<Adjustment>&',`ChamplainAdjustment*',__CONVERT_REFPTR_TO_P)
+
 # BaseMarker
 _CONVERSION(`ChamplainBaseMarker*',`Glib::RefPtr<BaseMarker>',`Glib::wrap($3)')
 _CONVERSION(`const Glib::RefPtr<BaseMarker>&',`ChamplainBaseMarker*',__CONVERT_REFPTR_TO_P)


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