summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/gui/editem.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/gui/editem.c')
-rw-r--r--plugins/pychrysalide/gui/editem.c126
1 files changed, 125 insertions, 1 deletions
diff --git a/plugins/pychrysalide/gui/editem.c b/plugins/pychrysalide/gui/editem.c
index 71bf316..683a0d1 100644
--- a/plugins/pychrysalide/gui/editem.c
+++ b/plugins/pychrysalide/gui/editem.c
@@ -39,6 +39,30 @@
+#define EDITOR_ITEM_DOC \
+ "EditorItem is an abstract class for all items belonging to main interface" \
+ " of Chrysalide: panels, menus, aso.\n" \
+ "\n" \
+ "These objets do not offer functions as the pychrysalide.gui.core module" \
+ " is aimed to deal with all editor items at once. Thus such functions are" \
+ " located in this module." \
+ "\n" \
+ "The following special method can be overridden:\n" \
+ "* _change_content(self, old, new): get notified about a" \
+ " pychrysalide.analysis.LoadedContent change.\n" \
+ "* _change_view(self, old, new): get notified about a" \
+ " pychrysalide.glibext.LoadedPanel change.\n" \
+ "* _update_view(self, panel): get notified about a" \
+ " pychrysalide.glibext.LoadedPanel change.\n" \
+ "* _track_cursor(self, panel, cursor): get notified when the position of a" \
+ " pychrysalide.glibext.LineCursor evolves in a" \
+ " pychrysalide.glibext.LoadedPanel.\n" \
+ "* _focus_cursor(self, content, cursor): place the current caret to a given"\
+ " pychrysalide.glibext.LineCursor inside a rendered" \
+ " pychrysalide.analysis.LoadedContent."
+
+
+
/* ------------------------ GLUE POUR CREATION DEPUIS PYTHON ------------------------ */
@@ -59,6 +83,17 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *, GLoadedContent *,
+/* -------------------------- FONCTIONNALITES D'UN ELEMENT -------------------------- */
+
+
+/* Fournit le nom humain attribué à l'élément réactif. */
+static PyObject *py_editor_item_get_name(PyObject *, void *);
+
+/* Fournit le composant GTK associé à l'élément réactif. */
+static PyObject *py_editor_item_get_widget(PyObject *, void *);
+
+
+
/* ---------------------------------------------------------------------------------- */
/* GLUE POUR CREATION DEPUIS PYTHON */
/* ---------------------------------------------------------------------------------- */
@@ -366,6 +401,93 @@ static void py_editor_item_focus_cursor_wrapper(GEditorItem *item, GLoadedConten
/******************************************************************************
* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le nom humain attribué à l'élément réactif. *
+* *
+* Retour : Désignation (courte) de l'élément de l'éditeur. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_editor_item_get_name(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GEditorItem *item; /* Elément à consulter */
+ const char *name; /* Désignation humaine */
+
+#define EDITOR_ITEM_NAME_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ name, py_editor_item, \
+ "Human name given to the editor item." \
+)
+
+ item = G_EDITOR_ITEM(pygobject_get(self));
+ name = g_editor_item_get_name(item);
+
+ if (name != NULL)
+ result = PyUnicode_FromString(name);
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
+* Paramètres : self = objet Python concerné par l'appel. *
+* closure = non utilisé ici. *
+* *
+* Description : Fournit le composant GTK associé à l'élément réactif. *
+* *
+* Retour : Instance de composant graphique chargé. *
+* *
+* Remarques : - *
+* *
+******************************************************************************/
+
+static PyObject *py_editor_item_get_widget(PyObject *self, void *closure)
+{
+ PyObject *result; /* Valeur à retourner */
+ GEditorItem *item; /* Elément à consulter */
+ GtkWidget *widget; /* Composant GTK employé */
+
+#define EDITOR_ITEM_WIDGET_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ widget, py_editor_item, \
+ "Base GTK widget involed in the editor item." \
+)
+
+ item = G_EDITOR_ITEM(pygobject_get(self));
+ widget = g_editor_item_get_widget(item);
+
+ if (widget != NULL)
+ {
+ result = pygobject_new(G_OBJECT(widget));
+ g_object_unref(G_OBJECT(widget));
+ }
+
+ else
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ return result;
+
+}
+
+
+/******************************************************************************
+* *
* Paramètres : - *
* *
* Description : Fournit un accès à une définition de type à diffuser. *
@@ -383,6 +505,8 @@ PyTypeObject *get_python_editor_item_type(void)
};
static PyGetSetDef py_editor_item_getseters[] = {
+ EDITOR_ITEM_NAME_ATTRIB,
+ EDITOR_ITEM_WIDGET_ATTRIB,
{ NULL }
};
@@ -394,7 +518,7 @@ PyTypeObject *get_python_editor_item_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
- .tp_doc = "PyChrysalide editor item",
+ .tp_doc = EDITOR_ITEM_DOC,
.tp_methods = py_editor_item_methods,
.tp_getset = py_editor_item_getseters,