1 /* 2 * Flat Scrollbar control 3 * 4 * Copyright 1998, 1999 Eric Kohl 5 * Copyright 1998 Alex Priem 6 * 7 * This library is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This library is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License for more details. 16 * 17 * You should have received a copy of the GNU Lesser General Public 18 * License along with this library; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 20 * 21 * NOTES 22 * This is just a dummy control. An author is needed! Any volunteers? 23 * I will only improve this control once in a while. 24 * Eric <ekohl@abo.rhein-zeitung.de> 25 * 26 * TODO: 27 * - All messages. 28 * - All notifications. 29 * 30 */ 31 32 #include "comctl32.h" 33 34 WINE_DEFAULT_DEBUG_CHANNEL(commctrl); 35 36 typedef struct 37 { 38 DWORD dwDummy; /* just to keep the compiler happy ;-) */ 39 } FLATSB_INFO, *LPFLATSB_INFO; 40 41 42 /*********************************************************************** 43 * InitializeFlatSB (COMCTL32.@) 44 * 45 * Initializes flat scroll bars for the specified window. 46 * 47 * RETURNS 48 * Success: Non-zero 49 * Failure: Zero 50 * 51 * NOTES 52 * Subclasses specified window so that flat scroll bars may be drawn 53 * and used. 54 */ 55 BOOL WINAPI InitializeFlatSB(HWND hwnd) 56 { 57 TRACE("[%p]\n", hwnd); 58 return TRUE; 59 } 60 61 /*********************************************************************** 62 * UninitializeFlatSB (COMCTL32.@) 63 * 64 * Uninitializes flat scroll bars for the specified window. 65 * 66 * RETURNS 67 * E_FAIL if one of the scroll bars is currently in use 68 * S_FALSE if InitializeFlatSB() was never called on this hwnd 69 * S_OK otherwise 70 * 71 * NOTES 72 * Removes any subclassing on the specified window so that regular 73 * scroll bars are drawn and used. 74 */ 75 HRESULT WINAPI UninitializeFlatSB(HWND hwnd) 76 { 77 TRACE("[%p]\n", hwnd); 78 return S_FALSE; 79 } 80 81 /*********************************************************************** 82 * FlatSB_GetScrollProp (COMCTL32.@) 83 * 84 * Retrieves flat-scroll-bar-specific properties for the specified window. 85 * 86 * RETURNS 87 * nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE, 88 * the return is nonzero if InitializeFlatSB has been called for this window, or 89 * zero otherwise. 90 */ 91 BOOL WINAPI 92 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop) 93 { 94 TRACE("[%p] propIndex=%d\n", hwnd, propIndex); 95 return FALSE; 96 } 97 98 /*********************************************************************** 99 * FlatSB_SetScrollProp (COMCTL32.@) 100 * 101 * Sets flat-scroll-bar-specific properties for the specified window. 102 * 103 * RETURNS 104 * Success: Non-zero 105 * Failure: Zero 106 */ 107 BOOL WINAPI 108 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag) 109 { 110 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag); 111 return FALSE; 112 } 113 114 /*********************************************************************** 115 * From the Microsoft docs: 116 * "If flat scroll bars haven't been initialized for the 117 * window, the flat scroll bar APIs will defer to the corresponding 118 * standard APIs. This allows the developer to turn flat scroll 119 * bars on and off without having to write conditional code." 120 * 121 * So, if we just call the standard functions until we implement 122 * the flat scroll bar functions, flat scroll bars will show up and 123 * behave properly, as though they had simply not been setup to 124 * have flat properties. 125 * 126 * Susan <sfarley@codeweavers.com> 127 * 128 */ 129 130 /*********************************************************************** 131 * FlatSB_EnableScrollBar (COMCTL32.@) 132 * 133 * See EnableScrollBar. 134 */ 135 BOOL WINAPI 136 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags) 137 { 138 return EnableScrollBar(hwnd, nBar, flags); 139 } 140 141 /*********************************************************************** 142 * FlatSB_ShowScrollBar (COMCTL32.@) 143 * 144 * See ShowScrollBar. 145 */ 146 BOOL WINAPI 147 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow) 148 { 149 return ShowScrollBar(hwnd, nBar, fShow); 150 } 151 152 /*********************************************************************** 153 * FlatSB_GetScrollRange (COMCTL32.@) 154 * 155 * See GetScrollRange. 156 */ 157 BOOL WINAPI 158 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max) 159 { 160 return GetScrollRange(hwnd, nBar, min, max); 161 } 162 163 /*********************************************************************** 164 * FlatSB_GetScrollInfo (COMCTL32.@) 165 * 166 * See GetScrollInfo. 167 */ 168 BOOL WINAPI 169 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info) 170 { 171 return GetScrollInfo(hwnd, nBar, info); 172 } 173 174 /*********************************************************************** 175 * FlatSB_GetScrollPos (COMCTL32.@) 176 * 177 * See GetScrollPos. 178 */ 179 INT WINAPI 180 FlatSB_GetScrollPos(HWND hwnd, int nBar) 181 { 182 return GetScrollPos(hwnd, nBar); 183 } 184 185 /*********************************************************************** 186 * FlatSB_SetScrollPos (COMCTL32.@) 187 * 188 * See SetScrollPos. 189 */ 190 INT WINAPI 191 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw) 192 { 193 return SetScrollPos(hwnd, nBar, pos, bRedraw); 194 } 195 196 /*********************************************************************** 197 * FlatSB_SetScrollInfo (COMCTL32.@) 198 * 199 * See SetScrollInfo. 200 */ 201 INT WINAPI 202 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw) 203 { 204 return SetScrollInfo(hwnd, nBar, info, bRedraw); 205 } 206 207 /*********************************************************************** 208 * FlatSB_SetScrollRange (COMCTL32.@) 209 * 210 * See SetScrollRange. 211 */ 212 INT WINAPI 213 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw) 214 { 215 return SetScrollRange(hwnd, nBar, min, max, bRedraw); 216 } 217 218 219 static LRESULT 220 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam) 221 { 222 TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam); 223 return 0; 224 } 225 226 227 static LRESULT 228 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam) 229 { 230 TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam); 231 return 0; 232 } 233 234 235 static LRESULT WINAPI 236 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 237 { 238 if (!GetWindowLongPtrW(hwnd, 0) && (uMsg != WM_CREATE)) 239 return DefWindowProcW( hwnd, uMsg, wParam, lParam ); 240 241 switch (uMsg) 242 { 243 case WM_CREATE: 244 return FlatSB_Create (hwnd, wParam, lParam); 245 246 case WM_DESTROY: 247 return FlatSB_Destroy (hwnd, wParam, lParam); 248 249 default: 250 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) 251 ERR("unknown msg %04x wp=%08lx lp=%08lx\n", 252 uMsg, wParam, lParam); 253 return DefWindowProcW (hwnd, uMsg, wParam, lParam); 254 } 255 } 256 257 258 VOID 259 FLATSB_Register (void) 260 { 261 WNDCLASSW wndClass; 262 263 ZeroMemory (&wndClass, sizeof(WNDCLASSW)); 264 wndClass.style = CS_GLOBALCLASS; 265 wndClass.lpfnWndProc = FlatSB_WindowProc; 266 wndClass.cbClsExtra = 0; 267 wndClass.cbWndExtra = sizeof(FLATSB_INFO *); 268 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); 269 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); 270 wndClass.lpszClassName = FLATSB_CLASSW; 271 272 RegisterClassW (&wndClass); 273 } 274 275 276 VOID 277 FLATSB_Unregister (void) 278 { 279 UnregisterClassW (FLATSB_CLASSW, NULL); 280 } 281