Release 980913
[wine/multimedia.git] / dlls / comctl32 / animate.c
blob9303711f1928245af04f1d4ff9c89832dedb65ad
1 /*
2 * Animation control
4 * Copyright 1998 Eric Kohl
6 * NOTES
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>
11 * TODO:
12 * - All messages.
13 * - All notifications.
16 #include "windows.h"
17 #include "commctrl.h"
18 #include "animate.h"
19 #include "win.h"
20 #include "debug.h"
23 #define ANIMATE_GetInfoPtr(wndPtr) ((ANIMATE_INFO *)wndPtr->wExtra[0])
26 static LRESULT
27 ANIMATE_Open32A (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
29 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr);
31 if (!lParam) {
33 FIXME (animate, "close avi: empty stub!\n");
35 return TRUE;
38 if (HIWORD(lParam)) {
40 FIXME (animate, "(\"%s\") empty stub!\n", (LPSTR)lParam);
43 else {
45 FIXME (animate, "(%u) empty stub!\n", (WORD)LOWORD(lParam));
50 return TRUE;
54 static LRESULT
55 ANIMATE_Play (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
57 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr);
58 INT32 nFrom = (INT32)LOWORD(lParam);
59 INT32 nTo = (INT32)HIWORD(lParam);
60 INT32 nRepeat = (INT32)wParam;
62 #if 0
63 /* nothing opened */
64 if (...)
65 return FALSE;
66 #endif
68 if (nRepeat == -1) {
70 FIXME (animate, "(loop from=%d to=%d) empty stub!\n",
71 nFrom, nTo);
74 else {
76 FIXME (animate, "(repeat=%d from=%d to=%d) empty stub!\n",
77 nRepeat, nFrom, nTo);
82 return TRUE;
86 static LRESULT
87 ANIMATE_Stop (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
89 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr);
91 #if 0
92 /* nothing opened */
93 if (...)
94 return FALSE;
95 #endif
97 return TRUE;
102 static LRESULT
103 ANIMATE_Create (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
105 ANIMATE_INFO *infoPtr;
107 /* allocate memory for info structure */
108 infoPtr = (ANIMATE_INFO *)COMCTL32_Alloc (sizeof(ANIMATE_INFO));
109 wndPtr->wExtra[0] = (DWORD)infoPtr;
111 if (infoPtr == NULL) {
112 ERR (animate, "could not allocate info memory!\n");
113 return 0;
116 if ((ANIMATE_INFO*)wndPtr->wExtra[0] != infoPtr) {
117 ERR (animate, "pointer assignment error!\n");
118 return 0;
121 /* set default settings */
124 return 0;
128 static LRESULT
129 ANIMATE_Destroy (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
131 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr);
136 /* free animate info data */
137 COMCTL32_Free (infoPtr);
139 return 0;
143 #if 0
144 static LRESULT
145 ANIMATE_EraseBackground (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
147 ANIMATE_INFO *infoPtr = ANIMATE_GetInfoPtr(wndPtr);
149 HBRUSH32 hBrush = CreateSolidBrush32 (infoPtr->clrBk);
150 RECT32 rect;
152 GetClientRect32 (wndPtr->hwndSelf, &rect);
153 FillRect32 ((HDC32)wParam, &rect, hBrush);
154 DeleteObject32 (hBrush);
156 return TRUE;
158 #endif
162 LRESULT WINAPI
163 ANIMATE_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
165 WND *wndPtr = WIN_FindWndPtr(hwnd);
167 switch (uMsg)
169 case ACM_OPEN32A:
170 return ANIMATE_Open32A (wndPtr, wParam, lParam);
172 // case ACM_OPEN32W:
173 // return ANIMATE_Open32W (wndPtr, wParam, lParam);
175 case ACM_PLAY:
176 return ANIMATE_Play (wndPtr, wParam, lParam);
178 case ACM_STOP:
179 return ANIMATE_Stop (wndPtr, wParam, lParam);
182 case WM_CREATE:
183 return ANIMATE_Create (wndPtr, wParam, lParam);
185 case WM_DESTROY:
186 return ANIMATE_Destroy (wndPtr, wParam, lParam);
188 // case WM_ERASEBKGND:
189 // return ANIMATE_EraseBackground (wndPtr, wParam, lParam);
191 // case WM_NCCREATE:
192 // case WM_NCHITTEST:
193 // case WM_PAINT:
194 // case WM_SIZE:
195 // case WM_STYLECHANGED:
196 // case WM_TIMER:
198 default:
199 if (uMsg >= WM_USER)
200 ERR (animate, "unknown msg %04x wp=%08x lp=%08lx\n",
201 uMsg, wParam, lParam);
202 return DefWindowProc32A (hwnd, uMsg, wParam, lParam);
204 return 0;
208 void
209 ANIMATE_Register (void)
211 WNDCLASS32A wndClass;
213 if (GlobalFindAtom32A (ANIMATE_CLASS32A)) return;
215 ZeroMemory (&wndClass, sizeof(WNDCLASS32A));
216 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS;
217 wndClass.lpfnWndProc = (WNDPROC32)ANIMATE_WindowProc;
218 wndClass.cbClsExtra = 0;
219 wndClass.cbWndExtra = sizeof(ANIMATE_INFO *);
220 wndClass.hCursor = LoadCursor32A (0, IDC_ARROW32A);
221 wndClass.hbrBackground = (HBRUSH32)(COLOR_BTNFACE + 1);
222 wndClass.lpszClassName = ANIMATE_CLASS32A;
224 RegisterClass32A (&wndClass);