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

Last change on this file since 6644 was 6644, checked in by bird, 24 years ago

Added $Id:$ keyword.

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