4 * Copyright 1998, 1999 Eric Kohl
7 * This is just a dummy control. An author is needed! Any volunteers?
8 * I will only improve this control once in a while.
9 * Eric <ekohl@abo.rhein-zeitung.de>
13 * - All notifications.
22 DEFAULT_DEBUG_CHANNEL(animate)
24 #define ANIMATE_GetInfoPtr(hwnd) ((ANIMATE_INFO *)GetWindowLongA (hwnd, 0))
28 ANIMATE_LoadResA (ANIMATE_INFO *infoPtr, HINSTANCE hInst, LPSTR lpName)
33 hrsrc = FindResourceA (hInst, lpName, "AVI");
37 handle = LoadResource (hInst, hrsrc);
41 infoPtr->lpAvi = LockResource (handle);
50 ANIMATE_LoadFileA (ANIMATE_INFO *infoPtr, LPSTR lpName)
55 CreateFileA (lpName, GENERIC_READ, 0, NULL, OPEN_EXISTING,
56 FILE_ATTRIBUTE_NORMAL, 0);
61 CreateFileMappingA (infoPtr->hFile, NULL, PAGE_READONLY | SEC_COMMIT,
64 CloseHandle (infoPtr->hFile);
69 infoPtr->lpAvi = MapViewOfFile (handle, FILE_MAP_READ, 0, 0, 0);
70 if (!infoPtr->lpAvi) {
71 CloseHandle (infoPtr->hFile);
81 ANIMATE_Free (ANIMATE_INFO *infoPtr)
84 UnmapViewOfFile (infoPtr->lpAvi);
85 CloseHandle (infoPtr->hFile);
86 infoPtr->lpAvi = NULL;
89 GlobalFree ((HGLOBAL)infoPtr->lpAvi);
90 infoPtr->lpAvi = NULL;
96 ANIMATE_GetAviInfo (infoPtr)
104 ANIMATE_OpenA (HWND hwnd, WPARAM wParam, LPARAM lParam)
106 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
107 HINSTANCE hInstance = (HINSTANCE)wParam;
109 ANIMATE_Free (infoPtr);
112 TRACE (animate, "closing avi!\n");
116 if (HIWORD(lParam)) {
117 FIXME (animate, "(\"%s\") empty stub!\n", (LPSTR)lParam);
119 if (ANIMATE_LoadResA (infoPtr, hInstance, (LPSTR)lParam)) {
121 FIXME (animate, "AVI resource found!\n");
125 FIXME (animate, "No AVI resource found!\n");
126 if (ANIMATE_LoadFileA (infoPtr, (LPSTR)lParam)) {
127 FIXME (animate, "AVI file found!\n");
130 FIXME (animate, "No AVI file found!\n");
136 FIXME (animate, "(%u) empty stub!\n", (WORD)LOWORD(lParam));
138 if (ANIMATE_LoadResA (infoPtr, hInstance,
139 MAKEINTRESOURCEA((INT)lParam))) {
140 FIXME (animate, "AVI resource found!\n");
143 FIXME (animate, "No AVI resource found!\n");
148 ANIMATE_GetAviInfo (infoPtr);
154 /* << ANIMATE_Open32W >> */
158 ANIMATE_Play (HWND hwnd, WPARAM wParam, LPARAM lParam)
160 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
161 INT nFrom = (INT)LOWORD(lParam);
162 INT nTo = (INT)HIWORD(lParam);
163 INT nRepeat = (INT)wParam;
173 FIXME (animate, "(loop from=%d to=%d) empty stub!\n",
179 FIXME (animate, "(repeat=%d from=%d to=%d) empty stub!\n",
180 nRepeat, nFrom, nTo);
190 ANIMATE_Stop (HWND hwnd, WPARAM wParam, LPARAM lParam)
192 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd); */
206 ANIMATE_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
208 ANIMATE_INFO *infoPtr;
210 /* allocate memory for info structure */
211 infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO));
213 ERR (animate, "could not allocate info memory!\n");
217 /* store pointer to info structure */
218 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
221 /* set default settings */
229 ANIMATE_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
231 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
235 ANIMATE_Free (infoPtr);
237 /* free animate info data */
238 COMCTL32_Free (infoPtr);
246 ANIMATE_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
248 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(hwnd);
250 HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
253 GetClientRect32 (wndPtr->hwndSelf, &rect);
254 FillRect32 ((HDC32)wParam, &rect, hBrush);
255 DeleteObject32 (hBrush);
264 ANIMATE_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
269 return ANIMATE_OpenA (hwnd, wParam, lParam);
271 /* case ACM_OPEN32W: */
272 /* return ANIMATE_Open32W (hwnd, wParam, lParam); */
275 return ANIMATE_Play (hwnd, wParam, lParam);
278 return ANIMATE_Stop (hwnd, wParam, lParam);
282 return ANIMATE_Create (hwnd, wParam, lParam);
285 return ANIMATE_Destroy (hwnd, wParam, lParam);
287 /* case WM_ERASEBKGND: */
288 /* return ANIMATE_EraseBackground (hwnd, wParam, lParam); */
290 /* case WM_NCCREATE: */
291 /* case WM_NCHITTEST: */
294 /* case WM_STYLECHANGED: */
299 ERR (animate, "unknown msg %04x wp=%08x lp=%08lx\n",
300 uMsg, wParam, lParam);
301 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
308 ANIMATE_Register (VOID)
312 if (GlobalFindAtomA (ANIMATE_CLASSA)) return;
314 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
315 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
316 wndClass.lpfnWndProc = (WNDPROC)ANIMATE_WindowProc;
317 wndClass.cbClsExtra = 0;
318 wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
319 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
320 wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
321 wndClass.lpszClassName = ANIMATE_CLASSA;
323 RegisterClassA (&wndClass);
328 ANIMATE_Unregister (VOID)
330 if (GlobalFindAtomA (ANIMATE_CLASSA))
331 UnregisterClassA (ANIMATE_CLASSA, (HINSTANCE)NULL);