ReactOS  0.4.14-dev-342-gdc047f9
flatsb.c
Go to the documentation of this file.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, 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 "winuser.h"
38 #include "commctrl.h"
39 #include "comctl32.h"
40 #include "wine/debug.h"
41 
43 
44 typedef struct
45 {
46  DWORD dwDummy; /* just to keep the compiler happy ;-) */
48 
49 
50 /***********************************************************************
51  * InitializeFlatSB (COMCTL32.@)
52  *
53  * Initializes flat scroll bars for the specified window.
54  *
55  * RETURNS
56  * Success: Non-zero
57  * Failure: Zero
58  *
59  * NOTES
60  * Subclasses specified window so that flat scroll bars may be drawn
61  * and used.
62  */
64 {
65  TRACE("[%p]\n", hwnd);
66  return TRUE;
67 }
68 
69 /***********************************************************************
70  * UninitializeFlatSB (COMCTL32.@)
71  *
72  * Uninitializes flat scroll bars for the specified window.
73  *
74  * RETURNS
75  * E_FAIL if one of the scroll bars is currently in use
76  * S_FALSE if InitializeFlatSB() was never called on this hwnd
77  * S_OK otherwise
78  *
79  * NOTES
80  * Removes any subclassing on the specified window so that regular
81  * scroll bars are drawn and used.
82  */
84 {
85  TRACE("[%p]\n", hwnd);
86  return S_FALSE;
87 }
88 
89 /***********************************************************************
90  * FlatSB_GetScrollProp (COMCTL32.@)
91  *
92  * Retrieves flat-scroll-bar-specific properties for the specified window.
93  *
94  * RETURNS
95  * nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
96  * the return is nonzero if InitializeFlatSB has been called for this window, or
97  * zero otherwise.
98  */
101 {
102  TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
103  return FALSE;
104 }
105 
106 /***********************************************************************
107  * FlatSB_SetScrollProp (COMCTL32.@)
108  *
109  * Sets flat-scroll-bar-specific properties for the specified window.
110  *
111  * RETURNS
112  * Success: Non-zero
113  * Failure: Zero
114  */
115 BOOL WINAPI
117 {
118  TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
119  return FALSE;
120 }
121 
122 /***********************************************************************
123  * From the Microsoft docs:
124  * "If flat scroll bars haven't been initialized for the
125  * window, the flat scroll bar APIs will defer to the corresponding
126  * standard APIs. This allows the developer to turn flat scroll
127  * bars on and off without having to write conditional code."
128  *
129  * So, if we just call the standard functions until we implement
130  * the flat scroll bar functions, flat scroll bars will show up and
131  * behave properly, as though they had simply not been setup to
132  * have flat properties.
133  *
134  * Susan <sfarley@codeweavers.com>
135  *
136  */
137 
138 /***********************************************************************
139  * FlatSB_EnableScrollBar (COMCTL32.@)
140  *
141  * See EnableScrollBar.
142  */
143 BOOL WINAPI
145 {
146  return EnableScrollBar(hwnd, nBar, flags);
147 }
148 
149 /***********************************************************************
150  * FlatSB_ShowScrollBar (COMCTL32.@)
151  *
152  * See ShowScrollBar.
153  */
154 BOOL WINAPI
156 {
157  return ShowScrollBar(hwnd, nBar, fShow);
158 }
159 
160 /***********************************************************************
161  * FlatSB_GetScrollRange (COMCTL32.@)
162  *
163  * See GetScrollRange.
164  */
165 BOOL WINAPI
167 {
168  return GetScrollRange(hwnd, nBar, min, max);
169 }
170 
171 /***********************************************************************
172  * FlatSB_GetScrollInfo (COMCTL32.@)
173  *
174  * See GetScrollInfo.
175  */
176 BOOL WINAPI
178 {
179  return GetScrollInfo(hwnd, nBar, info);
180 }
181 
182 /***********************************************************************
183  * FlatSB_GetScrollPos (COMCTL32.@)
184  *
185  * See GetScrollPos.
186  */
187 INT WINAPI
189 {
190  return GetScrollPos(hwnd, nBar);
191 }
192 
193 /***********************************************************************
194  * FlatSB_SetScrollPos (COMCTL32.@)
195  *
196  * See SetScrollPos.
197  */
198 INT WINAPI
199 FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
200 {
201  return SetScrollPos(hwnd, nBar, pos, bRedraw);
202 }
203 
204 /***********************************************************************
205  * FlatSB_SetScrollInfo (COMCTL32.@)
206  *
207  * See SetScrollInfo.
208  */
209 INT WINAPI
211 {
212  return SetScrollInfo(hwnd, nBar, info, bRedraw);
213 }
214 
215 /***********************************************************************
216  * FlatSB_SetScrollRange (COMCTL32.@)
217  *
218  * See SetScrollRange.
219  */
220 INT WINAPI
222 {
223  return SetScrollRange(hwnd, nBar, min, max, bRedraw);
224 }
225 
226 
227 static LRESULT
229 {
230  TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
231  return 0;
232 }
233 
234 
235 static LRESULT
237 {
238  TRACE("[%p] wParam=%04lx lParam=%08lx\n", hwnd, wParam, lParam);
239  return 0;
240 }
241 
242 
243 static LRESULT WINAPI
245 {
246  if (!GetWindowLongPtrW(hwnd, 0) && (uMsg != WM_CREATE))
247  return DefWindowProcW( hwnd, uMsg, wParam, lParam );
248 
249  switch (uMsg)
250  {
251  case WM_CREATE:
252  return FlatSB_Create (hwnd, wParam, lParam);
253 
254  case WM_DESTROY:
255  return FlatSB_Destroy (hwnd, wParam, lParam);
256 
257  default:
258  if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
259  ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
260  uMsg, wParam, lParam);
261  return DefWindowProcW (hwnd, uMsg, wParam, lParam);
262  }
263 }
264 
265 
266 VOID
268 {
269  WNDCLASSW wndClass;
270 
271  ZeroMemory (&wndClass, sizeof(WNDCLASSW));
272  wndClass.style = CS_GLOBALCLASS;
273  wndClass.lpfnWndProc = FlatSB_WindowProc;
274  wndClass.cbClsExtra = 0;
275  wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
276  wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
277  wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
278  wndClass.lpszClassName = FLATSB_CLASSW;
279 
280  RegisterClassW (&wndClass);
281 }
282 
283 
284 VOID
286 {
288 }
BOOL WINAPI GetScrollRange(_In_ HWND, _In_ int, _Out_ LPINT, _Out_ LPINT)
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static LRESULT FlatSB_Destroy(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: flatsb.c:236
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
BOOL WINAPI FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
Definition: flatsb.c:166
UINT style
Definition: winuser.h:3150
BOOL WINAPI FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
Definition: flatsb.c:100
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
Definition: flatsb.c:144
BOOL WINAPI ShowScrollBar(_In_ HWND, _In_ int, _In_ BOOL)
#define ZeroMemory
Definition: winbase.h:1642
int cbClsExtra
Definition: winuser.h:3152
BOOL WINAPI InitializeFlatSB(HWND hwnd)
Definition: flatsb.c:63
DWORD dwDummy
Definition: flatsb.c:46
UINT_PTR WPARAM
Definition: windef.h:207
#define GetWindowLongPtrW
Definition: winuser.h:4730
INT WINAPI FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
Definition: flatsb.c:199
#define COLOR_WINDOW
Definition: winuser.h:908
int32_t INT
Definition: typedefs.h:56
WPARAM wParam
Definition: combotst.c:138
INT WINAPI FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
Definition: flatsb.c:221
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static LRESULT FlatSB_Create(HWND hwnd, WPARAM wParam, LPARAM lParam)
Definition: flatsb.c:228
INT WINAPI FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
Definition: flatsb.c:210
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
unsigned int BOOL
Definition: ntddk_ex.h:94
WNDPROC lpfnWndProc
Definition: winuser.h:3151
#define S_FALSE
Definition: winerror.h:2357
BOOL WINAPI FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
Definition: flatsb.c:116
smooth NULL
Definition: ftsmooth.c:416
VOID FLATSB_Unregister(void)
Definition: flatsb.c:285
LPCWSTR lpszClassName
Definition: winuser.h:3159
LONG_PTR LPARAM
Definition: windef.h:208
GLuint index
Definition: glext.h:6031
#define WM_DESTROY
Definition: winuser.h:1591
#define TRACE(s)
Definition: solgame.cpp:4
int cbWndExtra
Definition: winuser.h:3153
BOOL WINAPI FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
Definition: flatsb.c:155
LONG HRESULT
Definition: typedefs.h:77
int WINAPI GetScrollPos(_In_ HWND, _In_ int)
#define CS_GLOBALCLASS
Definition: winuser.h:647
struct FLATSB_INFO * LPFLATSB_INFO
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
GLbitfield flags
Definition: glext.h:7161
BOOL WINAPI GetScrollInfo(_In_ HWND, _In_ int, _Inout_ LPSCROLLINFO)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
VOID FLATSB_Register(void)
Definition: flatsb.c:267
#define WM_APP
Definition: eventvwr.h:70
HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
Definition: flatsb.c:83
#define WM_USER
Definition: winuser.h:1877
INT WINAPI FlatSB_GetScrollPos(HWND hwnd, int nBar)
Definition: flatsb.c:188
HCURSOR hCursor
Definition: winuser.h:3156
#define ERR(fmt,...)
Definition: debug.h:109
static LRESULT WINAPI FlatSB_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: flatsb.c:244
HBRUSH hbrBackground
Definition: winuser.h:3157
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
WINE_DEFAULT_DEBUG_CHANNEL(commctrl)
static const WCHAR FLATSB_CLASSW[]
Definition: commctrl.h:56
BOOL WINAPI SetScrollRange(_In_ HWND, _In_ int, _In_ int, _In_ int, _In_ BOOL)
#define IDC_ARROW
Definition: winuser.h:682
#define WM_CREATE
Definition: winuser.h:1590
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
BOOL WINAPI EnableScrollBar(_In_ HWND, _In_ UINT, _In_ UINT)
WCHAR * LPWSTR
Definition: xmlstorage.h:184
LONG_PTR LRESULT
Definition: windef.h:209
int WINAPI SetScrollPos(_In_ HWND, _In_ int, _In_ int, _In_ BOOL)
LPARAM lParam
Definition: combotst.c:139
int WINAPI SetScrollInfo(_In_ HWND, _In_ int, _In_ LPCSCROLLINFO, _In_ BOOL)
int * LPINT
Definition: windef.h:178
BOOL WINAPI FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
Definition: flatsb.c:177