1999-01-17 16:32:32 +00:00
|
|
|
/*
|
|
|
|
* Flat Scrollbar control
|
|
|
|
*
|
1999-03-12 17:42:50 +00:00
|
|
|
* Copyright 1998, 1999 Eric Kohl
|
1999-01-24 19:14:58 +00:00
|
|
|
* Copyright 1998 Alex Priem
|
1999-01-17 16:32:32 +00:00
|
|
|
*
|
2002-03-09 23:29:33 +00: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 16:32:32 +00: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 20:43:40 +00:00
|
|
|
#include <string.h>
|
1999-03-16 10:53:11 +00:00
|
|
|
#include "winbase.h"
|
2000-05-24 21:05:20 +00:00
|
|
|
#include "winerror.h"
|
1999-01-17 16:32:32 +00:00
|
|
|
#include "commctrl.h"
|
2002-03-09 23:29:33 +00:00
|
|
|
#include "wine/debug.h"
|
1999-01-17 16:32:32 +00:00
|
|
|
|
2002-03-09 23:29:33 +00:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(commctrl);
|
1999-04-19 14:56:29 +00:00
|
|
|
|
2000-08-09 00:41:17 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
DWORD dwDummy; /* just to keep the compiler happy ;-) */
|
|
|
|
} FLATSB_INFO, *LPFLATSB_INFO;
|
1999-01-17 16:32:32 +00:00
|
|
|
|
1999-03-12 17:42:50 +00:00
|
|
|
#define FlatSB_GetInfoPtr(hwnd) ((FLATSB_INFO*)GetWindowLongA (hwnd, 0))
|
1999-01-17 16:32:32 +00:00
|
|
|
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* InitializeFlatSB (COMCTL32.@)
|
2000-05-24 21:05:20 +00:00
|
|
|
*
|
|
|
|
* returns nonzero if successful, zero otherwise
|
|
|
|
*
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2000-05-24 21:05:20 +00:00
|
|
|
BOOL WINAPI InitializeFlatSB(HWND hwnd)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p]\n", hwnd);
|
1999-12-08 03:56:23 +00:00
|
|
|
FIXME("stub\n");
|
2000-05-24 21:05:20 +00:00
|
|
|
return FALSE;
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* UninitializeFlatSB (COMCTL32.@)
|
2000-05-24 21:05:20 +00: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 20:46:04 +00:00
|
|
|
*/
|
2000-05-24 21:05:20 +00:00
|
|
|
HRESULT WINAPI UninitializeFlatSB(HWND hwnd)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p]\n", hwnd);
|
1999-12-08 03:56:23 +00:00
|
|
|
FIXME("stub\n");
|
2000-05-24 21:05:20 +00:00
|
|
|
return S_FALSE;
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_GetScrollProp (COMCTL32.@)
|
2000-05-24 21:05:20 +00: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-05-31 23:06:46 +00:00
|
|
|
* zero otherwise.
|
2000-05-24 21:05:20 +00:00
|
|
|
*
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_GetScrollProp(HWND hwnd, INT propIndex, LPINT prop)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p] propIndex=%d\n", hwnd, propIndex);
|
1999-12-08 03:56:23 +00:00
|
|
|
FIXME("stub\n");
|
2000-05-24 21:05:20 +00:00
|
|
|
return FALSE;
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_SetScrollProp (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_SetScrollProp(HWND hwnd, UINT index, INT newValue, BOOL flag)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p] index=%u newValue=%d flag=%d\n", hwnd, index, newValue, flag);
|
1999-12-08 03:56:23 +00:00
|
|
|
FIXME("stub\n");
|
2000-05-24 21:05:20 +00:00
|
|
|
return FALSE;
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2000-05-24 21:05:20 +00: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-05-31 23:06:46 +00:00
|
|
|
* the flat scroll bar functions, flat scroll bars will show up and
|
2000-05-24 21:05:20 +00:00
|
|
|
* behave properly, as though they had simply not been setup to
|
|
|
|
* have flat properties.
|
|
|
|
*
|
|
|
|
* Susan <sfarley@codeweavers.com>
|
|
|
|
*
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2000-05-24 21:05:20 +00:00
|
|
|
|
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_EnableScrollBar (COMCTL32.@)
|
2000-05-24 21:05:20 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_EnableScrollBar(HWND hwnd, int nBar, UINT flags)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return EnableScrollBar(hwnd, nBar, flags);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_ShowScrollBar (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_ShowScrollBar(HWND hwnd, int nBar, BOOL fShow)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return ShowScrollBar(hwnd, nBar, fShow);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_GetScrollRange (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_GetScrollRange(HWND hwnd, int nBar, LPINT min, LPINT max)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return GetScrollRange(hwnd, nBar, min, max);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_GetScrollInfo (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
BOOL WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_GetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return GetScrollInfo(hwnd, nBar, info);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_GetScrollPos (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
INT WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_GetScrollPos(HWND hwnd, int nBar)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return GetScrollPos(hwnd, nBar);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_SetScrollPos (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
INT WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_SetScrollPos(HWND hwnd, int nBar, INT pos, BOOL bRedraw)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return SetScrollPos(hwnd, nBar, pos, bRedraw);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_SetScrollInfo (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
INT WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_SetScrollInfo(HWND hwnd, int nBar, LPSCROLLINFO info, BOOL bRedraw)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return SetScrollInfo(hwnd, nBar, info, bRedraw);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
2000-03-24 20:46:04 +00:00
|
|
|
/***********************************************************************
|
2002-08-09 01:07:29 +00:00
|
|
|
* FlatSB_SetScrollRange (COMCTL32.@)
|
2000-03-24 20:46:04 +00:00
|
|
|
*/
|
2002-05-31 23:06:46 +00:00
|
|
|
INT WINAPI
|
2000-05-24 21:05:20 +00:00
|
|
|
FlatSB_SetScrollRange(HWND hwnd, int nBar, INT min, INT max, BOOL bRedraw)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2000-05-24 21:05:20 +00:00
|
|
|
return SetScrollRange(hwnd, nBar, min, max, bRedraw);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 17:42:50 +00:00
|
|
|
FlatSB_Create (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
|
1999-01-17 16:32:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static LRESULT
|
1999-03-12 17:42:50 +00:00
|
|
|
FlatSB_Destroy (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-10-23 22:19:10 +00:00
|
|
|
TRACE("[%p] wParam=%04x lParam=%08lx\n", hwnd, wParam, lParam);
|
1999-01-17 16:32:32 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-07-31 14:41:43 +00:00
|
|
|
static LRESULT WINAPI
|
1999-02-26 11:11:13 +00:00
|
|
|
FlatSB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2001-02-12 03:42:23 +00:00
|
|
|
if (!FlatSB_GetInfoPtr(hwnd) && (uMsg != WM_CREATE))
|
|
|
|
return DefWindowProcA( hwnd, uMsg, wParam, lParam );
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-01-17 16:32:32 +00:00
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_CREATE:
|
1999-03-12 17:42:50 +00:00
|
|
|
return FlatSB_Create (hwnd, wParam, lParam);
|
1999-01-17 16:32:32 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
1999-03-12 17:42:50 +00:00
|
|
|
return FlatSB_Destroy (hwnd, wParam, lParam);
|
1999-01-17 16:32:32 +00:00
|
|
|
|
|
|
|
default:
|
2002-07-16 01:23:59 +00:00
|
|
|
if ((uMsg >= WM_USER) && (uMsg < WM_APP))
|
1999-12-08 03:56:23 +00:00
|
|
|
ERR("unknown msg %04x wp=%08x lp=%08lx\n",
|
|
|
|
uMsg, wParam, lParam);
|
1999-02-26 11:11:13 +00:00
|
|
|
return DefWindowProcA (hwnd, uMsg, wParam, lParam);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 08:27:49 +00:00
|
|
|
FLATSB_Register (void)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
1999-02-26 11:11:13 +00:00
|
|
|
WNDCLASSA wndClass;
|
1999-01-17 16:32:32 +00:00
|
|
|
|
1999-02-26 11:11:13 +00:00
|
|
|
ZeroMemory (&wndClass, sizeof(WNDCLASSA));
|
1999-01-17 16:32:32 +00:00
|
|
|
wndClass.style = CS_GLOBALCLASS;
|
1999-02-26 11:11:13 +00:00
|
|
|
wndClass.lpfnWndProc = (WNDPROC)FlatSB_WindowProc;
|
1999-01-17 16:32:32 +00:00
|
|
|
wndClass.cbClsExtra = 0;
|
|
|
|
wndClass.cbWndExtra = sizeof(FLATSB_INFO *);
|
1999-02-26 11:11:13 +00:00
|
|
|
wndClass.hCursor = LoadCursorA (0, IDC_ARROWA);
|
|
|
|
wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
|
|
|
wndClass.lpszClassName = FLATSB_CLASSA;
|
2002-05-31 23:06:46 +00:00
|
|
|
|
1999-02-26 11:11:13 +00:00
|
|
|
RegisterClassA (&wndClass);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID
|
1999-06-12 08:27:49 +00:00
|
|
|
FLATSB_Unregister (void)
|
1999-01-17 16:32:32 +00:00
|
|
|
{
|
2002-12-02 18:10:57 +00:00
|
|
|
UnregisterClassA (FLATSB_CLASSA, NULL);
|
1999-01-17 16:32:32 +00:00
|
|
|
}
|