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 
21 #ifndef __CD_APPLET_STRUCT__
22 #define  __CD_APPLET_STRUCT__
23 
24 #include <cairo-dock.h>
25 
26 //\___________ structure containing the applet's configuration parameters.
27 struct _AppletConfig {
28 	gdouble fFontSizeRatio;  // 1 <=> taille du dock
29 	gboolean bTextOnTop;
30 	GldiTextDescription labelDescription;
31 	gchar *cShortkeySearch;
32 	gchar *cIconAnimation;
33 	gdouble pFrameColor[4];
34 	gint iAnimationDuration;
35 	gint iAppearanceDuration;
36 	gint iCloseDuration;
37 	gint iNbResultMax;
38 	GldiTextDescription infoDescription;
39 	gint iNbLinesInListing;
40 	gchar **cPreferredApplis;
41 	gboolean bUseFiles;
42 	gboolean bUseFirefox;
43 	gboolean bUseRecent;
44 	gboolean bUseWeb;
45 	gboolean bUseCommand;
46 	};
47 
48 typedef struct _CDEntry CDEntry;
49 typedef struct _CDBackend CDBackend;
50 typedef struct _CDListing CDListing;
51 typedef struct _CDListingBackup CDListingBackup;
52 typedef struct _CDChar CDChar;
53 
54 typedef gboolean (*CDFillEntryFunc) (CDEntry *pEntry);
55 typedef void (*CDExecuteEntryFunc) (CDEntry *pEntry);
56 typedef GList* (*CDListSubEntryFunc) (CDEntry *pEntry, int *iNbSubEntries);
57 
58 struct _CDEntry {
59 	gchar *cPath;
60 	gchar *cName;
61 	gchar *cLowerCaseName;
62 	gchar *cIconName;
63 	cairo_surface_t *pIconSurface;
64 	gpointer data;
65 	gboolean bHidden;
66 	gboolean bMainEntry;
67 	CDBackend *pBackend;
68 	CDFillEntryFunc fill;
69 	CDExecuteEntryFunc execute;
70 	CDListSubEntryFunc list;
71 	} ;
72 
73 struct _CDListing {
74 	GldiContainer container;
75 	GList *pEntries;
76 	gint iNbEntries;
77 	GList *pCurrentEntry;
78 	gint iAppearanceAnimationCount;
79 	gint iCurrentEntryAnimationCount;
80 	gint iScrollAnimationCount;
81 	gdouble fPreviousOffset;
82 	gdouble fCurrentOffset;
83 	gdouble fAimedOffset;
84 	gint iTitleOffset;
85 	gint iTitleWidth;
86 	gint sens;
87 	guint iSidFillEntries;
88 	GList *pEntryToFill;
89 	gint iNbVisibleEntries;
90 	} ;
91 
92 struct _CDListingBackup {
93 	GList *pEntries;
94 	gint iNbEntries;
95 	GList *pCurrentEntry;
96 	} ;
97 
98 struct _CDChar {
99 	gchar c;
100 	cairo_surface_t *pSurface;
101 	GLuint iTexture;
102 	gint iWidth, iHeight;
103 	gint iAnimationTime;
104 	gint iInitialX, iInitialY;
105 	gint iFinalX, iFinalY;
106 	gint iCurrentX, iCurrentY;
107 	gdouble fRotationAngle;
108 	} ;
109 
110 typedef enum _CDFilter {
111 	DO_FILTER_NONE	=0,
112 	DO_MATCH_CASE	=1<<0,
113 	DO_TYPE_MUSIC	=1<<1,
114 	DO_TYPE_IMAGE	=1<<2,
115 	DO_TYPE_VIDEO	=1<<3,
116 	DO_TYPE_TEXT	=1<<4,
117 	DO_TYPE_HTML	=1<<5,
118 	DO_TYPE_SOURCE	=1<<6
119 	} CDFilter;
120 
121 typedef gboolean (*CDBackendInitFunc) (void);
122 typedef GList * (*CDBackendSearchFunc) (const gchar *cText, gint iFilter, gboolean bSearchAll, int *iNbEntries);
123 typedef void (*CDBackendStopFunc) (void);
124 
125 struct _CDBackend {
126 	// interface
127 	const gchar *cName;
128 	gboolean bIsThreaded;
129 	gboolean bStaticResults;
130 	CDBackendInitFunc init;
131 	CDBackendSearchFunc search;
132 	CDBackendStopFunc stop;
133 	// private data
134 	gboolean bIsActive;
135 	gint iState;  // 0:uninitialized; 1:ok; -1:broken
136 	GldiTask *pTask;
137 	gboolean bTooManyResults;
138 	gboolean bFoundNothing;
139 	GList *pLastShownResults;
140 	gint iNbLastShownResults;
141 	// shared memory
142 	gchar *cCurrentLocateText;  // lecture seule dans le thread
143 	gint iLocateFilter;  // lecture seule dans le thread
144 	GList *pSearchResults;  // ecriture seule dans le thread
145 	gint iNbSearchResults;  // ecriture seule dans le thread
146 	// end of shared memory
147 	} ;
148 
149 //\___________ structure containing the applet's data, like surfaces, dialogs, results of calculation, etc.
150 struct _AppletData {
151 	gint iSessionState;  // 0:no session, 1: session closing, 2: session running
152 	GString *sCurrentText;
153 	guint iNbValidCaracters;
154 	gint iTextWidth, iTextHeight;
155 	gint iCloseTime;
156 	GList *pCharList;
157 	gint iAppearanceTime;
158 
159 	gint iPromptAnimationCount;
160 	cairo_surface_t *pPromptSurface;
161 	gint iPromptWidth, iPromptHeight;
162 	GLuint iPromptTexture;
163 
164 	GList *pMatchingIcons;
165 	GList *pCurrentMatchingElement;
166 	gint iCurrentMatchingOffset;
167 	gint iPreviousMatchingOffset;
168 	gint iMatchingGlideCount;
169 	gint iMatchingAimPoint;
170 
171 	GList *pApplications;
172 	GList *pMonitorList;
173 	GList *pCurrentApplicationToLoad;
174 	guint iSidLoadExternAppliIdle;
175 
176 	gint iCurrentFilter;
177 
178 	CDListing *pListing;
179 	gchar *cStatus;
180 	cairo_surface_t *pScoobySurface;
181 	cairo_surface_t *pActiveButtonSurface, *pInactiveButtonSurface;
182 	GList *pListingHistory;
183 	gchar *cSearchText;
184 
185 	GList *pBackends;
186 	GldiShortkey *cKeyBinding;
187 	} ;
188 
189 
190 #endif
191