src/cairo-dock-applet-factory.h

Aller à la documentation de ce fichier.
00001 
00002 #ifndef __CAIRO_DOCK_APPLET_FACTORY__
00003 #define  __CAIRO_DOCK_APPLET_FACTORY__
00004 
00005 #include <glib.h>
00006 
00007 #include "cairo-dock-struct.h"
00008 
00009 
00019 cairo_surface_t *cairo_dock_create_applet_surface (gchar *cImageFilePath, cairo_t *pSourceContext, double fMaxScale, double *fWidth, double *fHeight);
00020 
00021 
00031 Icon *cairo_dock_create_icon_for_applet (CairoDock *pDock, int iWidth, int iHeight, gchar *cName, gchar *cIconName);
00032 
00033 
00034 
00044 GKeyFile *cairo_dock_read_header_applet_conf_file (gchar *cConfFilePath, int *iWidth, int *iHeight, gchar **cName, gboolean *bFlushConfFileNeeded);
00045 
00046 
00054 GHashTable *cairo_dock_list_themes (gchar *cThemesDir, GHashTable *hProvidedTable, GError **erreur);
00055 
00056 
00064 gchar *cairo_dock_check_conf_file_exists (gchar *cUserDataDirName, gchar *cShareDataDir, gchar *cConfFileName);
00065 
00066 
00072 void cairo_dock_set_icon_surface (cairo_t *pIconContext, cairo_surface_t *pSurface);
00079 void cairo_dock_add_reflection_to_icon (cairo_t *pIconContext, Icon *pIcon, CairoDock *pDock);
00087 void cairo_dock_set_icon_surface_with_reflect (cairo_t *pIconContext, cairo_surface_t *pSurface, Icon *pIcon, CairoDock *pDock);
00088 
00096 void cairo_dock_set_icon_name (cairo_t *pSourceContext, const gchar *cIconName, Icon *pIcon, CairoDock *pDock);
00097 
00104 void cairo_dock_set_quick_info (cairo_t *pSourceContext, const gchar *cExtraInfo, Icon *pIcon);
00109 #define cairo_dock_remove_quick_info(pIcon) cairo_dock_set_quick_info (NULL, NULL, pIcon)
00110 
00111 
00119 void cairo_dock_animate_icon (Icon *pIcon, CairoDock *pDock, CairoDockAnimationType iAnimationType, int iNbRounds);
00120 
00121 
00122 #define CD_CONFIG_APPLET \
00123 void read_conf_file (gchar *cConfFilePath, int *iWidth, int *iHeight, gchar *cName)
00124 
00125 #define CD_CONFIG_BEGIN \
00126         GError *erreur = NULL; \
00127         gboolean bFlushConfFileNeeded = FALSE; \
00128         GKeyFile *pKeyFile = cairo_dock_read_header_applet_conf_file (cConfFilePath, iWidth, iHeight, &cName, &bFlushConfFileNeeded); \
00129         g_return_if_fail (pKeyFile != NULL);
00130 #define CD_CONFIG_END \
00131         if (bFlushConfFileNeeded) \
00132                 cairo_dock_write_keys_to_file (pKeyFile, cConfFilePath); \
00133         g_key_file_free (pKeyFile);
00134 
00135 #define CD_CONFIG_GET_BOOLEAN(cGroupName, cKeyName) cairo_dock_get_boolean_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, TRUE)
00136 #define CD_CONFIG_GET_INTEGER(cGroupName, cKeyName) cairo_dock_get_integer_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, 0)
00137 #define CD_CONFIG_GET_DOUBLE(cGroupName, cKeyName) cairo_dock_get_double_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, 0.)
00138 #define CD_CONFIG_GET_STRING(cGroupName, cKeyName) cairo_dock_get_string_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, NULL)
00139 #define CD_CONFIG_GET_ANIMATION(cGroupName, cKeyName) cairo_dock_get_animation_type_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, NULL);
00140 
00141 
00142 #define CD_APPLET_H \
00143 CairoDockVisitCard *pre_init (void);\
00144 Icon *init (CairoDock *pDock, gchar **cConfFilePath, GError **erreur);\
00145 void stop (void);
00146 
00147 
00148 #define CD_APPLET_DEFINITION(cName, iMajorVersion, iMinorVersion, iMicroVersion) \
00149 CairoDockVisitCard *pre_init (void)\
00150 {\
00151         CairoDockVisitCard *pVisitCard = g_new0 (CairoDockVisitCard, 1);\
00152         pVisitCard->cModuleName = g_strdup (cName);\
00153         pVisitCard->cReadmeFilePath = g_strdup_printf ("%s/%s", MY_APPLET_SHARE_DATA_DIR, MY_APPLET_README_FILE);\
00154         pVisitCard->iMajorVersionNeeded = iMajorVersion;\
00155         pVisitCard->iMinorVersionNeeded = iMinorVersion;\
00156         pVisitCard->iMicroVersionNeeded = iMicroVersion;\
00157         return pVisitCard;\
00158 }
00159 
00160 #define CD_APPLET_STOP_BEGIN \
00161 void stop (void) \
00162 { \
00163         myDock = NULL;\
00164         myIcon = NULL;\
00165         cairo_destroy (myDrawContext);
00166 
00167 #define CD_APPLET_STOP_END \
00168 }
00169 
00170 
00171 
00172 #define CD_APPLET_INIT_BEGIN \
00173 Icon *init (CairoDock *pDock, gchar **cConfFilePath, GError **erreur) \
00174 { \
00175         myDock = pDock; \
00176         *cConfFilePath = cairo_dock_check_conf_file_exists (MY_APPLET_USER_DATA_DIR, MY_APPLET_SHARE_DATA_DIR, APPLET_CONF_FILE); \
00177         int iOriginalWidth = 48, iOriginalHeight = 48; \
00178         gchar *cAppletName = NULL; \
00179         read_conf_file (*cConfFilePath, &iOriginalWidth, &iOriginalHeight, &cAppletName); \
00180         myIcon = cairo_dock_create_icon_for_applet (pDock, iOriginalWidth, iOriginalHeight, conf_defaultTitle, NULL); \
00181         myDrawContext = cairo_create (myIcon->pIconBuffer);
00182 
00183 #define CD_APPLET_INIT_END \
00184         g_free (cAppletName); \
00185         return myIcon; \
00186 }
00187 
00188 
00189 #define CD_CLICK_ON_APPLET_BEGIN \
00190 gboolean action_on_click (gpointer *data) \
00191 { \
00192 #define CD_CLICK_ON_APPLET_BEGIN \
00193         if (data[0] == myIcon) \
00194         {
00195 
00196 #define CD_CLICK_ON_APPLET_END \
00197         } \
00198         return CAIRO_DOCK_LET_PASS_NOTIFICATION;
00199 
00200 
00201 #endif

Généré le Tue Dec 11 02:26:43 2007 pour Cairo-Dock par  doxygen 1.5.3