2 * Flat Scrollbar control
4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 1998 Alex Priem
8 * This is just a dummy control. An author is needed! Any volunteers?
9 * I will only improve this control once in a while.
10 * Eric <ekohl@abo.rhein-zeitung.de>
14 * - All notifications.
22 #include "debugtools.h"
24 DEFAULT_DEBUG_CHANNEL(commctrl)
27 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
30 /***********************************************************************
33 * returns nonzero if successful, zero otherwise
36 BOOL WINAPI InitializeFlatSB(HWND hwnd)
38 TRACE("[%04x]\n", hwnd);
43 /***********************************************************************
47 * E_FAIL if one of the scroll bars is currently in use
48 * S_FALSE if InitializeFlatSB was never called on this hwnd
52 HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
54 TRACE("[%04x]\n", hwnd);
59 /***********************************************************************
60 * FlatSB_GetScrollProp
62 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
63 * the return is nonzero if InitializeFlatSB has been called for this window, or
68 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
70 TRACE("[%04x] propIndex=%d\n", hwnd, propIndex);
75 /***********************************************************************
76 * FlatSB_SetScrollProp
79 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
81 TRACE("[%04x] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
86 /***********************************************************************
87 * From the Microsoft docs:
88 * "If flat scroll bars haven't been initialized for the
89 * window, the flat scroll bar APIs will defer to the corresponding
90 * standard APIs. This allows the developer to turn flat scroll
91 * bars on and off without having to write conditional code."
93 * So, if we just call the standard functions until we implement
94 * the flat scroll bar functions, flat scroll bars will show up and
95 * behave properly, as though they had simply not been setup to
96 * have flat properties.
98 * Susan <sfarley@codeweavers.com>
102 /***********************************************************************
103 * FlatSB_EnableScrollBar
106 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
108 return EnableScrollBar(hwnd, nBar, flags);
111 /***********************************************************************
112 * FlatSB_ShowScrollBar
115 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
117 return ShowScrollBar(hwnd, nBar, fShow);
120 /***********************************************************************
121 * FlatSB_GetScrollRange
124 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
126 return GetScrollRange(hwnd, nBar, min, max);
129 /***********************************************************************
130 * FlatSB_GetScrollInfo
133 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
135 return GetScrollInfo(hwnd, nBar, info);
138 /***********************************************************************
139 * FlatSB_GetScrollPos
142 FlatSB_GetScrollPos(HWND hwnd, int nBar)
144 return GetScrollPos(hwnd, nBar);
147 /***********************************************************************
148 * FlatSB_SetScrollPos
151 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
153 return SetScrollPos(hwnd, nBar, pos, bRedraw);
156 /***********************************************************************
157 * FlatSB_SetScrollInfo
160 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
162 return SetScrollInfo(hwnd, nBar, info, bRedraw);
165 /***********************************************************************
166 * FlatSB_SetScrollRange
169 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
171 return SetScrollRange(hwnd, nBar, min, max, bRedraw);
176 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
178 TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
184 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
186 TRACE("[%04x] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
191 static LRESULT WINAPI
192 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
197 return FlatSB_Create (hwnd, wParam, lParam);
200 return FlatSB_Destroy (hwnd, wParam, lParam);
204 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
205 uMsg, wParam, lParam);
206 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
213 FLATSB_Register (void)
217 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
218 wndClass.style = CS_GLOBALCLASS;
219 wndClass.lpfnWndProc = (WNDPROC)FlatSB_WindowProc;
220 wndClass.cbClsExtra = 0;
221 wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
222 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
223 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
224 wndClass.lpszClassName = FLATSB_CLASSA;
226 RegisterClassA (&wndClass);
231 FLATSB_Unregister (void)
233 UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL);