Release 20030408.
[wine/gsoc-2012-control.git] / dlls / comctl32 / flatsb.c
bloba348a066d17e4ac1f602066935dcd3d0a3569c84
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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 <string.h>
33 #include "winbase.h"
34 #include "winerror.h"
35 #include "commctrl.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
40 typedef struct
42 DWORD dwDummy; /* just to keep the compiler happy ;-) */
43 } FLATSB_INFO, *LPFLATSB_INFO;
45 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
48 /***********************************************************************
49 * InitializeFlatSB (COMCTL32.@)
51 * returns nonzero if successful, zero otherwise
54 BOOL WINAPI InitializeFlatSB(HWND hwnd)
56 TRACE("[%p]\n", hwnd);
57 FIXME("stub\n");
58 return FALSE;
61 /***********************************************************************
62 * UninitializeFlatSB (COMCTL32.@)
64 * returns:
65 * E_FAIL if one of the scroll bars is currently in use
66 * S_FALSE if InitializeFlatSB was never called on this hwnd
67 * S_OK otherwise
70 HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
72 TRACE("[%p]\n", hwnd);
73 FIXME("stub\n");
74 return S_FALSE;
77 /***********************************************************************
78 * FlatSB_GetScrollProp (COMCTL32.@)
80 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
81 * the return is nonzero if InitializeFlatSB has been called for this window, or
82 * zero otherwise.
85 BOOL WINAPI
86 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
88 TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
89 FIXME("stub\n");
90 return FALSE;
93 /***********************************************************************
94 * FlatSB_SetScrollProp (COMCTL32.@)
96 BOOL WINAPI
97 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
99 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
100 FIXME("stub\n");
101 return FALSE;
104 /***********************************************************************
105 * From the Microsoft docs:
106 * "If flat scroll bars haven't been initialized for the
107 * window, the flat scroll bar APIs will defer to the corresponding
108 * standard APIs. This allows the developer to turn flat scroll
109 * bars on and off without having to write conditional code."
111 * So, if we just call the standard functions until we implement
112 * the flat scroll bar functions, flat scroll bars will show up and
113 * behave properly, as though they had simply not been setup to
114 * have flat properties.
116 * Susan <sfarley@codeweavers.com>
120 /***********************************************************************
121 * FlatSB_EnableScrollBar (COMCTL32.@)
123 BOOL WINAPI
124 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
126 return EnableScrollBar(hwnd, nBar, flags);
129 /***********************************************************************
130 * FlatSB_ShowScrollBar (COMCTL32.@)
132 BOOL WINAPI
133 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
135 return ShowScrollBar(hwnd, nBar, fShow);
138 /***********************************************************************
139 * FlatSB_GetScrollRange (COMCTL32.@)
141 BOOL WINAPI
142 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
144 return GetScrollRange(hwnd, nBar, min, max);
147 /***********************************************************************
148 * FlatSB_GetScrollInfo (COMCTL32.@)
150 BOOL WINAPI
151 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
153 return GetScrollInfo(hwnd, nBar, info);
156 /***********************************************************************
157 * FlatSB_GetScrollPos (COMCTL32.@)
159 INT WINAPI
160 FlatSB_GetScrollPos(HWND hwnd, int nBar)
162 return GetScrollPos(hwnd, nBar);
165 /***********************************************************************
166 * FlatSB_SetScrollPos (COMCTL32.@)
168 INT WINAPI
169 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
171 return SetScrollPos(hwnd, nBar, pos, bRedraw);
174 /***********************************************************************
175 * FlatSB_SetScrollInfo (COMCTL32.@)
177 INT WINAPI
178 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
180 return SetScrollInfo(hwnd, nBar, info, bRedraw);
183 /***********************************************************************
184 * FlatSB_SetScrollRange (COMCTL32.@)
186 INT WINAPI
187 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
189 return SetScrollRange(hwnd, nBar, min, max, bRedraw);
193 static LRESULT
194 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
196 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
197 return 0;
201 static LRESULT
202 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
204 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
205 return 0;
209 static LRESULT WINAPI
210 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
212 if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
213 return DefWindowProcA( hwnd, uMsg, wParam, lParam );
215 switch (uMsg)
217 case WM_CREATE:
218 return FlatSB_Create (hwnd, wParam, lParam);
220 case WM_DESTROY:
221 return FlatSB_Destroy (hwnd, wParam, lParam);
223 default:
224 if ((uMsg >= WM_USER) && (uMsg < WM_APP))
225 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
226 uMsg, wParam, lParam);
227 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
229 return 0;
233 VOID
234 FLATSB_Register (void)
236 WNDCLASSA wndClass;
238 ZeroMemory (&wndClass, sizeof(WNDCLASSA));
239 wndClass.style = CS_GLOBALCLASS;
240 wndClass.lpfnWndProc = (WNDPROC)FlatSB_WindowProc;
241 wndClass.cbClsExtra = 0;
242 wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
243 wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
244 wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
245 wndClass.lpszClassName = FLATSB_CLASSA;
247 RegisterClassA (&wndClass);
251 VOID
252 FLATSB_Unregister (void)
254 UnregisterClassA (FLATSB_CLASSA, NULL);