| 1 |
/** |
| 2 |
* This file is a part of the Cairo-Dock project |
| 3 |
* |
| 4 |
* Copyright : (C) see the 'copyright' file. |
| 5 |
* E-mail : see the 'copyright' file. |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or |
| 8 |
* modify it under the terms of the GNU General Public License |
| 9 |
* as published by the Free Software Foundation; either version 3 |
| 10 |
* of the License, or (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 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/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <stdlib.h> |
| 21 |
#include <string.h> |
| 22 |
#include <math.h> |
| 23 |
|
| 24 |
#include "applet-struct.h" |
| 25 |
#include "applet-fade-out.h" |
| 26 |
|
| 27 |
#define _update_alpha(pData) (pData)->fFadeOutAlpha = 1. - (pData)->fTime / myConfig.iFadeOutDuration |
| 28 |
|
| 29 |
gboolean cd_illusion_init_fade_out (Icon *pIcon, CairoDock *pDock, CDIllusionData *pData) |
| 30 |
{ |
| 31 |
_update_alpha (pData); |
| 32 |
return TRUE; |
| 33 |
} |
| 34 |
|
| 35 |
void cd_illusion_update_fade_out (Icon *pIcon, CairoDock *pDock, CDIllusionData *pData) |
| 36 |
{ |
| 37 |
_update_alpha (pData); |
| 38 |
if (pData->fFadeOutAlpha < 0) |
| 39 |
pData->fFadeOutAlpha = 0; |
| 40 |
|
| 41 |
cairo_dock_redraw_container (CAIRO_CONTAINER (pDock)); |
| 42 |
} |
| 43 |
|
| 44 |
void cd_illusion_draw_fade_out_icon (Icon *pIcon, CairoDock *pDock, CDIllusionData *pData) |
| 45 |
{ |
| 46 |
pIcon->fAlpha = pData->fFadeOutAlpha; // on laisse l'icone se faire redessiner par quelqu'un d'autre. |
| 47 |
} |