diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2017-12-26 23:52:44 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2017-12-26 23:52:44 (GMT) | 
| commit | 2c28d59fb3671c0fdd1987784076d4968c58b651 (patch) | |
| tree | a301f6cd9c1fd9f92191fba7fe7b59a7e3a01b5a /src/glibext | |
| parent | 67b4887317b7394d63b543aa48cb368406374103 (diff) | |
Created the GLoadedContent interface to load all kinds of content.
Diffstat (limited to 'src/glibext')
| -rw-r--r-- | src/glibext/gloadedpanel-int.h | 9 | ||||
| -rw-r--r-- | src/glibext/gloadedpanel.c | 52 | ||||
| -rw-r--r-- | src/glibext/gloadedpanel.h | 21 | 
3 files changed, 76 insertions, 6 deletions
| diff --git a/src/glibext/gloadedpanel-int.h b/src/glibext/gloadedpanel-int.h index 8686d1b..904041d 100644 --- a/src/glibext/gloadedpanel-int.h +++ b/src/glibext/gloadedpanel-int.h @@ -29,6 +29,12 @@ +/* Définit le contenu associé à un panneau de chargement. */ +typedef void (* set_loaded_panel_content_fc) (GLoadedPanel *, GLoadedContent *); + +/* Fournit le contenu associé à un panneau de chargement. */ +typedef GLoadedContent * (* get_loaded_panel_content_fc) (const GLoadedPanel *); +  /* Place en cache un rendu destiné à l'aperçu graphique rapide. */  typedef void (* cache_loaded_glance_fc) (GLoadedPanel *, cairo_t *, const GtkAllocation *, double); @@ -38,6 +44,9 @@ struct _GLoadedPanelIface  {      GTypeInterface base_iface;              /* A laisser en premier        */ +    set_loaded_panel_content_fc set_content;/* Définition du contenu       */ +    get_loaded_panel_content_fc get_content;/* Récupération du contenu     */ +      cache_loaded_glance_fc cache_glance;    /* Cache de la mignature       */  }; diff --git a/src/glibext/gloadedpanel.c b/src/glibext/gloadedpanel.c index fa12ec7..4d5a1e1 100644 --- a/src/glibext/gloadedpanel.c +++ b/src/glibext/gloadedpanel.c @@ -57,6 +57,58 @@ static void g_loaded_panel_default_init(GLoadedPanelInterface *iface)  /******************************************************************************  *                                                                             * +*  Paramètres  : panel   = composant GTK à compléter.                         * +*                content = contenu quelconque chargé en mémoire.              * +*                                                                             * +*  Description : Définit le contenu associé à un panneau de chargement.       * +*                                                                             * +*  Retour      :                                                              * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +void g_loaded_panel_set_content(GLoadedPanel *panel, GLoadedContent *content) +{ +    GLoadedPanelIface *iface;               /* Interface utilisée          */ + +    g_object_ref(G_OBJECT(content)); + +    iface = G_LOADED_PANEL_GET_IFACE(panel); + +    iface->set_content(panel, content); + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : panel = composant GTK à consulter.                           * +*                                                                             * +*  Description : Fournit le contenu associé à un panneau de chargement.       * +*                                                                             * +*  Retour      : Contenu quelconque chargé en mémoire.                        * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +GLoadedContent *g_loaded_panel_get_content(const GLoadedPanel *panel) +{ +    GLoadedContent *result;                 /* Contenu à retourner         */ +    GLoadedPanelIface *iface;               /* Interface utilisée          */ + +    iface = G_LOADED_PANEL_GET_IFACE(panel); + +    result = iface->get_content(panel); + +    return result; + +} + + +/****************************************************************************** +*                                                                             *  *  Paramètres  : panel = composant GTK à manipuler.                           *  *                cairo = assistant pour la création de rendus.                *  *                area  = taille de la surface réduite à disposition.          * diff --git a/src/glibext/gloadedpanel.h b/src/glibext/gloadedpanel.h index 51f4f36..c2c9e85 100644 --- a/src/glibext/gloadedpanel.h +++ b/src/glibext/gloadedpanel.h @@ -29,13 +29,16 @@  #include <gtk/gtk.h> +#include "../analysis/loaded.h" -#define G_TYPE_LOADED_PANEL               (g_loaded_panel_get_type()) -#define G_LOADED_PANEL(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_LOADED_PANEL, GLoadedPanel)) -#define G_LOADED_PANEL_CLASS(vtable)      (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_LOADED_PANEL, GLoadedPanelIface)) -#define GTK_IS_LOADED_PANEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_LOADED_PANEL)) -#define GTK_IS_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_LOADED_PANEL)) -#define G_LOADED_PANEL_GET_IFACE(inst)    (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_LOADED_PANEL, GLoadedPanelIface)) + + +#define G_TYPE_LOADED_PANEL             (g_loaded_panel_get_type()) +#define G_LOADED_PANEL(obj)             (G_TYPE_CHECK_INSTANCE_CAST((obj), G_TYPE_LOADED_PANEL, GLoadedPanel)) +#define G_LOADED_PANEL_CLASS(vtable)    (G_TYPE_CHECK_CLASS_CAST((vtable), G_TYPE_LOADED_PANEL, GLoadedPanelIface)) +#define G_IS_LOADED_PANEL(obj)          (G_TYPE_CHECK_INSTANCE_TYPE((obj), G_TYPE_LOADED_PANEL)) +#define G_IS_LOADED_PANEL_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE((vtable), G_TYPE_LOADED_PANEL)) +#define G_LOADED_PANEL_GET_IFACE(inst)  (G_TYPE_INSTANCE_GET_INTERFACE((inst), G_TYPE_LOADED_PANEL, GLoadedPanelIface))  /* Composant d'affichage basique (coquille vide) */ @@ -48,6 +51,12 @@ typedef struct _GLoadedPanelIface GLoadedPanelIface;  /* Détermine le type d'une interface pour la mise en place de lignes. */  GType g_loaded_panel_get_type(void) G_GNUC_CONST; +/* Définit le contenu associé à un panneau de chargement. */ +void g_loaded_panel_set_content(GLoadedPanel *, GLoadedContent *); + +/* Fournit le contenu associé à un panneau de chargement. */ +GLoadedContent *g_loaded_panel_get_content(const GLoadedPanel *); +  /* Place en cache un rendu destiné à l'aperçu graphique rapide. */  void g_loaded_panel_cache_glance(GLoadedPanel *, cairo_t *, const GtkAllocation *, double); | 
