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
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
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.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-01-26 21:43:40 +01:00
|
|
|
#include <string.h>
|
1999-03-16 11:53:11 +01:00
|
|
|
#include "winbase.h"
|
2000-05-24 23:05:20 +02:00
|
|
|
#include "winerror.h"
|
1999-01-17 17:32:32 +01:00
|
|
|
#include "commctrl.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
|
|
|
|
1999-03-12 18:42:50 +01:00
|
|
|
#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
|
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
|
|
|
*
|
|
|
|
* returns nonzero if successful, zero otherwise
|
|
|
|
*
|
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);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("stub\n");
|
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
|
|
|
* UninitializeFlatSB (COMCTL32.@)
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
|
|
|
* returns:
|
|
|
|
* E_FAIL if one of the scroll bars is currently in use
|
|
|
|
* S_FALSE if InitializeFlatSB was never called on this hwnd
|
|
|
|
* S_OK otherwise
|
|
|
|
*
|
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);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("stub\n");
|
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
|
|
|
*
|
|
|
|
* 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
|
2002-06-01 01:06:46 +02:00
|
|
|
* zero otherwise.
|
2000-05-24 23:05:20 +02:00
|
|
|
*
|
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);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("stub\n");
|
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.@)
|
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);
|
1999-12-08 04:56:23 +01:00
|
|
|
FIXME("stub\n");
|
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.@)
|
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.@)
|
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.@)
|
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.@)
|
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.@)
|
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.@)
|
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.@)
|
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.@)
|
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
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p] wParam=%04x lParam=%08lx\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
|
|
|
{
|
2002-10-24 00:19:10 +02:00
|
|
|
TRACE("[%p] wParam=%04x lParam=%08lx\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
|
|
|
{
|
2001-02-12 04:42:23 +01:00
|
|
|
if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
|
|
|
|
return DefWindowProcA( 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:
|
2002-07-16 03:23:59 +02:00
|
|
|
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
|
1999-12-08 04:56:23 +01:00
|
|
|
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
|
|
|
uMsg, wParam, lParam);
|
1999-02-26 12:11:13 +01:00
|
|
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 10:27:49 +02:00
|
|
|
FLATSB_Register (void)
|
1999-01-17 17:32:32 +01:00
|
|
|
{
|
1999-02-26 12:11:13 +01:00
|
|
|
WNDCLASSA wndClass;
|
1999-01-17 17:32:32 +01:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
1999-01-17 17:32:32 +01:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.lpfnWndProc = (WNDPROC)FlatSB_WindowProc;
|
1999-01-17 17:32:32 +01:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
|
1999-02-26 12:11:13 +01:00
|
|
|
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wndClass.lpszClassName = FLATSB_CLASSA;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-02-26 12:11:13 +01:00
|
|
|
RegisterClassA (&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
|
|
|
{
|
2002-12-02 19:10:57 +01:00
|
|
|
UnregisterClassA (FLATSB_CLASSA, NULL);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|