Removed the A/W constants for builtin cursors, icons and resource
[wine] / dlls / comctl32 / flatsb.c
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  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 <stdarg.h>
33 #include <string.h>
34 #include "windef.h"
35 #include "winbase.h"
36 #include "winerror.h"
37 #include "wingdi.h"
38 #include "winuser.h"
39 #include "winnls.h"
40 #include "commctrl.h"
41 #include "wine/debug.h"
42
43 WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
44
45 typedef struct
46 {
47     DWORD dwDummy;  /* just to keep the compiler happy ;-) */
48 } FLATSB_INFO, *LPFLATSB_INFO;
49
50 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
51
52
53 /***********************************************************************
54  *              InitializeFlatSB (COMCTL32.@)
55  *
56  *      returns nonzero if successful, zero otherwise
57  *
58  */
59 BOOL WINAPI InitializeFlatSB(HWND hwnd)
60 {
61     TRACE("[%p]\n", hwnd);
62     FIXME("stub\n");
63     return FALSE;
64 }
65
66 /***********************************************************************
67  *              UninitializeFlatSB (COMCTL32.@)
68  *
69  *      returns:
70  *      E_FAIL          if one of the scroll bars is currently in use
71  *      S_FALSE         if InitializeFlatSB was never called on this hwnd
72  *      S_OK            otherwise
73  *
74  */
75 HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
76 {
77     TRACE("[%p]\n", hwnd);
78     FIXME("stub\n");
79     return S_FALSE;
80 }
81
82 /***********************************************************************
83  *              FlatSB_GetScrollProp (COMCTL32.@)
84  *
85  *      Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
86  *      the return is nonzero if InitializeFlatSB has been called for this window, or
87  *      zero otherwise.
88  *
89  */
90 BOOL WINAPI
91 FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
92 {
93     TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
94     FIXME("stub\n");
95     return FALSE;
96 }
97
98 /***********************************************************************
99  *              FlatSB_SetScrollProp (COMCTL32.@)
100  */
101 BOOL WINAPI
102 FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
103 {
104     TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
105     FIXME("stub\n");
106     return FALSE;
107 }
108
109 /***********************************************************************
110  *      From the Microsoft docs:
111  *      "If flat scroll bars haven't been initialized for the
112  *      window, the flat scroll bar APIs will defer to the corresponding
113  *      standard APIs.  This allows the developer to turn flat scroll
114  *      bars on and off without having to write conditional code."
115  *
116  *      So, if we just call the standard functions until we implement
117  *      the flat scroll bar functions, flat scroll bars will show up and
118  *      behave properly, as though they had simply not been setup to
119  *      have flat properties.
120  *
121  *      Susan <sfarley@codeweavers.com>
122  *
123  */
124
125 /***********************************************************************
126  *              FlatSB_EnableScrollBar (COMCTL32.@)
127  */
128 BOOL WINAPI
129 FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
130 {
131     return EnableScrollBar(hwnd, nBar, flags);
132 }
133
134 /***********************************************************************
135  *              FlatSB_ShowScrollBar (COMCTL32.@)
136  */
137 BOOL WINAPI
138 FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
139 {
140     return ShowScrollBar(hwnd, nBar, fShow);
141 }
142
143 /***********************************************************************
144  *              FlatSB_GetScrollRange (COMCTL32.@)
145  */
146 BOOL WINAPI
147 FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
148 {
149     return GetScrollRange(hwnd, nBar, min, max);
150 }
151
152 /***********************************************************************
153  *              FlatSB_GetScrollInfo (COMCTL32.@)
154  */
155 BOOL WINAPI
156 FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
157 {
158     return GetScrollInfo(hwnd, nBar, info);
159 }
160
161 /***********************************************************************
162  *              FlatSB_GetScrollPos (COMCTL32.@)
163  */
164 INT WINAPI
165 FlatSB_GetScrollPos(HWND hwnd, int nBar)
166 {
167     return GetScrollPos(hwnd, nBar);
168 }
169
170 /***********************************************************************
171  *              FlatSB_SetScrollPos (COMCTL32.@)
172  */
173 INT WINAPI
174 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
175 {
176     return SetScrollPos(hwnd, nBar, pos, bRedraw);
177 }
178
179 /***********************************************************************
180  *              FlatSB_SetScrollInfo (COMCTL32.@)
181  */
182 INT WINAPI
183 FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
184 {
185     return SetScrollInfo(hwnd, nBar, info, bRedraw);
186 }
187
188 /***********************************************************************
189  *              FlatSB_SetScrollRange (COMCTL32.@)
190  */
191 INT WINAPI
192 FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
193 {
194     return SetScrollRange(hwnd, nBar, min, max, bRedraw);
195 }
196
197
198 static LRESULT
199 FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
200 {
201     TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
202     return 0;
203 }
204
205
206 static LRESULT
207 FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
208 {
209     TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
210     return 0;
211 }
212
213
214 static LRESULT WINAPI
215 FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
216 {
217     if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
218         return DefWindowProcA( hwnd, uMsg, wParam, lParam );
219
220     switch (uMsg)
221     {
222         case WM_CREATE:
223             return FlatSB_Create (hwnd, wParam, lParam);
224
225         case WM_DESTROY:
226             return FlatSB_Destroy (hwnd, wParam, lParam);
227
228         default:
229             if ((uMsg >= WM_USER) && (uMsg < WM_APP))
230                 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
231                     uMsg, wParam, lParam);
232             return DefWindowProcA (hwnd, uMsg, wParam, lParam);
233     }
234     return 0;
235 }
236
237
238 VOID
239 FLATSB_Register (void)
240 {
241     WNDCLASSA wndClass;
242
243     ZeroMemory (&wndClass, sizeof(WNDCLASSA));
244     wndClass.style         = CS_GLOBALCLASS;
245     wndClass.lpfnWndProc   = (WNDPROC)FlatSB_WindowProc;
246     wndClass.cbClsExtra    = 0;
247     wndClass.cbWndExtra    = sizeof(FLATSB_INFO *);
248     wndClass.hCursor       = LoadCursorA (0, (LPSTR)IDC_ARROW);
249     wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
250     wndClass.lpszClassName = FLATSB_CLASSA;
251
252     RegisterClassA (&wndClass);
253 }
254
255
256 VOID
257 FLATSB_Unregister (void)
258 {
259     UnregisterClassA (FLATSB_CLASSA, NULL);
260 }