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
|
|
|
*
|
|
|
|
* 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"
|
1999-05-02 16:32:27 +02:00
|
|
|
#include "debugtools.h"
|
1999-01-17 17:32:32 +01:00
|
|
|
|
2000-08-09 02:41:17 +02:00
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* InitializeFlatSB
|
|
|
|
*
|
|
|
|
* 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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x]\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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* UninitializeFlatSB
|
|
|
|
*
|
|
|
|
* 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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x]\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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_GetScrollProp
|
|
|
|
*
|
|
|
|
* 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
|
|
|
*/
|
1999-02-26 12:11:13 +01: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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x] 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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_SetScrollProp
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01: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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x] 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
|
|
|
|
* the flat scroll bar functions, flat scroll bars will show up and
|
|
|
|
* 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
|
|
|
|
|
|
|
/***********************************************************************
|
|
|
|
* FlatSB_EnableScrollBar
|
|
|
|
*/
|
|
|
|
BOOL WINAPI
|
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_ShowScrollBar
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01: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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_GetScrollRange
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
BOOL WINAPI
|
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_GetScrollInfo
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
BOOL WINAPI
|
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_GetScrollPos
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
1999-02-26 12:11:13 +01: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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_SetScrollPos
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
INT WINAPI
|
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_SetScrollInfo
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
INT WINAPI
|
|
|
|
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
|
|
|
/***********************************************************************
|
2000-05-24 23:05:20 +02:00
|
|
|
* FlatSB_SetScrollRange
|
2000-03-24 21:46:04 +01:00
|
|
|
*/
|
2000-05-24 23:05:20 +02:00
|
|
|
INT WINAPI
|
|
|
|
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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x] 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
|
|
|
{
|
2000-05-24 23:05:20 +02:00
|
|
|
TRACE("[%04x] 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 );
|
|
|
|
|
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:
|
|
|
|
if (uMsg >= WM_USER)
|
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;
|
1999-01-17 17:32:32 +01: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
|
|
|
{
|
2000-02-13 16:10:16 +01:00
|
|
|
UnregisterClassA (FLATSB_CLASSA, (HINSTANCE)NULL);
|
1999-01-17 17:32:32 +01:00
|
|
|
}
|
|
|
|
|