************************************************************************************************************************
***FIVEWIN CLASSE TPanel
************************************************************************************************************************
// TPanel Class. Mainly used for Automatic Alignment techniques
#include "WinApi.ch"
#define SYS_COLOR_INDEX_FLAG 0x40000000
#define COLOR_BTNFACE nOr( 15, SYS_COLOR_INDEX_FLAG )
//----------------------------------------------------------------------------//
CLASS TPanel FROM TControl
DATA nStart, nEnd
CLASSDATA lRegistered AS LOGICAL
METHOD New( nTop, nLeft, nBottom, nRight, oWnd ) CONSTRUCTOR
METHOD Paint()
METHOD Display() INLINE ::BeginPaint(), ::Paint(), ::EndPaint()
METHOD Notify( nIdCtrl, nPtrNMHDR ) INLINE ::oWnd:Notify( nIdCtrl, nPtrNMHDR )
METHOD VScroll( nWParam, nLParam )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nTop, nLeft, nBottom, nRight, oWnd, lPixel, nClrText, nClrBack ) CLASS TPanel
DEFAULT nTop := 0, nLeft := 0, nBottom := 100, nRight := 100,;
oWnd := GetWndDefault(), lPixel := .f.,;
nClrBack := GetSysColor( COLOR_BTNFACE )
::nTop = nTop
::nLeft = nLeft
::nBottom = nBottom * If( lPixel, 1, SAY_CHARPIX_H )
::nRight = nRight * If( lPixel, 1, SAY_CHARPIX_W )
::oWnd = oWnd
::nStyle = nOr( WS_CHILD, WS_VISIBLE, WS_VSCROLL, WS_BORDER )
::lDrag = .f.
::nClrText = nClrText
::nClrPane = nClrBack
::nStart = 0
::nEnd = -1000
::Register()
if ! Empty( ::oWnd:hWnd )
::Create()
::oWnd:AddControl( Self )
DEFINE SCROLLBAR ::oVScroll VERTICAL OF Self
::oVScroll:SetRange( 0, 100 )
else
::oWnd:DefControl( Self )
endif
return Self
//----------------------------------------------------------------------------//
METHOD Paint() CLASS TPanel
local nTop, nLeft, nHeight, nWidth, nBevel
*----------------------------------------------------------
if ValType( ::bPainted ) != nil
Eval( ::bPainted, ::hDC )
endif
if ::oClient != nil .and. ( nBevel := ::oClient:nClientBevel ) > 0
nBevel -= 1
nTop := nBevel
nLeft := nBevel
nHeight := ::nHeight - nBevel - 1
nWidth := ::nWidth - nBevel - 1
if ::oTop != nil
nTop += ::oTop:nHeight
endif
if ::oBottom != nil
nHeight -= ::oBottom:nHeight
endif
if ::oLeft != nil
nLeft += ::oLeft:nWidth
endif
if ::oRight != nil
nWidth -= ::oRight:nWidth
endif
WndBoxIn( ::hDC, nTop, nLeft, nHeight, nWidth )
endif
return nil
//----------------------------------------------------------------------------//
METHOD VScroll( nWParam, nLParam ) CLASS TPanel
local nScrollCode := nLoWord( nWParam )
do case
case nScrollCode == SB_LINEUP
if ::nStart < 0
ScrollWindow( ::hWnd, 0, 10 )
::nStart += 10
::oVScroll:SetPos( -::nStart )
endif
case nScrollCode == SB_LINEDOWN
if ::nStart > ::nEnd
ScrollWindow( ::hWnd, 0, -10 )
::nStart -= 10
::oVScroll:SetPos( -::nStart )
endif
endcase
return 0
//----------------------------------------------------------------------------//