diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2025-03-16 14:14:12 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2025-03-16 14:14:12 (GMT) |
commit | b18c64b69c8c048c640b5d9f6c45b1cfda605ae8 (patch) | |
tree | 70c293e0c6f5b39bf8b672c01480baf5625fb1c1 /src/glibext/helpers.h | |
parent | c0c06b9e1cbb760b661a7adf4163cc6ba19828b3 (diff) |
Update some core definitions for local GObjects.
Diffstat (limited to 'src/glibext/helpers.h')
-rw-r--r-- | src/glibext/helpers.h | 28 |
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 |