4 * Copyright 1998 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.
25 #define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0])
29 ANIMATE_LoadRes32A (ANIMATE_INFO
*infoPtr
, HINSTANCE32 hInst
, LPSTR lpName
)
34 hrsrc
= FindResource32A (hInst
, lpName
, "AVI");
38 handle
= LoadResource32 (hInst
, hrsrc
);
42 infoPtr
->lpAvi
= LockResource32 (handle
);
51 ANIMATE_LoadFile32A (ANIMATE_INFO
*infoPtr
, LPSTR lpName
)
56 CreateFile32A (lpName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
57 FILE_ATTRIBUTE_NORMAL
, 0);
62 CreateFileMapping32A (infoPtr
->hFile
, NULL
, PAGE_READONLY
| SEC_COMMIT
,
65 CloseHandle (infoPtr
->hFile
);
70 infoPtr
->lpAvi
= MapViewOfFile (handle
, FILE_MAP_READ
, 0, 0, 0);
71 if (!infoPtr
->lpAvi
) {
72 CloseHandle (infoPtr
->hFile
);
82 ANIMATE_Free (ANIMATE_INFO
*infoPtr
)
85 UnmapViewOfFile (infoPtr
->lpAvi
);
86 CloseHandle (infoPtr
->hFile
);
87 infoPtr
->lpAvi
= NULL
;
90 GlobalFree32 (infoPtr
->lpAvi
);
91 infoPtr
->lpAvi
= NULL
;
97 ANIMATE_GetAviInfo (infoPtr
)
105 ANIMATE_Open32A (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
107 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
108 HINSTANCE32 hInstance
= (HINSTANCE32
)wParam
;
110 ANIMATE_Free (infoPtr
);
113 TRACE (animate
, "closing avi!\n");
117 if (HIWORD(lParam
)) {
118 FIXME (animate
, "(\"%s\") empty stub!\n", (LPSTR
)lParam
);
120 if (ANIMATE_LoadRes32A (infoPtr
, hInstance
, (LPSTR
)lParam
)) {
122 FIXME (animate
, "AVI resource found!\n");
126 FIXME (animate
, "No AVI resource found!\n");
127 if (ANIMATE_LoadFile32A (infoPtr
, (LPSTR
)lParam
)) {
128 FIXME (animate
, "AVI file found!\n");
131 FIXME (animate
, "No AVI file found!\n");
137 FIXME (animate
, "(%u) empty stub!\n", (WORD
)LOWORD(lParam
));
139 if (ANIMATE_LoadRes32A (infoPtr
, hInstance
,
140 MAKEINTRESOURCE32A((INT32
)lParam
))) {
141 FIXME (animate
, "AVI resource found!\n");
144 FIXME (animate
, "No AVI resource found!\n");
149 ANIMATE_GetAviInfo (infoPtr
);
155 // << ANIMATE_Open32W >>
159 ANIMATE_Play (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
161 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
162 INT32 nFrom
= (INT32
)LOWORD(lParam
);
163 INT32 nTo
= (INT32
)HIWORD(lParam
);
164 INT32 nRepeat
= (INT32
)wParam
;
174 FIXME (animate
, "(loop from=%d to=%d) empty stub!\n",
180 FIXME (animate
, "(repeat=%d from=%d to=%d) empty stub!\n",
181 nRepeat
, nFrom
, nTo
);
191 ANIMATE_Stop (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
193 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
207 ANIMATE_Create (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
209 ANIMATE_INFO
*infoPtr
;
211 /* allocate memory for info structure */
212 infoPtr
= (ANIMATE_INFO
*)COMCTL32_Alloc (sizeof(ANIMATE_INFO
));
213 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
215 if (infoPtr
== NULL
) {
216 ERR (animate
, "could not allocate info memory!\n");
220 if ((ANIMATE_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
221 ERR (animate
, "pointer assignment error!\n");
225 /* set default settings */
233 ANIMATE_Destroy (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
235 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
239 ANIMATE_Free (infoPtr
);
241 /* free animate info data */
242 COMCTL32_Free (infoPtr
);
250 ANIMATE_EraseBackground (WND
*wndPtr
, WPARAM32 wParam
, LPARAM lParam
)
252 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
254 HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
257 GetClientRect32 (wndPtr->hwndSelf, &rect);
258 FillRect32 ((HDC32)wParam, &rect, hBrush);
259 DeleteObject32 (hBrush);
268 ANIMATE_WindowProc (HWND32 hwnd
, UINT32 uMsg
, WPARAM32 wParam
, LPARAM lParam
)
270 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
275 return ANIMATE_Open32A (wndPtr
, wParam
, lParam
);
278 // return ANIMATE_Open32W (wndPtr, wParam, lParam);
281 return ANIMATE_Play (wndPtr
, wParam
, lParam
);
284 return ANIMATE_Stop (wndPtr
, wParam
, lParam
);
288 return ANIMATE_Create (wndPtr
, wParam
, lParam
);
291 return ANIMATE_Destroy (wndPtr
, wParam
, lParam
);
293 // case WM_ERASEBKGND:
294 // return ANIMATE_EraseBackground (wndPtr, wParam, lParam);
297 // case WM_NCHITTEST:
300 // case WM_STYLECHANGED:
305 ERR (animate
, "unknown msg %04x wp=%08x lp=%08lx\n",
306 uMsg
, wParam
, lParam
);
307 return DefWindowProc32A (hwnd
, uMsg
, wParam
, lParam
);
314 ANIMATE_Register (VOID
)
316 WNDCLASS32A wndClass
;
318 if (GlobalFindAtom32A (ANIMATE_CLASS32A
)) return;
320 ZeroMemory (&wndClass
, sizeof(WNDCLASS32A
));
321 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
322 wndClass
.lpfnWndProc
= (WNDPROC32
)ANIMATE_WindowProc
;
323 wndClass
.cbClsExtra
= 0;
324 wndClass
.cbWndExtra
= sizeof(ANIMATE_INFO
*);
325 wndClass
.hCursor
= LoadCursor32A (0, IDC_ARROW32A
);
326 wndClass
.hbrBackground
= (HBRUSH32
)(COLOR_BTNFACE
+ 1);
327 wndClass
.lpszClassName
= ANIMATE_CLASS32A
;
329 RegisterClass32A (&wndClass
);
334 ANIMATE_Unregister (VOID
)
336 if (GlobalFindAtom32A (ANIMATE_CLASS32A
))
337 UnregisterClass32A (ANIMATE_CLASS32A
, (HINSTANCE32
)NULL
);