2
* This file is a part of the Cairo-Dock project
4
* Copyright : (C) see the 'copyright' file.
5
* E-mail : see the 'copyright' file.
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.
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/>.
21
#ifndef __CAIRO_DOCK_APPLET_SINGLE_INSTANCE__
22
#define __CAIRO_DOCK_APPLET_SINGLE_INSTANCE__
24
#define myDrawContext myApplet->pDrawContext
26
#define CD_APPLET_DEFINE_BEGIN(cName, iMajorVersion, iMinorVersion, iMicroVersion, iAppletCategory, cDescription, cAuthor) \
28
CairoContainer *myContainer; \
30
CairoDesklet *myDesklet; \
31
AppletConfig *myConfigPtr = NULL; \
32
AppletData *myDataPtr = NULL; \
33
CairoDockModuleInstance *myApplet = NULL; \
34
CD_APPLET_DEFINE_ALL_BEGIN (cName, iMajorVersion, iMinorVersion, iMicroVersion, iAppletCategory, cDescription, cAuthor) \
35
pVisitCard->bMultiInstance = FALSE;
37
#define CD_APPLET_INIT_BEGIN \
38
CD_APPLET_INIT_ALL_BEGIN(pApplet) \
40
myIcon = myApplet->pIcon; \
41
myContainer = myApplet->pContainer; \
42
myDock = myApplet->pDock; \
43
myDesklet = myApplet->pDesklet;
45
#define myConfig (* myConfigPtr)
46
#define myData (* myDataPtr)
49
#define CD_APPLET_RELOAD_BEGIN \
50
CD_APPLET_RELOAD_ALL_BEGIN \
51
myContainer = myApplet->pContainer; \
52
myDock = myApplet->pDock; \
53
myDesklet = myApplet->pDesklet; \
56
#define CD_APPLET_RESET_DATA_END \
60
if (myDataPtr) memset (myDataPtr, 0, sizeof (AppletData)); \
64
CD_APPLET_RESET_DATA_ALL_END
67
#define CD_APPLET_RESET_CONFIG_BEGIN \
68
CD_APPLET_RESET_CONFIG_ALL_BEGIN \
69
if (myConfigPtr == NULL) \
72
#define CD_APPLET_RESET_CONFIG_END \
74
CD_APPLET_RESET_CONFIG_ALL_END
76
#define CD_APPLET_GET_CONFIG_BEGIN \
77
CD_APPLET_GET_CONFIG_ALL_BEGIN\
78
if (myConfigPtr == NULL)\
79
myConfigPtr = (((gpointer)myApplet)+sizeof(CairoDockModuleInstance));\
80
if (myDataPtr == NULL)\
81
myDataPtr = (((gpointer)myConfigPtr)+sizeof(AppletConfig));
85
extern CairoContainer *myContainer;
86
extern CairoDock *myDock;
87
extern CairoDesklet *myDesklet;
88
extern AppletConfig *myConfigPtr;
89
extern AppletData *myDataPtr;
90
extern CairoDockModuleInstance *myApplet;