diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3799d1ea47..68741de6ca 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,4 +1,4 @@ -/* +/* * $Id$ */ @@ -8,6 +8,58 @@ 2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2008-11-14 00:45 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/gtwvg.c + + New HB_GTI_ + HB_GTE_ messages. + + * harbour/contrib/gtwvg/wvgutils.c + - Excluded WIN_* Windows API functions. + + + harbour/contrib/gtwvg/wvgwin.c + + Included WIN_* Windows API functions. + + + harbour/contrib/gtwvg/wvgsink.c + ! ActiveX container functions contributed by Andy Wos, a big thanks to him. + + + harbour/contrib/gtwvg/wvgphdlr.prg + + harbour/contrib/gtwvg/wvgwnd.prg + + harbour/contrib/gtwvg/wvgcrt.prg + + harbour/contrib/gtwvg/wvgax.prg + ! Xbase++ compatible class skeleton and implementation. + ! Partially but sufficient functional WvgCrt() class. + + * harbour/contrib/gtwvg/gtwvg.h + * harbour/contrib/gtwvg/hbgtwvg.ch + * harbour/contrib/gtwvg/wvtwin.ch + + Added few new members. + + * harbour/contrib/gtwvg/common.mak + * harbour/contrib/gtwvg/makefile + ! Updated to include added files. + + * harbour/contrib/gtwvg/tests/demowvg.prg + ! updated to include WvgCrt() class implementation. + ! Updated to host ActiveX controls in WvtCrt() terminal. + + ; It is a humble effort to introduce a common and portable class framework + to build futuristic CUI/GUI applications development and maintainability + easier. I had been a fairly good user of Xbase++ in early years + and was an admirer of their intuitive object modal especially + uniform way of parameters passing almost for all their objects. + So when Multi-threading and Multi-windows(GT) capability is introduced + Przemek, I thought it is the right moment to start in this direction too. + + The firts efforts are encouraging and I see a great hope in the future. + But for sure I cannot accomplish this task at my own. Someone has to join + this effort. I know all have their own preferences but also realize that + it can ease all of us in a big way. In the past many developers put their + hands on the GUI front but without a clear framework. I based this effort + on Xbase++ because it is the only compiler which offers such functionality + on console level if we do not talk about GUI. Also it has extensive + documentation which is a force in itself. + + I ever wished if Przemek would been a Windows user too! + 2008-11-12 23:28 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/hbgtcore.c ! removed code I committed by mistake. diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index 638c0eb7c2..c9cf23cd6e 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -12,10 +12,16 @@ C_SOURCES=\ gtwvg.c \ wvgcore.c \ wvgutils.c \ + wvgwin.c \ + wvgsink.c \ PRG_SOURCES=\ wvgclass.prg \ wvgpaint.prg \ + wvgphdlr.prg \ + wvgwnd.prg \ + wvgcrt.prg \ + wvgax.prg \ PRG_HEADERS=\ hbgtwvg.ch \ diff --git a/harbour/contrib/gtwvg/common.mak b/harbour/contrib/gtwvg/common.mak index a6f4f303fe..31726d1994 100644 --- a/harbour/contrib/gtwvg/common.mak +++ b/harbour/contrib/gtwvg/common.mak @@ -13,10 +13,16 @@ PRG_HEADERS=\ LIB_OBJS = \ $(OBJ_DIR)wvgclass$(OBJEXT) \ $(OBJ_DIR)wvgpaint$(OBJEXT) \ + $(OBJ_DIR)wvgphdlr$(OBJEXT) \ + $(OBJ_DIR)wvgwnd$(OBJEXT) \ + $(OBJ_DIR)wvgcrt$(OBJEXT) \ + $(OBJ_DIR)wvgax$(OBJEXT) \ \ $(OBJ_DIR)gtwvg$(OBJEXT) \ $(OBJ_DIR)wvgcore$(OBJEXT) \ $(OBJ_DIR)wvgutils$(OBJEXT) \ + $(OBJ_DIR)wvgsink$(OBJEXT) \ + $(OBJ_DIR)wvgwin$(OBJEXT) \ all: \ $(LIB_PATH) \ diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 2aa00e6c59..c14500fdd0 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -364,7 +364,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) return pWVT; } -static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent ) +static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent, PHB_ITEM pParams ) { int nResult = 0; /* Unhandled */ @@ -374,7 +374,7 @@ static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent ) { PHB_ITEM pEvent = hb_itemPutNI( NULL, nEvent ); - nResult = hb_itemGetNI( hb_vmEvalBlockV( ( PHB_ITEM ) pWVT->pGT->pNotifierBlock, 1, pEvent ) ); + nResult = hb_itemGetNI( hb_vmEvalBlockV( ( PHB_ITEM ) pWVT->pGT->pNotifierBlock, 2, pEvent, pParams ) ); hb_itemRelease( pEvent ); @@ -542,6 +542,13 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) hb_vmRequestRestore(); } } + /* Fire event to be trapped by the application */ + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + hb_itemPutNI( pEvParams, iKey ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_KEYBOARD, pEvParams ); + hb_itemRelease( pEvParams ); + } } static BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey ) @@ -1161,7 +1168,22 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L } if( keyCode != 0 ) + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + hb_gt_wvt_AddCharToInputQueue( pWVT, keyCode ); + + hb_arrayNew( pEvParams, 6 ); + hb_arraySetNL( pEvParams, 1, message ); + hb_arraySetNI( pEvParams, 2, keyCode ); + hb_arraySetNI( pEvParams, 3, xy.x ); + hb_arraySetNI( pEvParams, 4, xy.y ); + hb_arraySetNI( pEvParams, 5, colrow.y ); + hb_arraySetNI( pEvParams, 6, colrow.x ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); + hb_itemRelease( pEvParams ); + } } static BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam ) @@ -1716,15 +1738,18 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara return 0; case WM_CLOSE: /* Clicked 'X' on system menu */ - if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE ) == 0 ) + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE, pEvParams ) == 0 ) { PHB_ITEM pItem = hb_itemPutL( NULL, TRUE ); hb_setSetItem( HB_SET_CANCEL, pItem ); hb_itemRelease( pItem ); hb_vmRequestCancel(); } + hb_itemRelease( pEvParams ); return 0; - + } case WM_QUIT: case WM_DESTROY: return 0; @@ -1736,9 +1761,12 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara /* Pritpal Bedi - 06 Jun 2008 */ case WM_ACTIVATE: - hb_gt_wvt_FireEvent( pWVT, ( LOWORD( wParam ) == WA_INACTIVE ? HB_GTE_KILLFOCUS : HB_GTE_SETFOCUS ) ); + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + hb_gt_wvt_FireEvent( pWVT, ( LOWORD( wParam ) == WA_INACTIVE ? HB_GTE_KILLFOCUS : HB_GTE_SETFOCUS ), pEvParams ); + hb_itemRelease( pEvParams ); return 0; - + } case WM_ENTERSIZEMOVE: if( pWVT->bMaximized ) { @@ -1761,12 +1789,16 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara return 0; case WM_EXITSIZEMOVE: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + pWVT->bResizing = FALSE; hb_wvt_gtSaveGuiState( pWVT ); - hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED ); hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED, pEvParams ); + hb_itemRelease( pEvParams ); return 0; - + } case WM_SIZE: if( pWVT->bResizing ) { @@ -1788,6 +1820,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { case SC_MAXIMIZE: { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + pWVT->bMaximized = TRUE; if( pWVT->ResizeMode == HB_GTI_RESIZEMODE_FONT ) @@ -1809,8 +1843,9 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara ShowWindow( pWVT->hWnd, SW_HIDE ); ShowWindow( pWVT->hWnd, SW_NORMAL ); - hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED ); hb_gt_wvt_AddCharToInputQueue( pWVT, HB_K_RESIZE ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED, pEvParams ); + hb_itemRelease( pEvParams ); return 0; } @@ -1855,6 +1890,52 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_wvt_gtHandleMenuSelection( pWVT, ( int ) LOWORD( wParam ) ); return 0; + case WM_MOUSEHOVER: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 6 ); + hb_arraySetNI( pEvParams, 1, message ); + hb_arraySetNI( pEvParams, 2, 0 ); + hb_arraySetNI( pEvParams, 3, LOWORD( lParam ) ); + hb_arraySetNI( pEvParams, 4, HIWORD( lParam ) ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); + + hb_itemRelease( pEvParams ); + + { + TRACKMOUSEEVENT tmi; + tmi.cbSize = sizeof( TRACKMOUSEEVENT ); + tmi.dwFlags = TME_LEAVE; + tmi.hwndTrack = pWVT->hWnd; + tmi.dwHoverTime = HOVER_DEFAULT; + TrackMouseEvent( &tmi ); + } + return 0; + } + case WM_MOUSELEAVE: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 2 ); + hb_arraySetNI( pEvParams, 1, message ); + hb_arraySetNI( pEvParams, 2, 0 ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); + + hb_itemRelease( pEvParams ); + + { + TRACKMOUSEEVENT tmi; + tmi.cbSize = sizeof( TRACKMOUSEEVENT ); + tmi.dwFlags = TME_HOVER; + tmi.hwndTrack = pWVT->hWnd; + tmi.dwHoverTime = HOVER_DEFAULT; + TrackMouseEvent( &tmi ); + } + return 0; + } } return DefWindowProc( hWnd, message, wParam, lParam ); @@ -1960,6 +2041,29 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT ) pWVT->pPP->y = pt.y; } } + else + { + POINT pt; + + if( pWVT->pPP->bRowCols ) + { + pt.x = ( pWVT->PTEXTSIZE.x * pWVT->pPP->y ); + pt.y = ( pWVT->PTEXTSIZE.y * pWVT->pPP->x ); + + pWVT->ROWS = pWVT->pPP->width; + pWVT->COLS = pWVT->pPP->height; + } + else + { + pt.x = pWVT->pPP->x; + pt.y = pWVT->pPP->y; + } + pWVT->pPP->x = pt.x; + pWVT->pPP->y = pt.y; + + if( pWVT->pPP->y < 0 ) + pWVT->CentreWindow = TRUE; + } } hWnd = CreateWindowEx( @@ -2055,6 +2159,16 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) if( b_MouseEnable ) hb_wvt_gtCreateToolTipWindow( pWVT ); } + + /* Make sure that first tracking event is generated */ + { + TRACKMOUSEEVENT tmi; + tmi.cbSize = sizeof( TRACKMOUSEEVENT ); + tmi.dwFlags = TME_LEAVE | TME_HOVER ; + tmi.hwndTrack = pWVT->hWnd; + tmi.dwHoverTime = HOVER_DEFAULT; + TrackMouseEvent( &tmi ); + } } return TRUE; @@ -2286,7 +2400,20 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) int iVal; HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) ); - + /* + if( pInfo->pGT && hb_itemType( pInfo->pGT ) & HB_IT_POINTER ) + { + pGT = hb_gt_ItemBase( pInfo->pGT ); + if( pGT ) + hb_gt_BaseFree( pGT ); + else + pGT = pGTx; + } + if( !pGT ) + { + pGT = pGTx; + } + */ pWVT = HB_GTWVT_GET( pGT ); switch( iType ) @@ -3915,3 +4042,29 @@ PHB_GTWVT hb_wvt_gtGetWVT( void ) } //-------------------------------------------------------------------// +HB_FUNC( HB_GTINFOEX ) +{ + if( ISPOINTER( 1 ) && ISNUM( 2 ) ) + { + PHB_GT pGT = hb_gt_ItemBase( hb_param( 1, HB_IT_ANY ) ); + + if( pGT ) + { + HB_GT_INFO gtInfo; + + gtInfo.pNewVal = hb_param( 3, HB_IT_ANY ); + gtInfo.pNewVal2 = hb_param( 4, HB_IT_ANY ); + gtInfo.pResult = NULL; + + hb_gt_BaseFree( pGT ); + HB_GTSELF_INFO( pGT, hb_parni( 2 ), >Info ); + //hb_gt_BaseFree( pGT ); + + if( gtInfo.pResult ) + hb_itemReturnRelease( gtInfo.pResult ); + } + } + else + hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); +} +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index d9518a9d8b..beddc50a22 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -101,7 +101,7 @@ #define WVT_CHAR_QUEUE_SIZE 128 #define WVT_MAX_TITLE_SIZE 128 #define WVT_MAX_ROWS 256 -#define WVT_MAX_COLS 256 +#define WVT_MAX_COLS 512 #define WVT_MAX_WINDOWS 256 #if defined( HB_WINCE ) # define WVT_DEFAULT_ROWS 15 @@ -531,4 +531,14 @@ PHB_GTWVT HB_EXPORT hb_wvt_gtGetWVT( void ); void HB_EXPORT hb_ToOutDebug( const char * sTraceMsg, ... ); //----------------------------------------------------------------------// +extern BOOL wvt_Array2Rect(PHB_ITEM aRect, RECT *rc ); +extern PHB_ITEM wvt_Rect2Array( RECT *rc ); +extern BOOL wvt_Array2Point(PHB_ITEM aPoint, POINT *pt ); +extern PHB_ITEM wvt_Point2Array( POINT *pt ); +extern BOOL wvt_Array2Size(PHB_ITEM aSize, SIZE *siz ); +extern PHB_ITEM wvt_Size2Array( SIZE *siz ); +extern void wvt_Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect ); +extern void wvt_Point2ArrayEx( POINT *pt , PHB_ITEM aPoint); +extern void wvt_Size2ArrayEx( SIZE *siz ,PHB_ITEM aSize ); + #endif /* HB_WVT_H_ */ diff --git a/harbour/contrib/gtwvg/hbgtwvg.ch b/harbour/contrib/gtwvg/hbgtwvg.ch index 3b890385c3..fc267fa291 100644 --- a/harbour/contrib/gtwvg/hbgtwvg.ch +++ b/harbour/contrib/gtwvg/hbgtwvg.ch @@ -57,6 +57,9 @@ // Extended GT Manipulation Constants //----------------------------------------------------------------------// +#define HB_GTE_MOUSE 6 +#define HB_GTE_KEYBOARD 7 + #define HB_GTI_SETFONT 71 #define HB_GTI_PRESPARAMS 72 #define HB_GTI_ENABLE 73 @@ -117,6 +120,15 @@ #define HB_GTI_GUI 1001 +//----------------------------------------------------------------------// +// Class Framework Constants +//----------------------------------------------------------------------// + +#define objTypeNone 0 +#define objTypeCrt 1 +#define objTypeWindow 2 +#define objTypeActiveX 3 + //----------------------------------------------------------------------// #endif diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index 3ca1998bc6..9a6479823a 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -119,7 +119,16 @@ thread static shIcon, shImage static paint_:= { { "", {} } } #endif +static pGT_:= { NIL,NIL,NIL } //-------------------------------------------------------------------// +EXIT PROCEDURE KillGTs() + + pGT_[ 1 ] := NIL + pGT_[ 2 ] := NIL + pGT_[ 3 ] := NIL + + RETURN +//----------------------------------------------------------------------// PROCEDURE Main( cDSN ) LOCAL aLastPaint, clr, scr, bWhen, bValid, a_:={} @@ -144,7 +153,7 @@ PROCEDURE Main( cDSN ) LOCAL hPopup LOCAL oMenu LOCAL nConxn - + LOCAL pGT SET DATE BRITISH SET( _SET_EVENTMASK, INKEY_ALL ) @@ -152,14 +161,16 @@ PROCEDURE Main( cDSN ) Wvt_SetGui( .t. ) WvtSetKeys( .t. ) Popups( 1 ) - Wvt_SetFont( "Courier New", 18, 0, 0 ) Wvt_SetMouseMove( .t. ) + Wvt_SetFont( "Courier New", 18, 0, 0 ) CLS Wvt_ShowWindow( SW_RESTORE ) hPopup := Wvt_SetPopupMenu() oMenu := CreateMainMenu() + pGT_[ 1 ] := hb_gtSelect() + // Force mouse pointer right below the xHarbour label // Wvt_SetMousePos( 2,40 ) @@ -281,6 +292,8 @@ PROCEDURE Main( cDSN ) WvtSetKeys( .f. ) Wvt_SetPopupMenu( hPopup ) + pGT_[ 1 ] := NIL + RETURN //-------------------------------------------------------------------// @@ -633,6 +646,7 @@ FUNCTION Hb_Clear() FUNCTION WvtMyBrowse() #ifdef __MW__ +#if 0 Hb_ThreadStart( {|| Hb_gtReload( 'WVG' ), ; SetMode( 35,70 ), ; hb_gtInfo( HB_GTI_RESIZEMODE, HB_GTI_RESIZEMODE_ROWS ),; @@ -640,7 +654,17 @@ FUNCTION WvtMyBrowse() Wvt_SetGui( .t. ), ; Wvt_ShowWindow( SW_RESTORE ), ; WvtMyBrowse_X(); - } ) + } ) +#endif + Hb_ThreadStart( {|oCrt| oCrt := WvgCrt():New( , , { -1,-2 }, { 34,69 }, , .T. ), ; + oCrt:resizeMode := HB_GTI_RESIZEMODE_ROWS,; + oCrt:icon := "dia_excl.ico",; + oCrt:create(),; + Wvt_SetGui( .t. ),; + WvtMyBrowse_X(),; + oCrt:destroy(); + } ) + #else WvtMyBrowse_X() #endif @@ -669,6 +693,8 @@ FUNCTION WvtMyBrowse_X() STATIC nStyle := 0 THREAD STATIC nFactor := 200 + pGT_[ 2 ] := hb_gtSelect() + cRDD := "DBFCDX" cFileDbf := "test.dbf" cFileIndex := "test.z01" @@ -715,7 +741,7 @@ FUNCTION WvtMyBrowse_X() nStyle++ - hb_gtInfo( HB_GTI_ICONFILE, "dia_excl.ico" ) + //hb_gtInfo( HB_GTI_ICONFILE, "dia_excl.ico" ) hb_gtInfo( HB_GTI_WINTITLE, "WVT Gui TBrowse()" ) aAdd( aBlocks, {|| Wvt_DrawBoxRaised( oBrowse:nTop-3, oBrowse:nLeft-2, oBrowse:nBottom+1, oBrowse:nRight+2 ) } ) @@ -727,7 +753,7 @@ FUNCTION WvtMyBrowse_X() DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" ) DispOutAt( oBrowse:nTop-2, oBrowse:nleft, padc( CurDrive()+":\"+CurDir()+"\"+"test.dbf", oBrowse:nRight-oBrowse:nLeft+1 ), "W+/W" ) - DispOutAt( maxrow(), 0, padc( ' ',maxcol()+1), 'B/W' ) + DispOutAt( maxrow(), 0, padc( ' ',maxcol()+1), 'B/W' ) While !lEnd oBrowse:ForceStable() @@ -751,7 +777,7 @@ FUNCTION WvtMyBrowse_X() DispBox( 0, 0, maxrow(), maxcol(), " ", "N/W" ) DispOutAt( oBrowse:nTop-2, oBrowse:nleft, padc( CurDrive()+":\"+CurDir()+"\"+"test.dbf", oBrowse:nRight - oBrowse:nLeft + 1 ), "W+/W" ) - DispOutAt( maxrow(), 0, padc( ' ',maxcol()+1), 'B/W' ) + DispOutAt( maxrow(), 0, padc( ' ',maxcol()+1), 'B/W' ) oBrowse:configure() case nKey == K_F2 @@ -766,6 +792,8 @@ FUNCTION WvtMyBrowse_X() case nKey == K_F3 aLastPaint1 := WvtSetBlocks( {} ) + DoModalWindowByClass() + #if 0 pGT1 := hb_gtCreate( 'WVG' ) pGT := hb_gtSelect( pGT1 ) @@ -792,6 +820,7 @@ FUNCTION WvtMyBrowse_X() hb_gtSelect( pGT ) hb_gtInfo( HB_GTI_ENABLE, pGT ) hb_gtInfo( HB_GTI_SETFOCUS, pGT ) + #endif WvtSetBlocks( aLastPaint1 ) endcase end @@ -807,6 +836,7 @@ FUNCTION WvtMyBrowse_X() DBCloseArea() RestScreen( 0, 0, maxrow(), maxcol(), cScr ) Wvt_setPopupMenu( hPopup ) + pGT_[ 2 ] := NIL RETURN nil //-------------------------------------------------------------------// @@ -1348,6 +1378,10 @@ FUNCTION CreateMainMenu() oMenu:AddItem( "Slide Show" ,{|| DlgSlideShow() } ) oMenu:AddItem( "-") oMenu:AddItem( "Dialog Scond" ,{|| DynDialog_1() } ) + oMenu:AddItem( "-") + oMenu:AddItem( "ActiveX - Analog Clock" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 2 ) } ) } ) + oMenu:AddItem( "ActiveX - Internet Explorer", {|| Hb_ThreadStart( {|| ExecuteActiveX( 1 ) } ) } ) + oMenu:AddItem( "ActiveX - Visualize a PDF" , {|| Hb_ThreadStart( {|| ExecuteActiveX( 3 ) } ) } ) g_oMenuBar:addItem( "",oMenu) @@ -2171,9 +2205,7 @@ FUNCTION DlgSlideShowProc( hDlg, nMsg, wParam, lParam ) end Return ( 0 ) - //-------------------------------------------------------------------// - FUNCTION DrawSlide( hDlg, nSlide ) LOCAL hDC, aRect @@ -2187,5 +2219,200 @@ FUNCTION DrawSlide( hDlg, nSlide ) Win_ReleaseDC( hDlg,hDC ) Return nil - +//----------------------------------------------------------------------// +Function ExecuteActiveX( nActiveX ) + Local oCrt + + oCrt := WvgCrt():New( , , { 5,5 }, { 29,59 }, , .f. ) + oCrt:closable := .f. + oCrt:create() + + //hb_gtReload( 'WVG' ) + SetCursor( 0 ) + SetColor( 'N/W' ) + CLS + //SetMode( 30,60 ) + //Wvt_ShowWindow( 1 ) + oCrt:show() + //hb_gtInfo( HB_GTI_CLOSABLE, .F. ) + ExeActiveX( oCrt, nActiveX ) + + Return nil +//----------------------------------------------------------------------// +#define ie_evBeforeNavigate 100 +#define ie_ev + +#define evClick 1 +#define evDblClk 2 +#define evBtnDown 3 +#define evMouseMove 4 +#define evBtnUp 5 + +Static Function ExeActiveX( oCrt, nActiveX ) + #ifdef HB_ACTIVEX + + Local ev_ := Hash() + Local oCOM, nKey + Local cServer + Local cNavigate + Local lEnd := .f. + + DEFAULT nActiveX TO 2 + + oCOM := WvgActiveXControl():New( oCrt, , { 0,0 }, { 200,200 }, , .t. ) + + do case + case nActiveX == 1 + hb_gtInfo( HB_GTI_WINTITLE, 'Shell.Explorer.2'+' [ '+'http://www.harbour.vouch.info'+' ]' ) + + oCOM:CLSID := 'Shell.Explorer.2' + oCOM:mapEvent( 269, { {|| hb_ToOutDebug( ' E X P L O R E R - 2 9 2' ) } } ) + + case nActiveX == 2 + hb_gtInfo( HB_GTI_WINTITLE, 'AnalogClockControl.AnalogClock' ) + + oCOM:CLSID := 'AnalogClockControl.AnalogClock' + oCOM:Id := 5 + oCOM:mapEvent( evDblClk, {|| DoModalWindow() ,; + oCOM:Value := .75632 ,; + oCOM:BackColor := RGB( 0,140,210 ),; + oCOM:Refresh() ,; + oCOM:ShowSecondsHand := .t. ,; + oCOM:Hands3D := .t. ,; + oCOM:Refresh() } ) + + oCOM:mapEvent( evBtnUp, {|nBtn,nShift,nX,nY| if( nBtn == 2, lEnd := .t., NIL ) } ) + + case nActiveX == 3 + hb_gtInfo( HB_GTI_WINTITLE, 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' ) + + oCOM:CLSID := 'file://C:\harbour\contrib\gtwvg\tests\myharu.pdf' + + endcase + + oCOM:create() + + if nActiveX == 1 + // After CREATE Messages + // + oCOM:AddressBar := .t. + oCOM:Navigate( 'http://www.harbour.vouch.info' ) + endif + + do while !( lEnd ) + nKey := inkey() + + if nKey == HB_K_RESIZE + Win_MoveWindow( oCOM:hWnd, 0, 0, hb_gtInfo( HB_GTI_SCREENWIDTH ), hb_gtInfo( HB_GTI_SCREENHEIGHT ), .F. ) + + elseif nKey == K_LBUTTONDOWN + //hb_ToOutDebug( "Key is passed to the window procedure also!" ) + + endif + + if nKey == 27 + exit + endif + enddo + + oCOM:Destroy() + + #endif + Return nil +//----------------------------------------------------------------------// +Static Function DoModalWindow() + + DoModalWindowByClass() + + #if 0 + Local pGT1, pGT, nExStyle, nStStyle + + pGT1 := hb_gtCreate( 'WVG' ) + pGT := hb_gtSelect( pGT1 ) + + nExStyle := WS_EX_DLGMODALFRAME + nStStyle := WS_POPUP + WS_CAPTION + WS_MINIMIZEBOX + hb_gtInfo( HB_GTI_PRESPARAMS, { nExStyle, nStStyle, 4, 8, 13, 50, pGT, .F., .T. } ) + + SetColor( 'W+/W' ) + CLS + hb_gtInfo( HB_GTI_RESIZABLE , .F. ) + Hb_GtInfo( HB_GTI_CLOSABLE , .F. ) + hb_gtInfo( HB_GTI_WINTITLE , 'Information! [R:4 C:8]' ) + hb_gtInfo( HB_GTI_DISABLE , pGT ) + + Hb_GtInfo( HB_GTI_SPEC , HB_GTS_SHOWWINDOW, SW_NORMAL ) + + alert( 'I am in modal window !' ) + + pGT1 := NIL + hb_gtSelect( pGT ) + hb_gtInfo( HB_GTI_ENABLE, pGT ) + hb_gtInfo( HB_GTI_SETFOCUS, pGT ) + #endif + + Return nil +//----------------------------------------------------------------------// +Static Function DoModalWindowByClass() + Local oCrt, nSel + + /* This part can be clubbed in a separate prg for different dialogs + * OR can be loaded from a data dictionary. + */ + oCrt := WvgCrt():New( , , { 4,8 }, { 12,49 }, , .T. ) + + oCrt:lModal := .t. + oCrt:exStyle := WS_EX_DLGMODALFRAME + oCrt:resizable := .f. + oCrt:closable := .f. + oCrt:title := 'Information! [R:4 C:8]' + + oCrt:lbDblClick := {|aPos,uNIL,obj| MyCallback( aPos, uNIL, obj ) } + oCrt:leave := {|| hb_ToOutDebug( 'Left the window client area' ) } + oCrt:enter := {|| hb_ToOutDebug( 'Entered the window client area' ) } + + oCrt:Create() + oCrt:show() + + pGT_[ 3 ] := hb_gtSelect() + + #if 0 + hb_toOutDebug( "Browser:title = %s", hb_gtInfoEx( pGT_[ 2 ], HB_GTI_WINTITLE ) ) + hb_toOutDebug( "Application:title = %s", hb_gtInfoEx( pGT_[ 1 ], HB_GTI_WINTITLE ) ) + hb_toOutDebug( "This:title = %s", hb_gtInfoEx( pGT_[ 3 ], HB_GTI_WINTITLE ) ) + #endif + + // Here goes the Clipper Code + // + SetColor( 'N/W' ) + CLS + do while .t. + nSel := alert( 'I am in modal window !;Change parent position?',{'Yes','No','Exit'} ) + + if nSel == 0 .or. nSel == 3 + exit + + elseif nSel == 1 + #if 0 + hb_gtInfoEx( pGT_[ 2 ], HB_GTI_SETPOS_XY, 40, 40 ) + hb_gtInfoEx( pGT_[ 2 ], HB_GTI_SPEC, HB_GTS_WNDSTATE, HB_GTS_WS_MAXIMIZED ) + #endif + + endif + enddo + + // Cleanup + // + pGT_[ 3 ] := NIL + oCrt:Destroy() + + Return nil +//----------------------------------------------------------------------// +Static Function MyCallBack( aPos, uNIL, oObj ) + Local scr := SaveScreen( 0,0,maxrow(),maxcol() ) + + Alert( 'Hi '+str( aPos[ 1 ] ) +':'+ str( aPos[ 2 ] ) ) + + RestScreen( 0,0,maxrow(),maxcol(),scr ) + Return nil //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgax.prg b/harbour/contrib/gtwvg/wvgax.prg new file mode 100644 index 0000000000..973d1681dc --- /dev/null +++ b/harbour/contrib/gtwvg/wvgax.prg @@ -0,0 +1,352 @@ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Andy Wos + * Copyright 2008 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xbpActiveXControl Class +// +// Pritpal Bedi +// 08Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include "hbclass.ch" +#include "common.ch" +#include "hbgtwvg.ch" +#include "wvtwin.ch" + +//----------------------------------------------------------------------// + +STATIC nRef := 0 + +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xhbActiveXControl Class +// +// Pritpal Bedi +// 08Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +CLASS WvgActiveXControl FROM TOleAuto, WvgWindow + + DATA CLSID INIT '' + DATA server INIT NIL + DATA license INIT NIL + DATA controlFlags INIT 0 + DATA visible INIT .T. + DATA default INIT .F. + DATA cancel INIT .F. + + DATA interface + DATA interfaceName + + DATA lSubStdEvents INIT .f. + + DATA hEvents INIT Hash() + DATA Id INIT 0 + DATA hContainer + DATA hSink + + DATA style INIT WS_CHILD + WS_VISIBLE + WS_CLIPCHILDREN + WS_CLIPSIBLINGS + + METHOD New() + METHOD Create() + METHOD Destroy() + + METHOD inheritPresParams() + METHOD presParamsChanged() + METHOD setInputFocus() + + METHOD subscribeStdEvents() + METHOD unsubscribeStdEvents() + + METHOD keyDown() + METHOD click() + METHOD dblClick() + METHOD mouseDown() + METHOD mouseUp() + METHOD mouseMove() + + METHOD activate() + + METHOD mapEvent( nEvent, bBlock ) + +PROTECTED: + METHOD adviseEvents() + METHOD unadviseEvents() + + ENDCLASS + +//----------------------------------------------------------------------// +METHOD New( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgActiveXControl + + ::wvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + RETURN Self +//----------------------------------------------------------------------// +METHOD Create( oParent, oOwner, aPos, aSize, aPresParams, lVisible, cCLSID, cLicense ) CLASS WvgActiveXControl + LOCAL hx + + ::wvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + DEFAULT cCLSID TO ::CLSID + DEFAULT cLicense TO ::license + + ::CLSID := cCLSID + ::license := cLicense + + ::objType := objTypeActiveX + ::className := 'WVGACTIVEX' + + ::hObj := 0 + ::hSink := 0 + + ::hContainer := ::oParent:getHWND() + + IF ValType( ::hContainer ) + ValType( ::CLSID ) != "NC" + RETURN( NIL ) + ELSEIF HB_AX_AtlAxWinInit() + nRef++ + ENDIF + + ::hObj := HB_AX_AtlAxGetControl( "ATLAXWin", ::hContainer, ::CLSID, ::Id, ; + ::aPos[ 1 ], ::aPos[ 2 ], ::aSize[ 1 ], ::aSize[ 2 ], ::style, ::exStyle, @hx ) + ::hWnd := hx + + IF ::hObj <> 0 .AND. !Empty( ::hEvents ) + ::AdviseEvents() + ENDIF + + RETURN Self +//----------------------------------------------------------------------// +METHOD Destroy() CLASS WvgActiveXControl + + ::UnadviseEvents() + IF Win_IsWindow( ::hWnd ) + Win_DestroyWindow( ::hWnd ) + ENDIF + + //::hObj := NIL + + IF --nRef == 0 + HB_AX_AtlAxWinTerm() + ENDIF + RETURN NIL +//----------------------------------------------------------------------// +METHOD inheritPresParams() CLASS WvgActiveXControl + Local lSuccess := .t. + + RETURN lSuccess +//----------------------------------------------------------------------// +METHOD presParamsChanged() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD setInputFocus() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD subscribeStdEvents() CLASS WvgActiveXControl + RETURN NIL +//----------------------------------------------------------------------// +METHOD unsubscribeStdEvents() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD keyDown() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD click() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD dblClick() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD mouseDown() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD mouseUp() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD mouseMove() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD activate() CLASS WvgActiveXControl + RETURN Self +//----------------------------------------------------------------------// +METHOD adviseEvents() CLASS WvgActiveXControl + LOCAL n + + RETURN HB_AX_SetupConnectionPoint( ::hObj, @::hSink, @n, ::hEvents ) +//----------------------------------------------------------------------// +METHOD unadviseEvents() CLASS WvgActiveXControl + + IF ::hSink <> 0 + HB_AX_ShutDownConnectionPoint( ::hSink ) + ::hSink := 0 + ENDIF + + RETURN NIL +//----------------------------------------------------------------------// +METHOD mapEvent( nEvent, bBlock ) + + if hb_isNumeric( nEvent ) .and. hb_isBlock( bBlock ) + ::hEvents[ nEvent ] := { bBlock } + endif + + RETURN Self +//----------------------------------------------------------------------// +// Class AutomationObject +//----------------------------------------------------------------------// +#if 0 +CLASS AutomationObject + + DATA interface AS NUMERIC READONLY + DATA interfaceName AS CHARACTER READONLY + DATA CLSID AS CHARACTER READONLY INIT ' ' + DATA server AS CHARACTER READONLY INIT ' ' + DATA license AS CHARACTER READONLY INIT ' ' + DATA cargo + + METHOD create( cProgID, cServerName, cLicense ) + METHOD destroy() + METHOD dynamicCast() + METHOD addRef() + METHOD release() + METHOD queryInterface( cGUID ) + METHOD getIDsOfNames( aNames ) + METHOD invoke( cNameORnID, nNamedArgs /*, ...*/ ) + METHOD loadTypeLib( cTypeLib ) + METHOD getProperty( cNameORnID ) + METHOD setProperty( cNameORnID, xValue /*, ...*/ ) + METHOD callMethod( cNameORnID /*, ...*/ ) + METHOD onError( oError ) + + ENDCLASS + +//----------------------------------------------------------------------// +METHOD create( cProgID, cServerName, cLicense )CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD destroy() CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD dynamicCast() CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD addRef() CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD release() CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD queryInterface( cGUID ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD getIDsOfNames( aNames ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD invoke( cNameORnID, nNamedArgs, ... ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD loadTypeLib( cTypeLib ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD getProperty( cNameORnID ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD setProperty( cNameORnID, xValue, ... ) CLASS AutomationObject + Local lValue + + RETURN lValue +//----------------------------------------------------------------------// +METHOD callMethod( cNameORnID, ... ) CLASS AutomationObject + Local xValue + + RETURN xValue +//----------------------------------------------------------------------// +METHOD onError( oError ) CLASS AutomationObject + Local xValue + + RETURN xValue +#endif +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgcrt.prg b/harbour/contrib/gtwvg/wvgcrt.prg new file mode 100644 index 0000000000..da7d0405be --- /dev/null +++ b/harbour/contrib/gtwvg/wvgcrt.prg @@ -0,0 +1,1234 @@ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xbpCrt Class +// +// Pritpal Bedi +// 08Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'hbgtinfo.ch' +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'inkey.ch' + +//----------------------------------------------------------------------// + +CLASS WvgCrt INHERIT WvgPartHandler + + // CONFIGURATION + // + DATA alwaysOnTop INIT .F. // Determines whether the dialog can be covered by other windows + DATA border INIT 0 // Border type for the XbpCrt window + DATA clipChildren INIT .F. + DATA closable INIT .T. + DATA fontHeight INIT 16 + DATA fontName INIT 'Courier New' + DATA fontWidth INIT 8 + DATA gridMove INIT .F. + DATA icon INIT 0 + DATA minMax INIT .T. + DATA sysMenu INIT .T. + DATA taskList INIT .T. + DATA title INIT ' ' + DATA titleBar INIT .T. + DATA visible INIT .T. + + DATA autoFocus INIT .T. + DATA autoMark INIT .T. + DATA dropFont INIT .T. + DATA dropZone INIT .F. + DATA helpLink INIT NIL + DATA maxCol INIT 79 + DATA maxRow INIT 24 + DATA mouseMode INIT 1 // Determines whether mouse coordinates are given as graphics or text coordinates. + DATA modalResult INIT NIL // Specifies the result of a modal dialog. + DATA aSyncFlush INIT .F. // Determines the display behavior of text-mode output. + DATA tooltipText INIT '' + DATA useShortCuts INIT .F. // Enables shortcut keys for the system menu + DATA xSize INIT 640 READONLY + DATA ySize INIT 400 READONLY + + // GUI Specifics + DATA animate INIT .F. + DATA clipParent INIT .F. + DATA clipSiblings INIT .T. + DATA group INIT 0 // XBP_NO_GROUP + DATA sizeRedraw INIT .F. + DATA tabStop INIT .F. + + // CALLBACK SLOTS + DATA sl_enter + DATA sl_leave + DATA sl_lbClick + DATA sl_lbDblClick + DATA sl_lbDown + DATA sl_lbUp + DATA sl_mbClick + DATA sl_mbDblClick + DATA sl_mbDown + DATA sl_mbUp + DATA sl_motion + DATA sl_rbClick + DATA sl_rbDblClick + DATA sl_rbDown + DATA sl_rbUp + DATA sl_wheel + + DATA sl_close + DATA sl_helpRequest + DATA sl_keyboard + DATA sl_killDisplayFocus // only for CRT + DATA sl_killInputFocus + DATA sl_move + DATA sl_paint // only for gui dialogs + DATA sl_quit + DATA sl_resize + DATA sl_setDisplayFocus // only for CRT + DATA sl_setInputFocus + DATA sl_dragEnter + DATA sl_dragMotion + DATA sl_dragLeave + DATA sl_dragDrop + +EXPORTED: + // LIFE CYCLE + METHOD init() + METHOD create() + METHOD configure() + METHOD destroy() + + // METHODS + METHOD currentPos() + METHOD currentSize() + METHOD captureMouse() + METHOD disable() + METHOD enable() + METHOD getFrameState() + METHOD getHWND() + METHOD getModalState() + METHOD hasInputFocus() + METHOD hide() + METHOD invalidateRect() + METHOD isEnabled() + METHOD isVisible() + METHOD lockPS() + METHOD lockUpdate() + METHOD menuBar() + METHOD setColorBG() + METHOD setColorFG() + METHOD setFont() + METHOD setFontCompoundName() + METHOD setFrameState() + METHOD setPresParam() + METHOD setModalState() + METHOD setPointer() + METHOD setTrackPointer() + METHOD setPos() + METHOD setPosAndSize() + METHOD setSize() + METHOD showModal() + METHOD show() + METHOD toBack() + METHOD toFront() + METHOD unlockPS() + METHOD winDevice() + + // MESSAGES + // + METHOD enter() SETGET + METHOD leave() SETGET + METHOD lbClick() SETGET + METHOD lbDblClick() SETGET + METHOD lbDown() SETGET + METHOD lbUp() SETGET + METHOD mbClick() SETGET + METHOD mbDblClick() SETGET + METHOD mbDown() SETGET + METHOD mbUp() SETGET + METHOD motion() SETGET + METHOD rbClick() SETGET + METHOD rbDblClick() SETGET + METHOD rbDown() SETGET + METHOD rbUp() SETGET + METHOD wheel() SETGET + + // OTHER MESSAGES + // + METHOD close() SETGET + METHOD helpRequest() SETGET + METHOD keyboard() SETGET + METHOD killDisplayFocus() SETGET + METHOD killInputFocus() SETGET + METHOD move() SETGET + METHOD paint() SETGET + METHOD quit() SETGET + METHOD resize() SETGET + METHOD setDisplayFocus() SETGET + METHOD setInputFocus() SETGET + METHOD dragEnter() SETGET + METHOD dragMotion() SETGET + METHOD dragLeave() SETGET + METHOD dragDrop() SETGET + + // HARBOUR implementation + DATA resizable INIT .t. + DATA resizeMode INIT HB_GTI_RESIZEMODE_FONT + DATA style INIT WS_OVERLAPPEDWINDOW + DATA exStyle INIT 0 + DATA lModal INIT .f. + DATA pGTp + DATA pGT + DATA objType INIT objTypeCrt + DATA ClassName INIT 'WVGCRT' + + METHOD notifier() + METHOD setFocus() + METHOD sendMessage() + +PROTECTED: + DATA hWnd + DATA aPos INIT { 0,0 } + DATA aSize INIT { 24,79 } + DATA aPresParams INIT {} + + DATA lHasInputFocus INIT .F. + DATA nFrameState INIT 0 // normal + + ENDCLASS + +//----------------------------------------------------------------------// +// Instance Initiation +//----------------------------------------------------------------------// + +METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCrt + + ::WvgPartHandler:init( oParent, oOwner ) + + if hb_isArray( aPos ) + ::aPos := aPos + endif + if hb_isArray( aSize ) + ::aSize := aSize + endif + if hb_isArray( aPresParams ) + ::aPresParams := aPresParams + endif + if hb_isLogical( lVisible ) + ::visible := lVisible + endif + + RETURN Self + +//----------------------------------------------------------------------// +// Life Cycle +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCrt + Local lRowCol := .T. + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::aSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + ::oParent := oParent + ::oOwner := oOwner + ::aPos := aPos + ::aSize := aSize + ::aPresParams := aPresParams + ::visible := lVisible + + ::maxRow := ::aSize[ 1 ] + ::maxCol := ::aSize[ 2 ] + + ::WvgPartHandler:Create( oParent, oOwner ) + + if ::lModal + ::pGT := hb_gtCreate( 'WVG' ) + ::pGTp := hb_gtSelect( ::pGT ) + else + hb_gtReload( 'WVG' ) + ::pGT := hb_gtSelect() + endif + + hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; + ::maxRow+1, ::maxCol+1, ::pGTp, .F., lRowCol } ) + hb_gtInfo( HB_GTI_SETFONT, { ::fontName, ::fontHeight, ::fontWidth } ) + + /* CreateWindow() be forced to execute */ + ? ' ' + + ::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) + + hb_gtInfo( HB_GTI_RESIZABLE , ::resizable ) + Hb_GtInfo( HB_GTI_CLOSABLE , ::closable ) + hb_gtInfo( HB_GTI_WINTITLE , ::title ) + hb_gtInfo( HB_GTI_RESIZEMODE, if( ::resizeMode == HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_ROWS, HB_GTI_RESIZEMODE_FONT ) ) + + if !empty( ::icon ) + if hb_isNumeric( ::icon ) + hb_gtInfo( HB_GTI_ICONRES, ::icon ) + + elseif hb_isChar( ::icon ) + hb_gtInfo( HB_GTI_ICONFILE, ::icon ) + + endif + endif + + if ::lModal + hb_gtInfo( HB_GTI_DISABLE, ::pGTp ) + endif + + if ::visible + Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) + ::lHasInputFocus := .t. + endif + + HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| ::notifier( nEvent, ... ) } ) + + /* Not working yet. need to investigate how I have implemented it. */ + if !empty( ::toolTipText ) + Wvt_SetTooltip( ::toolTipText ) + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCrt + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::sSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgCrt + + if ::lModal + ::pGT := NIL + hb_gtSelect( ::pGTp ) + hb_gtInfo( HB_GTI_ENABLE , ::pGTp ) + hb_gtInfo( HB_GTI_SETFOCUS, ::pGTp ) + endif + + ::pGT := NIL + ::pGTp := NIL + + RETURN Self + +//----------------------------------------------------------------------// +// Methods +//----------------------------------------------------------------------// + +METHOD currentPos() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD currentSize() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD captureMouse() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD disable() CLASS WvgCrt + + hb_gtInfo( HB_GTI_DISABLE, ::pGT ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD enable() CLASS WvgCrt + + hb_gtInfo( HB_GTI_ENABLE, ::pGT ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD getFrameState() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD getHWND() CLASS WvgCrt + + RETURN ::hWnd + +//----------------------------------------------------------------------// + +METHOD getModalState() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD hasInputFocus() CLASS WvgCrt + + RETURN ::lHasInputFocus + +//----------------------------------------------------------------------// + +METHOD hide() CLASS WvgCrt + + hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, HB_GTS_SW_HIDE ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD invalidateRect() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD isEnabled() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD isVisible() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lockPS() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lockUpdate() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD menuBar() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setColorBG() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setColorFG() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setFont() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setFontCompoundName() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setFrameState() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setModalState() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPointer() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setTrackPointer() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPos() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPosAndSize() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPresParam() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setSize() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD show() CLASS WvgCrt + + Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) + ::lHasInputFocus := .t. + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD showModal() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD toBack() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD toFront() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD unlockPS() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD winDevice() CLASS WvgCrt + + RETURN Self + +//----------------------------------------------------------------------// +// Callback Methods +//----------------------------------------------------------------------// + +METHOD enter( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_enter ) + eval( ::sl_enter, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_enter := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD leave( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_leave ) + eval( ::sl_leave, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_leave := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbClick ) + eval( ::sl_lbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbDblClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbDblClick ) + eval( ::sl_lbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbDown( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbDown ) + eval( ::sl_lbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbUp( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbUp ) + eval( ::sl_lbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbClick ) + eval( ::sl_mbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbDblClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbDblClick ) + eval( ::sl_mbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbDown( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbDown ) + eval( ::sl_mbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbUp( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbUp ) + eval( ::sl_mbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD motion( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_motion ) + eval( ::sl_motion, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_motion := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbClick ) + eval( ::sl_rbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbDblClick( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbDblClick ) + eval( ::sl_rbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbDown( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbDown ) + eval( ::sl_rbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbUp( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbUp ) + eval( ::sl_rbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD wheel( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_wheel ) + eval( ::sl_wheel, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_wheel := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// +// Other Messages +//----------------------------------------------------------------------// + +METHOD close( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_close ) + eval( ::sl_close, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_close := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD helpRequest( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_helpRequest ) + eval( ::sl_helpRequest, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_helpRequest := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD keyboard( xParam ) CLASS WvgCrt + + if hb_isNumeric( xParam ) .and. hb_isBlock( ::sl_keyboard ) + eval( ::sl_keyboard, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_keyboard := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD killDisplayFocus( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_killDisplayFocus ) + eval( ::sl_killDisplayFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_killDisplayFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD killInputFocus( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_killInputFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD move( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_move ) + eval( ::sl_move, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_move := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD paint( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_paint ) + eval( ::sl_paint, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_paint := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD quit( xParam, xParam1 ) CLASS WvgCrt + + if hb_isNumeric( xParam ) .and. hb_isBlock( ::sl_quit ) + eval( ::sl_quit, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_quit := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD resize( xParam, xParam1 ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_resize ) + eval( ::sl_resize, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_resize := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setDisplayFocus( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::setDisplayFocus ) + eval( ::setDisplayFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::setDisplayFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setInputFocus( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_setInputFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragEnter( xParam, xParam1 ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragEnter ) + eval( ::sl_dragEnter, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragEnter := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragMotion( xParam ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragMotion ) + eval( ::sl_dragMotion, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragMotion := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragLeave( xParam ) CLASS WvgCrt + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_dragLeave ) + eval( ::sl_dragLeave, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragLeave := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragDrop( xParam, xParam1 ) CLASS WvgCrt + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragDrop ) + eval( ::sl_dragDrop, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragDrop := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// +// HARBOUR SPECIFIC +//----------------------------------------------------------------------// + +METHOD notifier( nEvent, xParams ) CLASS WvgCrt + Local aPos, nReturn := 0 + +//hb_ToOutDebug( "............ %i %i %i %i", nEvent, WM_MOUSEHOVER, WM_MOUSELEAVE, if( hb_isArray(xParams), xParams[ 1 ], 0 ) ) + DO CASE + + CASE nEvent == HB_GTE_MOUSE + if xParams[ 1 ] == WM_MOUSEHOVER + aPos := { xParams[ 3 ], xParams[ 4 ] } + elseif xParams[ 1 ] == WM_MOUSELEAVE + // Nothing + else + aPos := if( ::mouseMode == 2, { xParams[ 3 ], xParams[ 4 ] }, { xParams[ 5 ], xParams[ 6 ] } ) + endif + + SWITCH xParams[ 1 ] + + case WM_MOUSEHOVER + if hb_isBlock( ::sl_enter ) + eval( ::sl_enter, aPos, NIL, self ) + endif + EXIT + case WM_MOUSELEAVE + if hb_isBlock( ::sl_leave ) + eval( ::sl_leave, aPos, NIL, self ) + endif + EXIT + case WM_RBUTTONDOWN + if hb_isBlock( ::sl_rbDown ) + eval( ::sl_rbDown, aPos, NIL, self ) + endif + EXIT + case WM_LBUTTONDOWN + if hb_isBlock( ::sl_lbDown ) + eval( ::sl_lbDown, aPos, NIL, self ) + endif + EXIT + case WM_RBUTTONUP //// + if hb_isBlock( ::sl_rbClick ) + eval( ::sl_rbClick, aPos, NIL, self ) + endif + EXIT + case WM_LBUTTONUP //// + if hb_isBlock( ::sl_lbClick ) + eval( ::sl_lbClick, aPos, NIL, self ) + endif + EXIT + case WM_RBUTTONDBLCLK + if hb_isBlock( ::sl_rbDblClick ) + eval( ::sl_rbDblClick, aPos, NIL, self ) + endif + EXIT + case WM_LBUTTONDBLCLK + if hb_isBlock( ::sl_lbDblClick ) + eval( ::sl_lbDblClick, aPos, NIL, self ) + endif + EXIT + case WM_MBUTTONDOWN + if hb_isBlock( ::sl_mbDown ) + eval( ::sl_mbDown, aPos, NIL, self ) + endif + EXIT + case WM_MBUTTONUP //// + if hb_isBlock( ::sl_mbClick ) + eval( ::sl_mbClick, aPos, NIL, self ) + endif + EXIT + case WM_MBUTTONDBLCLK + if hb_isBlock( ::sl_mbDblClick ) + eval( ::sl_mbDblClick, aPos, NIL, self ) + endif + EXIT + case WM_MOUSEMOVE + if hb_isBlock( ::sl_motion ) + eval( ::sl_motion, aPos, NIL, self ) + endif + EXIT + case WM_MOUSEWHEEL + if hb_isBlock( ::sl_wheel ) + eval( ::sl_wheel, aPos, NIL, self ) + endif + EXIT + case WM_NCMOUSEMOVE + EXIT + END + + CASE nEvent == HB_GTE_KEYBOARD + if hb_isBlock( ::keyboard ) + eval( ::keyboard, xParams, NIL, Self ) + endif + + CASE nEvent == HB_GTE_SETFOCUS + if hb_isBlock( ::setInputFocus ) + eval( ::setInputFocus, NIL, NIL, Self ) + endif + ::lHasInputFocus := .t. + + CASE nEvent == HB_GTE_KILLFOCUS + if hb_isBlock( ::killInputFocus ) + eval( ::killInputFocus, NIL, NIL, Self ) + endif + ::lHasInputFocus := .f. + + CASE nEvent == HB_GTE_RESIZED + if hb_isBlock( ::resize ) + eval( ::resize, xParams[ 1 ], xParams[ 2 ], Self ) + endif + + CASE nEvent == HB_GTE_CLOSE + if hb_isBlock( ::close ) + nReturn := eval( ::close, NIL, NIL, Self ) + endif + + ENDCASE + + RETURN nReturn +//----------------------------------------------------------------------// +METHOD setFocus() CLASS WvgCrt + + ::sendMessage( WM_ACTIVATE, 1, 0 ) + + RETURN Self +//----------------------------------------------------------------------// +METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgCrt + + Win_SendMessage( ::hWnd, nMessage, nlParam, nwParam ) + + RETURN Self +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgphdlr.prg b/harbour/contrib/gtwvg/wvgphdlr.prg new file mode 100644 index 0000000000..47ad99db90 --- /dev/null +++ b/harbour/contrib/gtwvg/wvgphdlr.prg @@ -0,0 +1,225 @@ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xbpPartHandler Class +// +// Pritpal Bedi +// 08Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' + +//----------------------------------------------------------------------// + +CLASS WvgPartHandler + + DATA Cargo + + METHOD init( oParent, oOwner ) + METHOD create( oParent, oOwner ) + METHOD configure( oParent, oOwner ) + METHOD destroy() + METHOD handleEvent( hEvent, mp1, mp2 ) + METHOD status() + + METHOD addChild( oWvg ) + METHOD childFromName( nNameId ) + METHOD childList() + METHOD delChild( oWvg ) + METHOD setName( nNameId ) + METHOD setOwner( oWvg ) + METHOD setParent( oWvg ) + + DATA hChildren INIT Hash() + DATA nNameId + DATA oParent + DATA oOwner + DATA nStatus INIT 0 + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD init( oParent, oOwner ) CLASS WvgPartHandler + + ::oParent := oParent + ::oOwner := oOwner + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner ) CLASS WvgPartHandler + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + + ::oParent := oParent + ::oOwner := oOwner + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner ) CLASS WvgPartHandler + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + + ::oParent := oParent + ::oOwner := oOwner + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgPartHandler + + ::hChildren := NIL + ::nNameId := NIL + ::oParent := NIL + ::oOwner := NIL + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( hEvent, mp1, mp2 ) CLASS WvgPartHandler + + HB_SYMBOL_UNUSED( hEvent ) + HB_SYMBOL_UNUSED( mp1 ) + HB_SYMBOL_UNUSED( mp2 ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD status() CLASS WvgPartHandler + + RETURN ::nStatus + +//----------------------------------------------------------------------// + +METHOD addChild( oWvg ) CLASS WvgPartHandler + + HB_SYMBOL_UNUSED( oWvg ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD childFromName( nNameId ) CLASS WvgPartHandler + LOCAL oWvg + + if ::hChildren[ nNameId ] <> NIL + oWvg := ::hChildren[ nNameId ] // ??? + endif + + RETURN oWvg + +//----------------------------------------------------------------------// + +METHOD childList() CLASS WvgPartHandler + LOCAL aChildList := {} + + RETURN aChildList + +//----------------------------------------------------------------------// + +METHOD delChild( oWvg ) CLASS WvgPartHandler + + HB_SYMBOL_UNUSED( oWvg ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setName( nNameId ) CLASS WvgPartHandler + LOCAL nOldNameId := ::nNameId + + if Valtype( nNameId ) == 'N' + ::nNameId := nNameId + endif + + RETURN nOldNameId + +//----------------------------------------------------------------------// + +METHOD setOwner( oWvg ) CLASS WvgPartHandler + LOCAL oOldXbp := ::oOwner + + if valtype( oWvg ) == 'O' + ::oOwner := oWvg + endif + + RETURN oOldXbp + +//----------------------------------------------------------------------// + +METHOD setParent( oWvg ) CLASS WvgPartHandler + LOCAL oOldXbp := ::oParent + + if valtype( oWvg ) == 'O' + ::oParent := oWvg + endif + + RETURN oOldXbp + +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgsink.c b/harbour/contrib/gtwvg/wvgsink.c new file mode 100644 index 0000000000..c193987b1b --- /dev/null +++ b/harbour/contrib/gtwvg/wvgsink.c @@ -0,0 +1,827 @@ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Andy Wos + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// Active-X Interface Functions +// +// Contributed by Andy Wos +// A little tweaked by Pritpal Bedi +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +/* + Reference material: + + http://codeguru.earthweb.com/mfc/comments/55024.shtml + + Several examples here: + http://www.john.findlay1.btinternet.co.uk/OLE/ole.htm + + ADO example here: + http://www.john.findlay1.btinternet.co.uk/DataBase/database.htm + + HOWTO: Use OLE Automation from a C Application Rather Than C++: + http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q181/4/73.asp&NoWebContent=1 + + The Microsoft B2C.EXE utility, which converts Microsoft Visual Basic Automation code into Microsoft Visual C++ code. + http://support.microsoft.com/default.aspx?scid=kb;EN-US;216388 +*/ +//----------------------------------------------------------------------// + +#ifdef __XHARBOUR__ + #include "hbvmopt.h" +#else + #include "hbvmint.h" +#endif + +#include +#include +#include "hbapi.h" +#include "item.api" +#include "hbapiitm.h" +#include "hbapierr.h" +#include "hbvm.h" +#include "hbstack.h" +#include "hbthread.h" + +#include +#include +#include +#include +#include +#include + +//----------------------------------------------------------------------// +static HRESULT s_nOleError; +static HMODULE hLib = NULL; + +typedef BOOL ( CALLBACK *PATLAXWININIT )( void ); +typedef BOOL ( CALLBACK *PATLAXWINTERM )( void ); +typedef HRESULT ( CALLBACK *PATLAXGETCONTROL )( HWND, IUnknown** ); +typedef HRESULT ( CALLBACK *PATLAXATTACHCONTROL )( HWND, IUnknown** ); +typedef HRESULT ( CALLBACK *PATLAXCREATECONTROL )( LPCOLESTR, HWND, IStream*, IUnknown** ); +//----------------------------------------------------------------------// +HB_EXPORT void hb_oleItemToVariant( VARIANT *pVariant, PHB_ITEM pItem ); + +HRESULT hb_oleVariantToItem( PHB_ITEM pItem, VARIANT *pVariant ); + +static int s_ev_iid_[ 100 ]; +//----------------------------------------------------------------------// +static int ThisThreadId( void ) +{ + PHB_THREADSTATE pThread; + + pThread = ( PHB_THREADSTATE ) hb_vmThreadState(); + if( pThread ) + return( pThread->th_no ); + else + return( 0 ); +} +//----------------------------------------------------------------------// +// these 2 functions are required to send parameters by reference +// +static void hb_itemPushList( ULONG ulRefMask, ULONG ulPCount, PHB_ITEM** pItems ) +{ + HB_ITEM itmRef; + ULONG ulParam; + + if( ulPCount ) + { + // initialize the reference item + itmRef.type = HB_IT_BYREF; + itmRef.item.asRefer.offset = -1; + itmRef.item.asRefer.BasePtr.itemsbasePtr = pItems; + + for( ulParam = 0; ulParam < ulPCount; ulParam++ ) + { + if( ulRefMask & ( 1L << ulParam ) ) + { + // when item is passed by reference then we have to put + // the reference on the stack instead of the item itself + itmRef.item.asRefer.value = ulParam+1; + hb_vmPush( &itmRef ); + } + else + { + hb_vmPush( (*pItems)[ulParam] ); + } + } + } +} +//----------------------------------------------------------------------// +/* +static void hb_itemPushRef( PHB_ITEM** ppItem ) +{ + HB_ITEM itmRef; + ULONG ulParam; + + if( ppItem ) + { + // initialize the reference item + itmRef.type = HB_IT_BYREF; + itmRef.item.asRefer.offset = -1; + itmRef.item.asRefer.BasePtr.itemsbasePtr = ppItem; + itmRef.item.asRefer.value = 1; + hb_vmPush( &itmRef ); + + } +} +*/ +//----------------------------------------------------------------------// +//this is a macro which defines our IEventHandler struct as so: +// +// typedef struct { +// IEventHandlerVtbl *lpVtbl; +// } IEventHandler; + +#undef INTERFACE +#define INTERFACE IEventHandler + +DECLARE_INTERFACE_ (INTERFACE, IDispatch) +{ + // IUnknown functions + STDMETHOD (QueryInterface) (THIS_ REFIID, void **) PURE; + STDMETHOD_ (ULONG, AddRef) (THIS) PURE; + STDMETHOD_ (ULONG, Release) (THIS) PURE; + // IDispatch functions + STDMETHOD_ (ULONG, GetTypeInfoCount) (THIS_ UINT *) PURE; + STDMETHOD_ (ULONG, GetTypeInfo) (THIS_ UINT, LCID, ITypeInfo **) PURE; + STDMETHOD_ (ULONG, GetIDsOfNames) (THIS_ REFIID, LPOLESTR *, UINT, LCID, DISPID *) PURE; + STDMETHOD_ (ULONG, Invoke) (THIS_ DISPID, REFIID, LCID, WORD, DISPPARAMS *, VARIANT *, EXCEPINFO *, UINT *) PURE; +}; +//----------------------------------------------------------------------// +// +// In other words, it defines our IEventHandler to have nothing +// but a pointer to its VTable. And of course, every COM object must +// start with a pointer to its VTable. +// +// But we actually want to add some more members to our IEventHandler. +// We just don't want any app to be able to know about, and directly +// access, those members. So here we'll define a MyRealIEventHandler that +// contains those extra members. The app doesn't know that we're +// really allocating and giving it a MyRealIEventHAndler object. We'll +// lie and tell it we're giving a plain old IEventHandler. That's ok +// because a MyRealIEventHandler starts with the same VTable pointer. +// +// We add a DWORD reference count so that this IEventHandler +// can be allocated (which we do in our IClassFactory object's +// CreateInstance()) and later freed. And, we have an extra +// BSTR (pointer) string, which is used by some of the functions we'll +// add to IEventHandler +//----------------------------------------------------------------------// + +typedef struct { + DISPID dispid; + PHB_ITEM pSelf; + PHB_DYNS pSymbol; +} EventMap; + + +typedef struct { + IEventHandler* lpVtbl; + DWORD count; + IConnectionPoint* pIConnectionPoint; // Ref counted of course. + DWORD dwEventCookie; + char* parent_on_invoke; + IID device_event_interface_iid; + PHB_ITEM pSelf; // object to handle the events (optional) + EventMap* pEventMap; // event map + int iEventMapLen; // length of the eventMap + PHB_ITEM pEvents; +} MyRealIEventHandler; + +//----------------------------------------------------------------------// +// Here are IEventHandler's functions. +//----------------------------------------------------------------------// +// +// Every COM object's interface must have the 3 functions QueryInterface(), +// AddRef(), and Release(). + +// IEventHandler's QueryInterface() +static HRESULT STDMETHODCALLTYPE QueryInterface(IEventHandler *this, REFIID vTableGuid, void **ppv) +{ + // Check if the GUID matches IEvenetHandler VTable's GUID. We gave the C variable name + // IID_IEventHandler to our VTable GUID. We can use an OLE function called + // IsEqualIID to do the comparison for us. Also, if the caller passed a + // IUnknown GUID, then we'll likewise return the IEventHandler, since it can + // masquerade as an IUnknown object too. Finally, if the called passed a + // IDispatch GUID, then we'll return the IExample3, since it can masquerade + // as an IDispatch too + + if (IsEqualIID(vTableGuid, &IID_IUnknown) ) + { + *ppv = (IUnknown*) this; + + /* Increment the count of callers who have an outstanding pointer to this object */ + this->lpVtbl->AddRef(this); + return S_OK; + } + + if (IsEqualIID(vTableGuid, &IID_IDispatch)) + { + *ppv = (IDispatch*) this; + this->lpVtbl->AddRef(this); + return S_OK; + } + + if ( IsEqualIID( vTableGuid, &(((MyRealIEventHandler*) this)->device_event_interface_iid ) ) ) + { + if( s_ev_iid_[ ThisThreadId() ] == 0 ) + { + s_ev_iid_[ ThisThreadId() ]++; + *ppv = (IDispatch*) this; + this->lpVtbl->AddRef( this ); + } + return S_OK; + } + + // We don't recognize the GUID passed to us. Let the caller know this, + // by clearing his handle, and returning E_NOINTERFACE. + *ppv = 0; + return(E_NOINTERFACE); +} +//----------------------------------------------------------------------// +// +// IEventHandler's AddRef() + +static ULONG STDMETHODCALLTYPE AddRef(IEventHandler *this) +{ + // Increment IEventHandler's reference count, and return the updated value. + // NOTE: We have to typecast to gain access to any data members. These + // members are not defined (so that an app can't directly access them). + // Rather they are defined only above in our MyRealIEventHandler + // struct. So typecast to that in order to access those data members + + return(++((MyRealIEventHandler *) this)->count); + +} +//----------------------------------------------------------------------// +// +// IEventHandler's Release() + +static ULONG STDMETHODCALLTYPE Release(IEventHandler *this) +{ + if (--((MyRealIEventHandler *) this)->count == 0) + { + + if( ( (MyRealIEventHandler *) this)->pSelf ) + hb_itemRelease( ( (MyRealIEventHandler *) this)->pSelf ); + + if( ( (MyRealIEventHandler *) this)->pEventMap ) + hb_xfree( ( (MyRealIEventHandler *) this)->pEventMap ); + + GlobalFree(this); + return(0); + } + return(((MyRealIEventHandler *) this)->count); +} +//----------------------------------------------------------------------// +// +// IEventHandler's GetTypeInfoCount() + +static ULONG STDMETHODCALLTYPE GetTypeInfoCount(IEventHandler *this, UINT *pCount) +{ + HB_SYMBOL_UNUSED(this); + HB_SYMBOL_UNUSED(pCount); + + return E_NOTIMPL; +} +//----------------------------------------------------------------------// +// +// IEventHandler's GetTypeInfo() + +static ULONG STDMETHODCALLTYPE GetTypeInfo(IEventHandler *this, UINT itinfo, LCID lcid, ITypeInfo **pTypeInfo) +{ + HB_SYMBOL_UNUSED(this); + HB_SYMBOL_UNUSED(itinfo); + HB_SYMBOL_UNUSED(lcid); + HB_SYMBOL_UNUSED(pTypeInfo); + + return E_NOTIMPL; +} +//----------------------------------------------------------------------// +// +// IEventHandler's GetIDsOfNames() + +static ULONG STDMETHODCALLTYPE GetIDsOfNames(IEventHandler *this, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgdispid) +{ + + HB_SYMBOL_UNUSED(this); + HB_SYMBOL_UNUSED(riid); + HB_SYMBOL_UNUSED(rgszNames); + HB_SYMBOL_UNUSED(cNames); + HB_SYMBOL_UNUSED(lcid); + HB_SYMBOL_UNUSED(rgdispid); + + return E_NOTIMPL; +} + +//------------------------------------------------------------------------------ + +static ULONG STDMETHODCALLTYPE Invoke(IEventHandler *this, DISPID dispid, REFIID riid, + LCID lcid, WORD wFlags, DISPPARAMS *params, + VARIANT *result, EXCEPINFO *pexcepinfo, UINT *puArgErr) +{ + int iArg; + int i; + int iEvPos ; // = -1; + int iEvEnum; + ULONG ulRefMask = 0; + ULONG ulPos; + PHB_ITEM pItem; + PHB_DYNS pSymbol; + PHB_ITEM pItemArray[32]; // max 32 parameters? + PHB_ITEM *pItems; + PHB_ITEM Key = hb_itemNew( NULL ); +//hb_ToOutDebug( "Event=%i",dispid ); + // We implement only a "default" interface + if (!IsEqualIID(riid, &IID_NULL)) + { + return(DISP_E_UNKNOWNINTERFACE); + } + HB_SYMBOL_UNUSED(lcid); + HB_SYMBOL_UNUSED(wFlags); + HB_SYMBOL_UNUSED(result); + HB_SYMBOL_UNUSED(pexcepinfo); + HB_SYMBOL_UNUSED(puArgErr); + + + if ( hb_hashScan( ((MyRealIEventHandler*) this)->pEvents, hb_itemPutNL( Key, dispid ), &ulPos ) ) + { + PHB_ITEM pArray = hb_hashGetValueAt( ((MyRealIEventHandler*) this)->pEvents, ulPos ); + PHB_ITEM pExec = hb_arrayGetItemPtr( pArray, 01 ); + + if ( pExec ) + { + hb_vmPushState(); + + switch ( hb_itemType( pExec ) ) + { + case HB_IT_BLOCK: + hb_vmPushSymbol( &hb_symEval ); + hb_vmPush( pExec ); + break; + + case HB_IT_STRING: + { + PHB_ITEM pObject = hb_arrayGetItemPtr( pArray, 3 ); + + hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( hb_itemGetCPtr( pExec ) ) ) ); + if ( HB_IS_OBJECT( pObject ) ) + hb_vmPush( pObject ); + else + hb_vmPushNil(); + } + break; + + case HB_IT_POINTER: + hb_vmPushSymbol( hb_dynsymSymbol( ( (PHB_SYMB) pExec )->pDynSym ) ); + hb_vmPushNil(); + break; + } + + iArg = params->cArgs; + for( i = 1; i <= iArg; i++ ) + { + pItem = hb_itemNew( NULL ); + hb_oleVariantToItem( pItem, &(params->rgvarg[iArg-i]) ); // VARIANT *pVariant ) + pItemArray[ i-1 ] = pItem; + ulRefMask |= ( 1L << (i-1) ); // set bit i + } + + if( iArg ) + { + pItems = pItemArray; + hb_itemPushList( ulRefMask, iArg, &pItems ); + } + // execute + // + hb_vmDo( iArg ); + + for( i=iArg; i > 0; i-- ) + { + if( (&(params->rgvarg[iArg-i]))->n1.n2.vt & VT_BYREF == VT_BYREF ) + { + switch( (&(params->rgvarg[iArg-i]))->n1.n2.vt ) + { + case VT_I2|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.piVal) = (short) hb_itemGetNI(pItemArray[i-1]); + break; + case VT_I4|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.plVal) = (long) hb_itemGetNL(pItemArray[i-1]); + break; + case VT_R4|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pfltVal) = (float) hb_itemGetND(pItemArray[i-1]); + break; + case VT_R8|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pdblVal) = (double) hb_itemGetND(pItemArray[i-1]); + break; + case VT_BOOL|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pboolVal) = hb_itemGetL( pItemArray[i-1] ) ? 0xFFFF : 0; + break; + case VT_DATE|VT_BYREF: + *((&(params->rgvarg[iArg-i]))->n1.n2.n3.pdate) = (DATE) (double) (hb_itemGetDL(pItemArray[i-1])-2415019 ); //( (pItemArray[i-1])->item.asDate.value - 2415019 ) + break; + } + } + } + + // Pritpal + if ( iArg ) + { + for( i=iArg; i > 0; i-- ) + { + hb_itemRelease( pItemArray[ i-1 ] ); + } + } + hb_vmPopState(); + } + } + hb_itemRelease( Key ); // Pritpal + + return S_OK; +} + +//----------------------------------------------------------------------// +// Here's IEventHandler's VTable. It never changes so we can declare it static +// +static const IEventHandlerVtbl IEventHandler_Vtbl = { + QueryInterface, + AddRef, + Release, + GetTypeInfoCount, + GetTypeInfo, + GetIDsOfNames, + Invoke +}; + +#include + +//----------------------------------------------------------------------// +// constructor : params: +// device_interface - refers to the interface type of the COM object (whose event we are trying to receive). +// device_event_interface - indicates the interface type of the outgoing interface supported by the COM object. +// This will be the interface that must be implemented by the Sink object. +// is essentially derived from IDispatch, our Sink object (this IEventHandler) +// is also derived from IDispatch. + +typedef IEventHandler device_interface; + +//----------------------------------------------------------------------// +static HRESULT SetupConnectionPoint(device_interface* pdevice_interface, REFIID riid, void** pThis, int* pn ) +{ + IConnectionPointContainer* pIConnectionPointContainerTemp = NULL; + IUnknown* pIUnknown; + IConnectionPoint* m_pIConnectionPoint = NULL; + IEnumConnectionPoints* m_pIEnumConnectionPoints; + HRESULT hr,r; + IID rriid; + register IEventHandler* thisobj; + DWORD m_Points; + DWORD dwCookie = 0; + ITypeLib* pITypeLib; + DISPID dispid; + + HB_SYMBOL_UNUSED( riid ); + HB_SYMBOL_UNUSED( pn ); + + if( !( thisobj = (IEventHandler *) GlobalAlloc( GMEM_FIXED, sizeof( MyRealIEventHandler ) ) ) ) + { + hr = E_OUTOFMEMORY; + } + else + { + thisobj->lpVtbl = (IEventHandlerVtbl *) &IEventHandler_Vtbl; + + ((MyRealIEventHandler *) thisobj)->count = 0; + + hr = thisobj->lpVtbl->QueryInterface( thisobj, &IID_IUnknown, (void**) &pIUnknown); + if (hr == S_OK && pIUnknown) + { + hr = pdevice_interface->lpVtbl->QueryInterface( pdevice_interface, &IID_IConnectionPointContainer, (void**) &pIConnectionPointContainerTemp); + if ( hr == S_OK && pIConnectionPointContainerTemp ) + { + hr = pIConnectionPointContainerTemp->lpVtbl->EnumConnectionPoints(pIConnectionPointContainerTemp, &m_pIEnumConnectionPoints ); + if ( hr == S_OK && m_pIEnumConnectionPoints ) + { + do + { + hr = m_pIEnumConnectionPoints->lpVtbl->Next( m_pIEnumConnectionPoints, 1, &m_pIConnectionPoint, NULL); + + if( hr == S_OK ) + { + hr = m_pIConnectionPoint->lpVtbl->GetConnectionInterface( m_pIConnectionPoint, &rriid ); + + if ( hr == S_OK ) + { + ((MyRealIEventHandler *) thisobj)->device_event_interface_iid = rriid; + + hr = m_pIConnectionPoint->lpVtbl->Advise( m_pIConnectionPoint, pIUnknown, &dwCookie ); + if ( hr == S_OK ) + { + ((MyRealIEventHandler *) thisobj)->pIConnectionPoint = m_pIConnectionPoint; + ((MyRealIEventHandler *) thisobj)->dwEventCookie = dwCookie; + } + else + { + hr = S_OK; + } + } + else + { + hr = S_OK; + } + } + } while( hr == S_OK ); + + m_pIEnumConnectionPoints->lpVtbl->Release(m_pIEnumConnectionPoints); + m_pIEnumConnectionPoints = NULL; + } + + pIConnectionPointContainerTemp->lpVtbl->Release( pIConnectionPointContainerTemp ); + pIConnectionPointContainerTemp = NULL; + } + + pIUnknown->lpVtbl->Release(pIUnknown); + pIUnknown = NULL; + } + } + + *pThis = (void*) thisobj; + + return hr; +} +//----------------------------------------------------------------------// +static void ShutdownConnectionPoint(MyRealIEventHandler *this) +{ + if (this->pIConnectionPoint) + { + this->dwEventCookie = 0; + this->pIConnectionPoint->lpVtbl->Release(this->pIConnectionPoint); + this->pIConnectionPoint = NULL; + } +} +//----------------------------------------------------------------------// +HB_FUNC( HB_AX_SHUTDOWNCONNECTIONPOINT ) +{ + MyRealIEventHandler* hSink = (MyRealIEventHandler*) hb_parnl(1); + ShutdownConnectionPoint( hSink ); + hb_itemRelease( hSink->pEvents ); + + s_ev_iid_[ ThisThreadId() ] = 0; +} +//----------------------------------------------------------------------// +HB_FUNC( HB_AX_SETUPCONNECTIONPOINT ) +{ + HRESULT hr; + MyRealIEventHandler* hSink = NULL; + LPIID riid = (LPIID) &IID_IDispatch; + int n; + + hr = SetupConnectionPoint( (device_interface*) hb_parnint( 1 ), (REFIID) riid, (void**) &hSink, &n ) ; + + hSink->pEvents = hb_itemNew( hb_param( 4, HB_IT_ANY ) ); + hb_stornl( (LONG) hSink, 2 ); + hb_storni( n, 3 ); + hb_retnl( hr ); +} +//----------------------------------------------------------------------// +// ActiveX Container Management Interface +//----------------------------------------------------------------------// +HB_FUNC( HB_AX_ATLAXWININIT ) +{ + PATLAXWININIT AtlAxWinInit; + char szLibName[ MAX_PATH + 1 ] = {0} ; + BOOL bRet = FALSE; + + if( !hLib ) + { + GetSystemDirectory( szLibName,MAX_PATH); + strcat( szLibName, "\\atl.dll"); + hLib = LoadLibrary( (LPCSTR) szLibName ); + + if( hLib ) + { + AtlAxWinInit = (PATLAXWININIT) GetProcAddress( hLib, "AtlAxWinInit"); + if (AtlAxWinInit) + { + if ( (AtlAxWinInit)() ) + { + bRet = TRUE; + } + } + + if( !bRet ) + { + FreeLibrary( hLib ); + hLib = NULL; + } + } + } + else + { + bRet = TRUE; + } + + hb_retl( bRet); +} +//---------------------------------------------------------------------------// +HB_FUNC( HB_AX_ATLAXCREATECONTROL ) +{ + IUnknown* pUnk; + IDispatch *obj; + BSTR wString; + UINT uLen; + PATLAXCREATECONTROL AtlAxCreateControl; + HWND hContainer = NULL; + RECT rc; + char *class = hb_parc(1); + HWND hParent = (HWND) hb_parnl(2); + char *Caption = ISNIL(4) ? "" : hb_parc(3); + HMENU id = ISNIL(4) ? (HMENU)-1 : (HMENU) hb_parni(4); + int x = ISNIL(5) ? 0 : hb_parni(5); + int y = ISNIL(6) ? 0 : hb_parni(6); + int w = ISNIL(7) ? 0 : hb_parni(7); + int h = ISNIL(8) ? 0 : hb_parni(8); + int Style = ISNIL(9) ? WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS : hb_parni(9); + int Exstyle = ISNIL(10) ? 0 : hb_parni(10); + + AtlAxCreateControl = (PATLAXCREATECONTROL) GetProcAddress(hLib, "AtlAxCreateControl"); + if (AtlAxCreateControl) + { + hContainer = (HWND) CreateWindowEx( Exstyle, class, Caption, Style, x,y,w,h, hParent, id, GetModuleHandle(NULL), NULL); + if( hContainer ) + { + SendMessage( hContainer, (UINT)WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)MAKELPARAM(FALSE,0)); + uLen = MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen(Caption)+1, NULL, 0 ); + wString = (BSTR) malloc( uLen * sizeof(WCHAR)); + MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, Caption, strlen(Caption)+1, wString, uLen ); + + (AtlAxCreateControl) ( wString, hContainer,NULL, &pUnk ); + + free( wString ); + + pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, (void**) &obj ); + pUnk->lpVtbl->Release( pUnk ); + hb_retnl( (long) obj ); + + GetClientRect(hContainer,&rc); + MoveWindow( GetDlgItem(hContainer,(int) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE ); + } + else + { + hb_retnl(0); + } + } + else + { + hb_retnl(0); + } + + // return the container handle + if ISBYREF(11) + { + hb_stornl( (long) hContainer, 11 ); + } +} +//---------------------------------------------------------------------------// +HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container window +{ + IUnknown* pUnk = NULL; + IDispatch *obj; + PATLAXGETCONTROL AtlAxGetControl; + RECT rc; + HWND hWnd = NULL; + char * lpcclass = hb_parc(1); + HWND hParent = (HWND) hb_parnl(2); + char *Caption = ISNIL(4) ? "" : hb_parc(3); + HMENU id = ISNIL(4) ? (HMENU)-1 : (HMENU) hb_parni(4); + int x = ISNIL(5) ? 0 : hb_parni(5); + int y = ISNIL(6) ? 0 : hb_parni(6); + int w = ISNIL(7) ? 0 : hb_parni(7); + int h = ISNIL(8) ? 0 : hb_parni(8); + int Style = ISNIL(9) ? WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS : hb_parni(9); + int Exstyle = ISNIL(10) ? 0 : hb_parni(10); + + AtlAxGetControl = (PATLAXGETCONTROL) GetProcAddress( hLib, "AtlAxGetControl" ); + if (AtlAxGetControl) + { + hWnd = (HWND) CreateWindowEx( Exstyle, lpcclass, Caption, Style, x,y,w,h, hParent, id, GetModuleHandle(NULL), NULL); + if( hWnd ) + { + SendMessage( hWnd, (UINT)WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), (LPARAM)MAKELPARAM(FALSE,0)); + (AtlAxGetControl)( hWnd, &pUnk ); + + if(pUnk) + { + pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, (void**)&obj ); + pUnk->lpVtbl->Release( pUnk ); + GetClientRect(hParent,&rc); + MoveWindow( GetDlgItem(hParent, (int) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE ); + hb_retnl( (long) obj ); + } + else + { + hb_retnl( 0 ); + } + } + else + { + hb_retnl( 0 ); + } + } + else + { + hb_retnl( 0 ); + } + + // return the control handle + if ISBYREF( 11 ) + { + hb_stornl( (long) hWnd, 11 ); + } +} +//---------------------------------------------------------------------------// +// +// (hOleObject) +// +HB_FUNC_STATIC( HB_AX_AXRELEASEOBJECT ) +{ + IDispatch * pDisp = ( IDispatch * ) hb_parnl( 1 ); + s_nOleError = pDisp->lpVtbl->Release( pDisp ); +} +//---------------------------------------------------------------------------// +// +// terminate activex suport, free the library +// +HB_FUNC( HB_AX_ATLAXWINTERM ) +{ + PATLAXWINTERM AtlAxWinTerm; + BOOL bRet = FALSE; + + if( hLib ) + { + AtlAxWinTerm = (PATLAXWINTERM) GetProcAddress( hLib, "AtlAxWinTerm" ); + if( AtlAxWinTerm ) + { + if( AtlAxWinTerm() ) + { + FreeLibrary( hLib ); + hLib = NULL; + bRet = TRUE; + } + } + } + hb_retl( bRet ); +} +//----------------------------------------------------------------------// + diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 2ce1cd3f94..77cbeb12f8 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -86,7 +86,7 @@ BOOL WINAPI ChooseColor( LPCHOOSECOLORW ); #endif /* __MINGW32CE__ */ //-------------------------------------------------------------------// - +#if 0 HB_EXTERN_BEGIN extern BOOL wvt_Array2Rect(PHB_ITEM aRect, RECT *rc ); @@ -100,6 +100,7 @@ extern void wvt_Point2ArrayEx( POINT *pt , PHB_ITEM aPoint); extern void wvt_Size2ArrayEx( SIZE *siz ,PHB_ITEM aSize ); HB_EXTERN_END +#endif static HANDLE wvg_hInstance( void ) { @@ -1400,438 +1401,7 @@ HB_FUNC( WVT_DLGSETICON ) hb_retnint( ( HB_PTRDIFF ) hIcon ); } } - -//-------------------------------------------------------------------// -//-------------------------------------------------------------------// -//-------------------------------------------------------------------// -// -// Direct WinApi Functions - Prefixed WIN_*() -// -//-------------------------------------------------------------------// -//-------------------------------------------------------------------// -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SENDMESSAGE ) -{ - LPTSTR cText = NULL; - - if( ISBYREF( 4 ) ) - { - cText = HB_TCHAR_CONVTO( hb_parc( 4 ) ); - } - - hb_retnl( ( ULONG ) SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), - ( UINT ) hb_parni( 2 ), - ( ISNIL( 3 ) ? 0 : ( WPARAM ) hb_parnint( 3 ) ), - ( ISNIL( 4 ) ? 0 : ( cText ? ( LPARAM ) ( LPSTR ) cText : - ( ISCHAR( 4 ) ? ( LPARAM )( LPSTR ) hb_parc( 4 ) : - ( LPARAM ) hb_parnint( 4 ) ) ) ) ) - ); - - if( cText ) - { - char * szText = HB_TCHAR_CONVFROM( cText ); - hb_storc( szText, 4 ); - HB_TCHAR_FREE( szText ); - HB_TCHAR_FREE( cText ); - } -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SENDDLGITEMMESSAGE ) -{ - PHB_ITEM pText = hb_param( 5, HB_IT_STRING ); - char *cText = NULL; - int iLen = 0; - - if( pText ) - { - iLen = hb_itemGetCLen( pText ); - cText = (char*) hb_xgrab( iLen+1 ); - hb_xmemcpy( cText, hb_itemGetCPtr( pText ), iLen+1 ); - } - - hb_retnl( (LONG) SendDlgItemMessage( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) , - (int) hb_parni( 2 ) , - (UINT) hb_parni( 3 ) , - (ISNIL(4) ? 0 : (WPARAM) hb_parnint( 4 )) , - (cText ? (LPARAM) cText : (LPARAM) hb_parnint( 5 )) - ) ); - - if( cText ) - { - if( ISBYREF( 5 ) ) - { - hb_storclen( cText, iLen, 5 ) ; - } - hb_xfree( cText ); - } -} - -//-------------------------------------------------------------------// -// -// WIN_SetTimer( hWnd, nIdentifier, nTimeOut ) -// -HB_FUNC( WIN_SETTIMER ) -{ - hb_retl( SetTimer( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), NULL ) != 0 ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETFOCUS ) -{ - SetFocus( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETTEXTCOLOR ) -{ - hb_retnl( ( ULONG ) SetTextColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETBKCOLOR ) -{ - hb_retnl( ( ULONG ) SetBkColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETBKMODE ) -{ - hb_retni( ( int ) SetBkMode( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETSTOCKOBJECT ) -{ - hb_retnint( ( HB_PTRDIFF ) GetStockObject( hb_parni( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_DELETEOBJECT ) -{ - hb_retl( DeleteObject( ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SELECTOBJECT ) -{ - hb_retnint( ( HB_PTRDIFF ) SelectObject( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_LOWORD ) -{ - hb_retnl( LOWORD( hb_parnl( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_HIWORD ) -{ - hb_retnl( HIWORD( hb_parnl( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_MULDIV ) -{ - hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETDIALOGBASEUNITS ) -{ - hb_retnl( ( LONG ) GetDialogBaseUnits() ) ; -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETMENU ) -{ - SetMenu( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ; -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETDLGITEMTEXT ) -{ - LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 3 ) ); - SetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), lpBuffer ); - HB_TCHAR_FREE( lpBuffer ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETDLGITEMTEXT ) -{ - USHORT iLen = ( USHORT ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), WM_GETTEXTLENGTH, 0, 0 ) + 1 ; - LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) ); - char * szText; - UINT iResult; - - iResult = GetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box - hb_parni( 2 ), // identifier of control - cText, // address of buffer for text - iLen // maximum size of string - ); - - cText[ iResult ] = '\0'; - szText = HB_TCHAR_CONVFROM( cText ); - hb_retc( szText ); - HB_TCHAR_FREE( szText ); - hb_xfree( cText ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_CHECKDLGBUTTON ) -{ - hb_retl( CheckDlgButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), - ( UINT )( ISNUM( 3 ) ? hb_parni( 3 ) : hb_parl( 3 ) ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_ISDLGBUTTONCHECKED ) -{ - hb_retni( IsDlgButtonChecked( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ) ; -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_CHECKRADIOBUTTON ) -{ - hb_retl( CheckRadioButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box - hb_parni( 2 ), // identifier of first radio button in group - hb_parni( 3 ), // identifier of last radio button in group - hb_parni( 4 ) // identifier of radio button to select - ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETDLGITEM ) -{ - hb_retnint( ( HB_PTRDIFF ) GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_MESSAGEBOX ) -{ - LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) ); - LPTSTR lpBuffer2 = HB_TCHAR_CONVTO( hb_parc( 3 ) ); - - hb_retni( MessageBox( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lpBuffer2, ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ) ; - - HB_TCHAR_FREE( lpBuffer ); - HB_TCHAR_FREE( lpBuffer2 ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_INVALIDATERECT ) -{ - InvalidateRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), NULL, TRUE ); -} - -//-------------------------------------------------------------------// -// -// Win_LoadIcon( ncIcon ) -// -HB_FUNC( WIN_LOADICON ) -{ - HICON hIcon; - - if ( ISNUM( 1 ) ) - { - hIcon = LoadIcon( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) ); - } - else - { - LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) ); - hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); - HB_TCHAR_FREE( lpBuffer ); - } - - hb_retnint( ( HB_PTRDIFF ) hIcon ); -} - -//-------------------------------------------------------------------// -// -// Win_LoadImage( ncImage, nSource ) -> hImage -// nSource == 0 ResourceIdByNumber -// nSource == 1 ResourceIdByName -// nSource == 2 ImageFromDiskFile -// -HB_FUNC( WIN_LOADIMAGE ) -{ - HBITMAP hImage = 0; - LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) ); - int iSource = hb_parni( 2 ); - - switch ( iSource ) - { - case 0: - hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) ); - break; - - case 1: - hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), lpBuffer ); - break; - - case 2: - hImage = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); - break; - } - - HB_TCHAR_FREE( lpBuffer ); - hb_retnint( ( HB_PTRDIFF ) hImage ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETCLIENTRECT ) -{ - RECT rc = { 0,0,0,0 }; - PHB_ITEM info = hb_itemArrayNew( 4 ); - - GetClientRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc ); - - hb_arraySetNI( info, 1, rc.left ); - hb_arraySetNI( info, 2, rc.top ); - hb_arraySetNI( info, 3, rc.right ); - hb_arraySetNI( info, 4, rc.bottom ); - - hb_itemReturnRelease( info ); -} - -//-------------------------------------------------------------------// -// -// Win_DrawImage( hdc, nLeft, nTop, nWidth, nHeight, cImage ) in Pixels -// -HB_FUNC( WIN_DRAWIMAGE ) -{ - hb_retl( hb_wvt_DrawImage( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), - hb_parni( 4 ), hb_parni( 5 ), hb_parc( 6 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETDC ) -{ - hb_retnint( ( HB_PTRDIFF ) GetDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_RELEASEDC ) -{ - hb_retl( ReleaseDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HDC ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_RECTANGLE ) -{ - Rectangle( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_CREATEBRUSH ) -{ - LOGBRUSH lb = { 0,0,0 }; - - lb.lbStyle = hb_parni( 1 ); - lb.lbColor = ISNIL( 2 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 2 ) ; - lb.lbHatch = ISNIL( 3 ) ? 0 : hb_parni( 3 ); - - hb_retnint( ( HB_PTRDIFF ) CreateBrushIndirect( &lb ) ); -} - -//-------------------------------------------------------------------// -// -// Win_DrawText( hDC, cText, aRect, nFormat ) -// -HB_FUNC( WIN_DRAWTEXT ) -{ - RECT rc = { 0,0,0,0 }; - LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) ); - - rc.left = hb_parni( 3,1 ); - rc.top = hb_parni( 3,2 ); - rc.right = hb_parni( 3,3 ); - rc.bottom = hb_parni( 3,4 ); - - hb_retl( DrawText( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lstrlen( lpBuffer ), &rc, hb_parni( 4 ) ) ); - HB_TCHAR_FREE( lpBuffer ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_GETWINDOWRECT ) -{ - RECT rc; - PHB_ITEM info = hb_itemArrayNew( 4 ); - - GetWindowRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc ); - - hb_arraySetNI( info, 1, rc.left ); - hb_arraySetNI( info, 2, rc.top ); - hb_arraySetNI( info, 3, rc.right ); - hb_arraySetNI( info, 4, rc.bottom ); - - hb_itemReturnRelease( info ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_MOVEWINDOW ) -{ - MoveWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ), hb_parl( 6 ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETPARENT ) -{ - hb_retnint( ( HB_PTRDIFF ) SetParent( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), (HWND) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_SETWINDOWLONG ) -{ - hb_retnl( SetWindowLong( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parnl( 3 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_ISWINDOW ) -{ - hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_DESTROYWINDOW ) -{ - hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); -} - -//-------------------------------------------------------------------// +//----------------------------------------------------------------------// HB_FUNC( WVT_GETFONTHANDLE ) { @@ -1846,56 +1416,6 @@ HB_FUNC( WVT_GETFONTHANDLE ) hb_retnint( ( HB_PTRDIFF ) hFont ); } -//-------------------------------------------------------------------// - -HB_FUNC( WIN_CLIENTTOSCREEN ) -{ - POINT Point ; - PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY ); - - if ( wvt_Array2Point( pArray ,&Point ) ) - { - if ( ClientToScreen( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) ) - { - wvt_Point2ArrayEx( &Point, pArray ); - hb_retl( TRUE ) ; - } - else - { - hb_retl( FALSE ) ; - } - } - else - { - hb_retl( FALSE ) ; - } -} - -//----------------------------------------------------------------------// - -HB_FUNC( WIN_SCREENTOCLIENT ) -{ - POINT Point ; - PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY ); - - if ( wvt_Array2Point( pArray, &Point ) ) - { - if( ScreenToClient( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) > 0 ) - { - wvt_Point2ArrayEx( &Point, pArray ); - hb_retl( TRUE ) ; - } - else - { - hb_retl( FALSE ) ; - } - } - else - { - hb_retl( FALSE ) ; - } -} - //----------------------------------------------------------------------// //----------------------------------------------------------------------// //----------------------------------------------------------------------// @@ -2104,89 +1624,3 @@ HB_FUNC( WVT__GETSAVEFILENAME ) HB_PARTFREE( lpstrDefExt ); } //----------------------------------------------------------------------// - -HB_FUNC( WIN_AND ) -{ - hb_retnl( hb_parnl(1) & hb_parnl(2) ) ; -} - -//----------------------------------------------------------------------// - -HB_FUNC( WIN_OR ) -{ - hb_retnl( hb_parnl(1) | hb_parnl(2) ) ; -} - -//----------------------------------------------------------------------// - -HB_FUNC( WIN_NOT ) -{ - hb_retnl( ~( hb_parnl(1) ) ) ; -} - -//----------------------------------------------------------------------// - -HB_FUNC( WIN_TRACKPOPUPMENU ) -{ - HMENU hMenu = ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ); - UINT uFlags = ISNIL( 2 ) ? TPM_CENTERALIGN | TPM_RETURNCMD : hb_parnl( 2 ); - HWND hWnd = ISNIL( 3 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 3 ); - - POINT xy = { 0,0 }; - - GetCursorPos( &xy ); - - hb_retnl( TrackPopupMenu( hMenu, uFlags, xy.x, xy.y, 0, hWnd, NULL ) ); -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_CHOOSECOLOR ) -{ - CHOOSECOLOR cc ; - COLORREF crCustClr[ 16 ] ; - int i ; - - for( i = 0 ; i < 16 ; i++ ) - { - crCustClr[ i ] = ( ISARRAY( 2 ) ? ( COLORREF ) hb_parnl( 2, i+1 ) : GetSysColor( COLOR_BTNFACE ) ) ; - } - - cc.lStructSize = sizeof( CHOOSECOLOR ) ; - cc.hwndOwner = ISNIL( 4 ) ? NULL : (HWND) ( HB_PTRDIFF ) hb_parnint( 4 ); - cc.rgbResult = ISNIL( 1 ) ? 0 : ( COLORREF ) hb_parnl( 1 ) ; - cc.lpCustColors = crCustClr ; - cc.Flags = ( WORD ) ( ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) ); - - if ( ChooseColor( &cc ) ) - { - hb_retnl( cc.rgbResult ) ; - } - else - { - hb_retnl( -1 ); - } -} - -//-------------------------------------------------------------------// - -HB_FUNC( WIN_FINDWINDOW ) -{ - HWND hwnd; - LPTSTR lpStr; - - lpStr = HB_TCHAR_CONVTO( hb_parc( 1 ) ); - hwnd = FindWindow( NULL, lpStr ); - HB_TCHAR_FREE( lpStr ); - - if ( hwnd ) - { - hb_retnint( ( HB_PTRDIFF ) hwnd ); - } - else - { - hb_retnint( -1 ); - } -} - -//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c new file mode 100644 index 0000000000..df2b9793db --- /dev/null +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -0,0 +1,650 @@ +/* + * $Id: + */ + +/* + * Harbour Project source code: + * Video subsystem for Win32 using GUI windows instead of Console + * + * Copyright 2007 Pritpal Bedi + * based on: + * + * Copyright 2003 Peter Rees + * Rees Software & Systems Ltd + * based on + * Bcc ConIO Video subsystem by + * Copyright 2002 Marek Paliwoda + * Copyright 2002 Przemyslaw Czerpak + * Video subsystem for Win32 compilers + * Copyright 1999-2000 Paul Tucker + * Copyright 2002 Przemyslaw Czerpak + * + * See doc/license.txt for licensing terms. + * + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option ) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/ ). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +// +// Direct WinApi Functions - Prefixed WIN_*() +// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// +//-------------------------------------------------------------------// + +#define HB_OS_WIN_32_USED + +#include "gtwvg.h" + +//----------------------------------------------------------------------// + +static HANDLE wvg_hInstance( void ) +{ + HANDLE hInstance; + + hb_winmainArgGet( &hInstance, NULL, NULL ); + + return hInstance; +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_SENDMESSAGE ) +{ + LPTSTR cText = NULL; + + if( ISBYREF( 4 ) ) + { + cText = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + } + + hb_retnl( ( ULONG ) SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), + ( UINT ) hb_parni( 2 ), + ( ISNIL( 3 ) ? 0 : ( WPARAM ) hb_parnint( 3 ) ), + ( ISNIL( 4 ) ? 0 : ( cText ? ( LPARAM ) ( LPSTR ) cText : + ( ISCHAR( 4 ) ? ( LPARAM )( LPSTR ) hb_parc( 4 ) : + ( LPARAM ) hb_parnint( 4 ) ) ) ) ) + ); + + if( cText ) + { + char * szText = HB_TCHAR_CONVFROM( cText ); + hb_storc( szText, 4 ); + HB_TCHAR_FREE( szText ); + HB_TCHAR_FREE( cText ); + } +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SENDDLGITEMMESSAGE ) +{ + PHB_ITEM pText = hb_param( 5, HB_IT_STRING ); + char *cText = NULL; + int iLen = 0; + + if( pText ) + { + iLen = hb_itemGetCLen( pText ); + cText = (char*) hb_xgrab( iLen+1 ); + hb_xmemcpy( cText, hb_itemGetCPtr( pText ), iLen+1 ); + } + + hb_retnl( (LONG) SendDlgItemMessage( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) , + (int) hb_parni( 2 ) , + (UINT) hb_parni( 3 ) , + (ISNIL(4) ? 0 : (WPARAM) hb_parnint( 4 )) , + (cText ? (LPARAM) cText : (LPARAM) hb_parnint( 5 )) + ) ); + + if( cText ) + { + if( ISBYREF( 5 ) ) + { + hb_storclen( cText, iLen, 5 ) ; + } + hb_xfree( cText ); + } +} + +//-------------------------------------------------------------------// +// +// WIN_SetTimer( hWnd, nIdentifier, nTimeOut ) +// +HB_FUNC( WIN_SETTIMER ) +{ + hb_retl( SetTimer( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), NULL ) != 0 ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETFOCUS ) +{ + SetFocus( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETTEXTCOLOR ) +{ + hb_retnl( ( ULONG ) SetTextColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETBKCOLOR ) +{ + hb_retnl( ( ULONG ) SetBkColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETBKMODE ) +{ + hb_retni( ( int ) SetBkMode( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETSTOCKOBJECT ) +{ + hb_retnint( ( HB_PTRDIFF ) GetStockObject( hb_parni( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_DELETEOBJECT ) +{ + hb_retl( DeleteObject( ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SELECTOBJECT ) +{ + hb_retnint( ( HB_PTRDIFF ) SelectObject( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_LOWORD ) +{ + hb_retnl( LOWORD( hb_parnl( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_HIWORD ) +{ + hb_retnl( HIWORD( hb_parnl( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_MULDIV ) +{ + hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETDIALOGBASEUNITS ) +{ + hb_retnl( ( LONG ) GetDialogBaseUnits() ) ; +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETMENU ) +{ + SetMenu( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ; +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETDLGITEMTEXT ) +{ + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 3 ) ); + SetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), lpBuffer ); + HB_TCHAR_FREE( lpBuffer ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETDLGITEMTEXT ) +{ + USHORT iLen = ( USHORT ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), WM_GETTEXTLENGTH, 0, 0 ) + 1 ; + LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) ); + char * szText; + UINT iResult; + + iResult = GetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box + hb_parni( 2 ), // identifier of control + cText, // address of buffer for text + iLen // maximum size of string + ); + + cText[ iResult ] = '\0'; + szText = HB_TCHAR_CONVFROM( cText ); + hb_retc( szText ); + HB_TCHAR_FREE( szText ); + hb_xfree( cText ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_CHECKDLGBUTTON ) +{ + hb_retl( CheckDlgButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), + ( UINT )( ISNUM( 3 ) ? hb_parni( 3 ) : hb_parl( 3 ) ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_ISDLGBUTTONCHECKED ) +{ + hb_retni( IsDlgButtonChecked( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ) ; +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_CHECKRADIOBUTTON ) +{ + hb_retl( CheckRadioButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box + hb_parni( 2 ), // identifier of first radio button in group + hb_parni( 3 ), // identifier of last radio button in group + hb_parni( 4 ) // identifier of radio button to select + ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETDLGITEM ) +{ + hb_retnint( ( HB_PTRDIFF ) GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_MESSAGEBOX ) +{ + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) ); + LPTSTR lpBuffer2 = HB_TCHAR_CONVTO( hb_parc( 3 ) ); + + hb_retni( MessageBox( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lpBuffer2, ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ) ; + + HB_TCHAR_FREE( lpBuffer ); + HB_TCHAR_FREE( lpBuffer2 ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_INVALIDATERECT ) +{ + InvalidateRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), NULL, TRUE ); +} + +//-------------------------------------------------------------------// +// +// Win_LoadIcon( ncIcon ) +// +HB_FUNC( WIN_LOADICON ) +{ + HICON hIcon; + + if ( ISNUM( 1 ) ) + { + hIcon = LoadIcon( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) ); + } + else + { + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) ); + hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_ICON, 0, 0, LR_LOADFROMFILE ); + HB_TCHAR_FREE( lpBuffer ); + } + + hb_retnint( ( HB_PTRDIFF ) hIcon ); +} + +//-------------------------------------------------------------------// +// +// Win_LoadImage( ncImage, nSource ) -> hImage +// nSource == 0 ResourceIdByNumber +// nSource == 1 ResourceIdByName +// nSource == 2 ImageFromDiskFile +// +HB_FUNC( WIN_LOADIMAGE ) +{ + HBITMAP hImage = 0; + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) ); + int iSource = hb_parni( 2 ); + + switch ( iSource ) + { + case 0: + hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) ); + break; + + case 1: + hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), lpBuffer ); + break; + + case 2: + hImage = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE ); + break; + } + + HB_TCHAR_FREE( lpBuffer ); + hb_retnint( ( HB_PTRDIFF ) hImage ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETCLIENTRECT ) +{ + RECT rc = { 0,0,0,0 }; + PHB_ITEM info = hb_itemArrayNew( 4 ); + + GetClientRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc ); + + hb_arraySetNI( info, 1, rc.left ); + hb_arraySetNI( info, 2, rc.top ); + hb_arraySetNI( info, 3, rc.right ); + hb_arraySetNI( info, 4, rc.bottom ); + + hb_itemReturnRelease( info ); +} + +//-------------------------------------------------------------------// +// +// Win_DrawImage( hdc, nLeft, nTop, nWidth, nHeight, cImage ) in Pixels +// +HB_FUNC( WIN_DRAWIMAGE ) +{ + hb_retl( hb_wvt_DrawImage( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), + hb_parni( 4 ), hb_parni( 5 ), hb_parc( 6 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETDC ) +{ + hb_retnint( ( HB_PTRDIFF ) GetDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_RELEASEDC ) +{ + hb_retl( ReleaseDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HDC ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_RECTANGLE ) +{ + Rectangle( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_CREATEBRUSH ) +{ + LOGBRUSH lb = { 0,0,0 }; + + lb.lbStyle = hb_parni( 1 ); + lb.lbColor = ISNIL( 2 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 2 ) ; + lb.lbHatch = ISNIL( 3 ) ? 0 : hb_parni( 3 ); + + hb_retnint( ( HB_PTRDIFF ) CreateBrushIndirect( &lb ) ); +} + +//-------------------------------------------------------------------// +// +// Win_DrawText( hDC, cText, aRect, nFormat ) +// +HB_FUNC( WIN_DRAWTEXT ) +{ + RECT rc = { 0,0,0,0 }; + LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) ); + + rc.left = hb_parni( 3,1 ); + rc.top = hb_parni( 3,2 ); + rc.right = hb_parni( 3,3 ); + rc.bottom = hb_parni( 3,4 ); + + hb_retl( DrawText( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lstrlen( lpBuffer ), &rc, hb_parni( 4 ) ) ); + HB_TCHAR_FREE( lpBuffer ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_GETWINDOWRECT ) +{ + RECT rc; + PHB_ITEM info = hb_itemArrayNew( 4 ); + + GetWindowRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc ); + + hb_arraySetNI( info, 1, rc.left ); + hb_arraySetNI( info, 2, rc.top ); + hb_arraySetNI( info, 3, rc.right ); + hb_arraySetNI( info, 4, rc.bottom ); + + hb_itemReturnRelease( info ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_MOVEWINDOW ) +{ + MoveWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ), hb_parl( 6 ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETPARENT ) +{ + hb_retnint( ( HB_PTRDIFF ) SetParent( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), (HWND) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_SETWINDOWLONG ) +{ + hb_retnl( SetWindowLong( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parnl( 3 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_ISWINDOW ) +{ + hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_DESTROYWINDOW ) +{ + hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_CLIENTTOSCREEN ) +{ + POINT Point ; + PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY ); + + if ( wvt_Array2Point( pArray ,&Point ) ) + { + if ( ClientToScreen( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) ) + { + wvt_Point2ArrayEx( &Point, pArray ); + hb_retl( TRUE ) ; + } + else + { + hb_retl( FALSE ) ; + } + } + else + { + hb_retl( FALSE ) ; + } +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_SCREENTOCLIENT ) +{ + POINT Point ; + PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY ); + + if ( wvt_Array2Point( pArray, &Point ) ) + { + if( ScreenToClient( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) > 0 ) + { + wvt_Point2ArrayEx( &Point, pArray ); + hb_retl( TRUE ) ; + } + else + { + hb_retl( FALSE ) ; + } + } + else + { + hb_retl( FALSE ) ; + } +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_AND ) +{ + hb_retnl( hb_parnl(1) & hb_parnl(2) ) ; +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_OR ) +{ + hb_retnl( hb_parnl(1) | hb_parnl(2) ) ; +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_NOT ) +{ + hb_retnl( ~( hb_parnl(1) ) ) ; +} + +//----------------------------------------------------------------------// + +HB_FUNC( WIN_TRACKPOPUPMENU ) +{ + HMENU hMenu = ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ); + UINT uFlags = ISNIL( 2 ) ? TPM_CENTERALIGN | TPM_RETURNCMD : hb_parnl( 2 ); + HWND hWnd = ISNIL( 3 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 3 ); + + POINT xy = { 0,0 }; + + GetCursorPos( &xy ); + + hb_retnl( TrackPopupMenu( hMenu, uFlags, xy.x, xy.y, 0, hWnd, NULL ) ); +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_CHOOSECOLOR ) +{ + CHOOSECOLOR cc ; + COLORREF crCustClr[ 16 ] ; + int i ; + + for( i = 0 ; i < 16 ; i++ ) + { + crCustClr[ i ] = ( ISARRAY( 2 ) ? ( COLORREF ) hb_parnl( 2, i+1 ) : GetSysColor( COLOR_BTNFACE ) ) ; + } + + cc.lStructSize = sizeof( CHOOSECOLOR ) ; + cc.hwndOwner = ISNIL( 4 ) ? NULL : (HWND) ( HB_PTRDIFF ) hb_parnint( 4 ); + cc.rgbResult = ISNIL( 1 ) ? 0 : ( COLORREF ) hb_parnl( 1 ) ; + cc.lpCustColors = crCustClr ; + cc.Flags = ( WORD ) ( ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) ); + + if ( ChooseColor( &cc ) ) + { + hb_retnl( cc.rgbResult ) ; + } + else + { + hb_retnl( -1 ); + } +} + +//-------------------------------------------------------------------// + +HB_FUNC( WIN_FINDWINDOW ) +{ + HWND hwnd; + LPTSTR lpStr; + + lpStr = HB_TCHAR_CONVTO( hb_parc( 1 ) ); + hwnd = FindWindow( NULL, lpStr ); + HB_TCHAR_FREE( lpStr ); + + if ( hwnd ) + { + hb_retnint( ( HB_PTRDIFF ) hwnd ); + } + else + { + hb_retnint( -1 ); + } +} + +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg new file mode 100644 index 0000000000..716f2e563e --- /dev/null +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -0,0 +1,968 @@ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ Compatible xbpWindow Class +// +// Pritpal Bedi +// 08Nov2008 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'hbgtwvg.ch' + +//----------------------------------------------------------------------// + +CLASS WvgWindow INHERIT WvgPartHandler + + // CONFIGURATION + // + DATA animate INIT .F. + DATA clipChildren INIT .F. + DATA clipParent INIT .F. + DATA clipSiblings INIT .T. + DATA group INIT 0 // XBP_NO_GROUP + DATA sizeRedraw INIT .F. + DATA tabStop INIT .F. + DATA visible INIT .T. + + // RUNTIME DATA + // + DATA dropZone INIT .F. + DATA helpLink + DATA tooltipText INIT '' + + DATA style INIT 0 + DATA exStyle INIT 0 + DATA hWnd + DATA aPos INIT { 0,0 } + DATA aSize INIT { 0,0 } + DATA aPresParams INIT {} + DATA objType INIT objTypeNone + DATA ClassName INIT '' + + // CALLBACK SLOTS + DATA sl_enter + DATA sl_leave + DATA sl_lbClick + DATA sl_lbDblClick + DATA sl_lbDown + DATA sl_lbUp + DATA sl_mbClick + DATA sl_mbDblClick + DATA sl_mbDown + DATA sl_mbUp + DATA sl_motion + DATA sl_rbClick + DATA sl_rbDblClick + DATA sl_rbDown + DATA sl_rbUp + DATA sl_wheel + + DATA sl_helpRequest + DATA sl_keyboard + DATA sl_killInputFocus + DATA sl_move + DATA sl_paint + DATA sl_quit + DATA sl_resize + DATA sl_setInputFocus + DATA sl_dragEnter + DATA sl_dragMotion + DATA sl_dragLeave + DATA sl_dragDrop + + DATA sl_close + DATA sl_setDisplayFocus + DATA sl_killDisplayFocus + +EXPORTED: + // LIFE CYCLE + METHOD init() + METHOD create() + METHOD configure() + METHOD destroy() + + // MANIPULATE + METHOD captureMouse() + METHOD disable() + METHOD enable() + METHOD hide() + METHOD invalidateRect() + METHOD lockPS() + METHOD lockUpdate() + METHOD setModalState() + METHOD setPointer() + METHOD setTrackPointer() + METHOD setPos() + METHOD setPosAndSize() + METHOD setSize() + METHOD show() + METHOD toBack() + METHOD toFront() + METHOD unlockPS() + METHOD winDevice() + + // SETTINGS + METHOD setColorBG() + METHOD setColorFG() + METHOD setFont() + METHOD setFontCompoundName() + METHOD setPresParam() + + // STATUS + METHOD currentPos() + METHOD currentSize() + METHOD getHWND() + METHOD getModalState() + METHOD hasInputFocus() + METHOD isEnabled() + METHOD isVisible() + + // CALLBACKS + // + METHOD enter() SETGET + METHOD leave() SETGET + METHOD lbClick() SETGET + METHOD lbDblClick() SETGET + METHOD lbDown() SETGET + METHOD lbUp() SETGET + METHOD mbClick() SETGET + METHOD mbDblClick() SETGET + METHOD mbDown() SETGET + METHOD mbUp() SETGET + METHOD motion() SETGET + METHOD rbClick() SETGET + METHOD rbDblClick() SETGET + METHOD rbDown() SETGET + METHOD rbUp() SETGET + METHOD wheel() SETGET + + // OTHER MESSAGES + // + METHOD helpRequest() SETGET + METHOD keyboard() SETGET + METHOD killInputFocus() SETGET + METHOD move() SETGET + METHOD paint() SETGET + METHOD quit() SETGET + METHOD resize() SETGET + METHOD setInputFocus() SETGET + METHOD dragEnter() SETGET + METHOD dragMotion() SETGET + METHOD dragLeave() SETGET + METHOD dragDrop() SETGET + + METHOD close() SETGET + METHOD setDisplayFocus() SETGET + METHOD killDisplayFocus() SETGET + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWindow + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::aSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + ::WvgPartHandler:init( oParent, oOwner ) + + if hb_isArray( aPos ) + ::aPos := aPos + endif + if hb_isArray( aSize ) + ::aSize := aSize + endif + if hb_isArray( aPresParams ) + ::aPresParams := aPresParams + endif + if hb_isLogical( lVisible ) + ::visible := lVisible + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWindow + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::aSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + ::oParent := oParent + ::oOwner := oOwner + ::aPos := aPos + ::aSize := aSize + ::aPresParams := aPresParams + ::visible := lVisible + + ::WvgPartHandler:create( oParent, oOwner ) + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgWindow + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::sSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD captureMouse() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD disable() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD enable() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD hide() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD invalidateRect() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lockPS() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lockUpdate() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setModalState() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPointer() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setTrackPointer() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPos() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPosAndSize() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setSize() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD show() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD toBack() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD toFront() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD unlockPS() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD winDevice() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setColorBG() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setColorFG() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setFont() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setFontCompoundName() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setPresParam() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD currentPos() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD currentSize() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD getHWND() CLASS WvgWindow + + RETURN ::hWnd + +//----------------------------------------------------------------------// + +METHOD getModalState() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD hasInputFocus() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD isEnabled() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD isVisible() CLASS WvgWindow + + RETURN Self + +//----------------------------------------------------------------------// +// Callback Methods +//----------------------------------------------------------------------// + +METHOD enter( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_enter ) + eval( ::sl_enter, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_enter := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD leave( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_leave ) + eval( ::sl_leave, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_leave := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbClick ) + eval( ::sl_lbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbDblClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbDblClick ) + eval( ::sl_lbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbDown( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbDown ) + eval( ::sl_lbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD lbUp( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_lbUp ) + eval( ::sl_lbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_lbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbClick ) + eval( ::sl_mbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbDblClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbDblClick ) + eval( ::sl_mbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbDown( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbDown ) + eval( ::sl_mbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD mbUp( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_mbUp ) + eval( ::sl_mbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_mbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD motion( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_motion ) + eval( ::sl_motion, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_motion := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbClick ) + eval( ::sl_rbClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbDblClick( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbDblClick ) + eval( ::sl_rbDblClick, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbDblClick := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbDown( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbDown ) + eval( ::sl_rbDown, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbDown := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD rbUp( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_rbUp ) + eval( ::sl_rbUp, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_rbUp := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD wheel( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_wheel ) + eval( ::sl_wheel, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_wheel := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// +// Other Messages +//----------------------------------------------------------------------// + +METHOD close( xParam ) CLASS WvgWindow + if ::objType == objTypeCrt + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_close ) + eval( ::sl_close, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_close := xParam + RETURN NIL + endif + endif + RETURN Self + +//----------------------------------------------------------------------// + +METHOD helpRequest( xParam ) CLASS WvgWindow + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_helpRequest ) + eval( ::sl_helpRequest, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_helpRequest := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD keyboard( xParam ) CLASS WvgWindow + + if hb_isNumeric( xParam ) .and. hb_isBlock( ::sl_keyboard ) + eval( ::sl_keyboard, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_keyboard := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD killDisplayFocus( xParam ) CLASS WvgWindow + if ::objType == objTypeCrt + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_killDisplayFocus ) + eval( ::sl_killDisplayFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_killDisplayFocus := xParam + RETURN NIL + endif + endif + RETURN Self + +//----------------------------------------------------------------------// + +METHOD killInputFocus( xParam ) CLASS WvgWindow + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_killInputFocus ) + eval( ::sl_killInputFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_killInputFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD move( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_move ) + eval( ::sl_move, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_move := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD paint( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_paint ) + eval( ::sl_paint, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_paint := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD quit( xParam, xParam1 ) CLASS WvgWindow + + if hb_isNumeric( xParam ) .and. hb_isBlock( ::sl_quit ) + eval( ::sl_quit, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_quit := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD resize( xParam, xParam1 ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_resize ) + eval( ::sl_resize, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_resize := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// +// ::ObjType == objTypeCrt +METHOD setDisplayFocus( xParam ) CLASS WvgWindow + + if ::objType == objTypeCrt + if hb_isNil( xParam ) .and. hb_isBlock( ::setDisplayFocus ) + eval( ::setDisplayFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::setDisplayFocus := xParam + RETURN NIL + endif + endif + RETURN Self + +//----------------------------------------------------------------------// + +METHOD setInputFocus( xParam ) CLASS WvgWindow + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_setInputFocus ) + eval( ::sl_setInputFocus, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_setInputFocus := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragEnter( xParam, xParam1 ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragEnter ) + eval( ::sl_dragEnter, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragEnter := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragMotion( xParam ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragMotion ) + eval( ::sl_dragMotion, xParam, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragMotion := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragLeave( xParam ) CLASS WvgWindow + + if hb_isNil( xParam ) .and. hb_isBlock( ::sl_dragLeave ) + eval( ::sl_dragLeave, NIL, NIL, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragLeave := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD dragDrop( xParam, xParam1 ) CLASS WvgWindow + + if hb_isArray( xParam ) .and. hb_isBlock( ::sl_dragDrop ) + eval( ::sl_dragDrop, xParam, xParam1, Self ) + RETURN Self + endif + + if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + ::sl_dragDrop := xParam + RETURN NIL + endif + + RETURN Self + +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvtwin.ch b/harbour/contrib/gtwvg/wvtwin.ch index c84ec6861a..1d2ef8f019 100644 --- a/harbour/contrib/gtwvg/wvtwin.ch +++ b/harbour/contrib/gtwvg/wvtwin.ch @@ -359,9 +359,7 @@ #define WM_NCMOUSEMOVE 160 #define WM_NCLBUTTONDOWN 161 #define WM_NCLBUTTONUP 162 - #define WM_NCLBUTTONDBLCLK 163 - #define WM_NCRBUTTONDOWN 164 #define WM_NCRBUTTONUP 165 #define WM_NCRBUTTONDBLCLK 166 @@ -415,6 +413,9 @@ #define WM_XBUTTONDOWN 523 #define WM_XBUTTONUP 524 #define WM_XBUTTONDBLCLK 525 +#define WM_MOUSEHOVER 0x2A1 +#define WM_MOUSELEAVE 0x2A3 + #define WM_PARENTNOTIFY 528 #define WM_ENTERMENULOOP 529