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 #define PAGER_GetInfoPtr(hwnd) ((PAGER_INFO *)GetWindowLongA(hwnd, 0))
25 static __inline__ LRESULT
26 PAGER_ForwardMouse (HWND hwnd, WPARAM wParam)
28 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
30 infoPtr->bForward = (BOOL)wParam;
36 static __inline__ LRESULT
37 PAGER_GetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
39 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
41 return (LRESULT)infoPtr->clrBk;
45 static __inline__ LRESULT
46 PAGER_GetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
48 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
50 return (LRESULT)infoPtr->nBorder;
54 static __inline__ LRESULT
55 PAGER_GetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
57 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
59 return (LRESULT)infoPtr->nButtonSize;
64 PAGER_GetButtonState (HWND hwnd, WPARAM wParam, LPARAM lParam)
66 /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
68 FIXME (pager, "empty stub!\n");
74 /* << PAGER_GetDropTarget >> */
77 static __inline__ LRESULT
78 PAGER_GetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
80 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
87 PAGER_RecalcSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
89 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
90 DWORD dwStyle = GetWindowLongA (hwnd, GWL_STYLE);
93 if (infoPtr->hwndChild) {
94 ZeroMemory (&nmpgcs, sizeof (NMPGCALCSIZE));
95 nmpgcs.hdr.hwndFrom = hwnd;
96 nmpgcs.hdr.idFrom = GetWindowLongA (hwnd, GWL_ID);
97 nmpgcs.hdr.code = PGN_CALCSIZE;
98 nmpgcs.dwFlag = (dwStyle & PGS_HORZ) ? PGF_CALCWIDTH : PGF_CALCHEIGHT;
99 SendMessageA (GetParent (hwnd), WM_NOTIFY,
100 (WPARAM)nmpgcs.hdr.idFrom, (LPARAM)&nmpgcs);
102 infoPtr->nChildSize = (dwStyle & PGS_HORZ) ? nmpgcs.iWidth : nmpgcs.iHeight;
105 FIXME (pager, "Child size %d\n", infoPtr->nChildSize);
114 static __inline__ LRESULT
115 PAGER_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
117 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
118 COLORREF clrTemp = infoPtr->clrBk;
120 infoPtr->clrBk = (COLORREF)lParam;
124 return (LRESULT)clrTemp;
128 static __inline__ LRESULT
129 PAGER_SetBorder (HWND hwnd, WPARAM wParam, LPARAM lParam)
131 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
132 INT nTemp = infoPtr->nBorder;
134 infoPtr->nBorder = (INT)lParam;
138 return (LRESULT)nTemp;
142 static __inline__ LRESULT
143 PAGER_SetButtonSize (HWND hwnd, WPARAM wParam, LPARAM lParam)
145 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
146 INT nTemp = infoPtr->nButtonSize;
148 infoPtr->nButtonSize = (INT)lParam;
150 FIXME (pager, "size=%d\n", infoPtr->nButtonSize);
154 return (LRESULT)nTemp;
158 static __inline__ LRESULT
159 PAGER_SetChild (HWND hwnd, WPARAM wParam, LPARAM lParam)
161 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
163 infoPtr->hwndChild = IsWindow ((HWND)lParam) ? (HWND)lParam : 0;
165 FIXME (pager, "hwnd=%x\n", infoPtr->hwndChild);
168 if (infoPtr->hwndChild) {
169 SetParent (infoPtr->hwndChild, hwnd);
170 SetWindowPos (infoPtr->hwndChild, HWND_TOP,
171 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
178 static __inline__ LRESULT
179 PAGER_SetPos (HWND hwnd, WPARAM wParam, LPARAM lParam)
181 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
183 infoPtr->nPos = (INT)lParam;
185 FIXME (pager, "pos=%d\n", infoPtr->nPos);
188 SetWindowPos (infoPtr->hwndChild, HWND_TOP,
189 0, 0, 0, 0, SWP_SHOWWINDOW | SWP_NOSIZE);
196 PAGER_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
200 /* allocate memory for info structure */
201 infoPtr = (PAGER_INFO *)COMCTL32_Alloc (sizeof(PAGER_INFO));
202 SetWindowLongA (hwnd, 0, (DWORD)infoPtr);
204 /* set default settings */
205 infoPtr->hwndChild = (HWND)NULL;
206 infoPtr->clrBk = GetSysColor (COLOR_BTNFACE);
207 infoPtr->nBorder = 0;
208 infoPtr->nButtonSize = 0;
217 PAGER_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
219 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
224 /* free pager info data */
225 COMCTL32_Free (infoPtr);
232 PAGER_EraseBackground (HWND hwnd, WPARAM wParam, LPARAM lParam)
234 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
235 HBRUSH hBrush = CreateSolidBrush (infoPtr->clrBk);
238 GetClientRect (hwnd, &rect);
239 FillRect ((HDC)wParam, &rect, hBrush);
240 DeleteObject (hBrush);
248 PAGER_MouseMove (HWND hwnd, WPARAM wParam, LPARAM lParam)
250 /* PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd); */
252 TRACE (pager, "stub!\n");
258 /* << PAGER_Paint >> */
262 PAGER_Size (HWND hwnd, WPARAM wParam, LPARAM lParam)
264 PAGER_INFO *infoPtr = PAGER_GetInfoPtr (hwnd);
267 GetClientRect (hwnd, &rect);
268 if (infoPtr->hwndChild) {
269 SetWindowPos (infoPtr->hwndChild, HWND_TOP, rect.left, rect.top,
270 rect.right - rect.left, rect.bottom - rect.top,
272 /* MoveWindow32 (infoPtr->hwndChild, 1, 1, rect.right - 2, rect.bottom-2, TRUE); */
273 /* UpdateWindow32 (infoPtr->hwndChild); */
276 /* FillRect32 ((HDC32)wParam, &rect, hBrush); */
277 /* DeleteObject32 (hBrush); */
284 PAGER_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
288 case PGM_FORWARDMOUSE:
289 return PAGER_ForwardMouse (hwnd, wParam);
292 return PAGER_GetBkColor (hwnd, wParam, lParam);
295 return PAGER_GetBorder (hwnd, wParam, lParam);
297 case PGM_GETBUTTONSIZE:
298 return PAGER_GetButtonSize (hwnd, wParam, lParam);
300 case PGM_GETBUTTONSTATE:
301 return PAGER_GetButtonState (hwnd, wParam, lParam);
303 /* case PGM_GETDROPTARGET: */
306 return PAGER_SetPos (hwnd, wParam, lParam);
309 return PAGER_RecalcSize (hwnd, wParam, lParam);
312 return PAGER_SetBkColor (hwnd, wParam, lParam);
315 return PAGER_SetBorder (hwnd, wParam, lParam);
317 case PGM_SETBUTTONSIZE:
318 return PAGER_SetButtonSize (hwnd, wParam, lParam);
321 return PAGER_SetChild (hwnd, wParam, lParam);
324 return PAGER_SetPos (hwnd, wParam, lParam);
327 return PAGER_Create (hwnd, wParam, lParam);
330 return PAGER_Destroy (hwnd, wParam, lParam);
333 return PAGER_EraseBackground (hwnd, wParam, lParam);
336 return PAGER_MouseMove (hwnd, wParam, lParam);
340 return SendMessageA (GetParent (hwnd), uMsg, wParam, lParam);
343 /* return PAGER_Paint (hwnd, wParam); */
346 return PAGER_Size (hwnd, wParam, lParam);
350 ERR (pager, "unknown msg %04x wp=%08x lp=%08lx\n",
351 uMsg, wParam, lParam);
352 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
359 PAGER_Register (VOID)
363 if (GlobalFindAtomA (WC_PAGESCROLLERA)) return;
365 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
366 wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS;
367 wndClass.lpfnWndProc = (WNDPROC)PAGER_WindowProc;
368 wndClass.cbClsExtra = 0;
369 wndClass.cbWndExtra = sizeof(PAGER_INFO *);
370 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
371 wndClass.hbrBackground = 0;
372 wndClass.lpszClassName = WC_PAGESCROLLERA;
374 RegisterClassA (&wndClass);
379 PAGER_Unregister (VOID)
381 if (GlobalFindAtomA (WC_PAGESCROLLERA))
382 UnregisterClassA (WC_PAGESCROLLERA, (HINSTANCE)NULL);