// Modificado por José - para desplegar las barras de scroll proporcionales (tipo W95/98/2000)
// Modified by Manuel Mercado for TSBrowse, last update: February 27th, 2002
#include <WinTen.h> // set proper path if needed
#include <Windows.h>
#include <ClipApi.h> // set proper path if needed
#ifndef __FLAT__
#ifndef __HARBOUR__
typedef struct
{
DWORD cbSize ;
DWORD fMask ;
long nMin ;
long nMax ;
DWORD nPage ;
long nPos ;
long nTrackPos ;
} SCROLLINFO ;
typedef SCROLLINFO FAR * LPSCROLLINFO ;
#define SIF_RANGE 1
#define SIF_PAGE 2
#define SIF_POS 4
#define SIF_DISABLENOSCROLL 8
#define SIF_TRACKPOS 16
#endif
#endif
//----------------------------------------------------------------------------//
static BOOL SetScrInfo( HWND hWnd, int nScrollBar, LPSCROLLINFO si, BOOL lRedraw)
{
#ifndef __HARBOUR__
typedef BOOL ( WINAPI * FN )( HWND, int, LPSCROLLINFO, BOOL ) ;
FN p = ( FN ) GetProcAddress( GetModuleHandle( "USER" ), "SetScrollInfo" ) ;
if( p )
return ( p( ( HWND ) hWnd, nScrollBar, si, lRedraw ) ) ;
else
return ( FALSE ) ;
#else
return SetScrollInfo( hWnd, nScrollBar, si, lRedraw ) ;
#endif
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUN_SETSCROLLRANGE( PARAMS ) // ( hWnd, nFlags, nMin, nMax, lRepaint, lDisable, l32Bit )
#else
CLIPPER SETSCROLLR( PARAMS ) // ANGE()
#endif
[b]línea 56[/b] {
SCROLLINFO si ;
si.cbSize = sizeof( si ) ;
si.fMask = SIF_RANGE ;
si.nMin = _parni( 3 ) ;
si.nMax = _parni( 4 ) ;
if (_parl(6))
si.fMask = SIF_RANGE + SIF_DISABLENOSCROLL ;
if (_parl(7))
_retl( SetScrInfo( ( HWND ) _parnl( 1 ), _parni( 2 ), &si, _parl( 5 ) ) ) ;
else // NT does not support SetScrollInfo() API function
_retni( SetScrollRange( ( HWND ) _parnl( 1 ), // its hWnd
_parni( 2 ), // Scroll Bar flags
_parni( 3 ), // Min
_parni( 4 ), // Max
_parl( 5 ) ) ) ; // ReDraw
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUN_SETSCROLLPOS( PARAMS ) // ( hWnd, nFlags, nPos, lRepaint, lDisable, l32Bit )
#else
CLIPPER SETSCROLLP( PARAMS ) // OS
#endif
{
SCROLLINFO si;
si.cbSize = sizeof( si );
si.fMask = SIF_POS;
si.nPos = _parni( 3 );
if (_parl(5))
si.fMask = SIF_POS + SIF_DISABLENOSCROLL ;
if ( _parl( 6 ) )
_retl( SetScrInfo( ( HWND ) _parnl( 1 ), _parni( 2 ), &si, _parl( 4 ) ) ) ;
else // NT does not support SetScrollInfo() API function
_retl( SetScrollPos( ( HWND ) _parnl( 1 ), // its hWnd
_parni( 2 ), // Scroll Bar flags
_parni( 3 ), // new Position
_parl( 4 ) ) ) ; // repaint
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUN_GETSCROLLRANGE( PARAMS ) // ( hWnd, nFlags )
#else
CLIPPER GETSCROLLR( PARAMS ) // ANGE
#endif
{
int iMin = 0, iMax = 0 ;
#ifdef __FLAT__
#ifndef __HARBOUR__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
#endif
GetScrollRange( ( HWND ) _parnl( 1 ), // its hWnd
_parni( 2 ), // Scroll bar flags
&iMin,
&iMax ) ;
[b]línea 124[/b] _reta( 2 ) ; // { nMin, nMax }
_storni( iMin, -1, 1 ) ;
_storni( iMax, -1, 2 ) ;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUN_GETSCROLLPOS( PARAMS ) // ( hWnd, nFlags )
#else
CLIPPER GETSCROLLP( PARAMS ) // OS
#endif
{
_retni( GetScrollPos( ( HWND ) _parnl( 1 ), // its hWnd
_parni( 2 ) ) ) ; // Scroll bar flags
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HB_FUN_SETSCROLLINFO( PARAMS ) // ( hWnd, nFlags, nSize, lRedraw, lShowDisabled )
#else
CLIPPER SETSCROLLI( PARAMS ) // NFO()
#endif
{
SCROLLINFO si;
si.cbSize = sizeof( si );
si.fMask = SIF_PAGE ;
si.nPage = _parni( 3 );
if ( _parl( 5 ) )
si.fMask += SIF_DISABLENOSCROLL ;
_retl( SetScrInfo( ( HWND ) _parnl( 1 ), _parni( 2 ), &si, _parl( 4 ) ) ) ;
}
//----------------------------------------------------------------------------//