summaryrefslogtreecommitdiff
path: root/src/glibext/helpers.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/glibext/helpers.h')
-rw-r--r--src/glibext/helpers.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/glibext/helpers.h b/src/glibext/helpers.h
index cfcc85b..6176245 100644
--- a/src/glibext/helpers.h
+++ b/src/glibext/helpers.h
@@ -29,6 +29,9 @@
#include <glib-object.h>
+#include "../common/compiler.h"
+
+
/**
* Les définitions issues de <glib-2.80>/gobject/gtype.h fournissent des macros
@@ -118,6 +121,31 @@
}
+/**
+ * Définition sous condition d'une inclusion d'interface. Cette inclusion se réalise
+ * lorsque la fonction d'initialisation renseignée est définie.
+ *
+ * Cette version étendue de la macro G_IMPLEMENT_INTERFACE d'origine est principalement
+ * pour les raffinements d'objets en forme graphique.
+ */
+
+#define G_IMPLEMENT_INTERFACE_IF_SYM(iface_tp_getter, iface_init) \
+ do \
+ { \
+ extern GType iface_tp_getter(void) __weak; \
+ extern void iface_init(GTypeInterface *, gpointer) __weak; \
+ if (&iface_tp_getter != NULL && &iface_init != NULL) \
+ { \
+ GType iface_type = iface_tp_getter(); \
+ const GInterfaceInfo implementation_info = { \
+ (GInterfaceInitFunc)(void (*)(void))iface_init, NULL, NULL \
+ }; \
+ g_type_add_interface_static(g_define_type_id, iface_type, &implementation_info);\
+ } \
+ } \
+ while (0);
+
+
/**
* Les principales fonctions incrémentant ou réduisant le nombre de références