source: trunk/src/comctl32/flatsb.c

Last change on this file was 10097, checked in by sandervl, 22 years ago

Wine resync

File size: 6.7 KB
RevLine 
[4611]1/*
2 * Flat Scrollbar control
3 *
4 * Copyright 1998, 1999 Eric Kohl
5 * Copyright 1998 Alex Priem
6 *
[8382]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 *
[4611]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
[8382]32#include <string.h>
[4611]33#include "winbase.h"
34#include "winerror.h"
35#include "commctrl.h"
[8382]36#include "wine/debug.h"
[4611]37
[8382]38WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
[5416]39
[4611]40typedef struct
41{
42 DWORD dwDummy; /* just to keep the compiler happy ;-) */
43} FLATSB_INFO, *LPFLATSB_INFO;
44
45#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
46
47
48/***********************************************************************
[9370]49 * InitializeFlatSB (COMCTL32.@)
[4611]50 *
[6709]51 * returns nonzero if successful, zero otherwise
[4611]52 *
53 */
54BOOL WINAPI InitializeFlatSB(HWND hwnd)
55{
[9370]56 TRACE("[%p]\n", hwnd);
[4611]57 FIXME("stub\n");
58 return FALSE;
59}
60
61/***********************************************************************
[9370]62 * UninitializeFlatSB (COMCTL32.@)
[4611]63 *
[6709]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
[4611]68 *
69 */
70HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
71{
[9370]72 TRACE("[%p]\n", hwnd);
[4611]73 FIXME("stub\n");
74 return S_FALSE;
75}
76
77/***********************************************************************
[9370]78 * FlatSB_GetScrollProp (COMCTL32.@)
[4611]79 *
[6709]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
[9370]82 * zero otherwise.
[4611]83 *
84 */
[9370]85BOOL WINAPI
[4611]86FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
87{
[9370]88 TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
[4611]89 FIXME("stub\n");
90 return FALSE;
91}
92
93/***********************************************************************
[9370]94 * FlatSB_SetScrollProp (COMCTL32.@)
[4611]95 */
[9370]96BOOL WINAPI
[4611]97FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
98{
[9370]99 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
[4611]100 FIXME("stub\n");
101 return FALSE;
102}
103
104/***********************************************************************
[6709]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."
[4611]110 *
[6709]111 * So, if we just call the standard functions until we implement
[9370]112 * the flat scroll bar functions, flat scroll bars will show up and
[6709]113 * behave properly, as though they had simply not been setup to
114 * have flat properties.
[4611]115 *
[6709]116 * Susan <sfarley@codeweavers.com>
[4611]117 *
118 */
119
120/***********************************************************************
[9370]121 * FlatSB_EnableScrollBar (COMCTL32.@)
[4611]122 */
[9370]123BOOL WINAPI
[4611]124FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
125{
126 return EnableScrollBar(hwnd, nBar, flags);
127}
128
129/***********************************************************************
[9370]130 * FlatSB_ShowScrollBar (COMCTL32.@)
[4611]131 */
[9370]132BOOL WINAPI
[4611]133FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
134{
135 return ShowScrollBar(hwnd, nBar, fShow);
136}
137
138/***********************************************************************
[9370]139 * FlatSB_GetScrollRange (COMCTL32.@)
[4611]140 */
[9370]141BOOL WINAPI
[4611]142FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
143{
144 return GetScrollRange(hwnd, nBar, min, max);
145}
146
147/***********************************************************************
[9370]148 * FlatSB_GetScrollInfo (COMCTL32.@)
[4611]149 */
[9370]150BOOL WINAPI
[4611]151FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
152{
153 return GetScrollInfo(hwnd, nBar, info);
154}
155
156/***********************************************************************
[9370]157 * FlatSB_GetScrollPos (COMCTL32.@)
[4611]158 */
[9370]159INT WINAPI
[4611]160FlatSB_GetScrollPos(HWND hwnd, int nBar)
161{
162 return GetScrollPos(hwnd, nBar);
163}
164
165/***********************************************************************
[9370]166 * FlatSB_SetScrollPos (COMCTL32.@)
[4611]167 */
[9370]168INT WINAPI
[4611]169FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
170{
171 return SetScrollPos(hwnd, nBar, pos, bRedraw);
172}
173
174/***********************************************************************
[9370]175 * FlatSB_SetScrollInfo (COMCTL32.@)
[4611]176 */
[9370]177INT WINAPI
[4611]178FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
179{
180 return SetScrollInfo(hwnd, nBar, info, bRedraw);
181}
182
183/***********************************************************************
[9370]184 * FlatSB_SetScrollRange (COMCTL32.@)
[4611]185 */
[9370]186INT WINAPI
[4611]187FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
188{
189 return SetScrollRange(hwnd, nBar, min, max, bRedraw);
190}
191
192
193static LRESULT
194FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
195{
[9370]196 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
[4611]197 return 0;
198}
199
200
201static LRESULT
202FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
203{
[9370]204 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
[4611]205 return 0;
206}
207
208
209static LRESULT WINAPI
210FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
211{
[8382]212 if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
213 return DefWindowProcA( hwnd, uMsg, wParam, lParam );
[9370]214
[4611]215 switch (uMsg)
216 {
[6709]217 case WM_CREATE:
218 return FlatSB_Create (hwnd, wParam, lParam);
[4611]219
[6709]220 case WM_DESTROY:
221 return FlatSB_Destroy (hwnd, wParam, lParam);
[4611]222
[6709]223 default:
[9370]224 if ((uMsg >= WM_USER) && (uMsg < WM_APP))
[6709]225 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
[4611]226 uMsg, wParam, lParam);
[6709]227 return DefWindowProcA (hwnd, uMsg, wParam, lParam);
[4611]228 }
229 return 0;
230}
231
232
233VOID
234FLATSB_Register (void)
235{
236 WNDCLASSA wndClass;
237
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;
[9370]246
[4611]247 RegisterClassA (&wndClass);
248}
249
250
251VOID
252FLATSB_Unregister (void)
253{
[10097]254 UnregisterClassA (FLATSB_CLASSA, NULL);
[4611]255}
Note: See TracBrowser for help on using the repository browser.