Compilación para 12.05
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Compilación para 12.05
!Estoy aquí regresando al redil!
Acabo de estrenar la versión 12.05 de FWH y me encuentro con problema para compilar algunas clases de terceros.
- WBrwLine.C de Hernan no pasa. Al parecer porque hay llamadas a funciones de Clipper.
- Uso TScan de TheFull y Menus de Tamayo. Reportan 'Suspicious pointer conversion...'
Me pregunto si alguna alma caritativa ya superó estas situaciones y/o me da línea para superarlas.
Herramientas: FWH 12.05, xHarbour 1.2.1, BCC 5.82
Tengo por ahí algunos secretos que me gustaría compartir con ustedes interesados en trabajar con FWH y SQL, pero primero debo superar esto (snif!).
Gracias.
Acabo de estrenar la versión 12.05 de FWH y me encuentro con problema para compilar algunas clases de terceros.
- WBrwLine.C de Hernan no pasa. Al parecer porque hay llamadas a funciones de Clipper.
- Uso TScan de TheFull y Menus de Tamayo. Reportan 'Suspicious pointer conversion...'
Me pregunto si alguna alma caritativa ya superó estas situaciones y/o me da línea para superarlas.
Herramientas: FWH 12.05, xHarbour 1.2.1, BCC 5.82
Tengo por ahí algunos secretos que me gustaría compartir con ustedes interesados en trabajar con FWH y SQL, pero primero debo superar esto (snif!).
Gracias.
-
- Posts: 440
- Joined: Fri Oct 07, 2005 2:17 pm
- Location: Lima - Peru
- Contact:
Re: Compilación para 12.05
Alfredo, wBrwLine.c, Yo la tengo compilada con xHarbour, osea tengo el wBewLine.obj, no recuerdo de que version, pero pasa en todas mis compilaciones sin problemas, trabajo con FWH 12.02 si gustas te lo envio para que lo pruebes.
Enrrique Vertiz Pitta
Lima-Peru
xHb 1.23, Fwh 20.04, MySQL 5.7 - 8.0, SQLLIB 1.9m, SQLRDD
Lima-Peru
xHb 1.23, Fwh 20.04, MySQL 5.7 - 8.0, SQLLIB 1.9m, SQLRDD
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: Compilación para 12.05
Gracias Enrique, con gusto lo acepto. Mi correo: soporte@rc-extended.com.mx.
No obstante, si me agradaría obtener la compilación con las herramientas actuales, saber si hace falta incluir algun archivo o ajustar el código.
No obstante, si me agradaría obtener la compilación con las herramientas actuales, saber si hace falta incluir algun archivo o ajustar el código.
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Compilación para 12.05
Alfredo,
Puedes copiar aqui ó enviarme por email el fichero wbrwline.c de Hernan ? gracias!
Bienvenido nuevamente!
Puedes copiar aqui ó enviarme por email el fichero wbrwline.c de Hernan ? gracias!
Bienvenido nuevamente!
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: Compilación para 12.05
Gracias por el interés Antonio.
He aquí el código el problema de compilación se reporta en: static void near PaintTheLine .
Envié a tu correo la TScan para ver lo de 'Suspicious pointer...' parece que hay que hacer algun tipo de declaración en los parámetros pero no me atrevo a hacerlo sin consultar.
He aquí el código el problema de compilación se reporta en: static void near PaintTheLine .
Envié a tu correo la TScan para ver lo de 'Suspicious pointer...' parece que hay que hacer algun tipo de declaración en los parámetros pero no me atrevo a hacerlo sin consultar.
Code: Select all
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#define _HB_API_INTERNAL_
#include <Windows.h>
#ifdef __HARBOUR__
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbstack.h>
#include <hbvm.h>
// #include <hbfast.h>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#endif
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
// static far void * pSkip = 0;
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = SelectObject(hdcTemp, bmAndTemp);
bmMemOld = SelectObject(hdcMem, bmAndMem);
bmBackOld = SelectObject(hdcBack, bmAndBack);
bmObjectOld = SelectObject(hdcObject, bmAndObject);
hBrOld = SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
HB_ITEM uElem;
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
// uElem.type = HB_IT_NIL;
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & CHARACTER )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
uElem.type = HB_IT_NIL;
hb_arrayGet( pAJustify, wIndex, &uElem );
if ( ( hb_itemType( &uElem ) & LOGICAL ) && hb_itemGetL( &uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( &uElem );
hb_itemClear( &uElem );
}
uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, &uElem );
wType = hb_itemType( &uElem );
if ( wType & NUMERIC )
lValue = hb_itemGetNL( &uElem );
if ( wType & CHARACTER )
{
// cValue = hb_itemGetC( &uElem );
cValue = hb_itemGetCPtr( &uElem );
wcLen = strlen( cValue );
}
hb_itemClear( &uElem );
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es Numerico Bmp no Tree, o , es Character !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( _parinfo( -1 ) & NUMERIC )
lBkColorOld = SetBkColor( hDC, _parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( _parinfo( -1 ) & NUMERIC )
lTextColorOld = SetTextColor( hDC, _parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( _parinfo( -1 ) & NUMERIC )
hFont = (HFONT) _parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & CHARACTER ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSELBOX()
#else
CLIPPER WBRWSELBOX( PARAMS ) // ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
#endif
{
HWND hWnd = (HWND) _parnl( 1 );
HDC hDC = (HDC) _parnl( 2 );
WORD wRow = _parni( 3 );
WORD wIndex = _parni( 4 );
WORD wCol = _parni( 5 );
BOOL bFocused = _parl( 6 );
PCLIPVAR pAsizes = _param( 7, -1 );
HFONT hFont = (HFONT) _parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWLINE()
#else
CLIPPER WBRWLINE( PARAMS ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
#endif
{
HWND hWnd = (HWND) _parnl( 1 );
HDC hDC = (HDC) _parnl( 2 );
WORD wRow = _parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) _parnl( 9 );
HFONT hOldFont;
BOOL bTree = _parl( 10 );
BOOL bFooter = ISLOGICAL( 19 ) ? _parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( PCOUNT() > 6 )
{
if( ISBLOCK( 7 ) )
{
bClrFore = _param( 7, -1 );
_cEval0( bClrFore );
clrFore = _parnl( -1 );
}
else
clrFore = _parnl( 7 );
}
if( PCOUNT() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = _param( 8, -1 );
_cEval0( bClrBack );
clrBack = _parnl( -1 );
}
else
clrBack = _parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, _parni( 6 ), _param( 4, -1 ), _param( 5, -1 ),
hWhitePen, hGrayPen, bTree,
ISARRAY(11) ? _param( 11, -1 ) : 0, _parni( 12 ),
(wRow == 0), _parni( 13 ),
_parni( 14 ), _parl( 15 ),
ISBLOCK( 16 ) ? _param( 16, -1 ) : 0, // CeSoTech
ISBLOCK( 17 ) ? _param( 17, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 18 ) ? _parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
ISLOGICAL( 20 ) ? _parl( 20 ) : FALSE, // CeSoTech
ISBLOCK( 21 ) ? _param( 21, -1 ) : 0, // CeSoTech
ISLOGICAL( 22 ) ? _parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
_reta( 2 );
_storni( rct.top, -1, 1 );
_storni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_AWBRWROWDIM()
#else
CLIPPER AWBRWROWDIM( PARAMS )
#endif
{
HWND hWnd = (HWND) _parnl( 1 );
WORD wRow = (WORD) _parnl( 2 );
HFONT hFont = (HFONT) _parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
_reta( 2 );
_storni( tm.tmHeight * wRow++, -1, 1 );
_storni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWRECT()
#else
CLIPPER WBrwRect( PARAMS ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
#endif
{
HWND hWnd = ( HWND ) _parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = _parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = ISNUM( 6 ) ? _parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) _param( 3, HB_IT_ARRAY );
WORD wLen = _parinfa( 3, 0 );
#else
void * paSizes = ( void * ) _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = _parni( 4 );
WORD wCol = _parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define _parnl(x,y) PARNL(x,params,y);
#endif
l = _parnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
_storni( rct.top, -1, 1 );
_storni( rct.left, -1, 2 );
_storni( rct.bottom, -1, 3 );
_storni( ( wMaxRight <= rct.right ) ?
wMaxRight - _parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWPANE()
#else
CLIPPER WBRWPANE( PARAMS ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
#endif
{
HWND hWnd = ( HWND ) _parnl( 1 );
HDC hDC = ( HDC ) _parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = _param( 3, -1 );
PCLIPVAR bLine = _param( 4, -1 );
PCLIPVAR pASizes = _param( 5, -1 );
HFONT hFont = ( HFONT ) _parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = _parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & BLOCK;
#else
BOOL bColBlock = pASizes->type & BLOCK;
HB_ITEM aLine;
#endif
PCLIPVAR pAJustify = ISARRAY( 10 ) ? _param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = _parni( 11 );
if( PCOUNT() > 6 )
{
if( ISBLOCK( 7 ) )
bClrFore = _param( 7, -1 );
else
clrFore = _parnl( 7 );
}
if( PCOUNT() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = _param( 8, -1 );
_cEval0( bClrBack );
clrBack = _parnl( -1 );
}
else
clrBack = _parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, _parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) _parinfa( 5, NULL); wIndex++ )
{
rct.left += _parni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = _parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, _parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, _parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, _parni( 11 ),
_parni ( 12 ), _parl( 13 ),
ISBLOCK( 14 ) ? _param( 14, -1 ) : 0, // CeSoTech
ISBLOCK( 15 ) ? _param( 15, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? _parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? _param( 18, -1 ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( &aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( &aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, _parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, _parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, &aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, _parnl( 11 ),
_parnl ( 12 ), _parl( 13 ),
ISBLOCK( 14 ) ? _param( 14, -1 ) : 0, // CeSoTech
ISBLOCK( 15 ) ? _param( 15, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? _parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? _param( 18, -1 ) : 0, // CeSoTech
FALSE ) ;
hb_itemClear( &aLine );
if ( pSkip )
{
hb_vmPushSymbol( pSkip->pSymbol );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = _parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, _parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
_retni( wRow );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSET()
#else
CLIPPER WBrwSet() // ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
#endif
{ // CeSoTech
bAdjLastCol = _parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = _parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = _parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = _parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= _parni( 5 ) ;
wFooterHeight= _parni( 6 ) ;
wLineHeight = _parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWROWS()
#else
CLIPPER WBrwRows( PARAMS ) // ( hWnd, hDC, hFont )
#endif
{
_retni( WBrwRowsC( ( HWND ) _parnl( 1 ), ( HDC ) _parnl( 2 ),
( HFONT ) _parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSCRL()
#else
CLIPPER WBrwScrl( PARAMS ) // ( hWnd, nRows, hFont, nLineStyle, hDC )
#endif
{
HWND hWnd = ( HWND ) _parnl( 1 );
int wRows = _parni( 2 );
HFONT hFont = ( HFONT ) _parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) _parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = _parni( 4 );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWHEIGHT()
#else
CLIPPER WBrwHeight( PARAMS ) // ( hWnd, hFont )
#endif
{
HWND hWnd = ( HWND ) _parnl( 1 );
HFONT hFont = ( HFONT ) _parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_FWDISPBEGIN()
#else
CLIPPER FWDISPBEGI( PARAMS ) // ( hWnd, hDC )
#endif
{
HWND hWnd = ( HWND ) _parnl( 1 );
HDC hDC = ( HDC ) _parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
_reta( 5 );
_stornl( (LONG) hWnd , -1, 1 );
_stornl( (LONG) hDC , -1, 2 );
_stornl( (LONG) hDC2 , -1, 3 );
_stornl( (LONG) hBmp , -1, 4 );
_stornl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_FWDISPEND()
#else
CLIPPER FWDISPEND( PARAMS ) // { hWnd, hDC, hDC2, hBmp, hBmpOld }
#endif
{
RECT rct;
GetClientRect( (HWND) _parnl( 1, 1 ), &rct );
BitBlt( (HDC) _parnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) _parnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) _parnl( 1, 3 ), (HBITMAP) _parnl( 1, 5 ) );
DeleteObject( (HBITMAP) _parnl( 1, 4 ) );
DeleteObject( (HBITMAP) _parnl( 1, 5 ) );
DeleteDC( (HDC) _parnl( 1, 3 ) );
_retnl( (LONG) _parnl( 1, 2 ) ) ;
return ;
}
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Compilación para 12.05
Alfredo,
Con _ compila bien. Ahora pruébalo para ver si funciona o da algun error.
c:\bcc582\bin\bcc32 -c -Ic:\xharbour\include -D__HARBOUR__ wbrwline.c
Aqui tienes el OBJ:
http://min.us/m6LdheRaI
No me llegó tu email con tscan
wbrwline.c
Con _ compila bien. Ahora pruébalo para ver si funciona o da algun error.
c:\bcc582\bin\bcc32 -c -Ic:\xharbour\include -D__HARBOUR__ wbrwline.c
Aqui tienes el OBJ:
http://min.us/m6LdheRaI
No me llegó tu email con tscan
wbrwline.c
Code: Select all
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#include <Windows.h>
#define _HB_API_INTERNAL_
#define HB_OS_WIN
#define HB_OS_WIN_USED
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbstack.h>
#include <hbvm.h>
// #include <extend.api>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#define PCLIPVAR PHB_ITEM
#define far
#define WORD unsigned short
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
// static far void * pSkip = 0;
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = SelectObject(hdcTemp, bmAndTemp);
bmMemOld = SelectObject(hdcMem, bmAndMem);
bmBackOld = SelectObject(hdcBack, bmAndBack);
bmObjectOld = SelectObject(hdcObject, bmAndObject);
hBrOld = SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & HB_IT_NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
HB_ITEM uElem;
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
// uElem.type = HB_IT_NIL;
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & HB_IT_NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & HB_IT_STRING )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
uElem.type = HB_IT_NIL;
hb_arrayGet( pAJustify, wIndex, &uElem );
if ( ( hb_itemType( &uElem ) & HB_IT_LOGICAL ) && hb_itemGetL( &uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( &uElem );
hb_itemClear( &uElem );
}
uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, &uElem );
wType = hb_itemType( &uElem );
if ( wType & HB_IT_NUMERIC )
lValue = hb_itemGetNL( &uElem );
if ( wType & HB_IT_STRING )
{
// cValue = hb_itemGetC( &uElem );
cValue = hb_itemGetCPtr( &uElem );
wcLen = strlen( cValue );
}
hb_itemClear( &uElem );
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & HB_IT_NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es HB_IT_NUMERICo Bmp no Tree, o , es HB_IT_STRING !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & HB_IT_NUMERIC )
lBkColorOld = SetBkColor( hDC, hb_parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & HB_IT_NUMERIC )
lTextColorOld = SetTextColor( hDC, hb_parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & HB_IT_NUMERIC )
hFont = (HFONT) hb_parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & HB_IT_NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & HB_IT_STRING ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & HB_IT_NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSELBOX()
#else
CLIPPER WBRWSELBOX( PARAMS ) // ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
#endif
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
BOOL bFocused = hb_parl( 6 );
PCLIPVAR pAsizes = hb_param( 7, -1 );
HFONT hFont = (HFONT) hb_parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWLINE()
#else
CLIPPER WBRWLINE( PARAMS ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
#endif
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) hb_parnl( 9 );
HFONT hOldFont;
BOOL bTree = hb_parl( 10 );
BOOL bFooter = ISLOG( 19 ) ? hb_parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( hb_pcount() > 6 )
{
if( ISBLOCK( 7 ) )
{
bClrFore = hb_param( 7, -1 );
_cEval0( bClrFore );
clrFore = hb_parnl( -1 );
}
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, -1 );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, hb_parni( 6 ), hb_param( 4, -1 ), hb_param( 5, -1 ),
hWhitePen, hGrayPen, bTree,
ISARRAY(11) ? hb_param( 11, -1 ) : 0, hb_parni( 12 ),
(wRow == 0), hb_parni( 13 ),
hb_parni( 14 ), hb_parl( 15 ),
ISBLOCK( 16 ) ? hb_param( 16, -1 ) : 0, // CeSoTech
ISBLOCK( 17 ) ? hb_param( 17, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 18 ) ? hb_parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
ISLOG( 20 ) ? hb_parl( 20 ) : FALSE, // CeSoTech
ISBLOCK( 21 ) ? hb_param( 21, -1 ) : 0, // CeSoTech
ISLOG( 22 ) ? hb_parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storni( rct.top, -1, 1 );
hb_storni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_AWBRWROWDIM()
#else
CLIPPER AWBRWROWDIM( PARAMS )
#endif
{
HWND hWnd = (HWND) hb_parnl( 1 );
WORD wRow = (WORD) hb_parnl( 2 );
HFONT hFont = (HFONT) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storni( tm.tmHeight * wRow++, -1, 1 );
hb_storni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWRECT()
#else
CLIPPER WBrwRect( PARAMS ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
#endif
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = hb_parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = ISNUM( 6 ) ? hb_parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = hb_param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) hb_param( 3, HB_IT_ARRAY );
WORD wLen = hb_parinfa( 3, 0 );
#else
void * paSizes = ( void * ) hb_param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define hb_parnl(x,y) PARNL(x,params,y);
#endif
l = hb_parnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
hb_reta( 4 );
#ifdef __XPP__
#define hb_storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
hb_storni( rct.top, -1, 1 );
hb_storni( rct.left, -1, 2 );
hb_storni( rct.bottom, -1, 3 );
hb_storni( ( wMaxRight <= rct.right ) ?
wMaxRight - hb_parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWPANE()
#else
CLIPPER WBRWPANE( PARAMS ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
#endif
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = hb_param( 3, -1 );
PCLIPVAR bLine = hb_param( 4, -1 );
PCLIPVAR pASizes = hb_param( 5, -1 );
HFONT hFont = ( HFONT ) hb_parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = hb_parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & HB_II_BLOCK;
#else
BOOL bColBlock = pASizes->type & HB_IT_BLOCK;
HB_ITEM aLine;
#endif
PCLIPVAR pAJustify = ISARRAY( 10 ) ? hb_param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = hb_parni( 11 );
if( hb_pcount() > 6 )
{
if( ISBLOCK( 7 ) )
bClrFore = hb_param( 7, -1 );
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, -1 );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) hb_parinfa( 5, NULL); wIndex++ )
{
rct.left += hb_parni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = hb_parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parni( 11 ),
hb_parni ( 12 ), hb_parl( 13 ),
ISBLOCK( 14 ) ? hb_param( 14, -1 ) : 0, // CeSoTech
ISBLOCK( 15 ) ? hb_param( 15, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? hb_param( 18, -1 ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( &aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( &aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, &aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parnl( 11 ),
hb_parnl ( 12 ), hb_parl( 13 ),
ISBLOCK( 14 ) ? hb_param( 14, -1 ) : 0, // CeSoTech
ISBLOCK( 15 ) ? hb_param( 15, -1 ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? hb_param( 18, -1 ) : 0, // CeSoTech
FALSE ) ;
hb_itemClear( &aLine );
if ( pSkip )
{
hb_vmPushSymbol( pSkip->pSymbol );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = hb_parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_retni( wRow );
}
//---------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSET()
#else
CLIPPER WBrwSet() // ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
#endif
{ // CeSoTech
bAdjLastCol = hb_parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = hb_parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = hb_parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = hb_parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= hb_parni( 5 ) ;
wFooterHeight= hb_parni( 6 ) ;
wLineHeight = hb_parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWROWS()
#else
CLIPPER WBrwRows( PARAMS ) // ( hWnd, hDC, hFont )
#endif
{
hb_retni( WBrwRowsC( ( HWND ) hb_parnl( 1 ), ( HDC ) hb_parnl( 2 ),
( HFONT ) hb_parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWSCRL()
#else
CLIPPER WBrwScrl( PARAMS ) // ( hWnd, nRows, hFont, nLineStyle, hDC )
#endif
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
int wRows = hb_parni( 2 );
HFONT hFont = ( HFONT ) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) hb_parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = hb_parni( 4 );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_WBRWHEIGHT()
#else
CLIPPER WBrwHeight( PARAMS ) // ( hWnd, hFont )
#endif
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HFONT hFont = ( HFONT ) hb_parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
hb_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_FWDISPBEGIN()
#else
CLIPPER FWDISPBEGI( PARAMS ) // ( hWnd, hDC )
#endif
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_stornl( (LONG) hWnd , -1, 1 );
hb_stornl( (LONG) hDC , -1, 2 );
hb_stornl( (LONG) hDC2 , -1, 3 );
hb_stornl( (LONG) hBmp , -1, 4 );
hb_stornl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
#ifdef __HARBOUR__
HARBOUR HB_FUN_FWDISPEND()
#else
CLIPPER FWDISPEND( PARAMS ) // { hWnd, hDC, hDC2, hBmp, hBmpOld }
#endif
{
RECT rct;
GetClientRect( (HWND) hb_parnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parnl( 1, 3 ), (HBITMAP) hb_parnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parnl( 1, 5 ) );
DeleteDC( (HDC) hb_parnl( 1, 3 ) );
hb_retnl( (LONG) hb_parnl( 1, 2 ) ) ;
return ;
}
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: Compilación para 12.05
Bien!
Gracias Antonio, YA COMPILO!, (no se que hace ni como lo hace, pero investigaré), esto me da linea para superar los errores del 'Suspicious pointer...', si la aplicación funciona como debe seguro que lo comentaré.
Y también haré mucho ruido (es viernes de cantina, hip!).
Gracias Antonio, YA COMPILO!, (no se que hace ni como lo hace, pero investigaré), esto me da linea para superar los errores del 'Suspicious pointer...', si la aplicación funciona como debe seguro que lo comentaré.
Y también haré mucho ruido (es viernes de cantina, hip!).
Re: Compilación para 12.05
Comparto con ustedes todos los wbrwline modificados para compilar con Xharbour con BCC y Harbour con BCC, MSVC2010 y MingW
Wbrwlinex.c para Xharbour y Bcc sin Warnings
Wbrwlinex.c para Xharbour y Bcc sin Warnings
Code: Select all
// para xharbour 1.2.1
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#include <Windows.h>
#ifdef __HARBOUR__
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbvm.h>
// #include <hbfast.h>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#endif
#define LOGICAL HB_IT_LOGICAL
#define NUMERIC HB_IT_NUMERIC
#define CHARACTER HB_IT_STRING
#define BLOCK HB_IT_BLOCK
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
#ifdef __FLAT__
#undef PCLIPVAR
#define PCLIPVAR PHB_ITEM
#endif
#ifdef __XHARBOUR__
void hb_storvni( int iValue, int iParam, int iIndex );
long hb_parvnl( int iParam, int iIndex );
int hb_parvni( int iParam, int iIndex );
void hb_storvnl( LONG lValue, int iParam, int iIndex );
#endif
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = SelectObject(hdcTemp, bmAndTemp);
bmMemOld = SelectObject(hdcMem, bmAndMem);
bmBackOld = SelectObject(hdcBack, bmAndBack);
bmObjectOld = SelectObject(hdcObject, bmAndObject);
hBrOld = SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
PHB_ITEM uElem = hb_itemNew( NULL );
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & CHARACTER )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
hb_arrayGet( pAJustify, wIndex, uElem );
if ( ( hb_itemType( uElem ) & LOGICAL ) && hb_itemGetL( uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( uElem );
hb_itemClear( uElem );
}
// uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, uElem );
wType = hb_itemType( uElem );
if ( wType & NUMERIC )
lValue = hb_itemGetNL( uElem );
if ( wType & CHARACTER )
{
// cValue = hb_itemGetC( uElem );
cValue = ( char * ) hb_itemGetCPtr( uElem );
wcLen = strlen( cValue );
}
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es Numerico Bmp no Tree, o , es Character !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lBkColorOld = SetBkColor( hDC, hb_parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lTextColorOld = SetTextColor( hDC, hb_parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
hFont = (HFONT) hb_parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & CHARACTER ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
hb_itemRelease( uElem );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSELBOX )// ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
BOOL bFocused = hb_parl( 6 );
PCLIPVAR pAsizes = hb_param( 7, -1 );
HFONT hFont = (HFONT) hb_parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWLINE ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) hb_parnl( 9 );
HFONT hOldFont;
BOOL bTree = hb_parl( 10 );
BOOL bFooter = ISLOG( 19 ) ? hb_parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( hb_pcount() > 6 )
{
if( ISBLOCK( 7 ) )
{
bClrFore = hb_param( 7, HB_IT_BLOCK );
_cEval0( bClrFore );
clrFore = hb_parnl( -1 );
}
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, hb_parni( 6 ), hb_param( 4, 0xFFFF ), hb_param( 5, 0xFFFF ),
hWhitePen, hGrayPen, bTree,
ISARRAY(11) ? hb_param( 11, -1 ) : 0, hb_parni( 12 ),
(wRow == 0), hb_parni( 13 ),
hb_parni( 14 ), hb_parl( 15 ),
ISBLOCK( 16 ) ? hb_param( 16, HB_IT_BLOCK ) : 0, // CeSoTech
ISBLOCK( 17 ) ? hb_param( 17, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 18 ) ? hb_parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
ISLOG( 20 ) ? hb_parl( 20 ) : FALSE, // CeSoTech
ISBLOCK( 21 ) ? hb_param( 21, HB_IT_BLOCK ) : 0, // CeSoTech
ISLOG( 22 ) ? hb_parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
HB_FUNC( AWBRWROWDIM )
{
HWND hWnd = (HWND) hb_parnl( 1 );
WORD wRow = (WORD) hb_parnl( 2 );
HFONT hFont = (HFONT) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( tm.tmHeight * wRow++, -1, 1 );
hb_storvni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWRECT ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = hb_parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = ISNUM( 6 ) ? hb_parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) _param( 3, HB_IT_ARRAY );
WORD wLen = hb_parinfa( 3, 0 );
#else
void * paSizes = ( void * ) _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define _parnl(x,y) PARNL(x,params,y);
#endif
l = hb_parvnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
hb_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( ( wMaxRight <= rct.right ) ?
wMaxRight - hb_parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWPANE ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = hb_param( 3, -1 );
PCLIPVAR bLine = hb_param( 4, -1 );
PCLIPVAR pASizes = hb_param( 5, -1 );
HFONT hFont = ( HFONT ) hb_parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = hb_parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & BLOCK;
#else
BOOL bColBlock = hb_itemType( pASizes ) & BLOCK;
PHB_ITEM aLine = hb_itemNew( NULL );
#endif
PCLIPVAR pAJustify = ISARRAY( 10 ) ? hb_param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = hb_parni( 11 );
if( hb_pcount() > 6 )
{
if( ISBLOCK( 7 ) )
bClrFore = hb_param( 7, HB_IT_BLOCK );
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) hb_parinfa( 5, NULL); wIndex++ )
{
rct.left += hb_parvni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = hb_parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parni( 11 ),
hb_parni ( 12 ), hb_parl( 13 ),
ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
// aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parnl( 11 ),
hb_parnl ( 12 ), hb_parl( 13 ),
ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
if ( pSkip )
{
hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = hb_parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_retni( wRow );
hb_itemRelease( aLine );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSET )// ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
{ // CeSoTech
bAdjLastCol = hb_parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = hb_parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = hb_parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = hb_parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= hb_parni( 5 ) ;
wFooterHeight= hb_parni( 6 ) ;
wLineHeight = hb_parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWROWS )// ( hWnd, hDC, hFont )
{
hb_retni( WBrwRowsC( ( HWND ) hb_parnl( 1 ), ( HDC ) hb_parnl( 2 ),
( HFONT ) hb_parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWSCRL )// ( hWnd, nRows, hFont, nLineStyle, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
int wRows = hb_parni( 2 );
HFONT hFont = ( HFONT ) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) hb_parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = hb_parni( 4 );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWHEIGHT )// ( hWnd, hFont )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HFONT hFont = ( HFONT ) hb_parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
hb_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPBEGIN )// ( hWnd, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_storvnl( (LONG) hWnd , -1, 1 );
hb_storvnl( (LONG) hDC , -1, 2 );
hb_storvnl( (LONG) hDC2 , -1, 3 );
hb_storvnl( (LONG) hBmp , -1, 4 );
hb_storvnl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPEND )// { hWnd, hDC, hDC2, hBmp, hBmpOld }
{
RECT rct;
GetClientRect( (HWND) hb_parvnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parvnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parvnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parvnl( 1, 3 ), (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteDC( (HDC) hb_parvnl( 1, 3 ) );
hb_retnl( (LONG) hb_parvnl( 1, 2 ) ) ;
return ;
}
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Re: Compilación para 12.05
Wbrwlineh.c Para Harbour Borland
Code: Select all
// se corrigio para harbour 3.0 y 3.1
//Cambia todas las llamadas a funciones IS... por HB_IS... (por ejemplo: HB_ISLOG(...) en vez de ISLOG(...))
//y además añade despues de los includes Antes de los #includes añade este define: #define _HB_API_INTERNAL_
//
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#include <Windows.h>
#ifdef __HARBOUR__
#define _HB_API_INTERNAL_
// #include <clipapi.h>
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbvm.h>
#include <hbstack.h>
#include <hbvm.h>
// #include <hbfast.h>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#endif
#define LOGICAL HB_IT_LOGICAL
#define NUMERIC HB_IT_NUMERIC
#define CHARACTER HB_IT_STRING
#define BLOCK HB_IT_BLOCK
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
#ifdef __FLAT__
#undef PCLIPVAR
#define PCLIPVAR PHB_ITEM
#endif
#ifdef __XHARBOUR__
void hb_storvni( int iValue, int iParam, int iIndex );
long hb_parvnl( int iParam, int iIndex );
int hb_parvni( int iParam, int iIndex );
void hb_storvnl( LONG lValue, int iParam, int iIndex );
#endif
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = SelectObject(hdcTemp, bmAndTemp);
bmMemOld = SelectObject(hdcMem, bmAndMem);
bmBackOld = SelectObject(hdcBack, bmAndBack);
bmObjectOld = SelectObject(hdcObject, bmAndObject);
hBrOld = SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
PHB_ITEM uElem = hb_itemNew( NULL );
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & CHARACTER )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
hb_arrayGet( pAJustify, wIndex, uElem );
if ( ( hb_itemType( uElem ) & LOGICAL ) && hb_itemGetL( uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( uElem );
hb_itemClear( uElem );
}
// uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, uElem );
wType = hb_itemType( uElem );
if ( wType & NUMERIC )
lValue = hb_itemGetNL( uElem );
if ( wType & CHARACTER )
{
// cValue = hb_itemGetC( uElem );
cValue = ( char * ) hb_itemGetCPtr( uElem );
wcLen = strlen( cValue );
}
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es Numerico Bmp no Tree, o , es Character !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lBkColorOld = SetBkColor( hDC, hb_parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lTextColorOld = SetTextColor( hDC, hb_parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
hFont = (HFONT) hb_parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & CHARACTER ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = GetStockObject( BLACK_PEN );
hOldPen = SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
hb_itemRelease( uElem );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSELBOX )// ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
BOOL bFocused = hb_parl( 6 );
PCLIPVAR pAsizes = hb_param( 7, -1 );
HFONT hFont = (HFONT) hb_parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWLINE ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) hb_parnl( 9 );
HFONT hOldFont;
BOOL bTree = hb_parl( 10 );
BOOL bFooter = HB_ISLOG( 19 ) ? hb_parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
{
bClrFore = hb_param( 7, HB_IT_BLOCK );
_cEval0( bClrFore );
clrFore = hb_parnl( -1 );
}
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, hb_parni( 6 ), hb_param( 4, 0xFFFF ), hb_param( 5, 0xFFFF ),
hWhitePen, hGrayPen, bTree,
HB_ISARRAY(11) ? hb_param( 11, -1 ) : 0, hb_parni( 12 ),
(wRow == 0), hb_parni( 13 ),
hb_parni( 14 ), hb_parl( 15 ),
HB_ISBLOCK( 16 ) ? hb_param( 16, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 17 ) ? hb_param( 17, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 18 ) ? hb_parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
HB_ISLOG( 20 ) ? hb_parl( 20 ) : FALSE, // CeSoTech
HB_ISBLOCK( 21 ) ? hb_param( 21, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISLOG( 22 ) ? hb_parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
HB_FUNC( AWBRWROWDIM )
{
HWND hWnd = (HWND) hb_parnl( 1 );
WORD wRow = (WORD) hb_parnl( 2 );
HFONT hFont = (HFONT) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( tm.tmHeight * wRow++, -1, 1 );
hb_storvni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWRECT ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = hb_parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) _param( 3, HB_IT_ARRAY );
WORD wLen = hb_parinfa( 3, 0 );
#else
void * paSizes = ( void * ) _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define _parnl(x,y) PARNL(x,params,y);
#endif
l = hb_parvnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
hb_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( ( wMaxRight <= rct.right ) ?
wMaxRight - hb_parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWPANE ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = hb_param( 3, -1 );
PCLIPVAR bLine = hb_param( 4, -1 );
PCLIPVAR pASizes = hb_param( 5, -1 );
HFONT hFont = ( HFONT ) hb_parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = hb_parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & BLOCK;
#else
BOOL bColBlock = hb_itemType( pASizes ) & BLOCK;
PHB_ITEM aLine = hb_itemNew( NULL );
#endif
PCLIPVAR pAJustify = HB_ISARRAY( 10 ) ? hb_param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = hb_parni( 11 );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
bClrFore = hb_param( 7, HB_IT_BLOCK );
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) hb_parinfa( 5, NULL); wIndex++ )
{
rct.left += hb_parvni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = hb_parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parni( 11 ),
hb_parni ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
// aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parnl( 11 ),
hb_parnl ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
if ( pSkip )
{
hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = hb_parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_retni( wRow );
hb_itemRelease( aLine );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSET )// ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
{ // CeSoTech
bAdjLastCol = hb_parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = hb_parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = hb_parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = hb_parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= hb_parni( 5 ) ;
wFooterHeight= hb_parni( 6 ) ;
wLineHeight = hb_parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWROWS )// ( hWnd, hDC, hFont )
{
hb_retni( WBrwRowsC( ( HWND ) hb_parnl( 1 ), ( HDC ) hb_parnl( 2 ),
( HFONT ) hb_parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWSCRL )// ( hWnd, nRows, hFont, nLineStyle, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
int wRows = hb_parni( 2 );
HFONT hFont = ( HFONT ) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) hb_parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = hb_parni( 4 );
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWHEIGHT )// ( hWnd, hFont )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HFONT hFont = ( HFONT ) hb_parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
hb_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPBEGIN )// ( hWnd, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_storvnl( (LONG) hWnd , -1, 1 );
hb_storvnl( (LONG) hDC , -1, 2 );
hb_storvnl( (LONG) hDC2 , -1, 3 );
hb_storvnl( (LONG) hBmp , -1, 4 );
hb_storvnl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPEND )// { hWnd, hDC, hDC2, hBmp, hBmpOld }
{
RECT rct;
GetClientRect( (HWND) hb_parvnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parvnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parvnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parvnl( 1, 3 ), (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteDC( (HDC) hb_parvnl( 1, 3 ) );
hb_retnl( (LONG) hb_parvnl( 1, 2 ) ) ;
return ;
}
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Re: Compilación para 12.05
Wbrwline_VC.c Para Harbour y MSVC2010
Code: Select all
// se corrigio para harbour 3.0 y 3.1
//Cambia todas las llamadas a funciones IS... por HB_IS... (por ejemplo: HB_ISLOG(...) en vez de ISLOG(...))
//y además añade despues de los includes Antes de los #includes añade este define: #define _HB_API_INTERNAL_
//
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#include <Windows.h>
#ifdef __HARBOUR__
#define _HB_API_INTERNAL_
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbvm.h>
#include <hbstack.h>
#include <hbvm.h>
// #include <hbfast.h>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#endif
#define LOGICAL HB_IT_LOGICAL
#define NUMERIC HB_IT_NUMERIC
#define CHARACTER HB_IT_STRING
#define BLOCK HB_IT_BLOCK
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
#ifdef __FLAT__
#undef PCLIPVAR
#define PCLIPVAR PHB_ITEM
#endif
#ifdef __XHARBOUR__
void hb_storvni( int iValue, int iParam, int iIndex );
long hb_parvnl( int iParam, int iIndex );
int hb_parvni( int iParam, int iIndex );
void hb_storvnl( LONG lValue, int iParam, int iIndex );
#endif
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
void FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = (HBITMAP) SelectObject(hdcTemp, bmAndTemp);
bmMemOld = (HBITMAP) SelectObject(hdcMem, bmAndMem);
bmBackOld = (HBITMAP) SelectObject(hdcBack, bmAndBack);
bmObjectOld = (HBITMAP) SelectObject(hdcObject, bmAndObject);
hBrOld = (HBRUSH) SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
PHB_ITEM uElem = hb_itemNew( NULL );
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & CHARACTER )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
hb_arrayGet( pAJustify, wIndex, uElem );
if ( ( hb_itemType( uElem ) & LOGICAL ) && hb_itemGetL( uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( uElem );
hb_itemClear( uElem );
}
// uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, uElem );
wType = hb_itemType( uElem );
if ( wType & NUMERIC )
lValue = hb_itemGetNL( uElem );
if ( wType & CHARACTER )
{
// cValue = hb_itemGetC( uElem );
cValue = ( char * ) hb_itemGetCPtr( uElem );
wcLen = strlen( cValue );
}
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es Numerico Bmp no Tree, o , es Character !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lBkColorOld = SetBkColor( hDC, hb_parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lTextColorOld = SetTextColor( hDC, hb_parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
hFont = (HFONT) hb_parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & CHARACTER ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, (HPEN) GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = (HPEN) GetStockObject( BLACK_PEN );
hOldPen = (HPEN) SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = (HPEN) CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = (HPEN) SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = (HPEN) GetStockObject( BLACK_PEN );
hOldPen = (HPEN) SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, (HPEN) GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
hb_itemRelease( uElem );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSELBOX )// ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
BOOL bFocused = hb_parl( 6 );
PCLIPVAR pAsizes = hb_param( 7, -1 );
HFONT hFont = (HFONT) hb_parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWLINE ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) hb_parnl( 9 );
HFONT hOldFont;
BOOL bTree = hb_parl( 10 );
BOOL bFooter = HB_ISLOG( 19 ) ? hb_parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
{
bClrFore = hb_param( 7, HB_IT_BLOCK );
_cEval0( bClrFore );
clrFore = hb_parnl( -1 );
}
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, hb_parni( 6 ), hb_param( 4, 0xFFFF ), hb_param( 5, 0xFFFF ),
hWhitePen, hGrayPen, bTree,
HB_ISARRAY(11) ? hb_param( 11, -1 ) : 0, hb_parni( 12 ),
(wRow == 0), hb_parni( 13 ),
hb_parni( 14 ), hb_parl( 15 ),
HB_ISBLOCK( 16 ) ? hb_param( 16, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 17 ) ? hb_param( 17, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 18 ) ? hb_parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
HB_ISLOG( 20 ) ? hb_parl( 20 ) : FALSE, // CeSoTech
HB_ISBLOCK( 21 ) ? hb_param( 21, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISLOG( 22 ) ? hb_parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
HB_FUNC( AWBRWROWDIM )
{
HWND hWnd = (HWND) hb_parnl( 1 );
WORD wRow = (WORD) hb_parnl( 2 );
HFONT hFont = (HFONT) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( tm.tmHeight * wRow++, -1, 1 );
hb_storvni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWRECT ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = hb_parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) _param( 3, HB_IT_ARRAY );
WORD wLen = hb_parinfa( 3, 0 );
#else
void * paSizes = ( void * ) _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define _parnl(x,y) PARNL(x,params,y);
#endif
l = hb_parvnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
hb_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( ( wMaxRight <= rct.right ) ?
wMaxRight - hb_parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWPANE ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = hb_param( 3, -1 );
PCLIPVAR bLine = hb_param( 4, -1 );
PCLIPVAR pASizes = hb_param( 5, -1 );
HFONT hFont = ( HFONT ) hb_parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = hb_parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & BLOCK;
#else
BOOL bColBlock = hb_itemType( pASizes ) & BLOCK;
PHB_ITEM aLine = hb_itemNew( NULL );
#endif
PCLIPVAR pAJustify = HB_ISARRAY( 10 ) ? hb_param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = hb_parni( 11 );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
bClrFore = hb_param( 7, HB_IT_BLOCK );
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) hb_parinfa( 5, NULL); wIndex++ )
{
rct.left += hb_parvni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = hb_parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parni( 11 ),
hb_parni ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
// aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parnl( 11 ),
hb_parnl ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
if ( pSkip )
{
hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = hb_parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_retni( wRow );
hb_itemRelease( aLine );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSET )// ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
{ // CeSoTech
bAdjLastCol = hb_parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = hb_parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = hb_parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = hb_parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= hb_parni( 5 ) ;
wFooterHeight= hb_parni( 6 ) ;
wLineHeight = hb_parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWROWS )// ( hWnd, hDC, hFont )
{
hb_retni( WBrwRowsC( ( HWND ) hb_parnl( 1 ), ( HDC ) hb_parnl( 2 ),
( HFONT ) hb_parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWSCRL )// ( hWnd, nRows, hFont, nLineStyle, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
int wRows = hb_parni( 2 );
HFONT hFont = ( HFONT ) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) hb_parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = hb_parni( 4 );
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWHEIGHT )// ( hWnd, hFont )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HFONT hFont = ( HFONT ) hb_parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
hb_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPBEGIN )// ( hWnd, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = (HBITMAP) SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_storvnl( (LONG) hWnd , -1, 1 );
hb_storvnl( (LONG) hDC , -1, 2 );
hb_storvnl( (LONG) hDC2 , -1, 3 );
hb_storvnl( (LONG) hBmp , -1, 4 );
hb_storvnl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPEND )// { hWnd, hDC, hDC2, hBmp, hBmpOld }
{
RECT rct;
GetClientRect( (HWND) hb_parvnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parvnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parvnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parvnl( 1, 3 ), (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteDC( (HDC) hb_parvnl( 1, 3 ) );
hb_retnl( (LONG) hb_parvnl( 1, 2 ) ) ;
return ;
}
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Re: Compilación para 12.05
Wbrwlineg.c para Harbour y MINGW, hay una pequeña modificacion con los metodos FWDISPBEGIN por FW_DISPBEGIN y FWDISPEND por FW_DISPEND dan error de modulo duplicado solo hay que reemplazarlos en el código de wbrowse.prg de Hernan.
Slds,
Code: Select all
// se corrigio para harbour 3.0 y 3.1
//Cambia todas las llamadas a funciones IS... por HB_IS... (por ejemplo: HB_ISLOG(...) en vez de ISLOG(...))
//y además añade despues de los includes Antes de los #includes añade este define: #define _HB_API_INTERNAL_
//
void * __conArrayGet( void *, void *, ... );
long __conGetNL( void *, long * );
long __conRelease( void * );
#include <Windows.h>
#ifdef __HARBOUR__
#define _HB_API_INTERNAL_
#include <hbapi.h>
#include <hbapiitm.h>
#include <hbvm.h>
#include <hbstack.h>
#include <hbvm.h>
// #include <hbfast.h>
#define MoveTo( hDC, x, y ) MoveToEx( hDC, x, y, NULL )
#define _PutSym( _SymEval ) hb_vmPushSymbol( &hb_symEval )
#define _xPushM hb_vmPush
#define _PutLN hb_vmPushLong
#define _xEval hb_vmDo
#define _cEval0 hb_vmEvalBlock
#define _Get_Sym hb_dynsymFindName
#endif
#define LOGICAL HB_IT_LOGICAL
#define NUMERIC HB_IT_NUMERIC
#define CHARACTER HB_IT_STRING
#define BLOCK HB_IT_BLOCK
#define HA_LEFT 0 // by CeSoTech Alineaciones Horizontales y Verticales
#define HA_RIGHT 1
#define HA_CENTER 2
#define VA_TOP 4
#define VA_BOTTOM 8
#define VA_CENTER 32
#ifdef __FLAT__
#undef PCLIPVAR
#define PCLIPVAR PHB_ITEM
#endif
#ifdef __XHARBOUR__
void hb_storvni( int iValue, int iParam, int iIndex );
long hb_parvnl( int iParam, int iIndex );
int hb_parvni( int iParam, int iIndex );
void hb_storvnl( LONG lValue, int iParam, int iIndex );
#endif
static far BOOL bAdjLastCol ; // CeSoTech
static far BOOL bAdjBrowse ; // CeSoTech
static far BOOL bDrawHeaders ; // CeSoTech
static far BOOL bDrawFooters ; // CeSoTech
static far WORD wHeaderHeight; // CeSoTech
static far WORD wFooterHeight; // CeSoTech
static far WORD wLineHeight ; // CeSoTech
static far BOOL bWorking;
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont ); // CeSoTech
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iLen, HFONT hFont,
BOOL bHeadFoot ) ; // CeSoTech
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bFocused ) ;
static void MaskRegion( HDC hDC, RECT * rct, COLORREF cTrColor,
COLORREF cBackColor );
void FrameDot( HDC hDC, RECT * pRect );
extern void WndDrawBox( HDC, LPRECT, HPEN, HPEN );
extern void DrawBitmap( HDC, HBITMAP, WORD wCol, WORD wRow, WORD wWidth,
WORD wHeight, DWORD dwRaster );
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD nFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect ) ;
void DrawMasked( HDC, HBITMAP, WORD wCol, WORD wRow );
// LOW HIGH
extern int _dvtoi( DWORD, DWORD );
void MsgStr( long l );
LPSTR Str( WORD w );
#ifndef __FLAT__
static int near GetInt( PCLIPVAR Array, WORD wIndex );
static far PCLIPSYMBOL pSkip = 0;
#else
static long near GetInt( void * Array, WORD wIndex );
PHB_DYNS pSkip = NULL;
#endif
//---------------------------------------------------------------------------//
static void MaskRegion( HDC hdc, RECT * rct, COLORREF cTransparentColor,
COLORREF cBackgroundColor )
{
HDC hdcTemp, hdcObject, hdcBack, hdcMem;
POINT ptSize;
COLORREF cColor;
HBITMAP bmAndObject, bmAndBack, bmBackOld, bmObjectOld,
bmAndTemp, bmTempOld, bmAndMem, bmMemOld;
HBRUSH hBrush, hBrOld;
ptSize.x = rct->right - rct->left + 1;
ptSize.y = rct->bottom - rct->top + 1;
hBrush = CreateSolidBrush(cBackgroundColor);
hdcTemp = CreateCompatibleDC(hdc);
hdcObject = CreateCompatibleDC(hdc);
hdcBack = CreateCompatibleDC(hdc);
hdcMem = CreateCompatibleDC(hdc);
bmAndTemp = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndMem = CreateCompatibleBitmap(hdc, ptSize.x, ptSize.y);
bmAndObject = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmAndBack = CreateBitmap(ptSize.x, ptSize.y, 1, 1, NULL);
bmTempOld = (HBITMAP) SelectObject(hdcTemp, bmAndTemp);
bmMemOld = (HBITMAP) SelectObject(hdcMem, bmAndMem);
bmBackOld = (HBITMAP) SelectObject(hdcBack, bmAndBack);
bmObjectOld = (HBITMAP) SelectObject(hdcObject, bmAndObject);
hBrOld = (HBRUSH) SelectObject(hdcMem, hBrush);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdc, rct->left, rct->top, SRCCOPY);
SetMapMode(hdcTemp, GetMapMode(hdc));
cColor = SetBkColor(hdcTemp, cTransparentColor);
BitBlt(hdcObject, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCCOPY);
SetBkColor(hdcTemp, cColor);
BitBlt(hdcBack, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, NOTSRCCOPY);
PatBlt(hdcMem, 0,0, ptSize.x, ptSize.y, PATCOPY);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcObject, 0, 0, SRCAND);
BitBlt(hdcTemp, 0, 0, ptSize.x, ptSize.y, hdcBack, 0, 0, SRCAND);
BitBlt(hdcMem, 0, 0, ptSize.x, ptSize.y, hdcTemp, 0, 0, SRCPAINT);
BitBlt(hdc, rct->left, rct->top, ptSize.x, ptSize.y, hdcMem, 0, 0, SRCCOPY);
DeleteObject(SelectObject(hdcMem, hBrOld));
DeleteObject(SelectObject(hdcTemp, bmTempOld));
DeleteObject(SelectObject(hdcMem, bmMemOld));
DeleteObject(SelectObject(hdcBack, bmBackOld));
DeleteObject(SelectObject(hdcObject, bmObjectOld));
DeleteDC(hdcMem);
DeleteDC(hdcBack);
DeleteDC(hdcObject);
DeleteDC(hdcTemp);
}
//---------------------------------------------------------------------------//
#ifdef __CLIPPER__
static int near GetInt( PCLIPVAR Array, WORD wIndex )
{
int iRet = 0;
_cAt( Array, wIndex, -1, ++_tos );
if( _tos->wType & NUMERIC )
iRet = (int) _tos->pPointer1;
else if( _tos->wType & NUM_FLOAT )
iRet = _dvtoi( (DWORD) _tos->pPointer1, (DWORD) _tos->pPointer2 );
--_tos;
return iRet;
}
#endif
#ifdef __XPP__
static long GetInt( void * Array, WORD wIndex )
{
void * chItem = 0;
long l;
__conArrayGet( Array, chItem, wIndex, 0 );
__conGetNL( chItem, &l );
__conRelease( chItem );
return l;
}
#endif
#ifdef __HARBOUR__
#define GetInt( Array, wIndex ) hb_arrayGetNL( Array, wIndex )
#endif
//-----------------------------------------------------------------------=
// ÚÄ1ra Col.a Pintar
// ³
static void near PaintTheLine( HDC hDC, RECT * rct, WORD wIndex,
PCLIPVAR pAtext, PCLIPVAR pAsizes,
HPEN hWhitePen, HPEN hGrayPen, BOOL bTree,
PCLIPVAR pAJustify, WORD wPressed,
BOOL bHeader, WORD nStyle,
WORD wFocus, BOOL bFocused,
PCLIPVAR pTextColor, PCLIPVAR pBkColor,
WORD wRowPos, WORD nHeightCtrl,
LONG nClrLine, BOOL bFooter,
BOOL bSelect, PCLIPVAR pFont,
BOOL bDrawFocusRect )
{
RECT box, wholebox, rctadj;
int iMaxRight = rct->right;
WORD wLenJust = 0 ;
#ifndef __HARBOUR__
WORD wLen = _VARRAYLEN( pAtext );
CLV_WORD lJustify;
#else
WORD wLen = hb_arrayLen( pAtext );
PHB_ITEM uElem = hb_itemNew( NULL );
#endif
WORD wType, wcLen;
LONG lValue;
char * cValue;
HPEN hOldPen, hPen;
BITMAP bmp;
WORD wRow, wCol;
LONG lColor ;
HBRUSH hBrush;
LONG lTextColorOld = -1 ; // CeSoTech
LONG lBkColorOld = -1 ; // CeSoTech
PCLIPVAR pEvalOld ;
HFONT hFont ; // CeSoTech
WORD wAlign ; // CeSoTech
// CeSoTech
LONG nClrLineC = ( nStyle == 2 || nStyle == 6 || nStyle == 8 ||
nStyle == 10 ) ? GetSysColor( COLOR_BTNSHADOW ) : 0 ;
// CeSoTech
if ( nClrLine >= 0 ) // Desde Clipper manda color especifico linea
nClrLineC = nClrLine ;
if ( ! bDrawHeaders )
bHeader = FALSE ;
if ( bFooter )
bHeader = TRUE ; //-> Para que lo pinte con similar aspecto
//CeSoTech
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if ( ! (bHeader) && (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10) )
rct->top-- ;
wholebox.top = rct->top+1;
wholebox.left = rct->left;
wholebox.bottom = rct->bottom;
wholebox.right = rct->right;
rct->right = 0;
box.top = rct->top ;
box.bottom = rct->bottom - 1;
if( !wIndex | wIndex > wLen )
wIndex = 1;
if ( pAJustify )
#ifndef __HARBOUR__
wLenJust = _VARRAYLEN( pAJustify );
#else
wLenJust = hb_arrayLen( pAJustify );
#endif
while( wIndex <= wLen )
{
rct->left = rct->right;
rct->right = ( wIndex == wLen ? iMaxRight
: rct->left + GetInt( pAsizes, wIndex ) );
// CeSoTech // Cuando estoy estoy en la ultima celda, NO pintar hasta
// el final si no existe ajuste de ultima columna.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
rct->right = rct->left + GetInt( pAsizes, wIndex ) +(bHeader ? 1: 0) ;
if ( !bAdjBrowse )
wholebox.right = rct->right ; // Tambien ajusto el borde focus
}
// CeSoTech //
wAlign = HA_LEFT | VA_CENTER ; // Alineacion por defecto
wcLen = 0;
///////// INICIO Toma de datos celda !!!
#ifndef __HARBOUR__
if ( wIndex <= wLenJust )
{
_cAt( pAJustify, wIndex, 0xFFFF, ( PCLIPVAR ) &lJustify );
wAlign = lJustify.wWord ;
}
_cAt( pAtext, wIndex, 0xFFFF, ++_tos );
wType = _tos->wType;
if ( wType & NUMERIC )
lValue = (LONG) _tos->pPointer1;
if ( wType & CHARACTER )
{
cValue = _VSTR( _tos );
wcLen = _tos->w2;
}
#else
if ( wIndex <= wLenJust )
{
hb_arrayGet( pAJustify, wIndex, uElem );
if ( ( hb_itemType( uElem ) & LOGICAL ) && hb_itemGetL( uElem ) )
wAlign = HA_RIGHT | VA_CENTER ;
else
wAlign = hb_itemGetNL( uElem );
hb_itemClear( uElem );
}
// uElem.type = HB_IT_NIL;
hb_arrayGet( pAtext, wIndex, uElem );
wType = hb_itemType( uElem );
if ( wType & NUMERIC )
lValue = hb_itemGetNL( uElem );
if ( wType & CHARACTER )
{
// cValue = hb_itemGetC( uElem );
cValue = ( char * ) hb_itemGetCPtr( uElem );
wcLen = strlen( cValue );
}
#endif
///////// FIN Toma de datos celda !!!
if( wFocus > 0 && wIndex != wFocus )
{
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
continue;
}
if( bTree ||
(GetInt( pAsizes, wIndex ) > 0) ) //Si NO es columna oculta (x Freeze)
{ //(Es lo mismo no hacer esto,
// pero es para evitar hacer trabajar
// al codigo sin sentido !!! )
if( (wType & NUMERIC) && bTree )
{
if( lValue )
{
FillRect( hDC, rct, hBrush = CreateSolidBrush( GetPixel( hDC, rct->left, rct->top ) ) );
DrawMasked( hDC, (HBITMAP) lValue, rct->top, rct->left );
DeleteObject( hBrush );
}
}
else // Si es Numerico Bmp no Tree, o , es Character !!!!
{
if ( pBkColor ) // Bloque de Color Fondo Celda
{
_PutSym( _SymEval );
_xPushM( pBkColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lBkColorOld = SetBkColor( hDC, hb_parnl( - 1 ) ) ;
}
if( pTextColor ) // Bloque de Color Texto Celda
{
_PutSym( _SymEval );
_xPushM( pTextColor );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
lTextColorOld = SetTextColor( hDC, hb_parnl( - 1 ) ) ;
}
hFont = 0 ;
if( pFont ) // Bloque de Font Celda
{
_PutSym( _SymEval );
_xPushM( pFont );
_PutLN( wRowPos );
_PutLN( wIndex );
_PutLN( bFooter ? 2 : ( bHeader ? 1 : ( bSelect ? 3 : 0 ) ) );
_xEval( 3 ) ;
if ( hb_parinfo( -1 ) & NUMERIC )
hFont = (HFONT) hb_parnl( - 1 ) ;
}
/////// CeSoTech ///////
if (!bHeader) rct->top ++;
if( wType & NUMERIC ) // Es un BitMap
{
FW_DrawBitmapCenter( hDC, (HBITMAP) lValue, rct, nStyle, bSelect );
}
else // Es una Cadena
{
FW_DrawText( hDC, rct,
( wType & CHARACTER ) ? cValue : "",
wAlign, wcLen, hFont, bHeader ) ;
}
/////// CeSoTech restauracion de colores //////
if ( lTextColorOld >= 0 )
{
SetTextColor( hDC, lTextColorOld ) ;
lTextColorOld = -1 ;
}
if ( lBkColorOld >= 0 )
{
SetBkColor( hDC, lBkColorOld ) ;
lBkColorOld = -1 ;
}
/// CeSoTech ///
// Si hay modalidad ajustar el Browse y no hay ajuste de ultima
// columna, deber‚ pintar hasta el final hasta cubrir toda
// el area, hasta llegar a la derecha del control. (Col.Ficticia)
if ( bAdjBrowse && wIndex == wLen && !bAdjLastCol &&
rct->right <= iMaxRight )
{
rctadj.top = rct->top;
rctadj.left = rct->right ;
rctadj.bottom = rct->bottom;
rctadj.right = wholebox.right ;
if ( nStyle == 3 )
rctadj.top--;
if ( wFocus == 0 ) // Si No es CellStyle (Pinto hasta final)
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, &rctadj, "", 0, 0 );
if ( bHeader && nStyle==3 ) // Pinto Bordes Header Falso
{
rctadj.right = wholebox.right - 2 ;
rctadj.bottom = rctadj.bottom - 2 ;
WndDrawBox( hDC, &rctadj, hWhitePen, hGrayPen );
rctadj.bottom++ ;
rctadj.right++ ;
WndDrawBox( hDC, &rctadj, hWhitePen, (HPEN) GetStockObject( BLACK_PEN ) );
if ( bFooter ) // Si es Footer (Linea Negra de Arriba Foot)
{
hPen = (HPEN) GetStockObject( BLACK_PEN );
hOldPen = (HPEN) SelectObject( hDC, hPen );
MoveTo( hDC, rctadj.left-1, rctadj.top-1 );
LineTo( hDC, rctadj.right+1, rctadj.top-1 );
SelectObject( hDC, hOldPen );
}
}
}
/// CeSoTech Fin ///
if (!bHeader) rct->top --;
}
box.left = rct->left;
box.right = ( wIndex < wLen && rct->right <= iMaxRight ?
rct->right - 1 :
iMaxRight - 1 );
// CeSoTech // El Borde derecho de Box de la ultima columna,
// no estirarlo cuando no exista ajuste de ultima columna
// PERO cuando nLineStyle (nStyle) es 7/8 (Lineas Horiz)
// queda anti-estetico cortar los renglones, cuando no hay
// ajuste ult.col. y hay ajuste de browse. Por ello
// se verificara que para cortar el borde no se de esta
// condicion.
if ( ( wIndex == wLen ) && ( ! bAdjLastCol ) )
{
if (! (!bHeader && (nStyle==7 || nStyle==8) && !bAdjLastCol && bAdjBrowse) )
box.right = rct->left + GetInt( pAsizes, wIndex ) - 1 ;
}
// CeSoTech //
if( ! bTree )
{
if( wPressed && ( wIndex == wPressed ) )
{
WndDrawBox( hDC, &box, hGrayPen, hWhitePen );
}
else
///////////// if(!bHeader)
if(!bHeader || (bHeader && nStyle!=3) )
{
switch( nStyle )
{
case 0:
break;
case 1:
// hOldPen = SelectObject( hDC, GetStockObject( BLACK_PEN ) );
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 2:
hPen = CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
LineTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 3:
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
break;
case 4:
box.bottom ++;
box.right ++;
FrameDot( hDC, &box );
box.bottom --;
box.right --;
break;
case 7:
case 8:
hPen = (HPEN) CreatePen(PS_SOLID, 0, nClrLineC );
hOldPen = (HPEN) SelectObject( hDC, hPen);
MoveTo( hDC, box.left, box.top );
LineTo( hDC, box.right+1, box.top );
MoveTo( hDC, box.right+1, box.bottom+1 );
LineTo( hDC, box.left, box.bottom+1 );
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
case 5:
case 6:
case 9:
case 10:
hPen = CreatePen(PS_SOLID, 0, nClrLineC);
hOldPen = (HPEN) SelectObject( hDC, hPen);
if (box.left>1)
{
MoveTo( hDC, box.left, box.bottom+1 );
LineTo( hDC, box.left, box.top );
}
MoveTo( hDC, box.right+1, box.top );
if ( bDrawFooters && nStyle >= 9 )
{
LineTo( hDC, box.right+1,
nHeightCtrl - (wFooterHeight+1) ) ;
} else {
LineTo( hDC, box.right+1,
nStyle < 9 ? box.bottom+1 : nHeightCtrl );
}
SelectObject( hDC, hOldPen );
DeleteObject( hPen);
break;
}
}
else // Box para Headers !!!
{
box.left ++;
// CeSoTech
if ( bFooter ) // Linea negra sobre el Footer
{
hPen = (HPEN) GetStockObject( BLACK_PEN );
hOldPen = (HPEN) SelectObject( hDC, hPen );
MoveTo( hDC, box.left-1, box.top-1 );
LineTo( hDC, box.right+1, box.top-1 );
SelectObject( hDC, hOldPen );
}
box.right-- ;
box.bottom-- ;
WndDrawBox( hDC, &box, hWhitePen, hGrayPen );
box.bottom++ ;
box.right++ ;
WndDrawBox( hDC, &box, hWhitePen, (HPEN) GetStockObject( BLACK_PEN ) );
box.left --;
}
}
else
{
if( ! ( wType & NUMERIC ) )
{
box.left -= 16;
}
}
// CeSoTech if( bFocused && wFocus > 0 && wIndex == wFocus )
if( bDrawFocusRect && bFocused && wFocus > 0 &&
wIndex == wFocus && nStyle != 3)
{
rct->left++;
rct->top++;
DrawFocusRect( hDC, rct );
rct->left--;
rct->top--;
}
}
#ifndef __HARBOUR__
_tos--;
#endif
if( rct->right >= iMaxRight )
{
wIndex = wLen + 1; // ya no pintamos m s
}
else
++wIndex;
}
if (bDrawFocusRect && !bTree && bFocused && wFocus==0 && nStyle!=3) // CeSoTech
DrawFocusRect( hDC, &wholebox );
hb_itemRelease( uElem );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSELBOX )// ( hWnd, hDC, nRow, nFirstCol, nCurCol,;
// lFocus, aSizes, hFont)
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
BOOL bFocused = hb_parl( 6 );
PCLIPVAR pAsizes = hb_param( 7, -1 );
HFONT hFont = (HFONT) hb_parnl( 8 );
BOOL bDestroyDC = FALSE;
TEXTMETRIC tm;
RECT rct;
HFONT hOldFont;
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
GetTextMetrics( hDC, &tm );
if( hFont )
SelectObject( hDC, hOldFont );
tm.tmHeight += 1;
if ( ! bDrawHeaders ) // By CeSoTech
wRow-- ;
rct.top = tm.tmHeight * wRow ;
rct.bottom = tm.tmHeight * ( wRow + 1) - 1;
rct.left = 0;
while( wIndex < wCol )
rct.left += GetInt( pAsizes, wIndex++ );
rct.right = rct.left+GetInt( pAsizes, wCol ) - 1;
MaskRegion( hDC, &rct, GetBkColor( hDC ), GetSysColor(COLOR_ACTIVECAPTION) );
if( bFocused )
DrawFocusRect( hDC, &rct );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWLINE ) // ( hWnd, hDC, nRow, aText, aSizes, nFirstItem, ;
// nClrFore, nClrBack, hFont, lTree, aJustify, nPressed,
// nStyle, nColAct, lFocused )
// bTextColor, bBkColor, nClrLine, lFooter, lSelect,
// bFont, lDrawFocusRect ) // New's by CesoTech
{
HWND hWnd = (HWND) hb_parnl( 1 );
HDC hDC = (HDC) hb_parnl( 2 );
WORD wRow = hb_parni( 3 );
BOOL bDestroyDC = FALSE;
WORD wHeight;
RECT rct, box;
PCLIPVAR bClrFore, bClrBack;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen ;
HPEN hWhitePen ;
HFONT hFont = (HFONT) hb_parnl( 9 );
HFONT hOldFont;
BOOL bTree = hb_parl( 10 );
BOOL bFooter = HB_ISLOG( 19 ) ? hb_parl( 19 ) : FALSE ; // CeSoTech
WORD nHeightCtrl ; // by CeSoTech
hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
{
bClrFore = hb_param( 7, HB_IT_BLOCK );
_cEval0( bClrFore );
clrFore = hb_parnl( -1 );
}
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
nHeightCtrl = rct.bottom-rct.top ; // by CeSoTech
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
wHeight = wLineHeight + 1 ;
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
wHeight = wHeaderHeight + 1 ;
if ( ! bFooter )
{
if ( ( wRow == 0 ) && bDrawHeaders ) // Es una Cabecera
{
rct.top = 0 ;
rct.bottom = wHeaderHeight + 1 ;
}
else
{
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * (wRow-1) ) ;
rct.bottom = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) + (wHeight * wRow) ;
}
} else {
rct.top = rct.bottom - (wFooterHeight+1) ;
}
rct.left = 0;
PaintTheLine( hDC, &rct, hb_parni( 6 ), hb_param( 4, 0xFFFF ), hb_param( 5, 0xFFFF ),
hWhitePen, hGrayPen, bTree,
HB_ISARRAY(11) ? hb_param( 11, -1 ) : 0, hb_parni( 12 ),
(wRow == 0), hb_parni( 13 ),
hb_parni( 14 ), hb_parl( 15 ),
HB_ISBLOCK( 16 ) ? hb_param( 16, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 17 ) ? hb_param( 17, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 18 ) ? hb_parnl( 18 ) : -1, // CeSoTech
bFooter, // CeSoTech
HB_ISLOG( 20 ) ? hb_parl( 20 ) : FALSE, // CeSoTech
HB_ISBLOCK( 21 ) ? hb_param( 21, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISLOG( 22 ) ? hb_parl( 22 ) : FALSE );// CeSoTech
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.bottom, -1, 2 );
}
//---------------------------------------------------------------------------//
HB_FUNC( AWBRWROWDIM )
{
HWND hWnd = (HWND) hb_parnl( 1 );
WORD wRow = (WORD) hb_parnl( 2 );
HFONT hFont = (HFONT) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
tm.tmHeight += 1;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
hb_reta( 2 );
hb_storvni( tm.tmHeight * wRow++, -1, 1 );
hb_storvni( tm.tmHeight * wRow, -1, 2 );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseX( WORD wX )
{
return 4 * wX / LOWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
WORD ScreenBaseY( WORD wY )
{
return 8 * wY / HIWORD( GetDialogBaseUnits() );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWRECT ) // ( hWnd, nRow, aSizes, nFirstItem, nCol,
// nLineStyle, nWidthVScroll )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = GetDC( hWnd );
WORD wRow = hb_parni( 2 );
WORD wHeight ;
RECT rct;
WORD nStyle = HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ; // CeSoTech
#ifdef __CLIPPER__
PCLIPVAR paSizes = _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#else
#ifdef __HARBOUR__
// void * paSizes = ( void * ) _param( 3, HB_IT_ARRAY );
WORD wLen = hb_parinfa( 3, 0 );
#else
void * paSizes = ( void * ) _param( 3, 0x8000 );
WORD wLen = _VARRAYLEN( paSizes );
#endif
#endif
WORD wIndex = hb_parni( 4 );
WORD wCol = hb_parni( 5 );
WORD wMaxRight;
LONG l;
if( !wCol || wCol > wLen )
return;
GetWindowRect( hWnd, &rct );
wMaxRight = rct.right - 2;
wHeight = wLineHeight + 1 ;
rct.top = rct.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.right = rct.left;
while( wIndex <= wCol )
{
rct.left = rct.right;
#ifndef __FLAT__
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + GetInt( paSizes, wIndex ) );
#else
#ifndef __HARBOUR__
#define _parnl(x,y) PARNL(x,params,y);
#endif
l = hb_parvnl( 3, wIndex );
rct.right = ( wIndex == wLen && bAdjLastCol ? wMaxRight
: rct.left + l );
#endif
if( rct.right >= wMaxRight )
{
wIndex = wCol + 1; // ya no pintamos m s
rct.right = wMaxRight;
}
else
wIndex++;
}
ReleaseDC( hWnd, hDC );
hb_reta( 4 );
#ifdef __XPP__
#define _storni( x, y, z ) STORNI( x, params, y, z )
#endif
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
//CeSoTech para que que bien completa el area !!!
if (nStyle == 0 || nStyle == 5 || nStyle == 6 || nStyle == 9 || nStyle == 10)
rct.top-- ; // Las coord.de edicion deberan ser mas arriba tambien !!!
hb_storvni( rct.top, -1, 1 );
hb_storvni( rct.left, -1, 2 );
hb_storvni( rct.bottom, -1, 3 );
hb_storvni( ( wMaxRight <= rct.right ) ?
wMaxRight - hb_parni( 7 ) : rct.right, -1, 4 );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWPANE ) // ( hWnd, hDC, Self, bLine, aSizes, nFirstItem,
// nClrFore, nClrBack, hFont, aJustify, nStyle
// lCellStyle, lFocused ) -> nRowsSkipped
// bTextColor, bBkColor, nClrLine, nColorFondo, bFont ) // New's by CesoTech
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
WORD wRows;
WORD wLastBottom = 0;
WORD wRow = 1;
WORD wSkipped = 1;
PCLIPVAR Self = hb_param( 3, -1 );
PCLIPVAR bLine = hb_param( 4, -1 );
PCLIPVAR pASizes = hb_param( 5, -1 );
HFONT hFont = ( HFONT ) hb_parnl( 9 );
HFONT hOldFont;
BOOL bDestroyDC = FALSE;
WORD wHeight ;
RECT rct, box, client;
WORD wIndex = hb_parni( 6 );
PCLIPVAR bClrFore = 0, bClrBack = 0;
COLORREF clrFore = 0;
COLORREF clrBack = 0;
HPEN hGrayPen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) ) ; // RGB( 128, 128, 128 ) );
HPEN hWhitePen = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) ); // GetStockObject( WHITE_PEN );
#ifndef __HARBOUR__
BOOL bColBlock = pASizes->wType & BLOCK;
#else
BOOL bColBlock = hb_itemType( pASizes ) & BLOCK;
PHB_ITEM aLine = hb_itemNew( NULL );
#endif
PCLIPVAR pAJustify = HB_ISARRAY( 10 ) ? hb_param( 10, -1 ): 0;
WORD nHeightCtrl ; // by CeSoTech
WORD nStyle = hb_parni( 11 );
if( hb_pcount() > 6 )
{
if( HB_ISBLOCK( 7 ) )
bClrFore = hb_param( 7, HB_IT_BLOCK );
else
clrFore = hb_parnl( 7 );
}
if( hb_pcount() > 7 )
{
if( HB_ISBLOCK( 8 ) )
{
bClrBack = hb_param( 8, HB_IT_BLOCK );
_cEval0( bClrBack );
clrBack = hb_parnl( -1 );
}
else
clrBack = hb_parnl( 8 );
}
if( ! hDC )
{
bDestroyDC = TRUE;
hDC = GetDC( hWnd );
}
if( ! pSkip )
pSkip = _Get_Sym( "SKIP" );
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
/////////////////////////
// Borremos el Area de la derecha no coubierta
if ( !bAdjBrowse && !bAdjLastCol )
{
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
for( wIndex=wIndex ; wIndex <= (WORD) hb_parinfa( 5, 0 ); wIndex++ ) //nmm Null por 0 hb_parinfa( 5, NULL )
{
rct.left += hb_parvni( 5, wIndex ) ;
}
if ( !(nStyle == 0 || nStyle == 7 || nStyle == 8 || nStyle == 3) )
rct.left++;
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
wIndex = hb_parni( 6 );
GetClientRect( hWnd, &rct );
}
/////////////////////////
GetClientRect( hWnd, &client );
nHeightCtrl = client.bottom-client.top ; // by CeSoTech
wHeight = wLineHeight + 1 ;
wRows = WBrwRowsC( hWnd, hDC, hFont );
if( ! bClrFore )
SetTextColor( hDC, clrFore );
SetBkColor( hDC, clrBack );
while( wRow <= wRows && wSkipped == 1 )
{
rct.top = client.top + ( bDrawHeaders ? wHeaderHeight+1 : 0 ) +
(wHeight * (wRow-1) ) ;
rct.bottom = rct.top + wHeight;
rct.left = 0;
rct.right = client.right;
#ifndef __HARBOUR__
_cEval0( bLine );
_xPushM( _eval );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
if( bColBlock )
_cEval0( pASizes );
PaintTheLine( hDC, &rct, wIndex, _tos,
( bColBlock ? _eval : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parni( 11 ),
hb_parni ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
_tos--;
_PutSym( pSkip );
_xPushM( Self );
_PutQ( 1 );
_xSend( 1 );
#else
{
// aLine.type = HB_IT_NIL;
// Esta extension de xHarbour no se puede aplicar en Harbour
// hb_itemForwardValue( aLine, hb_vmEvalBlock( bLine ) );
hb_itemCopy( aLine, hb_vmEvalBlock( bLine ) );
if( bClrFore )
{
_cEval0( bClrFore );
SetTextColor( hDC, hb_parnl( -1 ) );
}
if( bClrBack )
{
_cEval0( bClrBack );
SetBkColor( hDC, hb_parnl( -1 ) );
}
PaintTheLine( hDC, &rct, wIndex, aLine,
( bColBlock ? hb_vmEvalBlock( pASizes ) : pASizes ),
hWhitePen, hGrayPen,
bColBlock, pAJustify, 0, FALSE, hb_parnl( 11 ),
hb_parnl ( 12 ), hb_parl( 13 ),
HB_ISBLOCK( 14 ) ? hb_param( 14, HB_IT_BLOCK ) : 0, // CeSoTech
HB_ISBLOCK( 15 ) ? hb_param( 15, HB_IT_BLOCK ) : 0, // CeSoTech
wRow, nHeightCtrl, // CeSoTech
HB_ISNUM( 16 ) ? hb_parnl( 16 ) : -1, // CeSoTech
FALSE, FALSE, // CeSoTech
HB_ISBLOCK( 18 ) ? hb_param( 18, HB_IT_BLOCK ) : 0, // CeSoTech
FALSE ) ;
if ( pSkip )
{
hb_vmPushSymbol( hb_dynsymSymbol( pSkip ) );
hb_vmPush( Self );
hb_vmPushLong( 1 );
hb_vmDo( 1 );
}
}
#endif
wLastBottom = rct.bottom ;
wSkipped = hb_parni( -1 );
if( wSkipped == 1 )
wRow++;
}
////////////////////////
// Borremos el Area de Abajo no cubierta
GetClientRect( hWnd, &rct );
SetBkColor( hDC, hb_parnl( 17 ) ) ;
rct.top = wLastBottom + 1 ;
if ( wLastBottom == 0 ) // No Mostro Registros
rct.top = ( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
rct.bottom-= 1 + ( bDrawFooters ? wFooterHeight+1 : 0 ) ;
if (nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 )
rct.top--;
if ( !bDrawFooters )
rct.bottom++;
if ( rct.top < rct.bottom )
{
ExtTextOut( hDC, rct.left, rct.top, ETO_OPAQUE | ETO_CLIPPED,
&rct, "", 0, 0 );
}
////////////////////////
DeleteObject( hGrayPen );
DeleteObject( hWhitePen );
if( hFont )
SelectObject( hDC, hOldFont );
if( bDestroyDC )
ReleaseDC( hWnd, hDC );
hb_retni( wRow );
hb_itemRelease( aLine );
}
//---------------------------------------------------------------------------//
HB_FUNC( WBRWSET )// ( lAdjLastCol, lAdjBrowse, lDrawHeaders, lDrawFooters )
{ // CeSoTech
bAdjLastCol = hb_parl( 1 ) ; // Ajuste o no de ultima columna al control.
bAdjBrowse = hb_parl( 2 ) ; // Ajuste del Browse a la derecha
// cuando no existe ajuste de ultima columna.
bDrawHeaders = hb_parl( 3 ) ; // Si quiere visualizar Headers !!!
bDrawFooters = hb_parl( 4 ) ; // Si se quiere visualizar Footers !!!
wHeaderHeight= hb_parni( 5 ) ;
wFooterHeight= hb_parni( 6 ) ;
wLineHeight = hb_parni( 7 ) ;
}
//----------------------------------------------------------------------------//
// Devuelve Nro. de Filas de Datos (No incluye Headers ni Footers)
static WORD WBrwRowsC( HWND hWnd, HDC hDC, HFONT hFont )
{
WORD wHeight;
RECT rct;
WORD wRows;
BOOL bDCDestroy = FALSE;
HFONT hOldFont;
if( ! hDC )
{
bDCDestroy = TRUE;
hDC = GetDC( hWnd );
}
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
wHeight = wLineHeight + 1 ;
GetClientRect( hWnd, &rct );
wRows = ( ( rct.bottom - rct.top - 2 ) -
( bDrawHeaders ? wHeaderHeight+1 : 0 ) -
( bDrawFooters ? wFooterHeight+1 : 0 ) ) / wHeight ;
if( hFont )
SelectObject( hDC, hOldFont );
if( bDCDestroy )
ReleaseDC( hWnd, hDC );
return wRows;
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWROWS )// ( hWnd, hDC, hFont )
{
hb_retni( WBrwRowsC( ( HWND ) hb_parnl( 1 ), ( HDC ) hb_parnl( 2 ),
( HFONT ) hb_parnl( 3 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWSCRL )// ( hWnd, nRows, hFont, nLineStyle, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
int wRows = hb_parni( 2 );
HFONT hFont = ( HFONT ) hb_parnl( 3 );
HFONT hOldFont;
HDC hDC = ( HDC ) hb_parnl( 5 ); // = GetDC( hWnd );
RECT rct;
WORD nStyle = hb_parni( 4 );
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetClientRect( hWnd, &rct );
if ( bDrawHeaders )
rct.top += wHeaderHeight+1 ;
// Defino Bottom de Area del Scroll
rct.bottom = ( WBrwRowsC( hWnd, hDC, hFont ) * (wLineHeight+1) ) +
( bDrawHeaders ? wHeaderHeight+1 : 0 ) ;
// Si es un estilo sin separadores horizontales, pintar uno mas arriba
// CeSoTech para que que bien completa el area !!!
// El Area Scroll deber entonces no tomar el separator (forma parte de ant)
if ( !(nStyle == 0 || nStyle == 5 || nStyle == 6 ||
nStyle == 9 || nStyle == 10 || nStyle == 3 ) )
rct.bottom++; // Debe tomarse dado que no pinta celda 1 una mas arriba
// ScrollWindowEx( hWnd, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0, 0 );
ScrollDC( hDC, 0, -( (wLineHeight+1) * wRows ), 0, &rct, 0, 0 );
if( hFont )
SelectObject( hDC, hOldFont );
// ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
HB_FUNC( WBRWHEIGHT )// ( hWnd, hFont )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HFONT hFont = ( HFONT ) hb_parnl( 2 );
HFONT hOldFont;
HDC hDC = GetDC( hWnd );
TEXTMETRIC tm;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
GetTextMetrics( hDC, &tm );
hb_retni( tm.tmHeight ) ;
if( hFont )
SelectObject( hDC, hOldFont );
ReleaseDC( hWnd, hDC );
}
//----------------------------------------------------------------------------//
static void FW_DrawText( HDC hDC, RECT * rct, LPCSTR pText,
WORD wAlign, int iWidth,
HFONT hFont, BOOL bHeadFoot )
{
RECT rcttmp ;
int iHeight ;
UINT uiFlag ;
HFONT hOldFont ;
int iFactor ;
if( hFont )
hOldFont = (HFONT) SelectObject( hDC, hFont );
/////////////////////////////
// Alineaciones Verticales //
/////////////////////////////
iHeight = DrawText( hDC, pText, iWidth, &rcttmp, DT_CALCRECT ) ;
iFactor = ( ( rct->bottom - rct->top ) - iHeight ) / 2 ;
if ( wAlign & VA_TOP )
iFactor = 0 ;
if ( wAlign & VA_BOTTOM )
{
iFactor = ( rct->bottom - rct->top ) - iHeight - ( bHeadFoot ? 1 : 0 ) ;
}
rcttmp.top = rct->top + iFactor ;
rcttmp.bottom = rct->bottom ;
rcttmp.left = rct->left ;
rcttmp.right = rct->right ;
if ( rcttmp.top < rct->top )
rcttmp.top = rct->top ;
///////////////////////////////
// Alineaciones Horizontales //
///////////////////////////////
uiFlag = DT_LEFT ;
rcttmp.left+= 2 ;
if ( wAlign & HA_CENTER )
{
rcttmp.left-= 2 ;
uiFlag = DT_CENTER ;
}
if ( wAlign & HA_RIGHT )
{
rcttmp.left-= 2 ;
uiFlag = DT_RIGHT ;
rcttmp.right-= 2 + ( bHeadFoot ? 1 : 0 ) ;
}
ExtTextOut( hDC, 0, 0, ETO_OPAQUE | ETO_CLIPPED, rct, "", 0, 0 ) ;
DrawText( hDC, pText, iWidth, &rcttmp, uiFlag | DT_NOPREFIX ) ;
if( hFont )
SelectObject( hDC, hOldFont );
}
//----------------------------------------------------------------------------//
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC );
BOOL bFlag = FALSE ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = rct->top + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = rct->top ;
}
if ( wWidth > bm.bmWidth )
{
wCol = rct->left + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = rct->left ;
}
rct->bottom++;
ExtTextOut( hDC, 0, rct->top, ETO_OPAQUE, rct, "", 0, 0 );
rct->bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC, rct, lBkColorBMP, lBkColor );
}
if (bFlag)
rct->bottom++ ;
}
//----------------------------------------------------------------------------//
/*******
static void FW_DrawBitmapCenter( HDC hDC, HBITMAP hBmp, RECT * rct, WORD nStyle, BOOL bSelect )
{
WORD wWidth ;
WORD wHeight ;
WORD wRow ;
WORD wCol ;
BITMAP bm;
LONG lBkColorBMP, lBkColor = GetBkColor( hDC ), lBkColorOld;
BOOL bFlag = FALSE ;
RECT rRect ;
HDC hDC2 ;
HBITMAP hBmp2, hBmpOld ;
if ( (nStyle == 0 || nStyle == 3 || nStyle == 5 ||
nStyle == 6 || nStyle == 9 || nStyle == 10) && bSelect )
{
rct->bottom-- ;
bFlag = TRUE ;
}
///////////////////////////////
// Creo un buffer auxiliar ////
rRect.top = 0 ;
rRect.left = 0 ;
rRect.right = rct->right - rct->left ;
rRect.bottom = rct->bottom - rct->top ;
hDC2 = CreateCompatibleDC( hDC );
hBmp2 = CreateCompatibleBitmap( hDC, rRect.right, rRect.bottom );
hBmpOld = SelectObject( hDC2, hBmp2 );
BitBlt( hDC2, 0, 0, rRect.right, rRect.bottom, hDC, 0, 0, SRCCOPY );
///////////////////////////////
wWidth = rct->right - rct->left ;
wHeight = rct->bottom - rct->top ;
GetObject( hBmp, sizeof( BITMAP ), ( LPSTR ) &bm );
if ( wHeight > bm.bmHeight )
{
wRow = 0 + ( ( wHeight - bm.bmHeight ) / 2 ) ;
wHeight = bm.bmHeight ;
} else
{
wRow = 0 ;
}
if ( wWidth > bm.bmWidth )
{
wCol = 0 + ( ( wWidth - bm.bmWidth ) / 2 ) ;
wWidth = bm.bmWidth ;
} else
{
wCol = 0 ;
}
rRect.bottom++;
lBkColorOld = SetBkColor( hDC2, lBkColor );
ExtTextOut( hDC2, 0, 0, ETO_OPAQUE, &rRect, "", 0, 0 );
rRect.bottom--;
if ( hBmp > 0 )
{
DrawBitmap( hDC2, hBmp, wRow, wCol, wWidth, wHeight, 0 ) ;
if( ( lBkColorBMP = GetPixel( hDC2, wCol, wRow ) ) != lBkColor)
MaskRegion( hDC2, &rRect, lBkColorBMP, lBkColor );
}
///////////////////////////////
// Pego el buffer auxiliar ////
BitBlt( hDC, rct->left, rct->top, rRect.right, rRect.bottom, hDC2, 0, 0, SRCCOPY );
SetBkColor( hDC2, lBkColorOld );
SelectObject( hDC2, hBmpOld );
DeleteObject( hBmp2 );
DeleteObject( hBmpOld );
DeleteDC( hDC2 );
///////////////////////////////
if (bFlag)
rct->bottom++ ;
}
************/
//----------------------------------------------------------------------------//
HB_FUNC( FW_DISPBEGIN )// ( hWnd, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = (HBITMAP) SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_storvnl( (LONG) hWnd , -1, 1 );
hb_storvnl( (LONG) hDC , -1, 2 );
hb_storvnl( (LONG) hDC2 , -1, 3 );
hb_storvnl( (LONG) hBmp , -1, 4 );
hb_storvnl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
HB_FUNC( FW_DISPEND )// { hWnd, hDC, hDC2, hBmp, hBmpOld }
{
RECT rct;
GetClientRect( (HWND) hb_parvnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parvnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parvnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parvnl( 1, 3 ), (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteDC( (HDC) hb_parvnl( 1, 3 ) );
hb_retnl( (LONG) hb_parvnl( 1, 2 ) ) ;
return ;
}
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPBEGIN )// ( hWnd, hDC )
{
HWND hWnd = ( HWND ) hb_parnl( 1 );
HDC hDC = ( HDC ) hb_parnl( 2 );
HDC hDC2 ;
HBITMAP hBmp, hBmpOld ;
RECT rct;
GetClientRect( hWnd, &rct );
hDC2 = CreateCompatibleDC( hDC );
hBmp = CreateCompatibleBitmap( hDC, rct.right - rct.left, rct.bottom - rct.top );
hBmpOld = (HBITMAP) SelectObject( hDC2, hBmp );
BitBlt( hDC2, 0, 0, rct.right, rct.bottom, hDC, 0, 0, SRCCOPY );
hb_reta( 5 );
hb_storvnl( (LONG) hWnd , -1, 1 );
hb_storvnl( (LONG) hDC , -1, 2 );
hb_storvnl( (LONG) hDC2 , -1, 3 );
hb_storvnl( (LONG) hBmp , -1, 4 );
hb_storvnl( (LONG) hBmpOld, -1, 5 );
return;
}
//----------------------------------------------------------------------------//
HB_FUNC( FWDISPEND )// { hWnd, hDC, hDC2, hBmp, hBmpOld }
{
RECT rct;
GetClientRect( (HWND) hb_parvnl( 1, 1 ), &rct );
BitBlt( (HDC) hb_parvnl( 1, 2 ), 0, 0, rct.right - rct.left, rct.bottom - rct.top, (HDC) hb_parvnl( 1, 3 ), 0, 0, SRCCOPY );
SelectObject( (HDC) hb_parvnl( 1, 3 ), (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 4 ) );
DeleteObject( (HBITMAP) hb_parvnl( 1, 5 ) );
DeleteDC( (HDC) hb_parvnl( 1, 3 ) );
hb_retnl( (LONG) hb_parvnl( 1, 2 ) ) ;
return ;
}
Slds,
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Re: Compilación para 12.05
Para los Warnings de TSCAN debes modificar las siguientes funciones:
Debido a que se espera un LPSTR solo es agregarlo antes del parametro.
Code: Select all
HB_FUNC( TW_GETNEXTSOURCENAME )
{
hb_retni( TWAIN_GetNextSourceName( hb_parc( 1 ) ) );
}
HB_FUNC( TW_GETDEFAULTSOURCENAME )
{
hb_retni( TWAIN_GetDefaultSourceName( hb_parc( 1 ) ));
}
Code: Select all
HB_FUNC( TW_GETNEXTSOURCENAME )
{
hb_retni( TWAIN_GetNextSourceName( (LPSTR) hb_parc( 1 ) ) );
}
HB_FUNC( TW_GETDEFAULTSOURCENAME )
{
hb_retni( TWAIN_GetDefaultSourceName( (LPSTR) hb_parc( 1 ) ));
}
Nicanor Martinez M.
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
Auditoria y Sistemas Ltda.
MicroExpress Ltda.
FW + FWH + XHARBOUR + HARBOUR + PELLES C + XDEVSTUDIO + XEDIT + BCC + VC_X86 + VCC_X64 + MINGW + R&R Reports + FastReport + Tdolphin + ADO + MYSQL + MARIADB + ORACLE
nnicanor@yahoo.com
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: Compilación para 12.05
Gracias Nicanor, ya hice las pruebas y también funcionan.
Ahora solo me queda un detalle con Menus.C de Tamayo. Reporta el 'Suspicios pointer' en la linea 180, pero si la veo declarada.
Ahora solo me queda un detalle con Menus.C de Tamayo. Reporta el 'Suspicios pointer' en la linea 180, pero si la veo declarada.
Code: Select all
#define OEMRESOURCE
#include <WinTen.h>
#include <Windows.h>
#include <ClipApi.h>
BOOL bStrAt( BYTE bChar, LPSTR szText );
LPSTR StrToken( LPSTR szText, WORD wOcurrence, BYTE bSeparator, LPWORD pwLen );
void WindowBoxIn( HDC hDC, RECT * pRect );
void WndDrawBox( HDC hDC, RECT * rct, HPEN hPUpLeft, HPEN hPBotRit );
void WindowInset( HDC hDC, RECT * pRect );
void WindowRaised( HDC hDC, RECT * pRect );
void DrawBitmap( HDC, HBITMAP, WORD, WORD, WORD, WORD, DWORD );
void DrawMasked( HDC, HBITMAP, WORD, WORD );
void DrawGrayed( HDC, HBITMAP, int, int );
void RectDisable( HDC, LPRECT);
void DegardeFill( HDC hDC, RECT * rori, COLORREF cFrom, COLORREF cTo, int nDegType ) ;
void DegradColor( HDC hDC, RECT * rori, COLORREF cFrom, COLORREF cTo, int nDegType, int iRound ) ;
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_CREATEMENU( PARAMS )
{
_retnl( ( LONG ) CreateMenu() );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_CREATEPOPUPMENU( PARAMS )
{
_retnl( ( LONG ) CreatePopupMenu() );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_TRACKPOPUP( PARAMS )
{
_retl( TrackPopupMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 4 ),
_parni( 3 ), _parni( 5 ), ( HWND ) _parni( 6 ), NULL ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_ENABLEMENUITEM( PARAMS )
{
_retl( EnableMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_CHECKMENUITEM( PARAMS ) // ()
{
_retl( CheckMenuItem( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETMITEMCOUNT( PARAMS ) // ()
{
_retni( GetMenuItemCount( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETMITEMID( PARAMS ) // hMenu, nPos
{
_retni( GetMenuItemID( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETSYSTEMMENU( PARAMS ) // ()
{
_retnl( ( LONG ) GetSystemMenu( ( HWND ) _parnl( 1 ), _parl( 2 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_DESTROYMENU( PARAMS ) // () hMenu
{
_retl( DestroyMenu( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETSUBMENU( PARAMS ) // hMenu, nPos
{
_retnl( ( LONG ) GetSubMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETMENUSTRING( PARAMS ) // () hMenu, nId, nPosOrValue
{
BYTE bBuffer[ 200 ];
WORD wLen = GetMenuString( ( HMENU ) _parnl( 1 ), _parni( 2 ), ( char * ) bBuffer,
199, _parni( 3 ) );
_retclen( ( char * ) bBuffer, wLen );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETMENUSTATE( PARAMS ) // () hMenu, nId, nFlags
{
_retni( GetMenuState( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_DRAWMENUBAR( PARAMS ) // () hWnd
{
DrawMenuBar( ( HWND ) _parnl( 1 ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_HILITEMENUITEM( PARAMS ) // () hWnd, hMenu, idItem, nHiliteFlags
{
_retl( HiliteMenuItem( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ),
_parni( 3 ), _parni( 4 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_LOADMENU( PARAMS )
{
_retnl( ( LONG ) LoadMenu( ( HINSTANCE ) _parnl( 1 ),
( LPSTR ) IF( ISCHAR( 2 ), _parc( 2 ),
MAKEINTRESOURCE( _parni( 2 ) ) ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_APPENDMENU( PARAMS )
{
_retl( AppendMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parnl( 2 ), _parnl( 3 ),
IF( ISCHAR( 4 ), _parc( 4 ), ( LPSTR ) _parnl( 4 ) ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_SETMENU( PARAMS )
{
_retl( SetMenu( ( HWND ) _parnl( 1 ), ( HMENU ) _parnl( 2 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_MODIFYMENU( PARAMS )
{
_retl( ModifyMenu( ( HMENU ) _parnl( 1 ), ( UINT ) _parni( 2 ),
_parni( 3 ), ( UINT ) _parni( 4 ),
IF( ISCHAR( 5 ), _parc( 5 ), ( LPSTR ) _parnl( 5 ) ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_INSERTMENU( PARAMS ) // ( hMenu, nIdItem, nFlags, nNewItem, cPrompt ) --> lSuccess
{
_retl( InsertMenu( ( HMENU ) _parnl( 1 ), _parni( 2 ), _parni( 3 ),
_parni( 4 ), _parc( 5 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_REMOVEMENU( PARAMS ) // ( hMenu, nItem, nFlags ) --> lSuccess
{
_retl( RemoveMenu( ( HMENU ) _parnl( 1 ),
( UINT ) _parni( 2 ),
( UINT ) _parni( 3 ) ) );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_ATMENUDRAWITEM( PARAMS ) // ( pDrawItemStruct, cPrompt, lTop, hBitmap,lSeparator,acolor,lbar )
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
LPSTR szPrompt = _parc( 2 );
BOOL bTab = bStrAt( 9, szPrompt );
WORD wLen;
BOOL lSeparator = _parl( 5 );
BOOL lBar = _parl( 7 );
HPEN hNormal,hOldPen;
HBRUSH hBrush;
LOGBRUSH lb;
RECT rct;
RECT rctdg;
RECT rctsep;
RECT rctshd;
COLORREF nClrMenu = _parnl(6,1);
COLORREF nClrMenuTxt = _parnl(6,2);
COLORREF nClrBack = _parnl(6,3);
COLORREF nClrTo = _parnl(6,4);
COLORREF nClrHighBai = _parnl(6,5);
COLORREF nClrHighBaf = _parnl(6,6);
COLORREF nClrHighTxt = _parnl(6,7);
COLORREF nClrHighBar = _parnl(6,8);
HBITMAP hBmp = ( HBITMAP ) _parnl( 4 );
switch( lpdis->itemAction )
{
case ODA_DRAWENTIRE:
case ODA_SELECT:
lb.lbStyle = BS_SOLID;
lb.lbColor = nClrMenu;
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
DeleteObject( hBrush );
SetBkColor( lpdis->hDC, nClrMenu );
SetBkMode( lpdis->hDC, TRANSPARENT );
SetTextColor( lpdis->hDC, nClrMenuTxt);
if( lpdis->itemState & ODS_SELECTED &&
! ( lpdis->itemState & ODS_GRAYED ) && !lSeparator )
{
lb.lbColor = nClrHighBai;
SetBkColor( lpdis->hDC, nClrHighBai );
SetTextColor( lpdis->hDC, nClrHighTxt );
if( !lBar )
lpdis->rcItem.left += 22;
}
else
lb.lbColor = nClrMenu;
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &lpdis->rcItem, hBrush );
DeleteObject( hBrush );
if( lpdis->itemState & ODS_SELECTED &&
! ( lpdis->itemState & ODS_GRAYED ) )
{
if( !lBar )
lpdis->rcItem.left -= 22;
}
if(!lBar)
{
rct.top = lpdis->rcItem.top ;
rct.left = lpdis->rcItem.left +23 ;
rct.right = lpdis->rcItem.right - 1 ;
rct.bottom = lpdis->rcItem.bottom- 1 ;
}
else
{
rct.top = lpdis->rcItem.top ;
rct.left = lpdis->rcItem.left + 1 ;
rct.right = lpdis->rcItem.right - 4 ;
rct.bottom = lpdis->rcItem.bottom- 1 ;
rctshd.top = lpdis->rcItem.top +3;
rctshd.left = lpdis->rcItem.right-3;
rctshd.right = lpdis->rcItem.right ;
rctshd.bottom = lpdis->rcItem.bottom ;
}
rctdg.top = lpdis->rcItem.top -1;
rctdg.left = lpdis->rcItem.left ;
rctdg.right = 22;
rctdg.bottom = lpdis->rcItem.bottom+1;
if( !lBar )
DegradColor( lpdis->hDC, &rctdg, nClrBack, nClrTo, 2, 1 ) ;
if( lpdis->itemState & ODS_SELECTED )
if( ! ( lpdis->itemState & ODS_GRAYED ) ) //&&
{
hNormal = CreatePen(PS_SOLID,0,nClrHighBar);
hOldPen = SelectObject(lpdis->hDC,hNormal);
// Rectangle(lpdis->hDC,rct.left-1,rct.top-1,rct.right+1,rct.bottom+1);
SelectObject(lpdis->hDC,hOldPen);
DeleteObject( hNormal );
DegradColor( lpdis->hDC, &rct, nClrHighBai, nClrHighBaf, 1, 1 ) ;
if(lBar)
{
lb.lbColor = GetSysColor(16);
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &rctshd, hBrush );
DeleteObject( hBrush );
rctshd.top = lpdis->rcItem.top;
rctshd.left = lpdis->rcItem.right-3;
rctshd.right = lpdis->rcItem.right;
rctshd.bottom = lpdis->rcItem.top+3;
lb.lbColor = nClrMenu;
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &rctshd, hBrush );
DeleteObject( hBrush );
}
}
if(!lBar)
{
if( lpdis->itemState & ODS_CHECKED )
{
HBITMAP hBmp = LoadBitmap( 0, MAKEINTRESOURCE( OBM_CHECK ) );
if( ! ( lpdis->itemState & ODS_SELECTED ) )
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
lpdis->rcItem.left + 4 );
else
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
lpdis->rcItem.left + 4 );
DeleteObject( hBmp );
}
if( hBmp && !( (int) hBmp == 1 ) )
{
if( ! ( lpdis->itemState & ODS_CHECKED ) )
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3, //ojo
lpdis->rcItem.left + 2 );
else
if( ! ( lpdis->itemState & ODS_SELECTED ) )
DrawGrayed( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
lpdis->rcItem.left + 2 );
else
DrawMasked( lpdis->hDC, hBmp, lpdis->rcItem.top + 3,
lpdis->rcItem.left + 2 );
}
}
if(!lBar)
{
lpdis->rcItem.top += 2; // 2
lpdis->rcItem.left += 27; // 26
}
else
{
lpdis->rcItem.top += 2;
lpdis->rcItem.left += 3;
}
if( !bTab )
{
if( lSeparator )
{
rctsep.top = lpdis->rcItem.top +1 ;
rctsep.left = lpdis->rcItem.left -3;
rctsep.right = lpdis->rcItem.right+5;
rctsep.bottom = lpdis->rcItem.bottom - 4;
lb.lbStyle = BS_SOLID;
lb.lbColor = nClrHighBar ;
hBrush = CreateBrushIndirect( &lb );
FillRect( lpdis->hDC, &rctsep, hBrush );
DeleteObject( hBrush );
}
else
{
if(!lBar)
{
DrawText( lpdis->hDC, szPrompt, -1, &lpdis->rcItem, DT_LEFT );
}
else
{
lpdis->rcItem.left -= 5;
DrawText( lpdis->hDC, szPrompt, -1, &lpdis->rcItem, DT_CENTER );
lpdis->rcItem.left += 5;
}
}
}
else
{
lpdis->rcItem.right -= 26;
StrToken( szPrompt, 1, 9, &wLen ); // 32 bits does not fill wLen before
DrawText( lpdis->hDC, StrToken(szPrompt, 1, 9, &wLen), wLen, &lpdis->rcItem, DT_LEFT );
StrToken( szPrompt, 2, 9, &wLen ); // 32 bits does not fill wLen before
DrawText( lpdis->hDC, StrToken(szPrompt, 2, 9, &wLen), wLen, &lpdis->rcItem, DT_RIGHT );
lpdis->rcItem.right += 26;
}
if(!lBar)
{
/*
if( !lSeparator )
{
if( lpdis->itemState & ODS_GRAYED )
RectDisable( lpdis->hDC, &lpdis->rcItem );
}
*/
lpdis->rcItem.top -= 2;
lpdis->rcItem.left -= 26;
}
else
{
lpdis->rcItem.top -= 2;
lpdis->rcItem.left -= 4;
}
_retl( TRUE );
break;
case ODA_FOCUS:
_retl( FALSE );
break;
}
}
//----------------------------------------------------------------------------//
/*
#ifdef __HARBOUR__
CLIPPER MENUMEASUREITEM( PARAMS ) // ( pMeasureItemStruct, nLen )
#else
CLIPPER MENUMEASUR( PARAMS ) // EITEM( pMeasureItemStruct, nLen )
#endif
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
lp->itemWidth = _parni( 2 );
lp->itemHeight = GetSystemMetrics( SM_CYMENU ); //18
}
*/
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETMEAITEM( PARAMS ) // ( pMeasureItemStruct ) --> nMenuItemID
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
_retnl( lp->itemID );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETDRAWITEM( PARAMS ) // ( pDrawItemStruct ) --> nMenuItemID
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
_retnl( lpdis->itemID );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_GETDRAWMENU( PARAMS ) // ( pDrawItemStruct ) --> hMenu
{
LPDRAWITEMSTRUCT lpdis = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
_retnl( ( LONG ) lpdis->hwndItem );
}
//----------------------------------------------------------------------------//
HARBOUR HB_FUN_ISMENU( PARAMS )
{
_retl( IsMenu( ( HMENU ) _parnl( 1 ) ) );
}
//----------------------------------------------------------------------------//
HB_FUNC( _GETMENUID)
{
_retnl((LONG)GetMenu((HWND)_parnl(1)));
}
//----------------------------------------------------------------------------//
HB_FUNC ( _COLORMENU )
{
HMENU iMenu;
MENUINFO iMenuInfo ;
COLORREF lColor = _parnl(2);
BOOL lSubMenu = _parl(3);
HWND himage ;
himage = (HWND)LoadImage(0,_parc(4),IMAGE_BITMAP ,0,0,LR_LOADFROMFILE | LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT );
if (himage==NULL)
{
himage = (HWND)LoadImage(GetModuleHandle(NULL),_parc(4),IMAGE_BITMAP ,0,0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT );
}
iMenu = GetMenu((HWND) _parnl(1));
GetMenuInfo(iMenu, &iMenuInfo);
iMenuInfo.cbSize = sizeof(MENUINFO);
iMenuInfo.dwStyle = GetWindowLongPtr( (HWND) _parnl(1), GWL_STYLE );
if (lSubMenu)
{
iMenuInfo.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS ;
}
else
{
iMenuInfo.fMask = MIM_BACKGROUND;
}
if (himage==NULL)
{
iMenuInfo.hbrBack = CreateSolidBrush(lColor);
}
else
{
iMenuInfo.hbrBack = CreatePatternBrush( (HBITMAP) himage);
}
SetMenuInfo(iMenu, &iMenuInfo);
DrawMenuBar((HWND) _parnl(1));
}
//----------------------------------------------------------------------------//
HB_FUNC ( _COLORSUBMENU )
{
HMENU iMenu;
MENUINFO iMenuInfo ;
COLORREF lColor = _parnl(2);
iMenu = GetMenu((HWND) _parnl(1));
GetMenuInfo(iMenu, &iMenuInfo);
iMenuInfo.cbSize = sizeof(MENUINFO);
iMenuInfo.fMask = MIM_BACKGROUND | MIM_APPLYTOSUBMENUS;
iMenuInfo.hbrBack = CreateSolidBrush(lColor);
SetMenuInfo(iMenu, &iMenuInfo);
// DrawMenuBar((HWND) _parnl(1));
}
//----------------------------------------------------------------------------//
HB_FUNC( CHGMENUMEA ) // pMeasureItemStruct, nWidth, nHeight
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
lp->itemWidth = _parni( 2 ) ;
lp->itemHeight = _parni( 3 ) ;
}
HB_FUNC( GETDRAWISR ) // ( pDrawitemstruct )
{
LPDRAWITEMSTRUCT lp = ( LPDRAWITEMSTRUCT ) _parnl( 1 );
hb_reta( 12 );
_storni( lp->CtlType , -1, 1 );
_storni( lp->CtlID , -1, 2 );
_storni( lp->itemID , -1, 3 );
_storni( lp->itemAction , -1, 4 );
_storni( lp->itemState , -1, 5 );
_storni( ( LONG ) lp->hwndItem , -1, 6 );
_storni( ( LONG ) lp->hDC , -1, 7 );
_storni( lp->rcItem.top , -1, 8 );
_storni( lp->rcItem.left , -1, 9 );
_storni( lp->rcItem.bottom, -1, 10 );
_storni( lp->rcItem.right , -1, 11 );
_stornd( lp->itemData , -1, 12 );
}
HB_FUNC( GETMEAUSUR ) // ( pMeasureItemStruct )
{
LPMEASUREITEMSTRUCT lp = ( LPMEASUREITEMSTRUCT ) _parnl( 1 );
hb_reta( 6 );
_storni( lp->CtlType , -1, 1 );
_storni( lp->CtlID , -1, 2 );
_storni( lp->itemID , -1, 3 );
_storni( lp->itemWidth , -1, 4 );
_storni( lp->itemHeight , -1, 5 );
_stornd( lp->itemData , -1, 12 );
}
//----------------------------------------------------------------------------//
- Alfredo Arteaga
- Posts: 326
- Joined: Sun Oct 09, 2005 5:22 pm
- Location: Mexico
- Contact:
Re: Compilación para 12.05
Me siento frustrado!!!
Ya superé los problemas de compilación, pero el WBrowse no funciona. Nicanor, ¿tienes la lib trabajando?.
Para no abrumar el hilo me gustaría contactarte por correo, será posible?
Ya superé los problemas de compilación, pero el WBrowse no funciona. Nicanor, ¿tienes la lib trabajando?.
Para no abrumar el hilo me gustaría contactarte por correo, será posible?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: Compilación para 12.05
Alfredo,
Con muy poco esfuerzo puedes migrar al xbrowse de FWH, anímate
Te ayudamos aqui
Con muy poco esfuerzo puedes migrar al xbrowse de FWH, anímate
Te ayudamos aqui