source: trunk/src/comctl32/flatsb.c@ 6502

Last change on this file since 6502 was 5416, checked in by sandervl, 24 years ago

Resync with Wine + previous merge fixes

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