1999-01-17 17:32:32 +01:00
|
|
|
/*
|
|
|
|
* Flat Scrollbar control
|
|
|
|
*
|
1999-03-12 18:42:50 +01:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1999-01-24 20:14:58 +01:00
|
|
|
* Copyright 1998 Alex Priem
|
1999-01-17 17:32:32 +01:00
|
|
|
*
|
2002-03-10 00:29:33 +01:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
1999-01-17 17:32:32 +01:00
|
|
|
* NOTES
|
|
|
|
* This is just a dummy control. An author is needed! Any volunteers?
|
|
|
|
* I will only improve this control once in a while.
|
|
|
|
* Eric <ekohl@abo.rhein-zeitung.de>
|
|
|
|
*
|
|
|
|
* TODO:
|
|
|
|
* - All messages.
|
|
|
|
* - All notifications.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
1999-03-16 11:53:11 +01:00
|
|
|
#include "winbase.h"
|
2000-05-24 23:05:20 +02:00
|
|
|
#include "winerror.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "winuser.h"
|
1999-01-17 17:32:32 +01:00
|
|
|
#include "commctrl.h"
|
2005-06-09 11:50:56 +02:00
|
|
|
#include "comctl32.h"
|
2002-03-10 00:29:33 +01:00
|
|
|
#include "wine/debug.h"
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
2000-08-09 02:41:17 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwDummy; /* just to keep the compiler happy ;-) */
|
|
|
|
} FLATSB_INFO, *LPFLATSB_INFO;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* InitializeFlatSB (COMCTL32.@)
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* Initializes flat scroll bars for the specified window.
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* RETURNS
|
|
|
|
* Success: Non-zero
|
|
|
|
* Failure: Zero
|
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* Subclasses specified window so that flat scroll bars may be drawn
|
|
|
|
* and used.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
BOOL WINAPI InitializeFlatSB(HWND hwnd)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p]\n", hwnd);
|
2015-03-24 22:07:06 +01:00
|
|
|
return TRUE;
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* UninitializeFlatSB (COMCTL32.@)
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* Uninitializes flat scroll bars for the specified window.
|
|
|
|
*
|
|
|
|
* RETURNS
|
2000-05-24 23:05:20 +02:00
|
|
|
* E_FAIL if one of the scroll bars is currently in use
|
2004-02-27 05:40:08 +01:00
|
|
|
* S_FALSE if InitializeFlatSB() was never called on this hwnd
|
2000-05-24 23:05:20 +02:00
|
|
|
* S_OK otherwise
|
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* NOTES
|
|
|
|
* Removes any subclassing on the specified window so that regular
|
|
|
|
* scroll bars are drawn and used.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p]\n", hwnd);
|
2000-05-24 23:05:20 +02:00
|
|
|
return S_FALSE;
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_GetScrollProp (COMCTL32.@)
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* Retrieves flat-scroll-bar-specific properties for the specified window.
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
2004-02-27 05:40:08 +01:00
|
|
|
* RETURNS
|
|
|
|
* nonzero if successful, or zero otherwise. If index is WSB_PROP_HSTYLE,
|
|
|
|
* the return is nonzero if InitializeFlatSB has been called for this window, or
|
|
|
|
* zero otherwise.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
|
2000-05-24 23:05:20 +02:00
|
|
|
return FALSE;
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_SetScrollProp (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* Sets flat-scroll-bar-specific properties for the specified window.
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: Non-zero
|
|
|
|
* Failure: Zero
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
|
2000-05-24 23:05:20 +02:00
|
|
|
return FALSE;
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* From the Microsoft docs:
|
|
|
|
* "If flat scroll bars haven't been initialized for the
|
|
|
|
* window, the flat scroll bar APIs will defer to the corresponding
|
|
|
|
* standard APIs. This allows the developer to turn flat scroll
|
|
|
|
* bars on and off without having to write conditional code."
|
|
|
|
*
|
|
|
|
* So, if we just call the standard functions until we implement
|
2002-06-01 01:06:46 +02:00
|
|
|
* the flat scroll bar functions, flat scroll bars will show up and
|
2000-05-24 23:05:20 +02:00
|
|
|
* behave properly, as though they had simply not been setup to
|
|
|
|
* have flat properties.
|
|
|
|
*
|
|
|
|
* Susan <sfarley@codeweavers.com>
|
|
|
|
*
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
|
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_EnableScrollBar (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See EnableScrollBar.
|
2000-05-24 23:05:20 +02:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return EnableScrollBar(hwnd, nBar, flags);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_ShowScrollBar (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See ShowScrollBar.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return ShowScrollBar(hwnd, nBar, fShow);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_GetScrollRange (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See GetScrollRange.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return GetScrollRange(hwnd, nBar, min, max);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_GetScrollInfo (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See GetScrollInfo.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
BOOL WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return GetScrollInfo(hwnd, nBar, info);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_GetScrollPos (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See GetScrollPos.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
INT WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_GetScrollPos(HWND hwnd, int nBar)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return GetScrollPos(hwnd, nBar);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_SetScrollPos (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See SetScrollPos.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
INT WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return SetScrollPos(hwnd, nBar, pos, bRedraw);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_SetScrollInfo (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See SetScrollInfo.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
INT WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return SetScrollInfo(hwnd, nBar, info, bRedraw);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
2000-03-24 21:46:04 +01:00
|
|
|
/***********************************************************************
|
2002-08-09 03:07:29 +02:00
|
|
|
* FlatSB_SetScrollRange (COMCTL32.@)
|
2004-02-27 05:40:08 +01:00
|
|
|
*
|
|
|
|
* See SetScrollRange.
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
INT WINAPI
|
2000-05-24 23:05:20 +02:00
|
|
|
FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
return SetScrollRange(hwnd, nBar, min, max, bRedraw);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2022-02-07 07:07:55 +01:00
|
|
|
TRACE("[%p] wParam %Ix, lParam %Ix\n", hwnd, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 18:42:50 +01:00
|
|
|
FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2022-02-07 07:07:55 +01:00
|
|
|
TRACE("[%p] wParam %Ix, lParam %Ix\n", hwnd, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-07-31 16:41:43 +02:00
|
|
|
static LRESULT WINAPI
|
1999-02-26 12:11:13 +01:00
|
|
|
FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2009-02-13 10:20:44 +01:00
|
|
|
if (!GetWindowLongPtrW(hwnd, 0) && (uMsg != WM_CREATE))
|
2005-03-23 11:22:52 +01:00
|
|
|
return DefWindowProcW( hwnd, uMsg, wParam, lParam );
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-01-17 17:32:32 +01:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
1999-03-12 18:42:50 +01:00
|
|
|
return FlatSB_Create (hwnd, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
1999-03-12 18:42:50 +01:00
|
|
|
return FlatSB_Destroy (hwnd, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
|
|
|
|
default:
|
2008-07-22 00:18:09 +02:00
|
|
|
if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
|
2022-02-07 07:07:55 +01:00
|
|
|
ERR("unknown msg %04x, wp %#Ix, lp %#Ix\n", uMsg, wParam, lParam);
|
2005-03-23 11:22:52 +01:00
|
|
|
return DefWindowProcW (hwnd, uMsg, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
FLATSB_Register (void)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2005-03-23 11:22:52 +01:00
|
|
|
WNDCLASSW wndClass;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2005-03-23 11:22:52 +01:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSW));
|
1999-01-17 17:32:32 +01:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
2004-11-06 04:49:03 +01:00
|
|
|
wndClass.lpfnWndProc = FlatSB_WindowProc;
|
1999-01-17 17:32:32 +01:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
|
2005-03-23 11:22:52 +01:00
|
|
|
wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
2005-03-23 11:22:52 +01:00
|
|
|
wndClass.lpszClassName = FLATSB_CLASSW;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2005-03-23 11:22:52 +01:00
|
|
|
RegisterClassW (&wndClass);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
FLATSB_Unregister (void)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
2005-03-23 11:22:52 +01:00
|
|
|
UnregisterClassW (FLATSB_CLASSW, NULL);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|