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.
22 #define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0])
26 ANIMATE_LoadResA (ANIMATE_INFO
*infoPtr
, HINSTANCE hInst
, LPSTR lpName
)
31 hrsrc
= FindResourceA (hInst
, lpName
, "AVI");
35 handle
= LoadResource (hInst
, hrsrc
);
39 infoPtr
->lpAvi
= LockResource (handle
);
48 ANIMATE_LoadFileA (ANIMATE_INFO
*infoPtr
, LPSTR lpName
)
53 CreateFileA (lpName
, GENERIC_READ
, 0, NULL
, OPEN_EXISTING
,
54 FILE_ATTRIBUTE_NORMAL
, 0);
59 CreateFileMappingA (infoPtr
->hFile
, NULL
, PAGE_READONLY
| SEC_COMMIT
,
62 CloseHandle (infoPtr
->hFile
);
67 infoPtr
->lpAvi
= MapViewOfFile (handle
, FILE_MAP_READ
, 0, 0, 0);
68 if (!infoPtr
->lpAvi
) {
69 CloseHandle (infoPtr
->hFile
);
79 ANIMATE_Free (ANIMATE_INFO
*infoPtr
)
82 UnmapViewOfFile (infoPtr
->lpAvi
);
83 CloseHandle (infoPtr
->hFile
);
84 infoPtr
->lpAvi
= NULL
;
87 GlobalFree ((HGLOBAL
)infoPtr
->lpAvi
);
88 infoPtr
->lpAvi
= NULL
;
94 ANIMATE_GetAviInfo (infoPtr
)
102 ANIMATE_OpenA (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
104 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
105 HINSTANCE hInstance
= (HINSTANCE
)wParam
;
107 ANIMATE_Free (infoPtr
);
110 TRACE (animate
, "closing avi!\n");
114 if (HIWORD(lParam
)) {
115 FIXME (animate
, "(\"%s\") empty stub!\n", (LPSTR
)lParam
);
117 if (ANIMATE_LoadResA (infoPtr
, hInstance
, (LPSTR
)lParam
)) {
119 FIXME (animate
, "AVI resource found!\n");
123 FIXME (animate
, "No AVI resource found!\n");
124 if (ANIMATE_LoadFileA (infoPtr
, (LPSTR
)lParam
)) {
125 FIXME (animate
, "AVI file found!\n");
128 FIXME (animate
, "No AVI file found!\n");
134 FIXME (animate
, "(%u) empty stub!\n", (WORD
)LOWORD(lParam
));
136 if (ANIMATE_LoadResA (infoPtr
, hInstance
,
137 MAKEINTRESOURCEA((INT
)lParam
))) {
138 FIXME (animate
, "AVI resource found!\n");
141 FIXME (animate
, "No AVI resource found!\n");
146 ANIMATE_GetAviInfo (infoPtr
);
152 /* << ANIMATE_Open32W >> */
156 ANIMATE_Play (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
158 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); */
159 INT nFrom
= (INT
)LOWORD(lParam
);
160 INT nTo
= (INT
)HIWORD(lParam
);
161 INT nRepeat
= (INT
)wParam
;
171 FIXME (animate
, "(loop from=%d to=%d) empty stub!\n",
177 FIXME (animate
, "(repeat=%d from=%d to=%d) empty stub!\n",
178 nRepeat
, nFrom
, nTo
);
188 ANIMATE_Stop (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
190 /* ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr); */
204 ANIMATE_Create (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
206 ANIMATE_INFO
*infoPtr
;
208 /* allocate memory for info structure */
209 infoPtr
= (ANIMATE_INFO
*)COMCTL32_Alloc (sizeof(ANIMATE_INFO
));
210 wndPtr
->wExtra
[0] = (DWORD
)infoPtr
;
212 if (infoPtr
== NULL
) {
213 ERR (animate
, "could not allocate info memory!\n");
217 if ((ANIMATE_INFO
*)wndPtr
->wExtra
[0] != infoPtr
) {
218 ERR (animate
, "pointer assignment error!\n");
222 /* set default settings */
230 ANIMATE_Destroy (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
232 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
236 ANIMATE_Free (infoPtr
);
238 /* free animate info data */
239 COMCTL32_Free (infoPtr
);
247 ANIMATE_EraseBackground (WND
*wndPtr
, WPARAM wParam
, LPARAM lParam
)
249 ANIMATE_INFO
*infoPtr
= ANIMATE_GetInfoPtr(wndPtr
);
251 HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
254 GetClientRect32 (wndPtr->hwndSelf, &rect);
255 FillRect32 ((HDC32)wParam, &rect, hBrush);
256 DeleteObject32 (hBrush);
265 ANIMATE_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
267 WND
*wndPtr
= WIN_FindWndPtr(hwnd
);
272 return ANIMATE_OpenA (wndPtr
, wParam
, lParam
);
274 /* case ACM_OPEN32W: */
275 /* return ANIMATE_Open32W (wndPtr, wParam, lParam); */
278 return ANIMATE_Play (wndPtr
, wParam
, lParam
);
281 return ANIMATE_Stop (wndPtr
, wParam
, lParam
);
285 return ANIMATE_Create (wndPtr
, wParam
, lParam
);
288 return ANIMATE_Destroy (wndPtr
, wParam
, lParam
);
290 /* case WM_ERASEBKGND: */
291 /* return ANIMATE_EraseBackground (wndPtr, wParam, lParam); */
293 /* case WM_NCCREATE: */
294 /* case WM_NCHITTEST: */
297 /* case WM_STYLECHANGED: */
302 ERR (animate
, "unknown msg %04x wp=%08x lp=%08lx\n",
303 uMsg
, wParam
, lParam
);
304 return DefWindowProcA (hwnd
, uMsg
, wParam
, lParam
);
311 ANIMATE_Register (VOID
)
315 if (GlobalFindAtomA (ANIMATE_CLASSA
)) return;
317 ZeroMemory (&wndClass
, sizeof(WNDCLASSA
));
318 wndClass
.style
= CS_GLOBALCLASS
| CS_DBLCLKS
;
319 wndClass
.lpfnWndProc
= (WNDPROC
)ANIMATE_WindowProc
;
320 wndClass
.cbClsExtra
= 0;
321 wndClass
.cbWndExtra
= sizeof(ANIMATE_INFO
*);
322 wndClass
.hCursor
= LoadCursorA (0, IDC_ARROWA
);
323 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_BTNFACE
+ 1);
324 wndClass
.lpszClassName
= ANIMATE_CLASSA
;
326 RegisterClassA (&wndClass
);
331 ANIMATE_Unregister (VOID
)
333 if (GlobalFindAtomA (ANIMATE_CLASSA
))
334 UnregisterClassA (ANIMATE_CLASSA
, (HINSTANCE
)NULL
);