msvcrt: Use fpclass constants from public header.
[wine/zf.git] / dlls / comctl32 / flatsb.c
blob66e25c307fac120f96432d87687b02fdbcfda7ef
1 /*
2 * Flat Scrollbar control
4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 1998 Alex Priem
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.
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.
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
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>
26 * TODO:
27 * - All messages.
28 * - All notifications.
32 #include <stdarg.h>
33 #include <string.h>
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winerror.h"
37 #include "winuser.h"
38 #include "commctrl.h"
39 #include "comctl32.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
44 typedef struct
46 DWORD dwDummy; /* just to keep the compiler happy ;-) */
47 } FLATSB_INFO, *LPFLATSB_INFO;
50 /***********************************************************************
51 * InitializeFlatSB (COMCTL32.@)
53 * Initializes flat scroll bars for the specified window.
55 * RETURNS
56 * Success: Non-zero
57 * Failure: Zero
59 * NOTES
60 * Subclasses specified window so that flat scroll bars may be drawn
61 * and used.
63 BOOL WINAPI InitializeFlatSB(HWND hwnd)
65 TRACE("[%p]\n", hwnd);
66 return TRUE;
69 /***********************************************************************
70 * UninitializeFlatSB (COMCTL32.@)
72 * Uninitializes flat scroll bars for the specified window.
74 * RETURNS
75 * E_FAIL if one of the scroll bars is currently in use
76 * S_FALSE if InitializeFlatSB() was never called on this hwnd
77 * S_OK otherwise
79 * NOTES
80 * Removes any subclassing on the specified window so that regular
81 * scroll bars are drawn and used.
83 HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
85 TRACE("[%p]\n", hwnd);
86 return S_FALSE;
89 /***********************************************************************
90 * FlatSB_GetScrollProp (COMCTL32.@)
92 * Retrieves flat-scroll-bar-specific properties for the specified window.
94 * RETURNS
95 * nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
96 * the return is nonzero if InitializeFlatSB has been called for this window, or
97 * zero otherwise.
99 BOOL WINAPI
100 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
102 TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
103 return FALSE;
106 /***********************************************************************
107 * FlatSB_SetScrollProp (COMCTL32.@)
109 * Sets flat-scroll-bar-specific properties for the specified window.
111 * RETURNS
112 * Success: Non-zero
113 * Failure: Zero
115 BOOL WINAPI
116 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
118 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
119 return FALSE;
122 /***********************************************************************
123 * From the Microsoft docs:
124 * "If flat scroll bars haven't been initialized for the
125 * window, the flat scroll bar APIs will defer to the corresponding
126 * standard APIs. This allows the developer to turn flat scroll
127 * bars on and off without having to write conditional code."
129 * So, if we just call the standard functions until we implement
130 * the flat scroll bar functions, flat scroll bars will show up and
131 * behave properly, as though they had simply not been setup to
132 * have flat properties.
134 * Susan <sfarley@codeweavers.com>
138 /***********************************************************************
139 * FlatSB_EnableScrollBar (COMCTL32.@)
141 * See EnableScrollBar.
143 BOOL WINAPI
144 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
146 return EnableScrollBar(hwnd, nBar, flags);
149 /***********************************************************************
150 * FlatSB_ShowScrollBar (COMCTL32.@)
152 * See ShowScrollBar.
154 BOOL WINAPI
155 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
157 return ShowScrollBar(hwnd, nBar, fShow);
160 /***********************************************************************
161 * FlatSB_GetScrollRange (COMCTL32.@)
163 * See GetScrollRange.
165 BOOL WINAPI
166 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
168 return GetScrollRange(hwnd, nBar, min, max);
171 /***********************************************************************
172 * FlatSB_GetScrollInfo (COMCTL32.@)
174 * See GetScrollInfo.
176 BOOL WINAPI
177 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
179 return GetScrollInfo(hwnd, nBar, info);
182 /***********************************************************************
183 * FlatSB_GetScrollPos (COMCTL32.@)
185 * See GetScrollPos.
187 INT WINAPI
188 FlatSB_GetScrollPos(HWND hwnd, int nBar)
190 return GetScrollPos(hwnd, nBar);
193 /***********************************************************************
194 * FlatSB_SetScrollPos (COMCTL32.@)
196 * See SetScrollPos.
198 INT WINAPI
199 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
201 return SetScrollPos(hwnd, nBar, pos, bRedraw);
204 /***********************************************************************
205 * FlatSB_SetScrollInfo (COMCTL32.@)
207 * See SetScrollInfo.
209 INT WINAPI
210 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
212 return SetScrollInfo(hwnd, nBar, info, bRedraw);
215 /***********************************************************************
216 * FlatSB_SetScrollRange (COMCTL32.@)
218 * See SetScrollRange.
220 INT WINAPI
221 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
223 return SetScrollRange(hwnd, nBar, min, max, bRedraw);
227 static LRESULT
228 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
230 TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
231 return 0;
235 static LRESULT
236 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
238 TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
239 return 0;
243 static LRESULT WINAPI
244 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
246 if (!GetWindowLongPtrW(hwnd, 0) && (uMsg != WM_CREATE))
247 return DefWindowProcW( hwnd, uMsg, wParam, lParam );
249 switch (uMsg)
251 case WM_CREATE:
252 return FlatSB_Create (hwnd, wParam, lParam);
254 case WM_DESTROY:
255 return FlatSB_Destroy (hwnd, wParam, lParam);
257 default:
258 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
259 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
260 uMsg, wParam, lParam);
261 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
266 VOID
267 FLATSB_Register (void)
269 WNDCLASSW wndClass;
271 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
272 wndClass.style = CS_GLOBALCLASS;
273 wndClass.lpfnWndProc = FlatSB_WindowProc;
274 wndClass.cbClsExtra = 0;
275 wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
276 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
277 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
278 wndClass.lpszClassName = FLATSB_CLASSW;
280 RegisterClassW (&wndClass);
284 VOID
285 FLATSB_Unregister (void)
287 UnregisterClassW (FLATSB_CLASSW, NULL);