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
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>
28 * - All notifications.
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(commctrl
);
48 DWORD dwDummy
; /* just to keep the compiler happy ;-) */
49 } FLATSB_INFO
, *LPFLATSB_INFO
;
51 #define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
54 /***********************************************************************
55 * InitializeFlatSB (COMCTL32.@)
57 * returns nonzero if successful, zero otherwise
60 BOOL WINAPI
InitializeFlatSB(HWND hwnd
)
62 TRACE("[%p]\n", hwnd
);
67 /***********************************************************************
68 * UninitializeFlatSB (COMCTL32.@)
71 * E_FAIL if one of the scroll bars is currently in use
72 * S_FALSE if InitializeFlatSB was never called on this hwnd
76 HRESULT WINAPI
UninitializeFlatSB(HWND hwnd
)
78 TRACE("[%p]\n", hwnd
);
83 /***********************************************************************
84 * FlatSB_GetScrollProp (COMCTL32.@)
86 * Returns nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
87 * the return is nonzero if InitializeFlatSB has been called for this window, or
92 FlatSB_GetScrollProp(HWND hwnd
, INT propIndex
, LPINT prop
)
94 TRACE("[%p] propIndex=%d\n", hwnd
, propIndex
);
99 /***********************************************************************
100 * FlatSB_SetScrollProp (COMCTL32.@)
103 FlatSB_SetScrollProp(HWND hwnd
, UINT index
, INT newValue
, BOOL flag
)
105 TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd
, index
, newValue
, flag
);
110 /***********************************************************************
111 * From the Microsoft docs:
112 * "If flat scroll bars haven't been initialized for the
113 * window, the flat scroll bar APIs will defer to the corresponding
114 * standard APIs. This allows the developer to turn flat scroll
115 * bars on and off without having to write conditional code."
117 * So, if we just call the standard functions until we implement
118 * the flat scroll bar functions, flat scroll bars will show up and
119 * behave properly, as though they had simply not been setup to
120 * have flat properties.
122 * Susan <sfarley@codeweavers.com>
126 /***********************************************************************
127 * FlatSB_EnableScrollBar (COMCTL32.@)
130 FlatSB_EnableScrollBar(HWND hwnd
, int nBar
, UINT flags
)
132 return EnableScrollBar(hwnd
, nBar
, flags
);
135 /***********************************************************************
136 * FlatSB_ShowScrollBar (COMCTL32.@)
139 FlatSB_ShowScrollBar(HWND hwnd
, int nBar
, BOOL fShow
)
141 return ShowScrollBar(hwnd
, nBar
, fShow
);
144 /***********************************************************************
145 * FlatSB_GetScrollRange (COMCTL32.@)
148 FlatSB_GetScrollRange(HWND hwnd
, int nBar
, LPINT min
, LPINT max
)
150 return GetScrollRange(hwnd
, nBar
, min
, max
);
153 /***********************************************************************
154 * FlatSB_GetScrollInfo (COMCTL32.@)
157 FlatSB_GetScrollInfo(HWND hwnd
, int nBar
, LPSCROLLINFO info
)
159 return GetScrollInfo(hwnd
, nBar
, info
);
162 /***********************************************************************
163 * FlatSB_GetScrollPos (COMCTL32.@)
166 FlatSB_GetScrollPos(HWND hwnd
, int nBar
)
168 return GetScrollPos(hwnd
, nBar
);
171 /***********************************************************************
172 * FlatSB_SetScrollPos (COMCTL32.@)
175 FlatSB_SetScrollPos(HWND hwnd
, int nBar
, INT pos
, BOOL bRedraw
)
177 return SetScrollPos(hwnd
, nBar
, pos
, bRedraw
);
180 /***********************************************************************
181 * FlatSB_SetScrollInfo (COMCTL32.@)
184 FlatSB_SetScrollInfo(HWND hwnd
, int nBar
, LPSCROLLINFO info
, BOOL bRedraw
)
186 return SetScrollInfo(hwnd
, nBar
, info
, bRedraw
);
189 /***********************************************************************
190 * FlatSB_SetScrollRange (COMCTL32.@)
193 FlatSB_SetScrollRange(HWND hwnd
, int nBar
, INT min
, INT max
, BOOL bRedraw
)
195 return SetScrollRange(hwnd
, nBar
, min
, max
, bRedraw
);
200 FlatSB_Create (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
202 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd
, wParam
, lParam
);
208 FlatSB_Destroy (HWND hwnd
, WPARAM wParam
, LPARAM lParam
)
210 TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd
, wParam
, lParam
);
215 static LRESULT WINAPI
216 FlatSB_WindowProc (HWND hwnd
, UINT uMsg
, WPARAM wParam
, LPARAM lParam
)
218 if (!FlatSB_GetInfoPtr(hwnd
) && (uMsg
!= WM_CREATE
))
219 return DefWindowProcA( hwnd
, uMsg
, wParam
, lParam
);
224 return FlatSB_Create (hwnd
, wParam
, lParam
);
227 return FlatSB_Destroy (hwnd
, wParam
, lParam
);
230 if ((uMsg
>= WM_USER
) && (uMsg
< WM_APP
))
231 ERR("unknown msg %04x wp=%08x lp=%08lx\n",
232 uMsg
, wParam
, lParam
);
233 return DefWindowProcA (hwnd
, uMsg
, wParam
, lParam
);
240 FLATSB_Register (void)
244 ZeroMemory (&wndClass
, sizeof(WNDCLASSA
));
245 wndClass
.style
= CS_GLOBALCLASS
;
246 wndClass
.lpfnWndProc
= (WNDPROC
)FlatSB_WindowProc
;
247 wndClass
.cbClsExtra
= 0;
248 wndClass
.cbWndExtra
= sizeof(FLATSB_INFO
*);
249 wndClass
.hCursor
= LoadCursorA (0, (LPSTR
)IDC_ARROW
);
250 wndClass
.hbrBackground
= (HBRUSH
)(COLOR_WINDOW
+ 1);
251 wndClass
.lpszClassName
= FLATSB_CLASSA
;
253 RegisterClassA (&wndClass
);
258 FLATSB_Unregister (void)
260 UnregisterClassA (FLATSB_CLASSA
, NULL
);