#include "FiveWin.ch"
function Main()
local oWnd, oTT
DEFINE WINDOW oWnd
oTT = TC5Tooltip():New( 10, 10, 100, 100, oWnd )
MsgInfo( oTT:hWnd )
ACTIVATE WINDOW oWnd
return nil
#include "FiveWin.ch"
function Main()
local oWnd, oTT
DEFINE WINDOW oWnd
oTT = TC5Tooltip():New( 100, 100, 250, 150, oWnd, .T., CLR_CYAN, CLR_WHITE )
oTT:cHeader = "header"
oTT:cBody = "this is the body of the tooltip" + CRLF + "It looks nice"
oTT:cFoot = "this is the footer"
ACTIVATE WINDOW oWnd
return nil
Obj\TC5Tooltip.c:
Warning W8065 TC5Tooltip.prg 574: Call to function 'IF' with no prototype in function HB_FUN_SETLAYEREDWINDOWATTRIBUTES
Error E2379 TC5Tooltip.prg 575: Statement missing ; in function HB_FUN_SETLAYEREDWINDOWATTRIBUTES
Warning W8065 TC5Tooltip.prg 644: Call to function 'IF' with no prototype in function Array2Point
Error E2379 TC5Tooltip.prg 644: Statement missing ; in function Array2Point
Warning W8070 TC5Tooltip.prg 650: Function should return a value in function Array2Point
Warning W8057 TC5Tooltip.prg 650: Parameter 'pt' is never used in function Array2Point
Warning W8065 TC5Tooltip.prg 661: Call to function 'IF' with no prototype in function HB_FUN_CREATEPOLYGONRGN
Error E2379 TC5Tooltip.prg 662: Statement missing ; in function HB_FUN_CREATEPOLYGONRGN
#include "fivewin.ch"
#define CW_USEDEFAULT 32768
#define SRCCOPY 13369376
#define DT_TOP 0x00000000
#define DT_LEFT 0x00000000
#define DT_CENTER 0x00000001
#define DT_RIGHT 0x00000002
#define DT_VCENTER 0x00000004
#define DT_BOTTOM 0x00000008
#define DT_WORDBREAK 0x00000010
#define DT_SINGLELINE 0x00000020
#define DT_EXPANDTABS 0x00000040
#define DT_TABSTOP 0x00000080
#define DT_NOCLIP 0x00000100
#define DT_EXTERNALLEADING 0x00000200
#define DT_CALCRECT 0x00000400
#define DT_NOPREFIX 0x00000800
#define DT_INTERNAL 0x00001000
CLASS TC5Tooltip FROM TWindow
CLASSDATA lRegistered AS LOGICAL
DATA lSplitHdr AS LOGICAL INIT .f.
DATA lLeft AS LOGICAL INIT .f.
DATA lLineHeader AS LOGICAL INIT .f.
DATA lLineFoot AS LOGICAL INIT .F.
DATA lBorder AS LOGICAL INIT .t.
DATA lBtnClose AS LOGICAL INIT .f.
DATA cHeader AS CHARACTER INIT ""
DATA cBmpLeft AS CHARACTER INIT ""
DATA cBody AS CHARACTER INIT ""
DATA cBmpFoot AS CHARACTER INIT ""
DATA cFoot AS CHARACTER INIT ""
DATA lRightAlignBody AS LOGICAL INIT .F.
DATA cLibHeader
DATA cBmpHeader
DATA cLibLeft
DATA cLibFoot
DATA cTumbNail AS CHARACTER INIT ""
DATA cHeader2 AS CHARACTER INIT SPACE(255)
DATA nClrPane2
DATA nClrBorder AS NUMERIC INIT 0
DATA nClrSepara1 AS NUMERIC INIT RGB(157,188,219)
DATA nClrSepara2 AS NUMERIC INIT CLR_WHITE
DATA nClrTextHeader
DATA nClrTextBody
DATA nClrTextFoot
DATA oFontHdr
DATA oFontHdr2
DATA oFontBody
DATA oFontPie
DATA aHeader AS ARRAY INIT {0,0,0,0}
DATA aHeader2 AS ARRAY INIT {0,0,0,0}
DATA aBody AS ARRAY INIT {0,0,0,0}
DATA aLeft AS ARRAY INIT {0,0,0,0}
DATA aRight AS ARRAY INIT {0,0,0,0}
DATA aFoot AS ARRAY INIT {0,0,0,0}
DATA aBtnClose AS ARRAY INIT {0,0,0,0}
DATA nWRadio
DATA nHRadio
DATA nGetColor
DATA aOldPos, nOldRow, nOldCol
DATA hRgn
DATA nMResize
DATA bBmpLeft
DATA nFixWidth
DATA nFixHeight
DATA bOwnerDraw
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio ) CONSTRUCTOR
METHOD DEFAULT ()
METHOD Destroy() INLINE ::oFontHdr :END(),;
::oFontHdr2:END(),;
::oFontBody:END(),;
::oFontPie :END(),;
DeleteObject( ::hRgn ),;
super:Destroy()
METHOD EndPaint() INLINE ::nPaintCount--,EndPaint( ::hWnd, ::cPS ), ::cPS := Nil, ::hDC := Nil, 0
METHOD DISPLAY() INLINE ::BeginPaint(),::PAINT(),::EndPaint(),0
METHOD PAINT ()
METHOD PaintHdr ( hDC, rc )
METHOD PaintHdr2( hDC, rc )
METHOD PaintBody( hDC, rc )
METHOD PaintFoot( hDC, rc )
METHOD HandleEvent( nMsg, nWParam, nLParam )
METHOD ReSize( nSizeType, nWidth, nHeight )
METHOD lHeader() INLINE !EMPTY( ::cHeader )
METHOD lFoot() INLINE !EMPTY( ::cFoot )
METHOD GetSize()
METHOD SetSize( nWidth, nHeight ) INLINE Super:SetSize( nWidth, nHeight, .t. )
METHOD CREATE( cClsName )
METHOD Show()
METHOD Hide()
ENDCLASS
*********************************************************************************************************************************
METHOD New( nTop, nLeft, nWidth, nHeight, oWnd, lDisenio, nClrPane, nClrPane2, nClrText, nWRadio, nHRadio ) CLASS TC5ToolTip
*********************************************************************************************************************************
DEFAULT nClrPane := CLR_WHITE
DEFAULT nClrPane2 := nClrPane
DEFAULT nClrText := 0
DEFAULT nWRadio := 2
DEFAULT nHRadio := 2
::oWnd := oWnd
::nStyle := nOR( WS_POPUP )
::nTop := nTop
::nLeft := nLeft
::nBottom := nTop + nHeight
::nRight := nLeft + nWidth
::nClrPane := nClrPane
::nClrPane2 := nClrPane2
::nClrText := nClrText
::nClrBorder := RGB( 118,118,118 )
::nWRadio := nWRadio
::nHRadio := nHRadio
DEFINE FONT ::oFontHdr NAME "Verdana" SIZE 0, -11 BOLD
DEFINE FONT ::oFontHdr2 NAME "Verdana" SIZE 0, -11
DEFINE FONT ::oFontBody NAME "Segoe UI" SIZE 0, -11
DEFINE FONT ::oFontPie NAME "Verdana" SIZE 0, -11 BOLD
::Register( nOR( CS_VREDRAW, CS_HREDRAW ) ) //, 131072
::CREATE()
::cTitle := "Undefined"
::hRgn := Nil
::DEFAULT(.t.)
RETURN Self
*********************************************************************************************************************************
METHOD CREATE( cClsName ) CLASS TC5ToolTip
*********************************************************************************************************************************
DEFAULT cClsName := ::ClassName(), ::cCaption := "",;
::nStyle := WS_OVERLAPPEDWINDOW,;
::nTop := 0, ::nLeft := 0, ::nBottom := 10, ::nRight := 10,;
::nId := 0
IF ::oWnd != Nil
::nStyle = nOR( ::nStyle, WS_CHILD )
ENDIF
IF ::nBottom != CW_USEDEFAULT
::hWnd = CreateWindow( "#32768", ::cCaption, WS_POPUP ,;
::nLeft, ::nTop, ::nRight - ::nLeft + 1, ;
::nBottom - ::nTop + 1, ;
IF( ::oWnd != Nil, ::oWnd:hWnd, 0 ), ;
::nId )
ELSE
::hWnd = CreateWindow( "#32768", ::cCaption, WS_POPUP, ;
::nLeft, ::nTop, ::nRight, ::nBottom, ;
IF( ::oWnd != Nil, ::oWnd:hWnd, 0 ), ;
::nId )
ENDIF
IF ::hWnd == 0
WndCreateError( Self )
ELSE
::Link()
ENDIF
RETURN Nil
************************************************************************************************************************
METHOD GetSize() CLASS TC5ToolTip
************************************************************************************************************************
LOCAL rc := 0
LOCAL ASIZE := { 0, 0 }
LOCAL hBmp := 0
LOCAL hDC := 0
LOCAL hOldFont := 0
LOCAL n := 0
LOCAL nHBmp := 0
LOCAL nHText := 0
LOCAL nHeight := 0
LOCAL nLen := 0
LOCAL nW := 0
LOCAL nW2 := 0
LOCAL nWB := 0
LOCAL nWBmp := 0
LOCAL nWBodyTxt := 227
LOCAL nWF := 0
LOCAL nWH := 0
LOCAL nWidth := 0
IF ::nFixWidth != Nil .AND. ::nFixHeight != Nil
RETURN {::nFixWidth, ::nFixHeight}
ENDIF
rc := GetClientRect(::hWnd)
nWidth := nWBodyTxt
// Cabecera
IF !EMPTY( ::cHeader )
nHeight += 31
nWH := GetTextWidth( 0, ::cHeader, ::oFontHdr:hFont )+ 16
ENDIF
// Imagen a la izquierda
IF !EMPTY( ::cBmpLeft )
hBmp := LoadImageEx( ::cBmpLeft )
ELSE
IF ::bBmpLeft != Nil
hBmp := EVAL( ::bBmpLeft, self )
ENDIF
ENDIF
IF hBmp != 0
nWBmp := BmpWidth ( hBmp )
nHBmp := BmpHeight( hBmp )
nWidth += ( 14 + nWBmp )
DeleteObject( hBmp )
ENDIF
IF EMPTY(::cHeader) .AND. EMPTY(::cFoot)
nWidth := 13 + IF( nWBmp != 0, (nWBmp+13),0) + GetTextWidth(0,::cBody,::oFontBody:hFont ) + 26
ENDIF
IF !EMPTY( ::cFoot )
nHeight += 30
nWF := GetTextWidth( 0, ::cFoot, ::oFontPie:hFont ) +22
ENDIF
nWidth := MAX( MAX( nWidth, nWH ), nWF )
IF EMPTY(::cHeader) .AND. EMPTY(::cFoot)
nWidth := MIN(nWidth,227)
ENDIF
// Si tenemos texto en el cuerpo del tooltip
IF !EMPTY( ::cBody )
hDC := CreateDC( "DISPLAY",0,0,0)
hOldFont := SelectObject( hDC, ::oFontBody:hFont )//
nHText := DrawText( hDC, ALLTRIM(::cBody), { 0, 12+nWBmp+12+10, 20, nWidth }, nOr(DT_WORDBREAK, 8192, DT_CALCRECT ) )
//nHText := DrawText( hDC, alltrim(::cBody), { 0, 6+nWBmp+12+6, 20, nWidth }, nOr(DT_WORDBREAK, 8192, DT_CALCRECT ) )
SelectObject( hDC, hOldFont )
DeleteDC( hDC )
nHeight += nHText
nHeight+=8
ENDIF
nHeight := MAX( nHeight, nHBmp )
ASIZE := { nWidth, nHeight }
RETURN ASIZE
************************************************************************************************************************
METHOD DEFAULT( lShowDlg ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL rc := {0, 0, ::nHeight, ::nWidth}
LOCAL hRgn
LOCAL hRgn2
LOCAL hRgn3
LOCAL o := self
DEFAULT lShowDlg := .F.
::hRgn := CreateRoundRectRgn( rc[2] ,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )
SetWindowRgn(::hWnd, ::hRgn, .t. )
DeleteObject( ::hRgn )
RETURN 0
#define GW_CHILD 5
#define GW_HWNDNEXT 2
************************************************************************************************************************
METHOD HandleEvent( nMsg, nWParam, nLParam ) CLASS TC5Tooltip
************************************************************************************************************************
IF nMsg == 20
RETURN 1
ENDIF
RETURN super:HandleEvent( nMsg, nWParam, nLParam )
************************************************************************************************************************
METHOD ReSize( nSizeType, nWidth, nHeight ) CLASS TC5Tooltip
************************************************************************************************************************
::DEFAULT()
::Refresh()
RETURN super:ReSize( nSizeType, nWidth, nHeight )
************************************************************************************************************************
METHOD PAINT() CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hDCMem := CreateCompatibleDC ( ::hDC )
LOCAL rc := GetClientRect ( ::hWnd )
LOCAL hBmpMem := CreateCompatibleBitmap( ::hDC, rc[4]-rc[2], rc[3]-rc[1] )
LOCAL hOldBmp := SelectObject ( hDCMem, hBmpMem )
LOCAL nWRadio := ::nWRadio
LOCAL nHRadio := ::nHRadio
LOCAL nClrText := SetTextColor( hDCMem, ::nClrText )
LOCAL hBrush
LOCAL hRgn := CreateRoundRectRgn( rc[2] ,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )
rc[3]--; rc[4]--
nWRadio += 2
nHRadio += 2
VerticalGradient( hDCMem, {rc[1]-1,rc[2],rc[3],rc[4]}, ::nClrPane, ::nClrPane2 )
IF ::bOwnerDraw == Nil
::PaintHdr ( hDCMem, rc ) // ::PaintHdr2( hDCMem, rc )
::PaintFoot( hDCMem, rc )
::PaintBody( hDCMem, rc )
ELSE
EVAL( ::bOwnerDraw, hDCMem )
ENDIF
hBrush := CreateSolidBrush( ::nClrBorder )
FrameRgn( hDCMem, hRgn, hBrush, 1, 1 )
DeleteObject( hBrush )
DeleteObject( hRgn )
SetTextColor( hDCMem, nClrText )
BitBlt( ::hDC, 0, 0, rc[4]-rc[2], rc[3]-rc[1], hDCMem, 0, 0, SRCCOPY )
SelectObject( hDCMem, hOldBmp )
DeleteDC ( hDCMem )
DeleteObject( hBmpMem )
RETURN 0
************************************************************************************************************************
METHOD PaintHdr ( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hBmpHdr
LOCAL nWBmpHdr := 0
LOCAL hOldFont
LOCAL nClrText
LOCAL lIcon := .f.
LOCAL nTop
LOCAL nMode
// 25 pixels
IF ::lHeader
::aHeader := {rc[1],rc[2],rc[1]+25,rc[4]}
IF !EMPTY(::cBmpHeader)
hBmpHdr := LoadImageEx( ::cBmpHeader )
IF hBmpHdr != 0
nWBmpHdr := BmpWidth( hBmpHdr )
nTop := (::aHeader[1]+(::aHeader[3]-::aHeader[1])/2)-BmpHeight(hBmpHdr)/2
nTop := MAX( nTop, 5)
DrawMasked( hDC, hBmpHdr, nTop , 5 )
DeleteObject( hBmpHdr )
ENDIF
ENDIF
hOldFont := SelectObject( hDC, ::oFontHdr:hFont )
IF ::nClrTextHeader != Nil
nClrText := SetTextColor( hDC, ::nCLrTextHeader )
ENDIF
nMode := SetBkMode( hDC, 1 )
DrawText( hDC, ::cHeader, {::aHeader[1],::aHeader[2]+10+IF(hBmpHdr!=0,nWBmpHdr,0),::aHeader[3],::aHeader[4]-10},nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )
SetBkMode( hDC, nMode )
IF ::nClrTextHeader != Nil
SetTextColor( hDC, nClrText )
ENDIF
SelectObject( hDC, hOldFont )
ELSE
::aHeader := {rc[1],rc[2],rc[1],rc[4]}
ENDIF
RETURN 0
************************************************************************************************************************
METHOD PaintHdr2( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hOldFont
LOCAL nClrText
::aHeader2 := {::aHeader[3],rc[2],::aHeader[3],rc[4]}
IF ::lHeader
IF ::lSplitHdr
::aHeader2 := {::aHeader[3],rc[2],::aHeader[3]+25,rc[4]}
ENDIF
IF ::lLineHeader
Line( hDC, ::aHeader2[3] , ::aHeader2[2]+5, ::aHeader2[3] , ::aHeader2[4]-5, ::nClrSepara1 )
Line( hDC, ::aHeader2[3]+1, ::aHeader2[2]+5, ::aHeader2[3]+1, ::aHeader2[4]-5, ::nClrSepara2 )
ENDIF
hOldFont := SelectObject( hDC, ::oFontHdr2:hFont )
IF ::nClrTextHeader != Nil
nClrText := SetTextColor( hDC, ::nCLrTextHeader )
ENDIF
IF ::lSplitHdr .AND. !EMPTY( ::cHeader2 )
DrawText( hDC, ::cHeader2, {::aHeader2[1]+1,::aHeader2[2]+20,::aHeader2[3],::aHeader2[4]-2}, nOR(DT_WORDBREAK, 8192) )
ENDIF
IF ::nClrTextHeader != Nil
SetTextColor( hDC, nClrText )
ENDIF
SelectObject( hDC, hOldFont )
ENDIF
RETURN 0
************************************************************************************************************************
METHOD PaintBody( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hOldFont
LOCAL nWBmp := 0
LOCAL nClrText
LOCAL lIcon := .f.
LOCAL nMode
LOCAL hBmpLeft := 0
LOCAL n
LOCAL nLen
LOCAL nW
LOCAL nW2
LOCAL aLeft
::aLeft := {0,0,0,0}
::aBody := {::aHeader[3],rc[2],::aFoot[1],rc[4]}
IF EMPTY(::cBmpLeft)
::aLeft := {::aBody[1],rc[2],::aBody[3],IF(::lLeft,(rc[4]-rc[2])*0.33,rc[2])}
ELSE
hBmpLeft := LoadImageEx( ::cBmpLeft )
IF hBmpLeft != 0
nWBmp := BmpWidth( hBmpLeft )
::aLeft := { ::aBody[1],rc[2],::aBody[3],12+nWBmp+12}
ENDIF
ENDIF
IF ::bBmpLeft != Nil
hBmpLeft := EVAL( ::bBmpLeft, self )
IF hBmpLeft != 0
nWBmp := BmpWidth( hBmpLeft )
::aLeft := { ::aBody[1],rc[2],::aBody[3],12+nWBmp+12}
ENDIF
ENDIF
//
::aRight := {::aBody[1] +3,::aLeft[4]+20,::aBody[3]-3,rc[4]-10}
hOldFont := SelectObject( hDC, ::oFontBody:hFont )
nMode := SetBkMode( hDC, 1 )
DrawText( hDC,ALLTRIM(::cBody), ::aRight, nOr(IF( ::lRightAlignBody,DT_RIGHT,DT_LEFT), DT_WORDBREAK ) )
SetBkMode( hDC, nMode )
SelectObject( hDC, hOldFont )
IF hBmpLeft != 0
DrawMasked( hDC, hBmpLeft, ::aLeft[1]+5, ::aLeft[2]+12 )
DeleteObject( hBmpLeft )
ENDIF
RETURN 0
************************************************************************************************************************
METHOD PaintFoot( hDC, rc ) CLASS TC5ToolTip
************************************************************************************************************************
LOCAL hOldFont, hBmpFoot
LOCAL nWFoot := 0
LOCAL nClrText
LOCAL lIcon := .f.
LOCAL nMode
IF ::lFoot
::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
IF !EMPTY(::cBmpFoot)
::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
ENDIF
hBmpFoot := LoadImageEx( ::cBmpFoot )
IF hBmpFoot != 0
nWFoot := BmpWidth( hBmpFoot )
::aFoot := {rc[3]-30,rc[2],rc[3],rc[4]}
DrawMasked( hDC, hBmpFoot, (::aFoot[1]+(::aFoot[3]-::aFoot[1])/2)-BmpHeight(hBmpFoot)/2, 5 )
DeleteObject( hBmpFoot )
ENDIF
ELSE
::aFoot := {rc[3],rc[2],rc[3],rc[4]}
ENDIF
IF ::lFoot
hOldFont := SelectObject( hDC, ::oFontPie:hFont )
IF ::nClrTextFoot != Nil
nClrText := SetTextColor( hDC, ::nClrTextFoot )
ENDIF
nMode := SetBkMode( hDC, 1 )
DrawText( hDC, ::cFoot, {::aFoot[1],::aFoot[2]+ 10+nWFoot,::aFoot[3],::aFoot[4]},nOr( DT_VCENTER, DT_SINGLELINE, 8192 ) )
SetBkMode( hDC, nMode )
IF ::nClrTextFoot != Nil
SetTextColor( hDC, nClrText )
ENDIF
SelectObject( hDC, hOldFont )
ENDIF
Line( hDC, ::aFoot[1] , ::aFoot[2]+5, ::aFoot[1] , ::aFoot[4]-5, ::nClrSepara1 )
Line( hDC, ::aFoot[1]+1, ::aFoot[2]+5, ::aFoot[1]+1, ::aFoot[4]-5, ::nClrSepara2 )
RETURN 0
*********************************************************************************************
METHOD Hide() CLASS TC5Tooltip
*********************************************************************************************
RETURN super:Hide()
#define WS_EX_LAYERED 524288
#define GWL_EXSTYLE -20
#define LWA_ALPHA 2
*********************************************************************************************
METHOD Show() CLASS TC5Tooltip
*********************************************************************************************
RETURN super:Show()
/*
////////////////////////////////////////////////////////////////////
function LoadImageEx2( cImage, hBmp )
////////////////////////////////////////////////////////////////////
local lIcon := .f.
hBmp := LoadImageEx( cImage )
if hBmp == 0
hBmp := LoadIcon( GetResources(), cImage )
if hBmp == 0
hBmp := ExtractIcon( cImage )
lIcon := hBmp != 0
else
lIcon := .t.
endif
endif
return lIcon
*/
/***************************************************************************************************************************/
FUNCTION Line( hDC, nTop, nLeft, nBottom, nRight, nColor, nGrueso )
/***************************************************************************************************************************/
LOCAL hPen, hOldPen
DEFAULT nGrueso := 1
DEFAULT nColor := CLR_BLACK
hPen := CreatePen( PS_SOLID, nGrueso, nColor )
hOldPen := SelectObject( hDC, hPen )
MoveTo( hDC, nLeft, nTop )
LineTo( hDC, nRight, nTop )
SelectObject( hDC, hOldPen )
DeleteObject( hPen )
RETURN 0
#pragma BEGINDUMP
#include "windows.h"
#include "hbapi.h"
//lngUser32 = LoadLibrary("User32.dll")
//lngSetLayeredWindowAttributes = GetProcAddress(lngUser32, "SetLayeredWindowAttributes")
//If lngSetLayeredWindowAttributes <> 0 Then
//' Set window translucency, if supported
//lngOldStyle = GetWindowLong(hDlg, %GWL_EXSTYLE)
//SetWindowLong hDlg, %GWL_EXSTYLE, lngOldStyle Or %WS_EX_LAYERED
//Call DWord lngSetLayeredWindowAttributes Using SetLayeredWindowAttributes(hDlg, 0, %TRANSLEVEL, %LWA_ALPHA)
//End If
typedef BOOL ( FAR PASCAL *LPSETLAYEREDWINDOWATTRIBUTES) ( HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags );
HB_FUNC( SETLAYEREDWINDOWATTRIBUTES )
{
HINSTANCE hLib;
LPSETLAYEREDWINDOWATTRIBUTES SetLayeredWindowAttributes;
hLib = LoadLibrary( "user32.dll" );
IF ( hLib )
{
SetLayeredWindowAttributes = (LPSETLAYEREDWINDOWATTRIBUTES) GetProcAddress( hLib, "SetLayeredWindowAttributes" );
IF( SetLayeredWindowAttributes )
{
SetLayeredWindowAttributes( ( HWND ) hb_parnl( 1 ),
( COLORREF ) hb_parnl( 2 ),
( BYTE ) hb_parni ( 3 ),
( DWORD ) hb_parnl( 4 ) );
}
FreeLibrary( hLib );
}
hb_ret();
}
/*
HB_FUNC( CREATERECTRGN )
{
hb_retnl( (long) CreateRectRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 )));
}
*/
/*
HB_FUNC( CREATEROUNDRECTRGN )
{
hb_retnl( (long) CreateRoundRectRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 ),hb_parni( 5 ),hb_parni( 6 )));
}
HB_FUNC( CREATEELLIPTICRGN )
{
hb_retnl( (long) CreateEllipticRgn( hb_parni( 1 ),hb_parni( 2 ),hb_parni( 3 ),hb_parni( 4 )));
}
HB_FUNC( COMBINERGN )
{
HRGN hrgn = CreateRectRgn(0,0,0,0);
HRGN hrgn1 = (HRGN) hb_parnl( 1 );
HRGN hrgn2 = (HRGN) hb_parnl( 2 );
int iRet;
iRet = CombineRgn( hrgn, // handle to destination region
hrgn1, // handle to source region
hrgn2, // handle to source region
hb_parni( 3 ) // region combining mode
);
hb_retni( (long)hrgn );
}
*/
/*
HB_FUNC( SETWINDOWRGN )
{
hb_retni( SetWindowRgn( (HWND) hb_parnl( 1 ),(HRGN) hb_parnl( 2 ), hb_parl( 3 ) ));
}
*/
HB_FUNC( FRAMERGN )
{
hb_retl( FrameRgn( (HDC) hb_parnl( 1 ), (HRGN) hb_parnl( 2 ), (HBRUSH) hb_parnl( 3 ), hb_parni( 4 ), hb_parni( 5 )));
}
BOOL Array2Point(PHB_ITEM aPoint, POINT *pt )
{
IF (HB_IS_ARRAY(aPoint) && hb_arrayLen(aPoint) == 2) {
pt->x = hb_arrayGetNL(aPoint,1);
pt->y = hb_arrayGetNL(aPoint,2);
RETURN TRUE ;
}
RETURN FALSE;
}
HB_FUNC( CREATEPOLYGONRGN )
{
POINT * Point ;
POINT pt ;
INT iCount ;
INT i ;
PHB_ITEM aParam ;
PHB_ITEM aSub ;
IF ( hb_param( 1, HB_IT_ARRAY ) != NULL )
{
iCount = (INT) hb_parinfa( 1, 0 ) ;
Point = (POINT *) hb_xgrab( iCount * sizeof (POINT) ) ;
aParam = hb_param(1,HB_IT_ARRAY);
FOR ( i = 0 ; i<iCount ; i++ )
{
aSub = ( PHB_ITEM ) hb_itemArrayGet( aParam, i+1 );
IF ( Array2Point(aSub, &pt ))
*(Point+i) = pt ;
ELSE {
hb_retnl(0);
hb_xfree(Point);
RETURN ;
}
}
hb_retnl( (LONG) CreatePolygonRgn( Point, iCount, hb_parni( 2 ) ) ) ;
hb_xfree(Point);
}
ELSE
hb_retnl( 0 );
}
HB_FUNC( GETDLGCTRLID )
{
hb_retni( GetDlgCtrlID( ( HWND ) hb_parnl( 1 ) ) );
}
#pragma ENDDUMP
METHOD Paint() CLASS TC5ToolTip
************************************************************************************************************************
local hDCMem := CreateCompatibleDC ( ::hDC )
local rc := GetClientRect ( ::hWnd )
local hBmpMem := CreateCompatibleBitmap( ::hDC, rc[4]-rc[2], rc[3]-rc[1] )
local hOldBmp := SelectObject ( hDCMem, hBmpMem )
local nWRadio := ::nWRadio
local nHRadio := ::nHRadio
local nClrText := SetTextColor( hDCMem, ::nClrText )
local hBrush
local hRgn := CreateRoundRectRgn( rc[2] ,rc[1], rc[4], rc[3] , ::nWRadio, ::nHRadio )
Local oThis := self
rc[3]--; rc[4]--
nWRadio += 2
nHRadio += 2
IF ::oTimer != nil
::oTimer:Deactivate()
endif
DEFINE TIMER ::oTimer INTERVAL ::nTimer ACTION oThis:Hide() OF Self
ACTIVATE TIMER ::oTimer
VerticalGradient( hDCMem, {rc[1]-1,rc[2],rc[3],rc[4]}, ::nClrPane, ::nClrPane2 )
if ::bOwnerDraw == nil
::PaintHdr ( hDCMem, rc ) // ::PaintHdr2( hDCMem, rc )
::PaintFoot( hDCMem, rc )
::PaintBody( hDCMem, rc )
else
eval( ::bOwnerDraw, hDCMem )
endif
hBrush := CreateSolidBrush( ::nClrBorder )
FrameRgn( hDCMem, hRgn, hBrush, 1, 1 )
DeleteObject( hBrush )
DeleteObject( hRgn )
SetTextColor( hDCMem, nClrText )
BitBlt( ::hDC, 0, 0, rc[4]-rc[2], rc[3]-rc[1], hDCMem, 0, 0, SRCCOPY )
SelectObject( hDCMem, hOldBmp )
DeleteDC ( hDCMem )
DeleteObject( hBmpMem )
return 0
#include "FiveWin.ch"
function Main()
local oWnd, oTT
DEFINE WINDOW oWnd
oTT = TC5Tooltip():New( 100, 100, 450, 350, oWnd, .T., CLR_CYAN, CLR_WHITE,15,15 )
oTT:cHeader = "header"
oTT:cHeader2 = "header2"
oTT:cBody = "this is the body of the tooltip" + CRLF + "It looks nice"
oTT:cFoot = "this is the footer"
oTT:cBmpFoot :=".\bitmaps\help2.bmp"
oTT:cBmpLeft :=".\bitmaps\brush.bmp"
* oTT:lRightAlignBody:=.t.
oTT:lLineHeader :=.t. //not run
oTT:lBtnClose :=.t. //not run
oTT:lSplitHdr:=.t. //not run
oTT:lBorder :=.f.
oTT:nTimer:= 2000
ACTIVATE WINDOW oWnd
return nil
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Google [Bot] and 25 guests