From: Emmanuel Rodriguez Date: Sun, 12 Apr 2009 07:16:48 +0000 (+0200) Subject: Bindings for ChamplainBaseMarker X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=253231cd20ec1305fdb31718c4bc7bfc9151625a;p=libchamplain Bindings for ChamplainBaseMarker --- diff --git a/bindings/perl/Champlain/MANIFEST b/bindings/perl/Champlain/MANIFEST index 085b6ca..a414e28 100644 --- a/bindings/perl/Champlain/MANIFEST +++ b/bindings/perl/Champlain/MANIFEST @@ -8,6 +8,7 @@ maps maps-gtk champlain-perl.h xs/Champlain.xs +xs/ChamplainBaseMarker.xs xs/ChamplainLayer.xs xs/ChamplainMapSource.xs xs/ChamplainMarker.xs @@ -17,6 +18,7 @@ xs/ChamplainView.xs xs/ChamplainZoomLevel.xs xs/Gtk2ChamplainViewEmbed.xs t/Champlain.t +t/ChamplainBaseMarker.t t/ChamplainLayer.t t/ChamplainMapSource.t t/ChamplainMarker.t diff --git a/bindings/perl/Champlain/maps b/bindings/perl/Champlain/maps index 65a3b2c..43ec216 100644 --- a/bindings/perl/Champlain/maps +++ b/bindings/perl/Champlain/maps @@ -1,6 +1,7 @@ CHAMPLAIN_TYPE_VIEW ChamplainView GObject Champlain::View CHAMPLAIN_TYPE_VIEW_SCROLL_MODE ChamplainScrollMode GEnum Champlain::ScrollMode CHAMPLAIN_TYPE_LAYER ChamplainLayer GObject Champlain::Layer +CHAMPLAIN_TYPE_BASE_MARKER ChamplainBaseMarker GObject Champlain::BaseMarker CHAMPLAIN_TYPE_MARKER ChamplainMarker GObject Champlain::Marker CHAMPLAIN_TYPE_MAP_SOURCE ChamplainMapSource GObject Champlain::MapSource CHAMPLAIN_TYPE_ZOOM_LEVEL ChamplainZoomLevel GObject Champlain::ZoomLevel diff --git a/bindings/perl/Champlain/t/ChamplainBaseMarker.t b/bindings/perl/Champlain/t/ChamplainBaseMarker.t new file mode 100644 index 0000000..80ae725 --- /dev/null +++ b/bindings/perl/Champlain/t/ChamplainBaseMarker.t @@ -0,0 +1,29 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Clutter::TestHelper tests => 5; + +use Champlain; + + +exit tests(); + + +sub tests { + my $marker = Champlain::BaseMarker->new(); + isa_ok($marker, 'Champlain::BaseMarker'); + + my ($latitude, $longitude) = $marker->get('latitude', 'longitude'); + is($latitude, 0.0, "Initial latitude is at 0.0"); + is($longitude, 0.0, "Initial longitude is at 0.0"); + + $marker->set_position(20.0, 40.0); + ($latitude, $longitude) = $marker->get('latitude', 'longitude'); + is($latitude, 20.0, "set_position() changed the latitude"); + is($longitude, 40.0, "set_position() changed the longitude"); + + return 0; +} + diff --git a/bindings/perl/Champlain/xs/ChamplainBaseMarker.c b/bindings/perl/Champlain/xs/ChamplainBaseMarker.c new file mode 100644 index 0000000..b909501 --- /dev/null +++ b/bindings/perl/Champlain/xs/ChamplainBaseMarker.c @@ -0,0 +1,86 @@ +/* + * This file was generated automatically by ExtUtils::ParseXS version 2.19 from the + * contents of ChamplainBaseMarker.xs. Do not edit this file, edit ChamplainBaseMarker.xs instead. + * + * ANY CHANGES MADE HERE WILL BE LOST! + * + */ + +#line 1 "xs/ChamplainBaseMarker.xs" +#include "champlain-perl.h" + + +#ifndef PERL_UNUSED_VAR +# define PERL_UNUSED_VAR(var) if (0) var = var +#endif + +#line 18 "xs/ChamplainBaseMarker.c" + +XS(XS_Champlain__BaseMarker_new); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Champlain__BaseMarker_new) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 1) + Perl_croak(aTHX_ "Usage: %s(%s)", "Champlain::BaseMarker::new", "class"); + PERL_UNUSED_VAR(cv); /* -W */ + { + ClutterActor * RETVAL; + + RETVAL = champlain_base_marker_new(/* No args */); + ST(0) = newSVClutterActor (RETVAL); + + sv_2mortal(ST(0)); + } + XSRETURN(1); +} + + +XS(XS_Champlain__BaseMarker_set_position); /* prototype to pass -Wmissing-prototypes */ +XS(XS_Champlain__BaseMarker_set_position) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + if (items != 3) + Perl_croak(aTHX_ "Usage: %s(%s)", "Champlain::BaseMarker::set_position", "marker, longitude, latitude"); + PERL_UNUSED_VAR(cv); /* -W */ + { + ChamplainBaseMarker * marker = SvChamplainBaseMarker (ST(0)); + gdouble longitude = (double)SvNV(ST(1)); + gdouble latitude = (double)SvNV(ST(2)); + + champlain_base_marker_set_position(marker, longitude, latitude); + } + XSRETURN_EMPTY; +} + +#ifdef __cplusplus +extern "C" +#endif +XS(boot_Champlain__BaseMarker); /* prototype to pass -Wmissing-prototypes */ +XS(boot_Champlain__BaseMarker) +{ +#ifdef dVAR + dVAR; dXSARGS; +#else + dXSARGS; +#endif + char* file = __FILE__; + + PERL_UNUSED_VAR(cv); /* -W */ + PERL_UNUSED_VAR(items); /* -W */ + XS_VERSION_BOOTCHECK ; + + newXS("Champlain::BaseMarker::new", XS_Champlain__BaseMarker_new, file); + newXS("Champlain::BaseMarker::set_position", XS_Champlain__BaseMarker_set_position, file); + if (PL_unitcheckav) + call_list(PL_scopestack_ix, PL_unitcheckav); + XSRETURN_YES; +} + diff --git a/bindings/perl/Champlain/xs/ChamplainBaseMarker.xs b/bindings/perl/Champlain/xs/ChamplainBaseMarker.xs new file mode 100644 index 0000000..b924702 --- /dev/null +++ b/bindings/perl/Champlain/xs/ChamplainBaseMarker.xs @@ -0,0 +1,16 @@ +#include "champlain-perl.h" + + +MODULE = Champlain::BaseMarker PACKAGE = Champlain::BaseMarker PREFIX = champlain_base_marker_ + +PROTOTYPES: DISABLE + + +ClutterActor* +champlain_base_marker_new (class) + C_ARGS: /* No args */ + + +void +champlain_base_marker_set_position (ChamplainBaseMarker *marker, gdouble longitude, gdouble latitude) +