~ubuntu-branches/ubuntu/oneiric/cairo-dock/oneiric-201110111206

« back to all changes in this revision

Viewing changes to src/cairo-dock-applet-facility.h

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne, Matthieu Baerts (matttbe), Julien Lavergne
  • Date: 2009-10-04 16:33:52 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20091004163352-ttbbjfmpb8uzl8j4
Tags: 2.0.9-0ubuntu1
[ Matthieu Baerts (matttbe) ]
* New Upstream Version. (LP: #435587)
* Added apport hook in debian/apport
 - Add debian/apport
 - debian/cairo-dock-core.install: Added debian/apport/cairo-dock.py
* Use .desktop provided by upstream
 - Removed debian/*.desktop
 - debian/cairo-dock-core.install: install upstream desktop files. 

[ Julien Lavergne ]
* Adjust debian/changelog with Daniel Holbach suggestions.
* debian/patches/01_rename_cairo-dock-package-theme.patch: drop, 
  merged upstream.
* debian/patches/01-desktop-file-category.patch:
 - Remove Encoding field and set category to Utility.
* debian/patches/02-merge-changelog.patch:
 - Merge ChangeLog and ChangeLog-2.0.9.
* debian/apport: Remove commands with grep, python doesn't like it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
* Facility applet headers for Cairo-Dock
 
2
* This file is a part of the Cairo-Dock project
3
3
*
4
 
* Copyright : (C) 2009 by Fabrice Rey
5
 
* E-mail    : fabounet@users.berlios.de
 
4
* Copyright : (C) see the 'copyright' file.
 
5
* E-mail    : see the 'copyright' file.
6
6
*
7
7
* This program is free software; you can redistribute it and/or
8
8
* modify it under the terms of the GNU General Public License
13
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
15
* GNU General Public License for more details.
16
 
*   http://www.gnu.org/licenses/licenses.html#GPL
 
16
* You should have received a copy of the GNU General Public License
 
17
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18
*/
18
19
 
19
 
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 2; tab-width: 2 -*- */
20
 
 
21
20
#ifndef __CAIRO_DOCK_APPLET_FACILITY__
22
21
#define  __CAIRO_DOCK_APPLET_FACILITY__
23
22
 
72
71
 
73
72
/** Apply an image on the context of an icon, clearing it beforehand, and adding the reflect.
74
73
*@param pIconContext the drawing context; is not altered by the function.
75
 
*@param cImagePath path of an image t apply on the icon.
 
74
*@param cImagePath path of an image to apply on the icon.
76
75
*@param pIcon the icon.
77
76
*@param pContainer the container of the icon.
78
77
*/
79
 
void cairo_dock_set_image_on_icon (cairo_t *pIconContext, gchar *cImagePath, Icon *pIcon, CairoContainer *pContainer);
 
78
void cairo_dock_set_image_on_icon (cairo_t *pIconContext, const gchar *cImagePath, Icon *pIcon, CairoContainer *pContainer);
80
79
 
81
80
 
82
81
void cairo_dock_set_hours_minutes_as_quick_info (cairo_t *pSourceContext, Icon *pIcon, CairoContainer *pContainer, int iTimeInSeconds);
137
136
*@return a gboolean.
138
137
*/
139
138
#define CD_CONFIG_GET_BOOLEAN_WITH_DEFAULT(cGroupName, cKeyName, bDefaultValue) cairo_dock_get_boolean_key_value (pKeyFile, cGroupName, cKeyName, &bFlushConfFileNeeded, bDefaultValue, NULL, NULL)
140
 
/** Get the value of a 'booleen' from the conf file, with TRUE as default value.
 
139
/** Get the value of a 'boolean' from the conf file, with TRUE as default value.
141
140
*@param cGroupName name of the group in the conf file.
142
141
*@param cKeyName name of the key in the conf file.
143
142
*@return a gboolean.
326
325
/** Create and add an entry to a menu, with an icon.
327
326
*@param cLabel name of the entry.
328
327
*@param gtkStock name of a GTK icon or path to an image.
329
 
*@param pFunction function called when the user selects this entry.
330
 
*@param pMenu menu to add the entry to.
 
328
*@param pCallBack function called when the user selects this entry.
 
329
*@param pSubMenu menu to add the entry to.
331
330
*@param pData data passed as parameter of the callback.
332
331
*/
333
 
#define CD_APPLET_ADD_IN_MENU_WITH_STOCK_AND_DATA CAIRO_DOCK_ADD_IN_MENU_WITH_STOCK_AND_DATA
 
332
#define CD_APPLET_ADD_IN_MENU_WITH_STOCK_AND_DATA(cLabel, gtkStock, pCallBack, pSubMenu, pData) cairo_dock_add_in_menu_with_stock_and_data (cLabel, gtkStock, (GFunc)pCallBack, pSubMenu, pData)
334
333
 
335
334
/** Create and add an entry to a menu, with an icon. 'myApplet' will be passed to the callback.
336
335
*@param cLabel name of the entry.
358
357
/////////////////////////
359
358
 
360
359
//\______________________ init, config, reload.
361
 
/** Path of the applet instance's conf file.
 
360
/** Path of the applet's instance's conf file.
362
361
*/
363
362
#define CD_APPLET_MY_CONF_FILE myApplet->cConfFilePath
364
363
/** Key file of the applet instance, availale during the init, config, and reload.
376
375
 
377
376
/** The previous Container.
378
377
*/
379
 
#define CD_APPLET_MY_OLD_CONTAINER pOldContainer;
 
378
#define CD_APPLET_MY_OLD_CONTAINER pOldContainer
380
379
 
381
380
 
382
381
//\______________________ clic droit, clic milieu, clic gauche.
388
387
#define CD_APPLET_CLICKED_CONTAINER pClickedContainer
389
388
 
390
389
//\______________________ clic droit
391
 
/**  TRUE if the 'SHIFT' key was pressed during the click ?
 
390
/**  TRUE if the 'SHIFT' key was pressed during the click.
392
391
*/
393
392
#define CD_APPLET_SHIFT_CLICK (iButtonState & GDK_SHIFT_MASK)
394
 
/**  TRUE if the 'CTRL' key was pressed during the click ?
 
393
/**  TRUE if the 'CTRL' key was pressed during the click.
395
394
*/
396
395
#define CD_APPLET_CTRL_CLICK (iButtonState & GDK_CONTROL_MASK)
397
 
/**  TRUE if the 'ALT' key was pressed during the click ?
 
396
/**  TRUE if the 'ALT' key was pressed during the click.
398
397
*/
399
398
#define CD_APPLET_ALT_CLICK (iButtonState & GDK_MOD1_MASK)
400
399
 
410
409
 
411
410
//\______________________ scroll
412
411
#define CD_APPLET_SCROLL_DIRECTION iDirection
413
 
/** TRUE if the users scrolled up.
 
412
/** TRUE if the user scrolled up.
414
413
*/
415
414
#define CD_APPLET_SCROLL_UP (CD_APPLET_SCROLL_DIRECTION == GDK_SCROLL_UP)
416
 
/** TRUE if the users scrolled down.
 
415
/** TRUE if the user scrolled down.
417
416
*/
418
417
#define CD_APPLET_SCROLL_DOWN (CD_APPLET_SCROLL_DIRECTION == GDK_SCROLL_DOWN)
419
418
 
426
425
*/
427
426
#define CD_APPLET_REDRAW_MY_ICON \
428
427
        cairo_dock_redraw_icon (myIcon, myContainer)
 
428
/** Redraw the applet's container (as soon as the main loop is available).
 
429
*/
429
430
#define CAIRO_DOCK_REDRAW_MY_CONTAINER \
430
431
        cairo_dock_redraw_container (myContainer)
431
 
/** Reload the reflect of the applet's icon (useless in OpenGL mode).
 
432
/** Reload the reflect of the applet's icon (do nothing in OpenGL mode).
432
433
*/
433
434
#define CD_APPLET_UPDATE_REFLECT_ON_MY_ICON \
434
435
        if (myContainer->bUseReflect) cairo_dock_add_reflection_to_icon (myDrawContext, myIcon, myContainer)
435
436
 
436
 
/**
437
 
*Charge une image dans une surface, aux dimensions of the icon of l'applet.
438
 
*@param cImagePath chemin du fichier of l'image.
439
 
*@return la surface nouvellement creee.
 
437
/** Load an image into a surface, at the same size as the applet's icon. If the image is given by its sole name, it is searched inside the current theme root folder. 
 
438
*@param cImagePath path or name of an image.
 
439
*@return the newly allocated surface.
440
440
*/
441
441
#define CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET(cImagePath) \
442
 
        cairo_dock_create_surface_for_icon (cImagePath, myDrawContext, myIcon->fWidth * (myDock ? (1 + g_fAmplitude) / myDock->fRatio : 1), myIcon->fHeight* (myDock ? (1 + g_fAmplitude) / myDock->fRatio : 1))
443
 
/**
444
 
*Charge une image utilisateur dans une surface, aux dimensions of the icon of l'applet, ou une image par defaut si la premiere est NULL.
445
 
*@param cUserImageName nom of l'image utilisateur.
446
 
*@param cDefaultLocalImageName icone par defaut
447
 
*@return la surface nouvellement creee.
 
442
        cairo_dock_create_surface_from_image_simple (cImagePath, myDrawContext, myIcon->fWidth * (myDock ? (1 + g_fAmplitude) / myDock->container.fRatio : 1), myIcon->fHeight* (myDock ? (1 + g_fAmplitude) / myDock->container.fRatio : 1))
 
443
 
 
444
/** Load a user image into a surface, at the same size as the applet's icon, or a default image taken in the installed folder of the applet if the first one is NULL. If the user image is given by its sole name, it is searched inside the current theme root folder.
 
445
*@param cUserImageName name or path of an user image.
 
446
*@param cDefaultLocalImageName default image
 
447
*@return the newly allocated surface.
448
448
*/
449
 
#define CD_APPLET_LOAD_USER_SURFACE_FOR_MY_APPLET(cUserImageName, cDefaultLocalImageName) \
 
449
#define CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET_WITH_DEFAULT(cUserImageName, cDefaultLocalImageName) \
450
450
        __extension__ ({\
451
 
        gchar *_cImagePath; \
 
451
        cairo_surface_t *pSurface; \
452
452
        if (cUserImageName != NULL) \
453
 
                _cImagePath = cairo_dock_generate_file_path (cUserImageName); \
 
453
                pSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (cUserImageName); \
454
454
        else if (cDefaultLocalImageName != NULL)\
455
 
                _cImagePath = g_strdup_printf ("%s/%s", MY_APPLET_SHARE_DATA_DIR, cDefaultLocalImageName); \
 
455
                pSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (MY_APPLET_SHARE_DATA_DIR"/"cDefaultLocalImageName); \
456
456
        else\
457
 
                _cImagePath = NULL;\
458
 
        cairo_surface_t *pSurface = CD_APPLET_LOAD_SURFACE_FOR_MY_APPLET (_cImagePath); \
459
 
        g_free (_cImagePath);\
 
457
                pSurface = NULL;\
460
458
        pSurface; })
461
459
 
462
 
 
463
 
/**
464
 
*Applique une surface existante sur le contexte of dessin of l'applet, et la rafraichit.
465
 
*@param pSurface la surface cairo a dessiner.
 
460
/** Apply a surface on the applet's icon, and redraw it.
 
461
*@param pSurface the surface to draw on your icon.
466
462
*/
467
463
#define CD_APPLET_SET_SURFACE_ON_MY_ICON(pSurface) do { \
468
464
        cairo_dock_set_icon_surface_with_reflect (myDrawContext, pSurface, myIcon, myContainer); \
469
465
        cairo_dock_redraw_icon (myIcon, myContainer); } while (0)
470
 
/**
471
 
*Applique une surface existante sur le contexte of dessin of l'applet en la zoomant, et la redessine.
472
 
*@param pSurface la surface cairo a dessiner.
473
 
*@param fScale le facteur of zoom (a 1 la surface remplit toute the icon).
 
466
 
 
467
/** Apply a surface on the applet's icon, with a zoom factor and centered, and redraw it.
 
468
*@param pSurface the surface to draw on your icon.
 
469
*@param fScale zoom factor (at 1 the surface will fill all the icon).
474
470
*/
475
471
#define CD_APPLET_SET_SURFACE_ON_MY_ICON_WITH_ZOOM(pSurface, fScale) do { \
476
472
        cairo_dock_set_icon_surface_full (myDrawContext, pSurface, fScale, 1., myIcon, myContainer); \
477
473
        cairo_dock_add_reflection_to_icon (myDrawContext, myIcon, myContainer); \
478
474
        cairo_dock_redraw_icon (myIcon, myContainer); } while (0)
479
 
/**
480
 
*Applique une surface existante sur le contexte of dessin of l'applet with un facteur of transparence, et la rafraichit.
481
 
*@param pSurface la surface cairo a dessiner.
482
 
*@param fAlpha la transparence (dans [0 , 1]).
 
475
 
 
476
/** Apply a surface on the applet's icon with a transparency factor, and redraw it.
 
477
*@param pSurface the surface to draw on your icon.
 
478
*@param fAlpha transparency (in [0,1]).
483
479
*/
484
480
#define CD_APPLET_SET_SURFACE_ON_MY_ICON_WITH_ALPHA(pSurface, fAlpha) do { \
485
481
        cairo_dock_set_icon_surface_full (myDrawContext, pSurface, 1., fAlpha, myIcon, myContainer); \
486
482
        cairo_dock_add_reflection_to_icon (myDrawContext, myIcon, myContainer); \
487
483
        cairo_dock_redraw_icon (myIcon, myContainer); } while (0)
488
 
/**
489
 
*Applique une surface existante sur le contexte of dessin of l'applet et ajoute une barre a sa base, et la rafraichit.
490
 
*@param pSurface la surface cairo a dessiner.
491
 
*@param fValue la valeur en fraction of la valeur max (donc dans [0 , 1]).
 
484
 
 
485
/** Apply a surface on the applet's icon with add a bar at the bottom, and redraw it. The bar is drawn at the bottom of the icon with a gradation from red to green and a given length.
 
486
*@param pSurface the surface to draw on your icon.
 
487
*@param fValue the value representing a percentage, in [-1,1]. If negative, the gradation is inverted, and the absolute value is used.
492
488
*/
493
489
#define CD_APPLET_SET_SURFACE_ON_MY_ICON_WITH_BAR(pSurface, fValue) do { \
494
490
        cairo_dock_set_icon_surface_with_bar (myDrawContext, pSurface, fValue, myIcon, myContainer); \
495
491
        cairo_dock_add_reflection_to_icon (myDrawContext, myIcon, myContainer); \
496
492
        cairo_dock_redraw_icon (myIcon, myContainer); } while (0)
497
493
 
498
 
/**
499
 
*Applique une image definie par son chemin sur le contexte of dessin of l'applet, mais ne la rafraichit pas. L'image est redimensionnee aux dimensions of the icon.
500
 
*@param cImagePath chemin du fichier of l'image.
 
494
/** Apply an image on the applet's icon. The image is resized at the same size as the icon. Does not trigger the icon refresh.
 
495
*@param cImagePath path to an image.
501
496
*/
502
 
#define CD_APPLET_SET_IMAGE_ON_MY_ICON(cImagePath) do { \
503
 
        if (cImagePath != myIcon->acFileName) \
504
 
        { \
505
 
                g_free (myIcon->acFileName); \
506
 
                myIcon->acFileName = g_strdup (cImagePath); \
507
 
        } \
508
 
        cairo_dock_set_image_on_icon (myDrawContext, cImagePath, myIcon, myContainer); } while (0)
 
497
#define CD_APPLET_SET_IMAGE_ON_MY_ICON(cImagePath)  \
 
498
        cairo_dock_set_image_on_icon (myDrawContext, cImagePath, myIcon, myContainer)
509
499
 
510
 
/**
511
 
*Idem que precedemment mais l'image est definie par son nom localement au repertoire d'installation of l'applet
512
 
*@param cImageName nom du fichier of l'image 
 
500
/** Apply an image, taken inside the installation folder of the applet, on the applet's icon. The image is resized at the same size as the icon. Does not trigger the icon refresh.
 
501
*@param cImageName name of an image 
513
502
*/
514
503
#define CD_APPLET_SET_LOCAL_IMAGE_ON_MY_ICON(cImageName) do { \
515
504
        gchar *_cImageFilePath = g_strconcat (MY_APPLET_SHARE_DATA_DIR, "/", cImageName, NULL); \
516
505
        CD_APPLET_SET_IMAGE_ON_MY_ICON (_cImageFilePath); \
517
506
        g_free (_cImageFilePath); } while (0)
518
507
 
519
 
/**
520
 
*Idem que precedemment mais l'image est definie soit relativement au repertoire utilisateur, soit relativement au repertoire d'installation of l'applet si la 1ere est NULL.
 
508
/** Apply an image on the applet's icon at the same size as the applet's icon, or a default image taken in the installed folder of the applet if the first one is NULL. If the user image is given by its sole name, it is searched inside the current theme root folder.
521
509
*@param cUserImageName nom du fichier of l'image cote utilisateur.
522
510
*@param cDefaultLocalImageName image locale par defaut cote installation.
523
511
*/
530
518
        CD_APPLET_SET_IMAGE_ON_MY_ICON (cImagePath); \
531
519
        g_free (cImagePath); } while (0)
532
520
 
 
521
/** Apply the default icon on the applet's icon if there is no image yet.
 
522
*/
533
523
#define CD_APPLET_SET_DEFAULT_IMAGE_ON_MY_ICON_IF_NONE do { \
534
 
        if (myIcon->acFileName == NULL) { \
535
 
                CD_APPLET_SET_LOCAL_IMAGE_ON_MY_ICON (MY_APPLET_ICON_FILE); } } while (0)
536
 
 
537
 
/**
538
 
*Applique une surface existante sur le contexte of dessin of l'applet, et la redessine. La surface est redimensionnee aux dimensions of the icon.
539
 
*@param pSurface
540
 
*@param fScale
541
 
*/
542
 
#define CD_APPLET_SET_ZOOMED_SURFACE_ON_MY_ICON(pSurface, fScale) do { \
543
 
        cairo_dock_set_icon_surface_with_zoom (myDrawContext, pSurface, fScale, myIcon, myContainer); \
544
 
        cairo_dock_redraw_icon (myIcon, myContainer); } while (0)
545
 
 
546
 
 
547
 
  /////////////
548
 
 /// LABEL ///
549
 
/////////////
550
 
/**
551
 
*Remplace l'etiquette of the icon of l'applet par une nouvelle.
552
 
*@param cIconName la nouvelle etiquette.
 
524
        if (myIcon->cFileName == NULL) { \
 
525
                CD_APPLET_SET_IMAGE_ON_MY_ICON (MY_APPLET_SHARE_DATA_DIR"/"MY_APPLET_ICON_FILE); } } while (0)
 
526
 
 
527
 
 
528
  ///////////
 
529
 // LABEL //
 
530
///////////
 
531
/** Set a new label on the applet's icon.
 
532
*@param cIconName the label.
553
533
*/
554
534
#define CD_APPLET_SET_NAME_FOR_MY_ICON(cIconName) \
555
535
        cairo_dock_set_icon_name (myDrawContext, cIconName, myIcon, myContainer)
556
 
/**
557
 
*Remplace l'etiquette of the icon of l'applet par une nouvelle.
558
 
*@param cIconNameFormat la nouvelle etiquette au format 'printf'.
 
536
/** Set a new label on the applet's icon.
 
537
*@param cIconNameFormat the label, in a 'printf'-like format.
 
538
*@param ... values to be written in the string.
559
539
*/
560
540
#define CD_APPLET_SET_NAME_FOR_MY_ICON_PRINTF(cIconNameFormat, ...) \
561
541
        cairo_dock_set_icon_name_full (myDrawContext, myIcon, myContainer, cIconNameFormat, ##__VA_ARGS__)
562
542
 
563
543
 
564
 
  /////////////////
565
 
 /// QUICK-INFO///
566
 
/////////////////
567
 
/**
568
 
*Ecris une info-rapide sur the icon of l'applet.
569
 
*@param cQuickInfo l'info-rapide. Ce doit etre une chaine of caracteres particulièrement petite, representant une info concise, puisque ecrite directement sur the icon.
 
544
  ///////////////
 
545
 // QUICK-INFO//
 
546
///////////////
 
547
/** Set a quick-info on the applet's icon.
 
548
*@param cQuickInfo the quick-info. This is a small text (a few characters) that is superimposed on the icon.
570
549
*/
571
550
#define CD_APPLET_SET_QUICK_INFO_ON_MY_ICON(cQuickInfo) \
572
551
        cairo_dock_set_quick_info (myDrawContext, cQuickInfo, myIcon, myDock ? (1 + myIcons.fAmplitude) / 1 : 1)
573
 
/**
574
 
*Ecris une info-rapide sur the icon of l'applet.
575
 
*@param cQuickInfoFormat l'info-rapide, au format 'printf'. Ce doit etre une chaine of caracteres particulièrement petite, representant une info concise, puisque ecrite directement sur the icon.
 
552
/** Set a quick-info on the applet's icon.
 
553
*@param cQuickInfoFormat the label, in a 'printf'-like format.
 
554
*@param ... values to be written in the string.
576
555
*/
577
556
#define CD_APPLET_SET_QUICK_INFO_ON_MY_ICON_PRINTF(cQuickInfoFormat, ...) \
578
557
        cairo_dock_set_quick_info_full (myDrawContext, myIcon, myContainer, cQuickInfoFormat, ##__VA_ARGS__)
601
580
*/
602
581
#define CD_APPLET_SET_STATIC_ICON cairo_dock_set_icon_static (myIcon)
603
582
 
604
 
/** Request an animation on applet's icon.
 
583
/** Launch an animation on the applet's icon.
605
584
*@param cAnimationName name of the animation.
606
585
*@param iAnimationLength number of rounds the animation should be played.
607
586
*/
608
587
#define CD_APPLET_ANIMATE_MY_ICON(cAnimationName, iAnimationLength) \
609
588
        cairo_dock_request_icon_animation (myIcon, myDock, cAnimationName, iAnimationLength)
610
589
 
 
590
/** Stop any animation on the applet's icon.
 
591
*/
 
592
#define CD_APPLET_STOP_ANIMATING_MY_ICON \
 
593
        cairo_dock_stop_icon_animation (myIcon)
 
594
 
 
595
 
611
596
/** Get the dimension allocated to the surface/texture of the applet's icon.
 
597
*@param iWidthPtr pointer to the width.
 
598
*@param iHeightPtr pointer to the height.
612
599
*/
613
600
#define CD_APPLET_GET_MY_ICON_EXTENT(iWidthPtr, iHeightPtr) cairo_dock_get_icon_extent (myIcon, myContainer, iWidthPtr, iHeightPtr)
614
601
 
615
 
 
616
602
/** Initiate an OpenGL drawing session on the applet's icon.
617
603
*/
618
604
#define CD_APPLET_START_DRAWING_MY_ICON cairo_dock_begin_draw_icon (myIcon, myContainer)
628
614
*/
629
615
#define CD_APPLET_FINISH_DRAWING_MY_ICON cairo_dock_end_draw_icon (myIcon, myContainer)
630
616
 
 
617
 
631
618
/** Add a Data Renderer the applet's icon.
 
619
*@param pAttr the attributes of the Data Renderer. They allow you to define its properties.
632
620
*/
633
621
#define CD_APPLET_ADD_DATA_RENDERER_ON_MY_ICON(pAttr) cairo_dock_add_new_data_renderer_on_icon (myIcon, myContainer, myDrawContext, pAttr)
 
622
 
634
623
/** Reload the Data Renderer of the applet's icon. Pass NULL as the attributes to simply reload the current data renderer without changing any of its parameters. Previous values are kept.
 
624
*@param pAttr the attributes of the Data Renderer, or NULL to simply reload the Data Renderer as it it.
635
625
*/
636
626
#define CD_APPLET_RELOAD_MY_DATA_RENDERER(pAttr) cairo_dock_reload_data_renderer_on_icon (myIcon, myContainer, myDrawContext, pAttr)
637
 
/** Add new values to the Data Renderer of the applet's icon. Values are a table of 'double', having the same size as defined when the data renderer was created (1 by default).
 
627
 
 
628
/** Add new values to the Data Renderer of the applet's icon. Values are a table of 'double', having the same size as defined when the data renderer was created (1 by default). It also triggers the redraw of the icon.
 
629
*@param pValues the values, a table of double of the correct size.
638
630
*/
639
631
#define CD_APPLET_RENDER_NEW_DATA_ON_MY_ICON(pValues) cairo_dock_render_new_data_on_icon (myIcon, myContainer, myDrawContext, pValues)
 
632
 
640
633
/** Completely remove the Data Renderer of the applet's icon, including the values associated with.
641
634
*/
642
635
#define CD_APPLET_REMOVE_MY_DATA_RENDERER cairo_dock_remove_data_renderer_on_icon (myIcon)
643
636
 
644
 
///__________________ deprecated ___________________
645
 
#define CD_APPLET_RENDER_GAUGE(pGauge, fValue) cairo_dock_render_gauge (myDrawContext, myContainer, myIcon, pGauge, fValue)
646
 
#define CD_APPLET_RENDER_GAUGE_MULTI_VALUE(pGauge, pValueList) cairo_dock_render_gauge_multi_value (myDrawContext, myContainer, myIcon, pGauge, pValueList)
647
 
#define CD_APPLET_RENDER_GRAPH(pGraph) cairo_dock_render_graph (myDrawContext, myContainer, myIcon, pGraph);
648
 
#define CD_APPLET_RENDER_GRAPH_NEW_VALUE(pGraph, fValue) do { \
649
 
        cairo_dock_update_graph (pGraph, fValue); \
650
 
        CD_APPLET_RENDER_GRAPH (pGraph); } while (0)
651
 
#define CD_APPLET_RENDER_GRAPH_NEW_VALUES(pGraph, fValue, fValue2) do { \
652
 
        cairo_dock_update_double_graph (pGraph, fValue, fValue2); \
653
 
        CD_APPLET_RENDER_GRAPH (pGraph); } while (0)
654
 
///__________________ end of deprecated ____________
 
637
 
 
638
/** Set the history size of the Data Renderer of the applet's icon to the maximum size, that is to say 1 value per pixel.
 
639
*/
 
640
#define CD_APPLET_SET_MY_DATA_RENDERER_HISTORY_TO_MAX cairo_dock_resize_data_renderer_history (myIcon, myIcon->fWidth)
 
641
 
655
642
 
656
643
#define CD_APPLET_GET_MY_ICON_DATA(pIcon) cairo_dock_get_icon_data (pIcon, myApplet)
657
644
#define CD_APPLET_GET_MY_CONTAINER_DATA(pContainer) cairo_dock_get_container_data (pContainer, myApplet)
663
650
#define CD_APPLET_SET_MY_DOCK_DATA(pDock, pData) CD_APPLET_SET_MY_CONTAINER_DATA (CAIRO_CONTAINER (pDock), pData)
664
651
#define CD_APPLET_SET_MY_DESKLET_DATA(pDesklet, pData) CD_APPLET_SET_MY_CONTAINER_DATA (CAIRO_CONTAINER (pDesklet), pData)
665
652
 
666
 
#define CD_APPLET_LOAD_LOCAL_TEXTURE(cImageName) cairo_dock_load_local_texture (cImageName, MY_APPLET_SHARE_DATA_DIR)
667
 
 
668
 
#define CD_APPLET_MY_CONTAINER_IS_OPENGL (g_bUseOpenGL && ((myDock && myDock->render_opengl) || (myDesklet && myDesklet->pRenderer && myDesklet->pRenderer->render_opengl)))
 
653
#define CD_APPLET_LOAD_LOCAL_TEXTURE(cImageName) cairo_dock_create_texture_from_image (MY_APPLET_SHARE_DATA_DIR"/"cImageName)
 
654
 
 
655
#define CD_APPLET_LOAD_TEXTURE_WITH_DEFAULT(cUserImageName, cDefaultLocalImageName) \
 
656
        __extension__ ({\
 
657
        GLuint iTexture; \
 
658
        if (cUserImageName != NULL) \
 
659
                iTexture = cairo_dock_create_texture_from_image (cUserImageName); \
 
660
        else if (cDefaultLocalImageName != NULL)\
 
661
                iTexture = cairo_dock_create_texture_from_image (MY_APPLET_SHARE_DATA_DIR"/"cDefaultLocalImageName); \
 
662
        else\
 
663
                iTexture = 0;\
 
664
        iTexture; })
 
665
 
 
666
/** Say if the applet's container currently supports OpenGL.
 
667
*/
 
668
#define CD_APPLET_MY_CONTAINER_IS_OPENGL (g_bUseOpenGL && ((myDock && myDock->pRenderer->render_opengl) || (myDesklet && myDesklet->pRenderer && myDesklet->pRenderer->render_opengl)))
669
669
 
670
670
#define CD_APPLET_SET_TRANSITION_ON_MY_ICON(render_step_cairo, render_step_opengl, bFastPace, iDuration, bRemoveWhenFinished) \
671
671
        cairo_dock_set_transition_on_icon (myIcon, myContainer, myDrawContext,\
690
690
#define CD_APPLET_SET_DESKLET_RENDERER_WITH_DATA(cRendererName, pConfig) do { \
691
691
        cairo_dock_set_desklet_renderer_by_name (myDesklet, cRendererName, NULL, CAIRO_DOCK_LOAD_ICONS_FOR_DESKLET, (CairoDeskletRendererConfigPtr) pConfig); \
692
692
        myDrawContext = cairo_create (myIcon->pIconBuffer); } while (0)
 
693
 
693
694
/** Set a renderer to the applet's desklet and create myDrawContext. Call it at the beginning of init and also reload, to take into account the desklet's resizing.
694
695
*@param cRendererName name of the renderer.
695
696
*/
700
701
#define CD_APPLET_SET_STATIC_DESKLET cairo_dock_set_static_desklet (myDesklet)
701
702
 
702
703
#define CD_APPLET_CREATE_MY_SUBDOCK(pIconsList, cRenderer) do { \
703
 
        if (myIcon->acName == NULL) { \
 
704
        if (myIcon->cName == NULL) { \
704
705
                CD_APPLET_SET_NAME_FOR_MY_ICON (myApplet->pModule->pVisitCard->cModuleName); } \
705
706
        if (cairo_dock_check_unique_subdock_name (myIcon)) { \
706
 
                CD_APPLET_SET_NAME_FOR_MY_ICON (myIcon->acName); } \
707
 
        myIcon->pSubDock = cairo_dock_create_subdock_from_scratch (pIconsList, myIcon->acName, myDock); \
 
707
                CD_APPLET_SET_NAME_FOR_MY_ICON (myIcon->cName); } \
 
708
        myIcon->pSubDock = cairo_dock_create_subdock_from_scratch (pIconsList, myIcon->cName, myDock); \
708
709
        cairo_dock_set_renderer (myIcon->pSubDock, cRenderer); \
709
710
        cairo_dock_update_dock_size (myIcon->pSubDock); } while (0)
710
711
 
711
712
#define CD_APPLET_DESTROY_MY_SUBDOCK do { \
712
 
        cairo_dock_destroy_dock (myIcon->pSubDock, myIcon->acName, NULL, NULL); \
 
713
        cairo_dock_destroy_dock (myIcon->pSubDock, myIcon->cName, NULL, NULL); \
713
714
        myIcon->pSubDock = NULL; } while (0)
714
715
 
715
716
#define CD_APPLET_LOAD_ICONS_IN_MY_SUBDOCK(pIconsList) do { \
716
 
        if (myIcon->acName == NULL) { \
 
717
        if (myIcon->cName == NULL) { \
717
718
                CD_APPLET_SET_NAME_FOR_MY_ICON (myIcon->pModuleInstance->pModule->pVisitCard->cModuleName); }\
718
719
        else { \
719
720
                Icon *icon;\
721
722
                for (ic = pIconsList; ic != NULL; ic = ic->next) {\
722
723
                        icon = ic->data;\
723
724
                        if (icon->cParentDockName == NULL)\
724
 
                                icon->cParentDockName = g_strdup (myIcon->acName); } } \
 
725
                                icon->cParentDockName = g_strdup (myIcon->cName); } } \
725
726
        myIcon->pSubDock->icons = pIconsList; \
726
727
        myIcon->pSubDock->pFirstDrawnElement = pIconsList; \
727
728
        cairo_dock_load_buffers_in_one_dock (myIcon->pSubDock); \
728
729
        cairo_dock_update_dock_size (myIcon->pSubDock); } while (0)
729
730
 
730
 
/** Delete the list of icons of an applet
 
731
/** Delete the list of icons of an applet (keep the subdock in dock mode).
731
732
*/
732
733
#define CD_APPLET_DELETE_MY_ICONS_LIST do {\
733
734
        if (myDesklet && myDesklet->icons != NULL) {\
744
745
                        myIcon->pSubDock->pFirstDrawnElement = NULL; } } } while (0)
745
746
 
746
747
/** Load a list of icons into an applet, with the given renderer for the sub-dock or the desklet).
 
748
*@param pIconList a list of icons. It will belong to the applet's container after that.
 
749
*@param cDockRendererName name of a renderer in case the applet is in dock mode.
 
750
*@param cDeskletRendererName name of a renderer in case the applet is in desklet mode.
 
751
*@param pDeskletRendererConfig possible configuration parameters for the desklet renderer.
747
752
*/
748
753
#define CD_APPLET_LOAD_MY_ICONS_LIST(pIconList, cDockRendererName, cDeskletRendererName, pDeskletRendererConfig) do {\
749
754
        if (myDock) {\
769
774
#define CD_APPLET_MY_ICONS_LIST (myDock ? (myIcon->pSubDock ? myIcon->pSubDock->icons : NULL) : myDesklet->icons)
770
775
/** Gets the container of the icons of your applet. It is either your sub-dock or your desklet.
771
776
*/
772
 
#define CD_APPLET_MY_ICONS_LIST_CONTAINER (myDock ? CAIRO_CONTAINER (myIcon->pSubDock) : CAIRO_CONTAINER (myDesklet))
 
777
#define CD_APPLET_MY_ICONS_LIST_CONTAINER (myDock && myIcon->pSubDock ? CAIRO_CONTAINER (myIcon->pSubDock) : myContainer)
773
778
 
774
779
 
775
780
//\_________________________________ TASKBAR
784
789
                cairo_dock_inhibate_class (cApplicationClass, myIcon); } while (0)
785
790
 
786
791
//\_________________________________ INTERNATIONNALISATION
787
 
/**
788
 
*Macro for gettext, similar to _() et N_(), but with the domaine of the applet. Surround all your strings with this, so that 'xgettext' can find them and automatically include them in the translation files.
 
792
/** Macro for gettext, similar to _() et N_(), but with the domain of the applet. Surround all your strings with this, so that 'xgettext' can find them and automatically include them in the translation files.
789
793
*/
790
794
#define D_(message) dgettext (MY_APPLET_GETTEXT_DOMAIN, message)
791
795
#define _D D_