[libchamplain/libchamplain-0-4] python-binding: Added the SelectionLayer api
- From: Pierre-Luc Beaudoin <plbeaudoin src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libchamplain/libchamplain-0-4] python-binding: Added the SelectionLayer api
- Date: Sat, 9 Jan 2010 19:58:36 +0000 (UTC)
commit dc412fb52b7958c527292b4d06c88ee784554373
Author: Victor Godoy Poluceno <victorpoluceno gmail com>
Date: Thu Dec 24 17:39:36 2009 -0200
python-binding: Added the SelectionLayer api
bindings/python/champlain/pychamplain-base.defs | 105 +++++++++++++++++++++++
bindings/python/champlain/pychamplain.override | 27 ++++++
bindings/python/update-binding.sh | 1 +
3 files changed, 133 insertions(+), 0 deletions(-)
---
diff --git a/bindings/python/champlain/pychamplain-base.defs b/bindings/python/champlain/pychamplain-base.defs
index 0b6a65f..1fda1fe 100644
--- a/bindings/python/champlain/pychamplain-base.defs
+++ b/bindings/python/champlain/pychamplain-base.defs
@@ -56,6 +56,13 @@
(gtype-id "CHAMPLAIN_TYPE_POLYGON")
)
+(define-object SelectionLayer
+ (in-module "Champlain")
+ (parent "ChamplainLayer")
+ (c-name "ChamplainSelectionLayer")
+ (gtype-id "CHAMPLAIN_TYPE_SELECTION_LAYER")
+)
+
(define-object Tile
(in-module "Champlain")
(parent "GObject")
@@ -102,6 +109,17 @@
)
)
+(define-enum SelectionMode
+ (in-module "Champlain")
+ (c-name "ChamplainSelectionMode")
+ (gtype-id "CHAMPLAIN_TYPE_SELECTION_MODE")
+ (values
+ '("none" "CHAMPLAIN_SELECTION_NONE")
+ '("single" "CHAMPLAIN_SELECTION_SINGLE")
+ '("multiple" "CHAMPLAIN_SELECTION_MULTIPLE")
+ )
+)
+
(define-enum MapProjection
(in-module "Champlain")
(c-name "ChamplainMapProjection")
@@ -713,6 +731,93 @@
+;; From champlain-selection-layer.h
+
+(define-function selection_layer_get_type
+ (c-name "champlain_selection_layer_get_type")
+ (return-type "GType")
+)
+
+(define-function selection_layer_new
+ (c-name "champlain_selection_layer_new")
+ (is-constructor-of "ChamplainSelectionLayer")
+ (return-type "ChamplainLayer*")
+)
+
+(define-method get_selected
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_get_selected")
+ (return-type "ChamplainBaseMarker*")
+)
+
+(define-method get_selected_markers
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_get_selected_markers")
+ (return-type "const-GList*")
+)
+
+(define-method count_selected_markers
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_count_selected_markers")
+ (return-type "guint")
+)
+
+(define-method select
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_select")
+ (return-type "none")
+ (parameters
+ '("ChamplainBaseMarker*" "marker")
+ )
+)
+
+(define-method unselect
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_unselect")
+ (return-type "none")
+ (parameters
+ '("ChamplainBaseMarker*" "marker")
+ )
+)
+
+(define-method marker_is_selected
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_marker_is_selected")
+ (return-type "gboolean")
+ (parameters
+ '("ChamplainBaseMarker*" "marker")
+ )
+)
+
+(define-method select_all
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_select_all")
+ (return-type "none")
+)
+
+(define-method unselect_all
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_unselect_all")
+ (return-type "none")
+)
+
+(define-method set_selection_mode
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_set_selection_mode")
+ (return-type "none")
+ (parameters
+ '("ChamplainSelectionMode" "mode")
+ )
+)
+
+(define-method get_selection_mode
+ (of-object "ChamplainSelectionLayer")
+ (c-name "champlain_selection_layer_get_selection_mode")
+ (return-type "ChamplainSelectionMode")
+)
+
+
+
;; From champlain-map-source.h
(define-function map_source_get_type
diff --git a/bindings/python/champlain/pychamplain.override b/bindings/python/champlain/pychamplain.override
index 99c55fc..21f78d2 100644
--- a/bindings/python/champlain/pychamplain.override
+++ b/bindings/python/champlain/pychamplain.override
@@ -455,3 +455,30 @@ _wrap_champlain_point__set_lon(PyGBoxed *self, PyObject *value,
return 0;
}
%%
+override champlain_selection_layer_get_selected_markers kwargs
+static PyObject *
+_wrap_champlain_selection_layer_get_selected_markers(PyGObject *self) {
+ const GList *iter, *list;
+ PyObject *ret;
+
+ list = champlain_selection_layer_get_selected_markers(
+ CHAMPLAIN_SELECTION_LAYER(self->obj));
+
+ if ((ret = PyList_New(0)) == NULL)
+ return NULL;
+
+ for(iter = list; iter != NULL; iter = iter->next) {
+ ChamplainMarker *marker = (ChamplainMarker *) iter->data;
+ PyObject *py_marker = NULL;
+
+ py_marker = pygobject_new((GObject *) marker);
+ if (!py_marker){
+ Py_DECREF(ret);
+ return NULL;
+ }
+ PyList_Append(ret, py_marker);
+ Py_DECREF(py_marker);
+ }
+ return ret;
+}
+%%
diff --git a/bindings/python/update-binding.sh b/bindings/python/update-binding.sh
index 201c3d8..300d9ba 100755
--- a/bindings/python/update-binding.sh
+++ b/bindings/python/update-binding.sh
@@ -12,6 +12,7 @@ python /usr/share/pygobject/2.0/codegen/h2def.py \
champlain-polygon.h \
champlain-point.h \
champlain-layer.h \
+ champlain-selection-layer.h \
champlain-map-source.h \
champlain-map-source-desc.h \
champlain-map-source-factory.h \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]