by karinha » Mon Mar 27, 2006 8:38 pm
Antonio, mi falta algo en la CLASSE GROUP.PRG, para ficar perfecta como la antigua. ke és???
#include "FiveWin.ch"
#include "Constant.ch"
#define WM_NCHITTEST 132 // 0x84
#define WM_UPDATEUISTATE 296 // 0x0128
#ifdef __XPP__
#define Super ::TControl
#define New _New
#endif
//----------------------------------------------------------------------------//
CLASS TGroup FROM TControl
METHOD New( nTop, nLeft, nBottom, nRight, cLabel, oWnd, nClrText,;
nClrPane, lPixel, lDesign, oFont, lTransparent ) CONSTRUCTOR
METHOD ReDefine( nId, cLabel, oWnd, nClrText, nClrPane, oFont, lTransparent ) CONSTRUCTOR
METHOD cToChar() INLINE Super:cToChar( "BUTTON" )
#ifndef __CLIPPER__
METHOD EraseBkGnd( hDC )
#endif
METHOD HandleEvent( nMsg, nWParam, nLParam )
METHOD Initiate( hDlg )
METHOD Colors( hDC )
ENDCLASS
//----------------------------------------------------------------------------//
METHOD New( nTop, nLeft, nBottom, nRight, cLabel, oWnd, nClrText, nClrPane,;
lPixel, lDesign, oFont, lTransparent ) CLASS TGroup
DEFAULT nTop := 0, nLeft := 0, nBottom := 3, nRight := 3,;
oWnd := GetWndDefault(),;
nClrText := oWnd:nClrText, nClrPane := oWnd:nClrPane,;
lPixel := .f., lDesign := .f.,;
lTransparent:= .f., oFont := oWnd:oFont
#ifdef __XPP__
#undef New
#endif
::nTop = nTop * If( lPixel, 1, GRP_CHARPIX_H ) // 14
::nLeft = nLeft * If( lPixel, 1, GRP_CHARPIX_W ) // 7
::nBottom = nBottom * If( lPixel, 1, GRP_CHARPIX_H ) // 14
::nRight = nRight * If( lPixel, 1, GRP_CHARPIX_W ) // 7
::cCaption = cLabel
::oWnd = oWnd
::nStyle = nOR( WS_CHILD, WS_VISIBLE, BS_GROUPBOX,;
If( lDesign, nOr( WS_TABSTOP, WS_CLIPSIBLINGS ), 0 ) )
::nId = ::GetNewId()
::lUpdate = .f.
::lDrag = lDesign
::SetColor( nClrText, nClrPane )
if lTransparent
#ifndef __XPP__
::SetBrush( TBrush():New( "NULL" ) )
#else
::SetBrush( TBrush():New():_New( "NULL" ) )
#endif
endIf
if ! Empty( oWnd:hWnd )
::Create( "BUTTON" )
oWnd:AddControl( Self )
else
oWnd:DefControl( Self )
endif
if oFont != nil
::SetFont( oFont )
endIf
if lDesign
::CheckDots()
endif
return Self
//----------------------------------------------------------------------------//
METHOD ReDefine( nId, cLabel, oWnd, nClrText, nClrPane, oFont,;
lTransparent ) CLASS TGroup
DEFAULT nId := ::GetNewId(),;
nClrText := oWnd:nClrText, nClrPane := oWnd:nClrPane,;
lTransparent:= .f.
::nId = nId
::cCaption = cLabel
::hWnd = 0
::oWnd = oWnd
::lUpdate = .f.
::lTransparent = lTransparent
::SetColor( nClrText, nClrPane )
If lTransparent
#ifndef __XPP__
::SetBrush( TBrush():New( "NULL" ) )
#else
::SetBrush( TBrush():New():_New( "NULL" ) ) // Xbase++ does not translates twice
#endif
EndIf
if oFont != Nil
::SetFont( oFont )
endIf
oWnd:DefControl( Self )
return Self
//----------------------------------------------------------------------------//
METHOD Initiate( hDlg ) CLASS TGroup
Super:Initiate( hDlg )
if Empty( ::cCaption )
::cCaption = GetWindowText( ::hWnd )
Else // [byHernan] Si se redefine el
SetWindowText( ::hWnd, ::cCaption ) // [byHernan] nombre debe respetarse
endif
return nil
//----------------------------------------------------------------------------//
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TGroup
local nResult
if ::lDrag .and. nMsg == WM_NCHITTEST // To have a standard behavior on Clicks
return DefWindowProc( ::hWnd, nMsg, nWParam, nLParam )
endif
if nMsg == WM_UPDATEUISTATE // Groups were erased when pressing ALT
nResult = Super:HandleEvent( nMsg, nWParam, nLParam )
::Refresh()
return nResult
endif
return Super:HandleEvent( nMsg, nWParam, nLParam )
//----------------------------------------------------------------------------//
#ifndef __CLIPPER__
METHOD EraseBkGnd( hDC ) CLASS TGroup
if IsAppThemed()
// return 1 Fix: 09-May-2005
endif
return Super:EraseBkGnd( hDC )
#endif
//----------------------------------------------------------------------------//
METHOD Colors( hDC ) CLASS TGroup
DEFAULT ::nClrText := GetTextColor( hDC ),;
::nClrPane := GetBkColor( hDC ),;
::oBrush := TBrush():New( , ::nClrPane )
SetTextColor( hDC, ::nClrText )
SetBkColor( hDC, ::nClrPane )
if ::oBrush:hBitmap != nil
SetBrushOrgEx( hDC, ::nLeft(), nBmpHeight( ::oBrush:hBitmap ) - ::nTop )
endif
return ::oBrush:hBrush
//----------------------------------------------------------------------------//
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341