[libchamplainmm] Wrap ChamplainScale



commit fb13594c2ad54a4cc5ccd5accbeb070bb4d27037
Author: Juan R. García Blanco <juanrgar gmail com>
Date:   Sun Jul 27 17:43:48 2014 +0200

    Wrap ChamplainScale
    
        * champlain/champlainmm.h: Add champlainmm/scale.h.
        * champlain/champlainmm/.gitignore: Ignore scale.*.
        * champlain/src/champlain_signals.defs: Add ::unit and
        ::max-width properties.
        * champlain/src/filelist.am: Add scale.hg.
        * champlain/src/scale.[ccg|hg]: New files.
        * tools/extradefs/generate_extra_defs_libchamplain.cc: Add
        CHAMPLAIN_TYPE_SCALE.
        * tools/m4/convert_libchamplain.m4: Add conversions for
        ChamplainUnit enum.

 champlain/champlainmm.h                            |    1 +
 champlain/champlainmm/.gitignore                   |    1 +
 champlain/src/champlain_signals.defs               |   20 +++++++
 champlain/src/filelist.am                          |    1 +
 champlain/src/scale.ccg                            |   23 ++++++++
 champlain/src/scale.hg                             |   59 ++++++++++++++++++++
 .../extradefs/generate_extra_defs_libchamplain.cc  |    1 +
 tools/m4/convert_libchamplain.m4                   |    1 +
 8 files changed, 107 insertions(+), 0 deletions(-)
---
diff --git a/champlain/champlainmm.h b/champlain/champlainmm.h
index 753ad14..8f9f29d 100644
--- a/champlain/champlainmm.h
+++ b/champlain/champlainmm.h
@@ -36,6 +36,7 @@
 #include <champlainmm/network-map-source.h>
 #include <champlainmm/point.h>
 #include <champlainmm/polygon.h>
+#include <champlainmm/scale.h>
 #include <champlainmm/selection-layer.h>
 #include <champlainmm/tile.h>
 #include <champlainmm/view.h>
diff --git a/champlain/champlainmm/.gitignore b/champlain/champlainmm/.gitignore
index 36cf16d..4267412 100644
--- a/champlain/champlainmm/.gitignore
+++ b/champlain/champlainmm/.gitignore
@@ -13,6 +13,7 @@ marker.*
 path-layer.*
 point.*
 renderer.*
+scale.*
 tile.*
 view.*
 wrap_init.cc
diff --git a/champlain/src/champlain_signals.defs b/champlain/src/champlain_signals.defs
index 50f0cd9..d25c8e3 100644
--- a/champlain/src/champlain_signals.defs
+++ b/champlain/src/champlain_signals.defs
@@ -440,6 +440,26 @@
 
 ;; From ChamplainRenderer
 
+;; From ChamplainScale
+
+(define-property unit
+  (of-object "ChamplainScale")
+  (prop-type "GParamEnum")
+  (docs "The map scale's unit")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property max-width
+  (of-object "ChamplainScale")
+  (prop-type "GParamUInt")
+  (docs "The max width of the scaleon screen")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
 ;; From ChamplainTile
 
 (define-signal render-complete
diff --git a/champlain/src/filelist.am b/champlain/src/filelist.am
index 0b09f7b..378133e 100644
--- a/champlain/src/filelist.am
+++ b/champlain/src/filelist.am
@@ -24,6 +24,7 @@ files_hg  =                                   \
        point.hg                                \
        path-layer.hg                           \
        renderer.hg                             \
+       scale.hg                                \
        marker-layer.hg                 \
        tile.hg                                 \
        view.hg
diff --git a/champlain/src/scale.ccg b/champlain/src/scale.ccg
new file mode 100644
index 0000000..98e7f82
--- /dev/null
+++ b/champlain/src/scale.ccg
@@ -0,0 +1,23 @@
+/* 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>
+
+namespace Champlain
+{
+} // namespace Champlain
diff --git a/champlain/src/scale.hg b/champlain/src/scale.hg
new file mode 100644
index 0000000..d9af79b
--- /dev/null
+++ b/champlain/src/scale.hg
@@ -0,0 +1,59 @@
+/* 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/view.h>
+#include <cluttermm/actor.h>
+
+_DEFS(champlainmm,champlain)
+_PINCLUDE(cluttermm/private/actor_p.h)
+
+namespace Champlain
+{
+
+_WRAP_ENUM(Unit, ChamplainUnit)
+
+/** An actor displaying a scale.
+ *
+ * An actor displaying a scale.
+ *
+ * @newin{0,1}
+ */
+class Scale : public Clutter::Actor
+{
+  _CLASS_GOBJECT(Scale, ChamplainScale, CHAMPLAIN_SCALE, Clutter::Actor, ClutterActor)
+
+protected:
+  _CTOR_DEFAULT()
+
+public:
+  _WRAP_CREATE()
+
+  _WRAP_METHOD(void set_max_width(guint value), champlain_scale_set_max_width)
+  _WRAP_METHOD(guint get_max_width() const, champlain_scale_get_max_width)
+
+  _WRAP_METHOD(void set_unit(Unit unit), champlain_scale_set_unit)
+  _WRAP_METHOD(Unit get_unit() const, champlain_scale_get_unit)
+
+  _WRAP_METHOD(void connect_view(const Glib::RefPtr<View>& view), champlain_scale_connect_view)
+  _WRAP_METHOD(void disconnect_view(), champlain_scale_disconnect_view)
+
+  _WRAP_PROPERTY("max-width", guint)
+  _WRAP_PROPERTY("unit", Unit)
+};
+
+} // namespace Champlain
diff --git a/tools/extradefs/generate_extra_defs_libchamplain.cc 
b/tools/extradefs/generate_extra_defs_libchamplain.cc
index a8dde26..36ef5ea 100644
--- a/tools/extradefs/generate_extra_defs_libchamplain.cc
+++ b/tools/extradefs/generate_extra_defs_libchamplain.cc
@@ -39,6 +39,7 @@ main(int argc, char *argv[])
             << get_defs(CHAMPLAIN_TYPE_PATH_LAYER)
             << get_defs(CHAMPLAIN_TYPE_POINT)
             << get_defs(CHAMPLAIN_TYPE_RENDERER)
+            << get_defs(CHAMPLAIN_TYPE_SCALE)
             << get_defs(CHAMPLAIN_TYPE_TILE)
             << get_defs(CHAMPLAIN_TYPE_VIEW)
             ;
diff --git a/tools/m4/convert_libchamplain.m4 b/tools/m4/convert_libchamplain.m4
index 7a98dc9..fdeb40c 100644
--- a/tools/m4/convert_libchamplain.m4
+++ b/tools/m4/convert_libchamplain.m4
@@ -6,6 +6,7 @@ _CONV_ENUM(Champlain,MapProjection)
 _CONV_ENUM(Champlain,ScrollMode)
 _CONV_ENUM(Champlain,SelectionMode)
 _CONV_ENUM(Champlain,State)
+_CONV_ENUM(Champlain,Unit)
 _CONV_ENUM(Pango,EllipsizeMode)
 
 # Glib


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