Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygensmoothscroll.c
Go to the documentation of this file.
00001 /* 00002 * Undocumented SmoothScrollWindow function from COMCTL32.DLL 00003 * 00004 * Copyright 2000 Marcus Meissner <marcus@jet.franken.de> 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 * 00020 * TODO 00021 * - actually add smooth scrolling 00022 */ 00023 00024 #include <stdarg.h> 00025 00026 #include "windef.h" 00027 #include "winbase.h" 00028 #include "winreg.h" 00029 #include "winerror.h" 00030 #include "winuser.h" 00031 #include "wine/debug.h" 00032 00033 WINE_DEFAULT_DEBUG_CHANNEL(commctrl); 00034 00035 static DWORD smoothscroll = 2; 00036 00037 typedef BOOL (CALLBACK *SCROLLWINDOWEXPROC)(HWND,INT,INT,LPRECT,LPRECT,HRGN,LPRECT,DWORD); 00038 typedef struct tagSMOOTHSCROLLSTRUCT { 00039 DWORD dwSize; 00040 DWORD x2; 00041 HWND hwnd; 00042 DWORD dx; 00043 00044 DWORD dy; 00045 LPRECT lpscrollrect; 00046 LPRECT lpcliprect; 00047 HRGN hrgnupdate; 00048 00049 LPRECT lpupdaterect; 00050 DWORD flags; 00051 DWORD stepinterval; 00052 DWORD dx_step; 00053 00054 DWORD dy_step; 00055 SCROLLWINDOWEXPROC scrollfun; /* same parameters as ScrollWindowEx */ 00056 } SMOOTHSCROLLSTRUCT; 00057 00058 /************************************************************************** 00059 * SmoothScrollWindow [COMCTL32.382] 00060 * 00061 * Lots of magic for smooth scrolling windows. 00062 * 00063 * RETURNS 00064 * Success: TRUE 00065 * Failure: FALSE 00066 * 00067 * BUGS 00068 * Currently only scrolls ONCE. The comctl32 implementation uses GetTickCount 00069 * and what else to do smooth scrolling. 00070 */ 00071 BOOL WINAPI SmoothScrollWindow( const SMOOTHSCROLLSTRUCT *smooth ) { 00072 LPRECT lpupdaterect = smooth->lpupdaterect; 00073 HRGN hrgnupdate = smooth->hrgnupdate; 00074 RECT tmprect; 00075 DWORD flags = smooth->flags; 00076 00077 if (smooth->dwSize!=sizeof(SMOOTHSCROLLSTRUCT)) 00078 return FALSE; 00079 00080 if (!lpupdaterect) 00081 lpupdaterect = &tmprect; 00082 SetRectEmpty(lpupdaterect); 00083 00084 if (!(flags & 0x40000)) { /* no override, use system wide defaults */ 00085 if (smoothscroll == 2) { 00086 HKEY hkey; 00087 00088 smoothscroll = 0; 00089 if (!RegOpenKeyA(HKEY_CURRENT_USER,"Control Panel\\Desktop",&hkey)) { 00090 DWORD len = 4; 00091 00092 RegQueryValueExA(hkey,"SmoothScroll",0,0,(LPBYTE)&smoothscroll,&len); 00093 RegCloseKey(hkey); 00094 } 00095 } 00096 if (!smoothscroll) 00097 flags |= 0x20000; 00098 } 00099 00100 if (flags & 0x20000) { /* are we doing jump scrolling? */ 00101 if ((smooth->x2 & 1) && smooth->scrollfun) 00102 return smooth->scrollfun( 00103 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect, 00104 smooth->lpcliprect,hrgnupdate,lpupdaterect, 00105 flags & 0xffff 00106 ); 00107 else 00108 return ScrollWindowEx( 00109 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect, 00110 smooth->lpcliprect,hrgnupdate,lpupdaterect, 00111 flags & 0xffff 00112 ); 00113 } 00114 00115 FIXME("(hwnd=%p,flags=%x,x2=%x): should smooth scroll here.\n", 00116 smooth->hwnd,flags,smooth->x2 00117 ); 00118 /* FIXME: do timer based smooth scrolling */ 00119 if ((smooth->x2 & 1) && smooth->scrollfun) 00120 return smooth->scrollfun( 00121 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect, 00122 smooth->lpcliprect,hrgnupdate,lpupdaterect, 00123 flags & 0xffff 00124 ); 00125 else 00126 return ScrollWindowEx( 00127 smooth->hwnd,smooth->dx,smooth->dy,smooth->lpscrollrect, 00128 smooth->lpcliprect,hrgnupdate,lpupdaterect, 00129 flags & 0xffff 00130 ); 00131 } Generated on Sun May 27 2012 04:23:03 for ReactOS by
1.7.6.1
|