From e07462e5641e37479f413a304530a76d6cfe8f39 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 15 Mar 2009 23:55:29 +0000 Subject: [PATCH] 2009-03-15 16:42 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/hbgtwvg.ch + #define HB_GTI_SETPOSANDSIZE + #define HB_GTI_HB_GTI_REFRESH + Two more events to manage new CUI-GUI objects. + #define GOBJ_OBJSTATE_* + #define GOBJ_OBJDATA_* + #define GOBJ_IMAGESOURCE_* + Constants to manage CUI=GUI objects. * harbour/contrib/gtwvg/gtwvg.h * harbour/contrib/gtwvg/wvggui.h ! Updated to be compilable for WinCE builds. * harbour/contrib/gtwvg/gtwvg.c ! Updated to honor WinCE builds. ! Implemented double-buffering of console. Now flickering should be the topic of the past. * harbour/contrib/gtwvg/wvggui.c ! Updated to honor WinCE builds. * harbour/contrib/gtwvg/wvgcuig.c + Implemented a highly optimized GUI controls for CUI consoles. Implementation includes auto-destruction, data-substitution, enable/disable feast, etc. These controls are almost identical which are available with Wvt_Draw*() namespace but with a great difference that these are tied to the urrent GT and are handelled transparently by the GT itself. Developer has only to define it. The only requirement is that SaveScreen()/RestScreen() needs to be changed to new Modal GT window. Appln screens will never get blurred. It also employs optimized double-buffering and hence almost eliminates screen flickering. * harbour/contrib/gtwvg/wvgcore.c * harbour/contrib/gtwvg/wvgsink.c * harbour/contrib/gtwvg/wvgutils.c * harbour/contrib/gtwvg/wvgwin.c ! Updated to honor WinCE builds. * harbour/contrib/gtwvg/wvgcrt.prg ! A couple of methods fine-tuned. ! Modal GT's more responsive to user needs. * harbour/contrib/gtwvg/tests/demowvg.prg ! Demonstrated the latest implemention of CUI-GUI controls. See below. Please try option in the main menu. Also note the usage of Modal GT to simulate Alert() in new window. Every GUI object returns a handle to it which may be used to change its parameters. ; TOFIX( WINCE BUILDS ) - GetSystemDirectory() /* IMPLEMENTATION OF CUI-GUI CONTROLS - A CODE PREVIEW #xTranslate Alert( => MyAlert( PROCEDURE GCUIConsole( oCrt ) LOCAL dDate := date() LOCAL cName := pad( 'Some Usefule Name' , 35 ) LOCAL cAdd1 := pad( 'Linda Goldman Avenue', 35 ) LOCAL cAdd2 := pad( 'Excellent Street' , 35 ) LOCAL cAdd3 := pad( 'Suit #415' , 35 ) LOCAL nSlry := 9000 LOCAL nColGet := 8 LOCAL GetList := {} LOCAL cLabel := "VOUCH, that GROWS with you" LOCAL oTab, oStat, hBoxR, hTxt SET SCOREBOARD OFF SetColor( "N/W,N/GR*,,,N/W*" ) CLS hb_gtInfo( HB_GTI_WINTITLE, "WVG Simplified yet Powerful CUI-GUI Console!" ) @ MaxRow(), 0 SAY PadC( "Navigate the Gets", maxcol()+1 ) COLOR "W+/B" @ 2, nColGet SAY "< Date >" @ 5, nColGet SAY "<" + PadC( "Name" , 33 ) + ">" @ 8, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 15, nColGet SAY "< Salary >" @ 3, nColGet GET dDate ; WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 1 ) ) } ; Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,0 ) ), .t. } @ 6, nColGet GET cName ; WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 2 ) ) } ; Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,0 ) ), ; Wvg_SetGObjState( hBoxR, 3 ), .t. } @ 9, nColGet GET cAdd1 ; WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 3 ) ) } ; Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,255 ) ), .t. } @ 11, nColGet GET cAdd2 ; WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 4 ) ) } ; Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,255 ) ), ; Wvg_SetGObjState( hBoxR, 1 ), .t. } @ 13, nColGet GET cAdd3 ; WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 198,21,140 ) ), .t. } @ 16, nColGet GET nSlry PICTURE "@Z 9999999.99" ; WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 0,0,0 ) ), .t. } // The only additional calls to render your console GUI // // The GETLIST : This can be embedded via @ GET preprocessor command aEval( GetList, {|oGet| Wvg_BoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) // hBoxR := Wvg_BoxRaised( 1,2,18,49, {-5,-5,5,5} ) // Wvg_BoxRecessed( 1,2,18,49 ) // // Wvg_BoxGroup( 2,4,17,47 ) // Wvg_BoxGroupRaised( 2,4,17,47, {-7,-7,7,7} ) // hTxt := Wvg_TextBox( 3,57,16,75, {10,10,-10,-10}, 'This is first TextBox Line!', 2, 2 ) // Wvg_Image( 15,36,16,42, {-3,-3,3,3}, GOBJ_IMAGESOURCE_FILE, 'Vouch1.bmp' ) // Wvg_BoxRaised( 15,36,16,42,{-2,-2,2,2} ) // Wvg_ShadedRect( 1,54,18,79, { -5,-5,5,5 }, 0, {65000,21000,7000,56000}, {255,32255,16000,32500} ) // Wvg_BoxRaised( 1,54,18,79, {-5,-5,5,5} ) // Instruct GT to Repaint the Screen with GUI elements. oCrt:refresh() // Issue the read READ Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) RETURN /*----------------------------------------------------------------------*/ #xUntranslate alert( => FUNCTION MyAlert( cMsg, aOpt ) LOCAL nSel, oCrt oCrt := WvgCrt():New( , , { -1,-1 }, { 9, MaxCol()-6 }, , .t. ) oCrt:lModal := .t. oCrt:icon := "dia_excl.ico" oCrt:create() oCrt:resizable := .t. SetColor( 'N/W' ) CLS hb_gtInfo( HB_GTI_WINTITLE, cMsg ) nSel := Alert( cMsg, aOpt ) oCrt:destroy() RETURN nSel #xTranslate Alert( => MyAlert( /*----------------------------------------------------------------------*/ STATIC FUNCTION FetchText( nMode ) LOCAL cText DO CASE CASE nMode == 1 cText := 'Do you know Harbour is gaining a popularity what Clipper enjoyed at one time! ' cText += 'Enjoy it.' CASE nMode == 2 cText := 'Do you know Harbour can host pure console, cui+gui console, pure gui consoles applications? ' cText += 'This demonstration is a proof of that.' CASE nMode == 3 cText := 'Do you know Harbour is a multi-gt, multi-window, multi-thread compiler far superior than others in the market! ' cText += 'And is FREE.' CASE nMode == 4 cText := 'Enjoy and contribute to the project any way you can. Develop, Debug, Support, and spread a word of mouth!' ENDCASE RETURN cText /*----------------------------------------------------------------------*/ */ ;TODO - Write a comprehensive help to exploit CUI-GUI functionality. Will do in a few days. --- harbour/ChangeLog | 188 +++ harbour/contrib/gtwvg/gtwvg.c | 225 ++-- harbour/contrib/gtwvg/gtwvg.h | 81 +- harbour/contrib/gtwvg/hbgtwvg.ch | 21 + harbour/contrib/gtwvg/tests/demowvg.prg | 175 ++- harbour/contrib/gtwvg/wvgcore.c | 190 ++- harbour/contrib/gtwvg/wvgcrt.prg | 52 +- harbour/contrib/gtwvg/wvgcuig.c | 1414 ++++++++++++++++++++--- harbour/contrib/gtwvg/wvggui.c | 19 +- harbour/contrib/gtwvg/wvggui.h | 2 + harbour/contrib/gtwvg/wvgsink.c | 19 +- harbour/contrib/gtwvg/wvgutils.c | 3 +- harbour/contrib/gtwvg/wvgwin.c | 485 ++------ 13 files changed, 2172 insertions(+), 702 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 316b9fb67e..879d751c0c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,194 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-03-15 16:42 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + + * harbour/contrib/gtwvg/hbgtwvg.ch + + #define HB_GTI_SETPOSANDSIZE + + #define HB_GTI_HB_GTI_REFRESH + + Two more events to manage new CUI-GUI objects. + + + #define GOBJ_OBJSTATE_* + + #define GOBJ_OBJDATA_* + + #define GOBJ_IMAGESOURCE_* + + Constants to manage CUI=GUI objects. + + * harbour/contrib/gtwvg/gtwvg.h + * harbour/contrib/gtwvg/wvggui.h + ! Updated to be compilable for WinCE builds. + + * harbour/contrib/gtwvg/gtwvg.c + ! Updated to honor WinCE builds. + ! Implemented double-buffering of console. Now flickering + should be the topic of the past. + + * harbour/contrib/gtwvg/wvggui.c + ! Updated to honor WinCE builds. + + * harbour/contrib/gtwvg/wvgcuig.c + + Implemented a highly optimized GUI controls for CUI consoles. + Implementation includes auto-destruction, data-substitution, + enable/disable feast, etc. These controls are almost identical + which are available with Wvt_Draw*() namespace but with a + great difference that these are tied to the urrent GT and + are handelled transparently by the GT itself. Developer + has only to define it. The only requirement is that + SaveScreen()/RestScreen() needs to be changed to new + Modal GT window. Appln screens will never get blurred. It + also employs optimized double-buffering and hence almost + eliminates screen flickering. + + * harbour/contrib/gtwvg/wvgcore.c + * harbour/contrib/gtwvg/wvgsink.c + * harbour/contrib/gtwvg/wvgutils.c + * harbour/contrib/gtwvg/wvgwin.c + ! Updated to honor WinCE builds. + + * harbour/contrib/gtwvg/wvgcrt.prg + ! A couple of methods fine-tuned. + ! Modal GT's more responsive to user needs. + + * harbour/contrib/gtwvg/tests/demowvg.prg + ! Demonstrated the latest implemention of CUI-GUI controls. See below. + Please try option in the main menu. + Also note the usage of Modal GT to simulate Alert() in new window. + Every GUI object returns a handle to it which may be used to + change its parameters. + + ; TOFIX( WINCE BUILDS ) - GetSystemDirectory() + + + /* IMPLEMENTATION OF CUI-GUI CONTROLS - A CODE PREVIEW + + + + #xTranslate Alert( => MyAlert( + + PROCEDURE GCUIConsole( oCrt ) + LOCAL dDate := date() + LOCAL cName := pad( 'Some Usefule Name' , 35 ) + LOCAL cAdd1 := pad( 'Linda Goldman Avenue', 35 ) + LOCAL cAdd2 := pad( 'Excellent Street' , 35 ) + LOCAL cAdd3 := pad( 'Suit #415' , 35 ) + LOCAL nSlry := 9000 + LOCAL nColGet := 8 + LOCAL GetList := {} + LOCAL cLabel := "VOUCH, that GROWS with you" + LOCAL oTab, oStat, hBoxR, hTxt + + SET SCOREBOARD OFF + + SetColor( "N/W,N/GR*,,,N/W*" ) + CLS + hb_gtInfo( HB_GTI_WINTITLE, "WVG Simplified yet Powerful CUI-GUI Console!" ) + + @ MaxRow(), 0 SAY PadC( "Navigate the Gets", maxcol()+1 ) COLOR "W+/B" + + @ 2, nColGet SAY "< Date >" + @ 5, nColGet SAY "<" + PadC( "Name" , 33 ) + ">" + @ 8, nColGet SAY "<" + PadC( "Address", 33 ) + ">" + @ 15, nColGet SAY "< Salary >" + + @ 3, nColGet GET dDate ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 1 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,0 ) ), .t. } + @ 6, nColGet GET cName ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 2 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,0 ) ), ; + Wvg_SetGObjState( hBoxR, 3 ), .t. } + @ 9, nColGet GET cAdd1 ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 3 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,255 ) ), .t. } + @ 11, nColGet GET cAdd2 ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 4 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,255 ) ), ; + Wvg_SetGObjState( hBoxR, 1 ), .t. } + @ 13, nColGet GET cAdd3 ; + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 198,21,140 ) ), .t. } + @ 16, nColGet GET nSlry PICTURE "@Z 9999999.99" ; + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 0,0,0 ) ), .t. } + + // The only additional calls to render your console GUI + // + // The GETLIST : This can be embedded via @ GET preprocessor command + aEval( GetList, {|oGet| Wvg_BoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) + // + hBoxR := Wvg_BoxRaised( 1,2,18,49, {-5,-5,5,5} ) + // + Wvg_BoxRecessed( 1,2,18,49 ) + // + // Wvg_BoxGroup( 2,4,17,47 ) + // + Wvg_BoxGroupRaised( 2,4,17,47, {-7,-7,7,7} ) + // + hTxt := Wvg_TextBox( 3,57,16,75, {10,10,-10,-10}, 'This is first TextBox Line!', 2, 2 ) + // + Wvg_Image( 15,36,16,42, {-3,-3,3,3}, GOBJ_IMAGESOURCE_FILE, 'Vouch1.bmp' ) + // + Wvg_BoxRaised( 15,36,16,42,{-2,-2,2,2} ) + // + Wvg_ShadedRect( 1,54,18,79, { -5,-5,5,5 }, 0, {65000,21000,7000,56000}, {255,32255,16000,32500} ) + // + Wvg_BoxRaised( 1,54,18,79, {-5,-5,5,5} ) + + // Instruct GT to Repaint the Screen with GUI elements. + oCrt:refresh() + + // Issue the read + READ + + Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) + + RETURN + /*----------------------------------------------------------------------*/ + #xUntranslate alert( => + + FUNCTION MyAlert( cMsg, aOpt ) + LOCAL nSel, oCrt + + oCrt := WvgCrt():New( , , { -1,-1 }, { 9, MaxCol()-6 }, , .t. ) + oCrt:lModal := .t. + oCrt:icon := "dia_excl.ico" + oCrt:create() + oCrt:resizable := .t. + + SetColor( 'N/W' ) + CLS + hb_gtInfo( HB_GTI_WINTITLE, cMsg ) + + nSel := Alert( cMsg, aOpt ) + + oCrt:destroy() + + RETURN nSel + + #xTranslate Alert( => MyAlert( + /*----------------------------------------------------------------------*/ + STATIC FUNCTION FetchText( nMode ) + LOCAL cText + + DO CASE + CASE nMode == 1 + cText := 'Do you know Harbour is gaining a popularity what Clipper enjoyed at one time! ' + cText += 'Enjoy it.' + CASE nMode == 2 + cText := 'Do you know Harbour can host pure console, cui+gui console, pure gui consoles applications? ' + cText += 'This demonstration is a proof of that.' + CASE nMode == 3 + cText := 'Do you know Harbour is a multi-gt, multi-window, multi-thread compiler far superior than others in the market! ' + cText += 'And is FREE.' + CASE nMode == 4 + cText := 'Enjoy and contribute to the project any way you can. Develop, Debug, Support, and spread a word of mouth!' + ENDCASE + + RETURN cText + /*----------------------------------------------------------------------*/ + */ + + ;TODO - Write a comprehensive help to exploit CUI-GUI functionality. + Will do in a few days. + + 2009-03-16 00:38 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * bin/postinst.bat + Added owatcom and pocc support for implib generation. diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 6df5c6a481..ff530e6eb4 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -127,6 +127,7 @@ static void hb_wvt_gtCreateToolTipWindow( PHB_GTWVT pWVT ); static void hb_wvt_gtHandleMenuSelection( PHB_GTWVT pWVT, int ); static void hb_wvt_gtSaveGuiState( PHB_GTWVT pWVT ); static void hb_wvt_gtRestGuiState( PHB_GTWVT pWVT, LPRECT rect ); +static void hb_wvt_gtRestScreen( PHB_GTWVT pWVT ); static void hb_wvt_gtLoadGuiData( void ); static void hb_wvt_gtReleaseGuiData( void ); @@ -243,8 +244,8 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) if( pWVT->hFontBox && pWVT->hFontBox != pWVT->hFont ) DeleteObject( pWVT->hFontBox ); #endif - if( pWVT->hFont ) - DeleteObject( pWVT->hFont ); + //if( pWVT->hFont ) + //DeleteObject( pWVT->hFont ); // Detach PRG callback pWVT->pSymWVT_PAINT = NULL; @@ -270,10 +271,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) hb_itemRelease( pWVT->pPP->pParentGT ); hb_xfree( pWVT->pPP ); - if( pWVT->hWnd ) - DestroyWindow( pWVT->hWnd ); - - if( pWVT->hIcon && pWVT->bIconToFree ) + if( pWVT->hIcon ) DestroyIcon( pWVT->hIcon ); if( pWVT->gObjs ) @@ -283,11 +281,31 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) while( pWVT->gObjs ) { gObj = pWVT->gObjs->gObjNext; + + if( pWVT->gObjs->lpText != NULL ) + HB_TCHAR_FREE( pWVT->gObjs->lpText ); + if( pWVT->gObjs->hFont ) + if( pWVT->gObjs->bDestroyFont ) + DeleteObject( pWVT->gObjs->hFont ); + if( pWVT->gObjs->hPen ) + if( pWVT->gObjs->bDestroyPen ) + DeleteObject( pWVT->gObjs->hPen ); + if( pWVT->gObjs->hBrush ) + if( pWVT->gObjs->bDestroyBrush ) + DeleteObject( pWVT->gObjs->hBrush ); +#if ! defined( HB_OS_WIN_CE ) + if( pWVT->gObjs->iPicture ) + if( pWVT->gObjs->bDestroyPicture ) + pWVT->gObjs->iPicture->lpVtbl->Release( pWVT->gObjs->iPicture ); +#endif hb_xfree( pWVT->gObjs ); pWVT->gObjs = gObj; } } + if( pWVT->hWnd ) + DestroyWindow( pWVT->hWnd ); + hb_xfree( pWVT ); } @@ -411,6 +429,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->pGUI = s_guiData; pWVT->gObjs = NULL; + pWVT->hWndParent = NULL; return pWVT; } @@ -1293,12 +1312,14 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L } if( !pWVT->bTracking ) { +#if ! defined( HB_OS_WIN_CE ) TRACKMOUSEEVENT tmi; tmi.cbSize = sizeof( TRACKMOUSEEVENT ); tmi.dwFlags = TME_LEAVE | TME_HOVER ; tmi.hwndTrack = pWVT->hWnd; tmi.dwHoverTime = 1; pWVT->bTracking = _TrackMouseEvent( &tmi ); +#endif } break; } @@ -1735,13 +1756,6 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) return; } - hdc = BeginPaint( pWVT->hWnd, &ps ); - SelectObject( hdc, pWVT->hFont ); - if( pWVT->bGui ) - { - SelectObject( pWVT->hGuiDC, pWVT->hFont ); - } - rcRect = hb_gt_wvt_GetColRowFromXYRect( pWVT, updateRect ); /* Required, GUI Paint mechanism is based on it */ pWVT->rowStart = rcRect.top ; @@ -1749,6 +1763,10 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) pWVT->colStart = rcRect.left ; pWVT->colStop = rcRect.right ; + BeginPaint( pWVT->hWnd, &ps ); + hdc = pWVT->hGuiDC; + SelectObject( hdc, pWVT->hFont ); + for( iRow = rcRect.top; iRow <= rcRect.bottom; ++iRow ) { iCol = startCol = rcRect.left; @@ -1759,7 +1777,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) if( !HB_GTSELF_GETSCRCHAR( pWVT->pGT, iRow, iCol, &bColor, &bAttr, &usChar ) ) break; -#if defined( UNICODE ) + #if defined( UNICODE ) usChar = hb_cdpGetU16( bAttr & HB_GT_ATTR_BOX ? pWVT->boxCDP : pWVT->hostCDP, TRUE, ( BYTE ) usChar ); if( len == 0 ) { @@ -1772,7 +1790,7 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) startCol = iCol; len = 0; } -#else + #else usChar = pWVT->chrTransTbl[ usChar & 0xFF ]; if( len == 0 ) { @@ -1783,10 +1801,6 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) else if( bColor != bOldColor || bAttr != bOldAttr ) { hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len ); - if( pWVT->bGui ) - { - hb_gt_wvt_TextOut( pWVT, pWVT->hGuiDC, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len ); - } if( bAttr != bOldAttr ) { SelectObject( hdc, ( bAttr & HB_GT_ATTR_BOX ) ? pWVT->hFontBox : pWVT->hFont ); @@ -1796,25 +1810,23 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) startCol = iCol; len = 0; } -#endif + #endif text[ len++ ] = ( TCHAR ) usChar; iCol++; } if( len > 0 ) - { hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len ); - if( pWVT->bGui ) - { - hb_gt_wvt_TextOut( pWVT, pWVT->hGuiDC, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len ); - } - } } + /* Transfer on screen from bitmap */ + BitBlt( pWVT->hdc, updateRect.left, updateRect.top, + updateRect.right - updateRect.left, updateRect.bottom - updateRect.top, + pWVT->hGuiDC, updateRect.left, updateRect.top, SRCCOPY ); + /* Paint Graphic Objects Supporting CUI Elements */ hb_gt_wvt_PaintGObjects( pWVT, &updateRect ); - EndPaint( pWVT->hWnd, &ps ); - + /* Tell PRG code to execute paint objects - Wvt_Draw*() */ if( pWVT->bPaint ) { if( pWVT->pSymWVT_PAINT ) @@ -1832,6 +1844,8 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) { pWVT->bPaint = TRUE; } + + EndPaint( pWVT->hWnd, &ps ); } static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) @@ -1912,11 +1926,9 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case WM_SETFOCUS: hb_gt_wvt_UpdateCaret( pWVT ); - if( pWVT->bGui ) - { - pWVT->bSetFocus = TRUE; - pWVT->bKillFocus = FALSE; - } + pWVT->bSetFocus = TRUE; + pWVT->bKillFocus = FALSE; + if( pWVT->bGetFocus ) { if( pWVT->pSymWVT_SETFOCUS ) @@ -1949,10 +1961,8 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case WM_KILLFOCUS: hb_gt_wvt_KillCaret( pWVT ); - if( pWVT->bGui ) - { - pWVT->bKillFocus = TRUE; - } + pWVT->bKillFocus = TRUE; + if( pWVT->pSymWVT_KILLFOCUS ) { if( hb_vmRequestReenter() ) @@ -2154,6 +2164,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_FireMenuEvent( pWVT, 2, ( int ) wParam ); return 0; } +#if ! defined( HB_OS_WIN_CE ) case WM_MOUSEHOVER: { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -2180,6 +2191,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara pWVT->bTracking = FALSE; return DefWindowProc( hWnd, message, wParam, lParam );; } +#endif case WM_NOTIFY: { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -2311,6 +2323,21 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, BOOL bResizable ) RECT rc; POINT pt; + pWVT->hWndParent = hWndParent; + + // Inherit attributes from parent + // + pWVT->PTEXTSIZE.x = pWVTp->PTEXTSIZE.x; + pWVT->PTEXTSIZE.y = pWVTp->PTEXTSIZE.y; + pWVT->fontWidth = pWVTp->fontWidth; + pWVT->fontHeight = pWVTp->fontHeight; + pWVT->fontWeight = pWVTp->fontWeight; + pWVT->fontQuality = pWVTp->fontQuality; + pWVT->CodePage = pWVTp->CodePage; + hb_strncpy( pWVT->fontFace, pWVTp->fontFace, sizeof( pWVTp->fontFace ) - 1 ); + pWVT->hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, + pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); + if( pWVT->pPP->y < 0 ) { GetClientRect( hWndParent, &rc ); @@ -2319,8 +2346,8 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, BOOL bResizable ) pWVT->ROWS = pWVT->pPP->width; pWVT->COLS = pWVT->pPP->height; - pt.x = ( rc.right-rc.left + 1 - ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) / 2; - pt.y = ( rc.bottom-rc.top + 1 - ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) / 2; + pt.x = ( rc.right-rc.left + 1 - ( pWVTp->PTEXTSIZE.x * pWVT->COLS ) ) / 2; + pt.y = ( rc.bottom-rc.top + 1 - ( pWVTp->PTEXTSIZE.y * pWVT->ROWS ) ) / 2; } else { @@ -2330,17 +2357,17 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, BOOL bResizable ) } else { - GetClientRect( hWndParent, &rc ); if( pWVT->pPP->bRowCols ) { pWVT->ROWS = pWVT->pPP->width; pWVT->COLS = pWVT->pPP->height; - pt.x = rc.left + ( pWVTp->PTEXTSIZE.x * pWVT->pPP->y ); - pt.y = rc.top + ( pWVTp->PTEXTSIZE.y * pWVT->pPP->x ); + pt.x = ( pWVTp->PTEXTSIZE.x * pWVT->pPP->y ); + pt.y = ( pWVTp->PTEXTSIZE.y * pWVT->pPP->x ); } else { + GetWindowRect( hWndParent, &rc ); pt.x = rc.left + pWVT->pPP->x; pt.y = rc.top + pWVT->pPP->y; } @@ -2443,7 +2470,9 @@ static BOOL hb_gt_wvt_CreateConsoleWindow( PHB_GTWVT pWVT ) } } #endif + hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS ); + /* Set icon */ if( pWVT->hIcon ) { @@ -2995,7 +3024,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { if( ( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) ) { - HICON hIconToFree = ( pWVT->hIcon && pWVT->bIconToFree ) ? pWVT->hIcon : NULL; + //HICON hIconToFree = ( pWVT->hIcon && pWVT->bIconToFree ) ? pWVT->hIcon : NULL; + HICON hIconToFree = pWVT->hIcon; LPTSTR lpImage; lpImage = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) ); @@ -3020,7 +3050,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING ) { - HICON hIconToFree = ( pWVT->hIcon && pWVT->bIconToFree ) ? pWVT->hIcon : NULL; + //HICON hIconToFree = ( pWVT->hIcon && pWVT->bIconToFree ) ? pWVT->hIcon : NULL; + HICON hIconToFree = pWVT->hIcon; LPTSTR lpIcon; lpIcon = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) ); @@ -3129,6 +3160,23 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; } + case HB_GTI_SETPOSANDSIZE: + { + int iX, iY, iW, iH; + + iX = hb_arrayGetNI( pInfo->pNewVal,1 ); + iY = hb_arrayGetNI( pInfo->pNewVal,2 ); + + iW = hb_arrayGetNI( pInfo->pNewVal2,1 ); + iH = hb_arrayGetNI( pInfo->pNewVal2,2 ); + + SetWindowPos( pWVT->hWnd, NULL, iX, iY, iW, iH, SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOZORDER ); + + hb_gt_wvt_FitSize( pWVT ); + + hb_wvt_gtSaveGuiState( pWVT ); + break; + } case HB_GTI_RESIZABLE: pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bResizable ); if( pInfo->pNewVal ) @@ -3471,7 +3519,9 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } case HB_GTS_WS_MINIMIZED: +#if ! defined( HB_OS_WIN_CE ) SendNotifyMessage( pWVT->hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 ); +#endif break; case HB_GTS_WS_MAXIMIZED: @@ -3496,7 +3546,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { if( pWVT->hWnd ) { -#if ( _WIN32_WINNT >= 0x0500 ) +#if ( _WIN32_WINNT >= 0x0500 ) && ! defined( HB_OS_WIN_CE ) if ( s_guiData->pfnLayered ) { SetWindowLong( pWVT->hWnd, @@ -3631,6 +3681,12 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { pWVT->bBeginMarked = TRUE; } + break; + } + case HB_GTI_REFRESH: + { + if( pWVT->hWnd ) + InvalidateRect( pWVT->hWnd, NULL, FALSE ); } default: return HB_GTSUPER_INFO( pGT, iType, pInfo ); @@ -3817,7 +3873,7 @@ static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize ) if( pWVT->hWnd ) { RECT rect; - +//hb_ToOutDebug( "hb_gt_wvt_Redraw( PHB_GT pGT, iRow=%i, iCol=%i, iSize=%i)", iRow,iCol, iSize ); rect.top = rect.bottom = ( SHORT ) iRow; rect.left = ( SHORT ) iCol; rect.right = ( SHORT ) ( iCol + iSize - 1 ); @@ -4055,7 +4111,11 @@ static void hb_wvt_gtLoadGuiData( void ) s_guiData->penGray = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 198,198,198 ) ); s_guiData->penNull = CreatePen( PS_NULL , 0, ( COLORREF ) RGB( 198,198,198 ) ); +#if ! defined( HB_OS_WIN_CE ) s_guiData->diagonalBrush = CreateHatchBrush( HS_DIAGCROSS, RGB( 210,210,210 ) ); +#else + s_guiData->diagonalBrush = CreateSolidBrush( RGB( 210,210,210 ) ); +#endif s_guiData->solidBrush = CreateSolidBrush( RGB( 0,0,0 ) ); s_guiData->whiteBrush = CreateSolidBrush( RGB( 198,198,198 ) ); @@ -4114,7 +4174,7 @@ static void hb_wvt_gtReleaseGuiData( void ) FreeLibrary( s_guiData->hUser32 ); s_guiData->hUser32 = NULL; } - +#if ! defined( HB_OS_WIN_CE ) for( i = 0; i < WVT_PICTURES_MAX; i++ ) { if( s_guiData->iPicture[ i ] ) @@ -4123,7 +4183,7 @@ static void hb_wvt_gtReleaseGuiData( void ) s_guiData->iPicture[ i ] = NULL; } } - +#endif for( i = 0; i < WVT_FONTS_MAX; i++ ) { if( s_guiData->hUserFonts[ i ] ) @@ -4148,7 +4208,6 @@ static void hb_wvt_gtReleaseGuiData( void ) static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) { - LOGBRUSH lb; int iIndex; pWVT->bDeferPaint = FALSE; @@ -4156,11 +4215,17 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) pWVT->currentPen = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 0, 0, 0 ) ); // - lb.lbStyle = BS_NULL; - lb.lbColor = RGB( 198,198,198 ); - lb.lbHatch = 0; - pWVT->currentBrush = CreateBrushIndirect( &lb ); - +#if ! defined( HB_OS_WIN_CE ) + { + LOGBRUSH lb; + lb.lbStyle = BS_NULL; + lb.lbColor = RGB( 198,198,198 ); + lb.lbHatch = 0; + pWVT->currentBrush = CreateBrushIndirect( &lb ); + } +#else + pWVT->currentBrush = GetStockObject( NULL_BRUSH ); +#endif /* GUI members of global structure */ pWVT->LastMenuEvent = 0; pWVT->MenuKeyEvent = 1024; @@ -4194,6 +4259,7 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) } pWVT->bGui = FALSE; + pWVT->bPaint = FALSE; pWVT->bGetFocus = FALSE; pWVT->bSetFocus = FALSE; @@ -4203,14 +4269,13 @@ static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT ) static void hb_wvt_gtExitGui( PHB_GTWVT pWVT ) { int i; - HMENU hMenu; - - hMenu = GetMenu( pWVT->hWnd ); +#if ! defined( HB_OS_WIN_CE ) + HMENU hMenu = GetMenu( pWVT->hWnd ); if( hMenu ) { DestroyMenu( hMenu ); } - +#endif for( i = 0; i < WVT_DLGML_MAX; i++ ) { if( pWVT->hDlgModeless[ i ] ) @@ -4259,9 +4324,7 @@ static void hb_wvt_gtInitGui( PHB_GTWVT pWVT ) pWVT->iGuiHeight = pWVT->ROWS * pWVT->PTEXTSIZE.y; if( pWVT->hGuiDC ) - { DeleteDC( pWVT->hGuiDC ); - } pWVT->hGuiDC = CreateCompatibleDC( pWVT->hdc ); if( pWVT->hGuiBmp ) @@ -4277,43 +4340,29 @@ static void hb_wvt_gtInitGui( PHB_GTWVT pWVT ) static void hb_wvt_gtRestGuiState( PHB_GTWVT pWVT, LPRECT rect ) { - if( pWVT->bGui ) - { - BitBlt( pWVT->hdc, rect->left, rect->top, - rect->right - rect->left, rect->bottom - rect->top, - pWVT->hGuiDC, rect->left, rect->top, SRCCOPY ); - } + BitBlt( pWVT->hdc, rect->left, rect->top, + rect->right - rect->left, rect->bottom - rect->top, + pWVT->hGuiDC, rect->left, rect->top, SRCCOPY ); } static void hb_wvt_gtSaveGuiState( PHB_GTWVT pWVT ) { - if( pWVT->bGui ) - { - RECT rc = { 0, 0, 0, 0 }; + RECT rc = { 0, 0, 0, 0 }; - GetClientRect( pWVT->hWnd, &rc ); + GetClientRect( pWVT->hWnd, &rc ); - pWVT->iGuiWidth = rc.right - rc.left; - pWVT->iGuiHeight = rc.bottom - rc.top; + pWVT->iGuiWidth = rc.right - rc.left; + pWVT->iGuiHeight = rc.bottom - rc.top; - if( pWVT->hGuiDC ) - { - DeleteDC( pWVT->hGuiDC ); - } - pWVT->hGuiDC = CreateCompatibleDC( pWVT->hdc ); + if( pWVT->hGuiBmp ) + DeleteObject( pWVT->hGuiBmp ); + pWVT->hGuiBmp = CreateCompatibleBitmap( pWVT->hdc, pWVT->iGuiWidth, pWVT->iGuiHeight ); + SelectObject( pWVT->hGuiDC, pWVT->hGuiBmp ); - if( pWVT->hGuiBmp ) - { - DeleteObject( pWVT->hGuiBmp ); - } - pWVT->hGuiBmp = CreateCompatibleBitmap( pWVT->hdc, pWVT->iGuiWidth, pWVT->iGuiHeight ); - SelectObject( pWVT->hGuiDC, pWVT->hGuiBmp ); + BitBlt( pWVT->hGuiDC, 0, 0, pWVT->iGuiWidth, pWVT->iGuiHeight, pWVT->hdc, 0, 0, SRCCOPY ); - BitBlt( pWVT->hGuiDC, 0, 0, pWVT->iGuiWidth, pWVT->iGuiHeight, pWVT->hdc, 0, 0, SRCCOPY ); - - SetTextCharacterExtra( pWVT->hGuiDC,0 ); - SelectObject( pWVT->hGuiDC, pWVT->hFont ); - } + SetTextCharacterExtra( pWVT->hGuiDC,0 ); + SelectObject( pWVT->hGuiDC, pWVT->hFont ); } static void hb_wvt_gtHandleMenuSelection( PHB_GTWVT pWVT, int menuIndex ) diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index 757873cfae..935be7e238 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -75,7 +75,9 @@ #include #include #include +#if ! defined( HB_OS_WIN_CE ) #include +#endif #include #include @@ -217,9 +219,11 @@ HB_EXTERN_BEGIN #ifdef __cplusplus extern "C" { STDAPI OleLoadPicture(LPSTREAM,LONG,BOOL,REFIID,PVOID*); } #else +#if ! defined( HB_OS_WIN_CE ) STDAPI OleLoadPicture(LPSTREAM,LONG,BOOL,REFIID,PVOID*); #endif #endif +#endif #endif /* __BORLANDC__ */ //-------------------------------------------------------------------// @@ -253,23 +257,56 @@ typedef struct #define GOBJ_OBJTYPE_BOXGET 3 #define GOBJ_OBJTYPE_BOXGROUP 4 #define GOBJ_OBJTYPE_BOXGROUPRAISED 5 +#define GOBJ_OBJTYPE_PICTURE 6 +#define GOBJ_OBJTYPE_LINE 7 +#define GOBJ_OBJTYPE_LINEEX 8 +#define GOBJ_OBJTYPE_LABEL 9 +#define GOBJ_OBJTYPE_LABELEX 10 +#define GOBJ_OBJTYPE_OUTLINE 11 +#define GOBJ_OBJTYPE_ELLIPSE 12 +#define GOBJ_OBJTYPE_RECTANGLE 13 +#define GOBJ_OBJTYPE_ROUNDRECT 14 +#define GOBJ_OBJTYPE_COLORRECT 15 +#define GOBJ_OBJTYPE_SHADEDRECT 16 +#define GOBJ_OBJTYPE_TEXTBOX 17 +#define GOBJ_OBJTYPE_OUTLINEEX 18 typedef struct _tag_GOBJS { - int iObjType ; - int iTop ; - int iLeft ; - int iBottom ; - int iRight ; - int iHeight ; - int iWidth ; // iThick - int iOrient ; - int iFormat ; - int iStyle ; // iShape - HB_GOBJ_OFFSET aOffset ; - COLORREF crRGB ; + int iObjType ; + int iHandle ; + int iState ; + int iTop ; + int iLeft ; + int iBottom ; + int iRight ; + HB_GOBJ_OFFSET aOffset ; + int iHeight ; + int iWidth ; // iThick + int iOrient ; + int iAlign ; + int iAlignVert ; + int iFormat ; + int iStyle ; // iShape + int iData ; // iSlot, etc + COLORREF crRGB ; + COLORREF crRGBText ; + COLORREF crRGBBk ; + HFONT hFont ; + HPEN hPen ; + HBRUSH hBrush ; +#if ! defined( HB_OS_WIN_CE ) + IPicture * iPicture ; +#endif + BOOL bDestroyFont ; + BOOL bDestroyPen ; + BOOL bDestroyBrush ; + BOOL bDestroyPicture ; + TRIVERTEX vert[ 2 ] ; + LPTSTR lpText ; struct _tag_GOBJS * gObjNext ; -} HB_GOBJS, * PHB_GOBJS ; + +} HB_GOBJS, * PHB_GOBJS ; typedef struct { @@ -297,7 +334,9 @@ typedef struct HBRUSH diagonalBrush; // Handle to diaoganl brush to draw scrollbars HBRUSH solidBrush; // Handle to solid brush HBRUSH whiteBrush; // Wvt specific White colored brush +#if ! defined( HB_OS_WIN_CE ) IPicture *iPicture[ WVT_PICTURES_MAX ]; // Array to hold the Picture Streams to avoid recurring loading and unloading +#endif HFONT hUserFonts[ WVT_FONTS_MAX ] ; // User defined font handles HPEN hUserPens[ WVT_PENS_MAX ]; // User defined pens HINSTANCE hMSImg32; // Handle to the loaded library msimg32.dll @@ -397,6 +436,7 @@ typedef struct HDC hdc; // Handle to Windows Device Context HDC hCompDC; // Compatible DC to _s.hdc + HDC hWndDC; int LastMenuEvent; // Last menu item selected int MenuKeyEvent; // User definable event number for windows menu command @@ -451,6 +491,8 @@ typedef struct PHB_GOBJS gObjs; // Graphic Objects + HWND hWndParent; // Parent Window Handle, if any + } HB_GTWVT, * PHB_GTWVT; //----------------------------------------------------------------------// @@ -559,11 +601,21 @@ typedef struct _tag_HB_GT_COLDEF # define SC_MAXIMIZE 0xF030 #endif +#if defined( HB_OS_WIN_CE ) + BOOL SetMenu( HWND hWnd, HMENU hMenu ); + HMENU GetMenu( HWND hWnd ); + + #define LR_LOADMAP3DCOLORS 0 + #define SWP_NOREDRAW 0 +#endif + POINT HB_EXPORT hb_wvt_gtGetXYFromColRow( USHORT col, USHORT row ); +#if ! defined( HB_OS_WIN_CE ) IPicture HB_EXPORT * hb_wvt_gtLoadPicture( char * image ); IPicture HB_EXPORT * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection ); BOOL HB_EXPORT hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture ); BOOL HB_EXPORT hb_wvt_gtDestroyPicture( IPicture * iPicture ); +#endif BOOL HB_EXPORT hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image ); LPWORD HB_EXPORT lpwAlign( LPWORD lpIn ); @@ -578,7 +630,8 @@ PHB_GTWVT HB_EXPORT hb_wvt_gtGetWVT( void ); void HB_EXPORT hb_ToOutDebug( const char * sTraceMsg, ... ); -void hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ); +void HB_EXPORT hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ); + //----------------------------------------------------------------------// extern BOOL wvt_Array2Rect(PHB_ITEM aRect, RECT *rc ); diff --git a/harbour/contrib/gtwvg/hbgtwvg.ch b/harbour/contrib/gtwvg/hbgtwvg.ch index 4eda1d340b..143780d8d8 100644 --- a/harbour/contrib/gtwvg/hbgtwvg.ch +++ b/harbour/contrib/gtwvg/hbgtwvg.ch @@ -82,6 +82,8 @@ #define HB_GTI_SETFOCUS 75 #define HB_GTI_DEFERPAINT 76 #define HB_GTI_ACTIVATESELECTCOPY 77 +#define HB_GTI_SETPOSANDSIZE 78 +#define HB_GTI_REFRESH 79 /* Presentation Parameters | HB_GTI_PRESPARAMS */ #define HB_GTI_PP_EXSTYLE 1 @@ -140,6 +142,25 @@ #define HB_GTI_GUI 1001 +/* Constants to manage CUI-GUI objects */ +#define GOBJ_OBJSTATE_ENABLED 1 +#define GOBJ_OBJSTATE_DISABLED 2 +#define GOBJ_OBJSTATE_HIDDEN 3 +#define GOBJ_OBJSTATE_HILIGHTED 4 + +#define GOBJ_OBJDATA_TEXT 1 +#define GOBJ_OBJDATA_PICTURE 2 +#define GOBJ_OBJDATA_HFONT 3 +#define GOBJ_OBJDATA_HPEN 4 +#define GOBJ_OBJDATA_HBRUSH 5 +#define GOBJ_OBJDATA_COLORTEXT 6 +#define GOBJ_OBJDATA_COLORBK 7 +#define GOBJ_OBJDATA_IMAGE 8 + +#define GOBJ_IMAGESOURCE_SLOT 1 +#define GOBJ_IMAGESOURCE_RESOURCE 2 +#define GOBJ_IMAGESOURCE_FILE 3 + /*----------------------------------------------------------------------*/ #endif /* _HBGTWVG_CH */ diff --git a/harbour/contrib/gtwvg/tests/demowvg.prg b/harbour/contrib/gtwvg/tests/demowvg.prg index fc6d9e174c..0c871916e4 100644 --- a/harbour/contrib/gtwvg/tests/demowvg.prg +++ b/harbour/contrib/gtwvg/tests/demowvg.prg @@ -172,7 +172,9 @@ PROCEDURE Main() CLS Wvt_ShowWindow( SW_RESTORE ) -//smain() +// EditMemo() + +// smain() SetKey( K_F12 , {|| hb_gtInfo( HB_GTI_ACTIVATESELECTCOPY ) } ) SetKey( K_CTRL_V , {|| __KeyBoard( hb_gtInfo( HB_GTI_CLIPBOARDDATA ) ) } ) @@ -774,14 +776,18 @@ FUNCTION WvtMyBrowse_X( oCrt ) LOCAL nRow := row() LOCAL nCol := col() LOCAL cColor := SetColor( "N/W*,N/GR*,,,N/W*" ) - LOCAL cScr := SaveScreen( 0,0,maxrow(),maxcol() ) LOCAL aObjects:= WvtSetObjects( {} ) LOCAL hPopup := Wvt_SetPopupMenu() LOCAL stru_:={}, cFileIndex, cFileDbf, cRDD, nIndex, oTBar + LOCAL cScr STATIC nStyle := 0 THREAD STATIC nFactor := 200 + IF oCrt == NIL + cScr := SaveScreen( 0,0,maxrow(),maxcol() ) + ENDIF + BrwBuildMenu( oCrt ) oTBar := ActiveXBuildToolBar( oCrt ) @@ -908,7 +914,9 @@ FUNCTION WvtMyBrowse_X( oCrt ) SetCursor( nCursor ) DBCloseArea() - RestScreen( 0, 0, maxrow(), maxcol(), cScr ) + IF oCrt == NIL + RestScreen( 0, 0, maxrow(), maxcol(), cScr ) + ENDIF Wvt_setPopupMenu( hPopup ) s_pGT_[ 2 ] := NIL @@ -3437,7 +3445,7 @@ STATIC FUNCTION ExeFontDialog( oCrt ) #if 1 // Every 2nd FontDialog will be MODAL oWvgFont := oFontDlg:display( ++nMode % 2 ) - hb_ToOutDebug( '%s %i', oWvgFont:compoundName, oWvgFont:nominalPointSize ) +// hb_ToOutDebug( '%s %i', oWvgFont:compoundName, oWvgFont:nominalPointSize ) #endif oFontDlg:destroy() @@ -3861,6 +3869,7 @@ PROCEDURE ExecGCUI() IF hb_mtvm() Hb_ThreadStart( {|oCrt| oCrt := WvgCrt():New( , , { 2,4 }, { 20,81 }, , .t. ) , ; + oCrt:icon := "dia_excl.ico",; oCrt:create(), ; GCUIConsole( oCrt ) , ; oCrt:destroy() } ) @@ -3872,67 +3881,79 @@ PROCEDURE ExecGCUI() #xTranslate Alert( => MyAlert( PROCEDURE GCUIConsole( oCrt ) - LOCAL dDate := ctod( "" ) - LOCAL cName := Space( 35 ) - LOCAL cAdd1 := Space( 35 ) - LOCAL cAdd2 := Space( 35 ) - LOCAL cAdd3 := Space( 35 ) - LOCAL nSlry := 0 + LOCAL dDate := date() + LOCAL cName := pad( 'Some Usefule Name' , 35 ) + LOCAL cAdd1 := pad( 'Linda Goldman Avenue', 35 ) + LOCAL cAdd2 := pad( 'Excellent Street' , 35 ) + LOCAL cAdd3 := pad( 'Suit #415' , 35 ) + LOCAL nSlry := 9000 LOCAL nColGet := 8 LOCAL GetList := {} LOCAL cLabel := "VOUCH, that GROWS with you" - LOCAL oTab, oStat + LOCAL oTab, oStat, hBoxR, hTxt + + SET SCOREBOARD OFF SetColor( "N/W,N/GR*,,,N/W*" ) CLS - hb_gtInfo( HB_GTI_WINTITLE, "WVG Simplified GUI Console" ) + hb_gtInfo( HB_GTI_WINTITLE, "WVG Simplified yet Powerful CUI-GUI Console!" ) - oTab := WvgTabPage():New( oCrt, , { 430, 9 }, { 210, 301 }, , .t. ) - oTab:caption := 'First' - oTab:minimized := .f. - oTab:create() - oTab:tabActivate := {|mp1,mp2,oTab| oTab:Show() } - - oStat := WvgStatic():New( oTab, , { 10, 30 }, { 190, 50 }, , .t. ) - oStat:type := WVGSTATIC_TYPE_TEXT - oStat:options := WVGSTATIC_TEXT_CENTER - oStat:caption := 'This is first caption' - oStat:create() - oStat:setColorBG( RGB( 240, 255, 0 ) ) - - @ MaxRow(), 0 SAY PadC( "GTWVG Simplified GUI Console", maxcol()+1 ) COLOR "W+/B*" + @ MaxRow(), 0 SAY PadC( "Navigate the Gets", maxcol()+1 ) COLOR "W+/B" @ 2, nColGet SAY "< Date >" @ 5, nColGet SAY "<" + PadC( "Name" , 33 ) + ">" @ 8, nColGet SAY "<" + PadC( "Address", 33 ) + ">" @ 15, nColGet SAY "< Salary >" - @ 3, nColGet GET dDate Valid {|| Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) == 1 } - @ 6, nColGet GET cName Valid {|| oTab:hide(), .t. } - @ 9, nColGet GET cAdd1 Valid {|| oTab:show(), .t. } - @ 11, nColGet GET cAdd2 Valid {|| oTab:hide(), .t. } - @ 13, nColGet GET cAdd3 Valid {|| oTab:show(), .t. } - @ 16, nColGet GET nSlry PICTURE "@Z 9999999.99" + @ 3, nColGet GET dDate ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 1 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,0 ) ), .t. } + @ 6, nColGet GET cName ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 2 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,0 ) ), ; + Wvg_SetGObjState( hBoxR, 3 ), .t. } + @ 9, nColGet GET cAdd1 ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 3 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,0,255 ) ), .t. } + @ 11, nColGet GET cAdd2 ; + WHEN {|| Wvg_SetGObjData( hTxt, 1, FetchText( 4 ) ) } ; + Valid {|| Wvg_SetGObjData( hTxt, 6, RGB( 255,255,255 ) ), ; + Wvg_SetGObjState( hBoxR, 1 ), .t. } + @ 13, nColGet GET cAdd3 ; + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 198,21,140 ) ), .t. } + @ 16, nColGet GET nSlry PICTURE "@Z 9999999.99" ; + WHEN {|| Wvg_SetGObjData( hTxt, 6, RGB( 0,0,0 ) ), .t. } // The only additional calls to render your console GUI // // The GETLIST : This can be embedded via @ GET preprocessor command aEval( GetList, {|oGet| Wvg_BoxGet( oGet:Row, oGet:Col, Len( Transform( oGet:VarGet(), oGet:Picture ) ) ) } ) // - Wvg_BoxRaised( 1, 2, 18, 49, { -5,-5,5,5 } ) + hBoxR := Wvg_BoxRaised( 1,2,18,49, {-5,-5,5,5} ) // - Wvg_BoxRecessed( 1, 2, 18, 49 ) + Wvg_BoxRecessed( 1,2,18,49 ) // - // Wvg_BoxGroup( 2, 4, 17, 47 ) + // Wvg_BoxGroup( 2,4,17,47 ) // - Wvg_BoxGroupRaised( 2, 4, 17, 47, { -7,-7,7,7 } ) + Wvg_BoxGroupRaised( 2,4,17,47, {-7,-7,7,7} ) + // + hTxt := Wvg_TextBox( 3,57,16,75, {10,10,-10,-10}, 'This is first TextBox Line!', 2, 2 ) + // + Wvg_Image( 15,36,16,42, {-3,-3,3,3}, GOBJ_IMAGESOURCE_FILE, 'Vouch1.bmp' ) + Wvg_BoxRaised( 15,36,16,42,{-2,-2,2,2} ) + // + Wvg_ShadedRect( 1,54,18,79, { -5,-5,5,5 }, 0, {65000,21000,7000,56000}, {255,32255,16000,32500} ) + // + Wvg_BoxRaised( 1,54,18,79, {-5,-5,5,5} ) // Instruct GT to Repaint the Screen with GUI elements. - Wvt_InvalidateRect( 0, 0, maxrow(), maxcol() ) + oCrt:refresh() // Issue the read READ + Alert( 'How did you like the "Alert" replacement?', { 'WOW','OK','OOps'} ) + RETURN /*----------------------------------------------------------------------*/ #xUntranslate alert( => @@ -3940,7 +3961,7 @@ PROCEDURE GCUIConsole( oCrt ) FUNCTION MyAlert( cMsg, aOpt ) LOCAL nSel, oCrt - oCrt := WvgCrt():New( , , { -1,-1 }, { 9, MaxCol()-4 }, , .t. ) + oCrt := WvgCrt():New( , , { -1,-1 }, { 9, MaxCol()-6 }, , .t. ) oCrt:lModal := .t. oCrt:icon := "dia_excl.ico" oCrt:create() @@ -3958,4 +3979,82 @@ FUNCTION MyAlert( cMsg, aOpt ) #xTranslate Alert( => MyAlert( /*----------------------------------------------------------------------*/ +STATIC FUNCTION FetchText( nMode ) + LOCAL cText + + DO CASE + CASE nMode == 1 + cText := 'Do you know Harbour is gaining a popularity what Clipper enjoyed at one time! ' + cText += 'Enjoy it.' + CASE nMode == 2 + cText := 'Do you know Harbour can host pure console, cui+gui console, pure gui consoles applications? ' + cText += 'This demonstration is a proof of that.' + CASE nMode == 3 + cText := 'Do you know Harbour is a multi-gt, multi-window, multi-thread compiler far superior than others in the market! ' + cText += 'And is FREE.' + CASE nMode == 4 + cText := 'Enjoy and contribute to the project any way you can. Develop, Debug, Support, and spread a word of mouth!' + ENDCASE + + RETURN cText +/*----------------------------------------------------------------------*/ +#if 0 +#include 'memoedit.ch' +#include 'setcurs.ch' +#include 'inkey.ch' + +Function Editmemo() + Local cText := 'This is initial text' + Local lEditMode := .f. + + DO WHILE .T. + cText := MEMOEDIT( cText, 3,6,20,76, lEditMode, "EditFunc", 50 ) + if lastkey() == 27 + exit + endif + ENDDO + + Return nil +//----------------------------------------------------------------------// +Function EditFunc( nMode, nRow, nCol ) + Local nKey := Lastkey() + + STATIC nLoop := 0 + + nLoop++ + + DO CASE + CASE nMode == ME_INIT + + DO CASE + CASE nLoop == 1 // Set insert mode + SetCursor( SC_SPECIAL1 ) +hb_ToOutDebug( 'nLoop %i %s', nLoop, 'ME_INIT:K_INS' ) + RETURN K_INS + + OTHERWISE +hb_ToOutDebug( 'nLoop %i %s', nLoop, 'ME_INIT:OTHERWISE' ) + RETURN ME_DEFAULT + + ENDCASE + + CASE nMode == ME_IDLE +hb_ToOutDebug( 'nLoop %i %s', nLoop, 'ME_IDLE' ) + + OTHERWISE + IF nKey == K_INS + IF ReadInsert() + SetCursor(SC_NORMAL) + ELSE + SetCursor(SC_SPECIAL1) + ENDIF + + ENDIF +hb_ToOutDebug( 'nLoop %i %s %i %i', nLoop, 'OTHERWISE', nKey, nMode ) + + ENDCASE + + RETURN ME_DEFAULT +#endif +//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgcore.c b/harbour/contrib/gtwvg/wvgcore.c index 829ff1751a..0c5b8b0158 100644 --- a/harbour/contrib/gtwvg/wvgcore.c +++ b/harbour/contrib/gtwvg/wvgcore.c @@ -80,6 +80,8 @@ #include "gtwvg.h" +#define __SETGUI__ + static void hb_wvt_DrawBoxRaised ( HDC hdc, int iTop, int iLeft, int iBottom, int iRight ); static void hb_wvt_DrawBoxRecessed ( HDC hdc, int iTop, int iLeft, int iBottom, int iRight ); static void hb_wvt_DrawOutline ( HDC hdc, int iTop, int iLeft, int iBottom, int iRight ); @@ -147,6 +149,7 @@ void hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT righ // // Courtesy - Augusto Infante - Thanks // +#if ! defined( HB_OS_WIN_CE ) IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection ) { HRSRC res = 0; @@ -333,7 +336,7 @@ BOOL hb_wvt_gtDestroyPicture( IPicture * iPicture ) return bResult; } - +#endif //#if ! defined( HB_OS_WIN_CE ) //-------------------------------------------------------------------// POINT hb_wvt_gtGetXYFromColRow( USHORT col, USHORT row ) @@ -442,8 +445,11 @@ BOOL CALLBACK hb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPA DestroyWindow( hDlg ); lReturn = 0; break; - +#if ! defined( HB_OS_WIN_CE ) case WM_NCDESTROY: +#else + case WM_DESTROY: +#endif if ( _s->pFunc[ iIndex ] != NULL && _s->iType[ iIndex ] == 2 ) { hb_itemRelease( ( PHB_ITEM ) _s->pFunc[ iIndex ] ); @@ -557,7 +563,11 @@ BOOL CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA lReturn = 0; break; +#if ! defined( HB_OS_WIN_CE ) case WM_NCDESTROY: +#else + case WM_DESTROY: +#endif if ( _s->pFuncModal[ iIndex ] != NULL && _s->iTypeModal[ iIndex ] == 2 ) { hb_itemRelease( ( PHB_ITEM ) _s->pFuncModal[ iIndex ] ); @@ -576,6 +586,7 @@ BOOL CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPA BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image ) { +#if ! defined( HB_OS_WIN_CE ) HGLOBAL hGlobal; HANDLE hFile; DWORD nFileSize; @@ -672,6 +683,9 @@ BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image ) CloseHandle( hFile ); } return( bResult ); +#else + return( FALSE ); +#endif } //-------------------------------------------------------------------// @@ -887,7 +901,7 @@ static void hb_wvt_DrawToolButtonUp( HDC hdc, int iTop, int iLeft, int iBottom, LineTo( hdc, iRight, iTop ); } -//-------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ static void hb_wvt_DrawToolButtonDown( HDC hdc, int iTop, int iLeft, int iBottom, int iRight ) { @@ -910,6 +924,8 @@ static void hb_wvt_DrawToolButtonDown( HDC hdc, int iTop, int iLeft, int iBottom LineTo( hdc, iRight, iTop ); } +/*----------------------------------------------------------------------*/ + static COLORREF hb_wvt_BgColorParam( int iParam ) { PHB_GTWVT _s = hb_wvt_gtGetWVT(); @@ -929,6 +945,8 @@ static COLORREF hb_wvt_BgColorParam( int iParam ) return color; } +/*----------------------------------------------------------------------*/ + static COLORREF hb_wvt_FgColorParam( int iParam ) { PHB_GTWVT _s = hb_wvt_gtGetWVT(); @@ -948,7 +966,7 @@ static COLORREF hb_wvt_FgColorParam( int iParam ) return color; } -//-------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ // // Wvt_SetPen( nPenStyle, nWidth, nColor ) // @@ -987,7 +1005,7 @@ HB_FUNC( WVT_SETPEN ) } } -//-------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ // // Wvt_SetBrush( nStyle, nColor, [ nHatch ] ) // @@ -1006,9 +1024,11 @@ HB_FUNC( WVT_SETBRUSH ) lb.lbStyle = hb_parnl( 1 ); lb.lbColor = ISNIL( 2 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 2 ) ; lb.lbHatch = ISNIL( 3 ) ? 0 : hb_parnl( 3 ); - +#if ! defined( HB_OS_WIN_CE ) hBrush = CreateBrushIndirect( &lb ); - +#else + hBrush = CreateSolidBrush( lb.lbColor ); +#endif if ( hBrush ) { if ( _s->currentBrush ) @@ -1025,7 +1045,7 @@ HB_FUNC( WVT_SETBRUSH ) } } -//-------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ // // Wvt_DrawBoxGet( nRow, nCol, nWidth ) // @@ -1040,13 +1060,15 @@ HB_FUNC( WVT_DRAWBOXGET ) yz = hb_wvt_gtGetXYFromColRow( ( USHORT ) ( hb_parni( 2 ) + hb_parni( 3 ) ), ( USHORT ) hb_parni( 1 ) + 1 ); hb_wvt_DrawBoxGet( _s->hdc, xy.y, xy.x, yz.y, yz.x ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxGet( _s->hGuiDC, xy.y, xy.x, yz.y, yz.x ); } + #endif } -//-------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ // // Wvt_DrawBoxRaised( nTop, nLeft, nBottom, nRight, aPxlOff ) // @@ -1060,10 +1082,12 @@ HB_FUNC( WVT_DRAWBOXRAISED ) int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 ); hb_wvt_DrawBoxRaised( _s->hdc, iTop-1, iLeft-1, iBottom+1, iRight+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop-1, iLeft-1, iBottom+1, iRight+1 ); } + #endif } //-------------------------------------------------------------------// @@ -1080,10 +1104,12 @@ HB_FUNC( WVT_DRAWBOXRECESSED ) int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 ); hb_wvt_DrawBoxRecessed( _s->hdc, iTop-1, iLeft-1, iBottom+1, iRight+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRecessed( _s->hGuiDC, iTop-1, iLeft-1, iBottom+1, iRight+1 ); } + #endif } //-------------------------------------------------------------------// @@ -1100,10 +1126,12 @@ HB_FUNC( WVT_DRAWBOXGROUP ) int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 ); hb_wvt_DrawBoxGroup( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxGroup( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } //-------------------------------------------------------------------// @@ -1120,10 +1148,12 @@ HB_FUNC( WVT_DRAWBOXGROUPRAISED ) int iRight = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 ); hb_wvt_DrawBoxGroupRaised( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxGroupRaised( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } //-------------------------------------------------------------------// @@ -1132,6 +1162,7 @@ HB_FUNC( WVT_DRAWBOXGROUPRAISED ) // HB_FUNC( WVT_DRAWIMAGE ) { +#if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); POINT xy = { 0,0 }; @@ -1152,13 +1183,18 @@ HB_FUNC( WVT_DRAWIMAGE ) else { hb_wvt_DrawImage( _s->hdc, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ) ; + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawImage( _s->hGuiDC, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ) ; } + #endif } hb_retl( TRUE ); +#else + hb_retl( FALSE ); +#endif } //-------------------------------------------------------------------// @@ -1212,7 +1248,7 @@ HB_FUNC( WVT_DRAWLABEL ) ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); SelectObject( _s->hdc, hOldFont ); - + #if defined(__SETGUI__) if ( _s->bGui ) { SetBkColor( _s->hGuiDC, bgClr ); @@ -1224,6 +1260,7 @@ HB_FUNC( WVT_DRAWLABEL ) ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); SelectObject( _s->hGuiDC, hOldFontGui ); } + #endif HB_TCHAR_FREE( text ); DeleteObject( hFont ); hb_retl( TRUE ); @@ -1268,6 +1305,7 @@ HB_FUNC( WVT_DRAWOUTLINE ) } hb_wvt_DrawOutline( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { if ( hPen ) @@ -1280,6 +1318,7 @@ HB_FUNC( WVT_DRAWOUTLINE ) hb_wvt_DrawOutline( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } } + #endif if ( hPen ) { @@ -1381,7 +1420,7 @@ HB_FUNC( WVT_DRAWLINE ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y+1, NULL ); LineTo( _s->hdc, iRight, y+1 ); - + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->penWhite ); @@ -1391,6 +1430,7 @@ HB_FUNC( WVT_DRAWLINE ) MoveToEx( _s->hGuiDC, x, y+1, NULL ); LineTo( _s->hGuiDC, iRight, y+1 ); } + #endif } else // Vertical { @@ -1400,6 +1440,7 @@ HB_FUNC( WVT_DRAWLINE ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x+1, y, NULL ); LineTo( _s->hdc, x+1, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->penWhite ); @@ -1409,6 +1450,7 @@ HB_FUNC( WVT_DRAWLINE ) MoveToEx( _s->hGuiDC, x+1, y, NULL ); LineTo( _s->hGuiDC, x+1, iBottom ); } + #endif } } break; @@ -1423,6 +1465,7 @@ HB_FUNC( WVT_DRAWLINE ) SelectObject( _s->hdc, _s->pGUI->penWhite ); MoveToEx( _s->hdc, x, y+1, NULL ); LineTo( _s->hdc, iRight, y+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); @@ -1432,6 +1475,7 @@ HB_FUNC( WVT_DRAWLINE ) MoveToEx( _s->hGuiDC, x, y+1, NULL ); LineTo( _s->hGuiDC, iRight, y+1 ); } + #endif } else // Vertical { @@ -1441,6 +1485,7 @@ HB_FUNC( WVT_DRAWLINE ) SelectObject( _s->hdc, _s->pGUI->penWhite ); MoveToEx( _s->hdc, x+1, y, NULL ); LineTo( _s->hdc, x+1, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); @@ -1450,6 +1495,7 @@ HB_FUNC( WVT_DRAWLINE ) MoveToEx( _s->hGuiDC, x+1, y, NULL ); LineTo( _s->hGuiDC, x+1, iBottom ); } + #endif } } break; @@ -1461,24 +1507,28 @@ HB_FUNC( WVT_DRAWLINE ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y, NULL ); LineTo( _s->hdc, iRight, y ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); MoveToEx( _s->hGuiDC, x, y, NULL ); LineTo( _s->hGuiDC, iRight, y ); } + #endif } else // Vertical { SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y, NULL ); LineTo( _s->hdc, x, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); MoveToEx( _s->hGuiDC, x, y, NULL ); LineTo( _s->hGuiDC, x, iBottom ); } + #endif } } break; @@ -1511,10 +1561,12 @@ HB_FUNC( WVT_DRAWELLIPSE ) SelectObject( _s->hdc, _s->currentPen ); hb_retl( Ellipse( _s->hdc, iLeft, iTop, iRight, iBottom ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_retl( Ellipse( _s->hGuiDC, iLeft, iTop, iRight, iBottom ) ); } + #endif } //-------------------------------------------------------------------// @@ -1534,10 +1586,12 @@ HB_FUNC( WVT_DRAWRECTANGLE ) SelectObject( _s->hdc, _s->currentPen ); hb_retl( Rectangle( _s->hdc, iLeft, iTop, iRight, iBottom ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_retl( Rectangle( _s->hGuiDC, iLeft, iTop, iRight, iBottom ) ); } + #endif } //-------------------------------------------------------------------// @@ -1561,10 +1615,12 @@ HB_FUNC( WVT_DRAWROUNDRECT ) SelectObject( _s->hdc, _s->currentPen ); hb_retl( RoundRect( _s->hdc, iLeft, iTop, iRight, iBottom, iWd, iHt ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_retl( RoundRect( _s->hGuiDC, iLeft, iTop, iRight, iBottom, iWd, iHt ) ); } + #endif } //-------------------------------------------------------------------// @@ -1587,10 +1643,12 @@ HB_FUNC( WVT_DRAWFOCUSRECT ) rc.bottom = iBottom; hb_retl( DrawFocusRect( _s->hdc, &rc ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_retl( DrawFocusRect( _s->hGuiDC, &rc ) ); } + #endif } //-------------------------------------------------------------------// @@ -1618,11 +1676,12 @@ HB_FUNC( WVT_DRAWCOLORRECT ) rc.bottom = iBottom; hb_retl( FillRect( _s->hdc, &rc, hBrush ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_retl( FillRect( _s->hGuiDC, &rc, hBrush ) ); } - + #endif DeleteObject( hBrush ); } } @@ -1657,7 +1716,7 @@ HB_FUNC( WVT_DRAWGRIDHORZ ) iAtRow++; } - + #if defined(__SETGUI__) if ( _s->bGui ) { iAtRow = hb_parni( 1 ); @@ -1674,6 +1733,7 @@ HB_FUNC( WVT_DRAWGRIDHORZ ) iAtRow++; } } + #endif hb_retl( TRUE ); } @@ -1711,7 +1771,7 @@ HB_FUNC( WVT_DRAWGRIDVERT ) MoveToEx( _s->hdc, x, iTop, NULL ); LineTo( _s->hdc, x, iBottom ); } - + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->currentPen ); @@ -1723,7 +1783,7 @@ HB_FUNC( WVT_DRAWGRIDVERT ) LineTo( _s->hGuiDC, x, iBottom ); } } - + #endif hb_retl( TRUE ); } @@ -1742,10 +1802,8 @@ HB_FUNC( WVT_DRAWBUTTON ) int iTop, iLeft, iBottom, iRight; int iAlign; int iTextHeight /*, iTextWidth */ ; - int iImageWidth, iImageHeight; LOGBRUSH lb = { 0,0,0 }; HBRUSH hBrush; - IPicture *iPicture; BOOL bText = ISCHAR( 5 ); BOOL bImage = !( ISNIL( 6 ) ); @@ -1764,19 +1822,23 @@ HB_FUNC( WVT_DRAWBUTTON ) lb.lbStyle = BS_SOLID; lb.lbColor = bkColor; lb.lbHatch = 0; - +#if ! defined( HB_OS_WIN_CE ) hBrush = CreateBrushIndirect( &lb ); - +#else + hBrush = CreateSolidBrush( lb.lbColor ); +#endif rc.left = iLeft ; rc.top = iTop ; rc.right = iRight + 1; rc.bottom = iBottom + 1; FillRect( _s->hdc, &rc, hBrush ); + #if defined(__SETGUI__) if ( _s->bGui ) { FillRect( _s->hGuiDC, &rc, hBrush ); } + #endif DeleteObject( hBrush ); switch ( iFormat ) @@ -1811,10 +1873,11 @@ HB_FUNC( WVT_DRAWBUTTON ) if ( bText ) { LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 5 ) ); - +#if ! defined( HB_OS_WIN_CE ) SelectObject( _s->hdc, GetStockObject( DEFAULT_GUI_FONT ) ); - - //GetTextExtentPoint32( _s->hdc, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), &sz ); +#else + SelectObject( _s->hdc, GetStockObject( OEM_FIXED_FONT ) ); +#endif GetTextExtentPoint32( _s->hdc, text, lstrlen( text ), &sz ); // iTextWidth = sz.cx; @@ -1847,7 +1910,11 @@ HB_FUNC( WVT_DRAWBUTTON ) ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); if ( _s->bGui ) { +#if ! defined( HB_OS_WIN_CE ) SelectObject( _s->hGuiDC, GetStockObject( DEFAULT_GUI_FONT ) ); +#else + SelectObject( _s->hGuiDC, GetStockObject( OEM_FIXED_FONT ) ); +#endif SetTextAlign( _s->hGuiDC, iAlign ); SetBkMode( _s->hGuiDC, TRANSPARENT ); SetTextColor( _s->hGuiDC, textColor ); @@ -1864,12 +1931,13 @@ HB_FUNC( WVT_DRAWBUTTON ) if ( bImage ) { - iImageWidth = ( iRight - iLeft + 1 - 8 ); - iImageHeight = ( iBottom - iTop + 1 - 8 - iTextHeight ); +#if ! defined( HB_OS_WIN_CE ) + int iImageWidth = ( iRight - iLeft + 1 - 8 ); + int iImageHeight = ( iBottom - iTop + 1 - 8 - iTextHeight ); if ( ISNUM( 6 ) ) { - iPicture = _s->pGUI->iPicture[ hb_parni( 6 ) - 1 ]; + IPicture *iPicture = _s->pGUI->iPicture[ hb_parni( 6 ) - 1 ]; hb_wvt_gtRenderPicture( iLeft+4, iTop+4, iImageWidth, iImageHeight, iPicture ); } else @@ -1880,6 +1948,7 @@ HB_FUNC( WVT_DRAWBUTTON ) hb_wvt_DrawImage( _s->hGuiDC, iLeft+4, iTop+4, iImageWidth, iImageHeight, hb_parcx( 6 ) ); } } +#endif } hb_retl( TRUE ); @@ -1961,6 +2030,7 @@ HB_FUNC( WVT_DRAWSTATUSBAR ) // HB_FUNC( WVT_DRAWPICTURE ) { +#if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); POINT xy = { 0,0 }; @@ -1982,6 +2052,7 @@ HB_FUNC( WVT_DRAWPICTURE ) hb_retl( hb_wvt_gtRenderPicture( iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, _s->pGUI->iPicture[ iSlot ] ) ); } } +#endif } //-------------------------------------------------------------------// @@ -2012,6 +2083,7 @@ HB_FUNC( WVT_DRAWLABELEX ) //ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL ); ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); + #if defined(__SETGUI__) if ( _s->bGui ) { SetBkColor( _s->hGuiDC, bgClr ); @@ -2022,6 +2094,7 @@ HB_FUNC( WVT_DRAWLABELEX ) //ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL ); ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL ); } + #endif HB_TCHAR_FREE( text ); hb_retl( TRUE ); } @@ -2124,6 +2197,7 @@ HB_FUNC( WVT_DRAWLINEEX ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y+1, NULL ); LineTo( _s->hdc, iRight, y+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->penWhite ); @@ -2133,6 +2207,7 @@ HB_FUNC( WVT_DRAWLINEEX ) MoveToEx( _s->hGuiDC, x, y+1, NULL ); LineTo( _s->hGuiDC, iRight, y+1 ); } + #endif } else // Vertical { @@ -2142,6 +2217,7 @@ HB_FUNC( WVT_DRAWLINEEX ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x+1, y, NULL ); LineTo( _s->hdc, x+1, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->penWhite ); @@ -2151,6 +2227,7 @@ HB_FUNC( WVT_DRAWLINEEX ) MoveToEx( _s->hGuiDC, x+1, y, NULL ); LineTo( _s->hGuiDC, x+1, iBottom ); } + #endif } } break; @@ -2165,6 +2242,7 @@ HB_FUNC( WVT_DRAWLINEEX ) SelectObject( _s->hdc, _s->pGUI->penWhite ); MoveToEx( _s->hdc, x, y+1, NULL ); LineTo( _s->hdc, iRight, y+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); @@ -2174,6 +2252,7 @@ HB_FUNC( WVT_DRAWLINEEX ) MoveToEx( _s->hGuiDC, x, y+1, NULL ); LineTo( _s->hGuiDC, iRight, y+1 ); } + #endif } else // Vertical { @@ -2183,6 +2262,7 @@ HB_FUNC( WVT_DRAWLINEEX ) SelectObject( _s->hdc, _s->pGUI->penWhite ); MoveToEx( _s->hdc, x+1, y, NULL ); LineTo( _s->hdc, x+1, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); @@ -2192,6 +2272,7 @@ HB_FUNC( WVT_DRAWLINEEX ) MoveToEx( _s->hGuiDC, x+1, y, NULL ); LineTo( _s->hGuiDC, x+1, iBottom ); } + #endif } } break; @@ -2203,24 +2284,28 @@ HB_FUNC( WVT_DRAWLINEEX ) SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y, NULL ); LineTo( _s->hdc, iRight, y ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); MoveToEx( _s->hGuiDC, x, y, NULL ); LineTo( _s->hGuiDC, iRight, y ); } + #endif } else // Vertical { SelectObject( _s->hdc, hPen ); MoveToEx( _s->hdc, x, y, NULL ); LineTo( _s->hdc, x, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, hPen ); MoveToEx( _s->hGuiDC, x, y, NULL ); LineTo( _s->hGuiDC, x, iBottom ); } + #endif } } break; @@ -2258,10 +2343,12 @@ HB_FUNC( WVT_DRAWOUTLINEEX ) } hb_wvt_DrawOutline( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawOutline( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } //----------------------------------------------------------------------// @@ -2348,6 +2435,7 @@ HB_FUNC( WVT_DRAWLABELOBJ ) // //ExtTextOut( _s->hdc, x, y, uiOptions, &rect, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL ); ExtTextOut( _s->hdc, x, y, uiOptions, &rect, text, lstrlen( text ), NULL ); + #if defined(__SETGUI__) if ( _s->bGui ) { SetTextColor( _s->hGuiDC, fgClr ); @@ -2358,6 +2446,7 @@ HB_FUNC( WVT_DRAWLABELOBJ ) //ExtTextOut( _s->hGuiDC, x, y, uiOptions, &rect, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL ); ExtTextOut( _s->hGuiDC, x, y, uiOptions, &rect, text, lstrlen( text ), NULL ); } + #endif HB_TCHAR_FREE( text ); hb_retl( TRUE ); } @@ -2380,30 +2469,36 @@ HB_FUNC( WVT_DRAWTOOLBUTTONSTATE ) case 0: // Flat { hb_wvt_DrawToolButtonFlat( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawToolButtonFlat( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } break; case 1: // Raised { hb_wvt_DrawToolButtonUp( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawToolButtonUp( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } break; case 2: // Recessed { hb_wvt_DrawToolButtonDown( _s->hdc, iTop, iLeft, iBottom, iRight ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawToolButtonDown( _s->hGuiDC, iTop, iLeft, iBottom, iRight ); } + #endif } break; } @@ -2436,18 +2531,22 @@ HB_FUNC( WVT_DRAWSCROLLBUTTON ) if ( bDepressed ) { hb_wvt_DrawBoxRecessed( _s->hdc, iTop+1, iLeft+1, iBottom-2, iRight-2 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRecessed( _s->hGuiDC, iTop+1, iLeft+1, iBottom-2, iRight-2 ); } + #endif } else { hb_wvt_DrawBoxRaised( _s->hdc, iTop+1, iLeft+1, iBottom-2, iRight-2 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop+1, iLeft+1, iBottom-2, iRight-2 ); } + #endif } switch ( hb_parni( 6 ) ) @@ -2507,12 +2606,13 @@ HB_FUNC( WVT_DRAWSCROLLBUTTON ) SelectObject( _s->hdc, _s->pGUI->solidBrush ); Polygon( _s->hdc, Point, 3 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->solidBrush ); Polygon( _s->hGuiDC, Point, 3 ); } - + #endif hb_xfree( Point ); } @@ -2537,6 +2637,7 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBVERT ) SelectObject( _s->hdc, _s->pGUI->diagonalBrush ); SelectObject( _s->hdc, _s->pGUI->penNull ); Rectangle( _s->hdc, iLeft, iTop, iRight+1, iBottom+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SetBkMode( _s->hGuiDC, OPAQUE ); @@ -2545,7 +2646,7 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBVERT ) SelectObject( _s->hGuiDC, _s->pGUI->penNull ); Rectangle( _s->hGuiDC, iLeft, iTop, iRight+1, iBottom+1 ); } - + #endif // Thumb // iTabTop = _s->PTEXTSIZE.y * hb_parni( 6 ); @@ -2556,18 +2657,21 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBVERT ) SelectObject( _s->hdc, _s->pGUI->whiteBrush ); SelectObject( _s->hdc, _s->pGUI->penGray ); Rectangle( _s->hdc, iTabLft, iTabTop, iTabRgt+1, iTabBtm ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->whiteBrush ); SelectObject( _s->hGuiDC, _s->pGUI->penGray ); Rectangle( _s->hGuiDC, iTabLft, iTabTop, iTabRgt+1, iTabBtm ); } - + #endif hb_wvt_DrawBoxRaised( _s->hdc, iTabTop+1, iTabLft+1, iTabBtm-2, iTabRgt-2 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRaised( _s->hGuiDC, iTabTop+1, iTabLft+1, iTabBtm-2, iTabRgt-2 ); } + #endif } //-------------------------------------------------------------------// @@ -2594,6 +2698,7 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBHORZ ) SelectObject( _s->hdc, _s->pGUI->diagonalBrush ); SelectObject( _s->hdc, _s->pGUI->penNull ); Rectangle( _s->hdc, iLeft, iTop, iRight+1, iBottom+1 ); + #if defined(__SETGUI__) if ( _s->bGui ) { SetBkMode( _s->hGuiDC, OPAQUE ); @@ -2602,24 +2707,27 @@ HB_FUNC( WVT_DRAWSCROLLTHUMBHORZ ) SelectObject( _s->hGuiDC, _s->pGUI->penNull ); Rectangle( _s->hGuiDC, iLeft, iTop, iRight+1, iBottom+1 ); } - + #endif // Thumb // SelectObject( _s->hdc, _s->pGUI->whiteBrush ); SelectObject( _s->hdc, _s->pGUI->penGray ); Rectangle( _s->hdc, iThumbLeft, iTop, iThumbRight, iBottom ); + #if defined(__SETGUI__) if ( _s->bGui ) { SelectObject( _s->hGuiDC, _s->pGUI->whiteBrush ); SelectObject( _s->hGuiDC, _s->pGUI->penGray ); Rectangle( _s->hGuiDC, iThumbLeft, iTop, iThumbRight, iBottom ); } - + #endif hb_wvt_DrawBoxRaised( _s->hdc, iTop+1, iThumbLeft+1, iBottom-2, iThumbRight-2 ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop+1, iThumbLeft+1, iBottom-2, iThumbRight-2 ); } + #endif } //#if WINVER > 0x500 @@ -2663,10 +2771,12 @@ HB_FUNC( WVT_DRAWSHADEDRECT ) gRect.LowerRight= 1; bGF = ( BOOL ) _s->pGUI->pfnGF( _s->hdc, vert, 2, &gRect, 1, iMode ); + #if defined(__SETGUI__) if ( _s->bGui ) { bGF = ( BOOL ) _s->pGUI->pfnGF( _s->hGuiDC, vert, 2, &gRect, 1, iMode ); } + #endif } hb_retl( bGF ); } @@ -2723,6 +2833,7 @@ HB_FUNC( WVT_DRAWTEXTBOX ) //DrawText( _s->hdc, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &rc, iAlignH | DT_WORDBREAK | DT_TOP ); DrawText( _s->hdc, text, lstrlen( text ), &rc, iAlignH | DT_WORDBREAK | DT_TOP ); + #if defined(__SETGUI__) if ( _s->bGui ) { SetTextAlign( _s->hGuiDC, TA_TOP | TA_LEFT | TA_NOUPDATECP ); @@ -2734,6 +2845,7 @@ HB_FUNC( WVT_DRAWTEXTBOX ) //DrawText( _s->hGuiDC, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &rc, iAlignH | DT_WORDBREAK | DT_TOP ); DrawText( _s->hGuiDC, text, lstrlen( text ), &rc, iAlignH | DT_WORDBREAK | DT_TOP ); } + #endif HB_TCHAR_FREE( text ); } @@ -2804,10 +2916,12 @@ HB_FUNC( WVT_DRAWPROGRESSBAR ) if ( bImage ) { hb_wvt_DrawImage( _s->hdc, rc.left, rc.top, rc.right-rc.left+1, rc.bottom-rc.top+1, hb_parc( 9 ) ); + #if defined(__SETGUI__) if ( _s->bGui ) { hb_wvt_DrawImage( _s->hGuiDC, rc.left, rc.top, rc.right-rc.left+1, rc.bottom-rc.top+1, hb_parc( 9 ) ); } + #endif } else { @@ -2816,17 +2930,21 @@ HB_FUNC( WVT_DRAWPROGRESSBAR ) lb.lbStyle = BS_SOLID; lb.lbColor = crBarColor; lb.lbHatch = 0; - +#if ! defined( HB_OS_WIN_CE ) hBrush = CreateBrushIndirect( &lb ); - +#else + hBrush = CreateSolidBrush( lb.lbColor ); +#endif rc.bottom++; rc.right++; FillRect( _s->hdc, &rc, hBrush ); + #if defined(__SETGUI__) if ( _s->bGui ) { FillRect( _s->hGuiDC, &rc, hBrush ); } + #endif DeleteObject( hBrush ); } } @@ -2868,10 +2986,11 @@ HB_FUNC( WVT_CREATEFONT ) // HB_FUNC( WVT_LOADPICTURE ) { + BOOL bResult = FALSE; +#if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); IPicture * iPicture = hb_wvt_gtLoadPicture( hb_parcx( 2 ) ); - BOOL bResult = FALSE; int iSlot = hb_parni( 1 ) - 1 ; if ( iPicture ) @@ -2884,6 +3003,7 @@ HB_FUNC( WVT_LOADPICTURE ) _s->pGUI->iPicture[ iSlot ] = iPicture; bResult = TRUE; } +#endif hb_retl( bResult ); } @@ -2891,10 +3011,11 @@ HB_FUNC( WVT_LOADPICTURE ) HB_FUNC( WVT_LOADPICTUREFROMRESOURCE ) { + BOOL bResult = FALSE; +#if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); IPicture * iPicture = hb_wvt_gtLoadPictureFromResource( hb_parcx( 2 ),hb_parcx( 3 ) ); - BOOL bResult = FALSE; int iSlot = hb_parni( 1 ) - 1 ; if ( iPicture ) @@ -2907,6 +3028,7 @@ HB_FUNC( WVT_LOADPICTUREFROMRESOURCE ) _s->pGUI->iPicture[ iSlot ] = iPicture; bResult = TRUE; } +#endif hb_retl( bResult ); } diff --git a/harbour/contrib/gtwvg/wvgcrt.prg b/harbour/contrib/gtwvg/wvgcrt.prg index c5a013f9e5..6963a51539 100644 --- a/harbour/contrib/gtwvg/wvgcrt.prg +++ b/harbour/contrib/gtwvg/wvgcrt.prg @@ -260,6 +260,8 @@ EXPORTED: DATA lHasInputFocus INIT .F. DATA nFrameState INIT 0 // normal + METHOD showWindow() INLINE ::show() + METHOD refresh() INLINE ::invalidateRect() ENDCLASS //----------------------------------------------------------------------// @@ -268,7 +270,6 @@ EXPORTED: METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCrt - //::WvgPartHandler:init( oParent, oOwner ) ::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) if hb_isArray( aPos ) @@ -310,7 +311,6 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr ::maxRow := ::aSize[ 1 ] ::maxCol := ::aSize[ 2 ] - //::WvgPartHandler:Create( oParent, oOwner ) ::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) if ::lModal @@ -333,6 +333,16 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr ::maxRow+1, ::maxCol+1, ::pGTp, .F., lRowCol, HB_WNDTYPE_CRT } ) hb_gtInfo( HB_GTI_SETFONT, { ::fontName, ::fontHeight, ::fontWidth } ) + IF hb_isNumeric( ::icon ) + hb_gtInfo( HB_GTI_ICONRES, ::icon ) + ELSE + IF ( '.ico' $ lower( ::icon ) ) + hb_gtInfo( HB_GTI_ICONFILE, ::icon ) + ELSE + hb_gtInfo( HB_GTI_ICONRES, ::icon ) + ENDIF + ENDIF + /* CreateWindow() be forced to execute */ ? ' ' ::hWnd := hb_gtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE ) @@ -342,24 +352,15 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr 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 + IF ::lModal hb_gtInfo( HB_GTI_DISABLE, ::pGTp ) - endif + ENDIF - if ::visible + IF ::visible Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) ::lHasInputFocus := .t. - endif + ENDIF // Drawing Area of oCrt will point to itself // @@ -495,7 +496,14 @@ METHOD hide() CLASS WvgCrt //----------------------------------------------------------------------// -METHOD invalidateRect() CLASS WvgCrt +METHOD invalidateRect( nTop, nLeft, nBottom, nRight ) CLASS WvgCrt + + DEFAULT nTop TO 0 + DEFAULT nLeft TO 0 + DEFAULT nBottom TO maxrow() + DEFAULT nRight TO maxcol() + + Wvt_InvalidateRect( nTop, nLeft, nBottom, nRight ) RETURN Self @@ -649,8 +657,8 @@ METHOD toBack() CLASS WvgCrt //----------------------------------------------------------------------// METHOD toFront() CLASS WvgCrt - - RETURN Self + //RETURN Self + RETURN Win_SetWindowPosToTop( ::hWnd ) //----------------------------------------------------------------------// @@ -1056,10 +1064,13 @@ METHOD quit( xParam, xParam1 ) CLASS WvgCrt METHOD resize( xParam ) CLASS WvgCrt - if hb_isBlock( xParam ) .or. hb_isNil( xParam ) + if hb_isBlock( xParam )// .or. hb_isNil( xParam ) ::sl_resize := xParam RETURN NIL endif + IF empty( xParam ) + ::sendMessage( WM_SIZE, 0, 0 ) + ENDIF RETURN Self @@ -1162,9 +1173,10 @@ METHOD dragDrop( xParam, xParam1 ) CLASS WvgCrt //----------------------------------------------------------------------// // HARBOUR SPECIFIC //----------------------------------------------------------------------// -METHOD setFocus() CLASS WvgCrt +METHOD SetFocus() CLASS WvgCrt ::sendMessage( WM_ACTIVATE, 1, 0 ) + //::sendMessage( WM_SETFOCUS, 0, 0 ) RETURN Self //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgcuig.c b/harbour/contrib/gtwvg/wvgcuig.c index 7063bda7ef..a39d1f9775 100644 --- a/harbour/contrib/gtwvg/wvgcuig.c +++ b/harbour/contrib/gtwvg/wvgcuig.c @@ -5,7 +5,7 @@ /* * Harbour Project source code: * - * Copyright 2007 Pritpal Bedi + * Copyright 2009 Pritpal Bedi * Based on: * * Video subsystem for Windows using GUI windows instead of Console @@ -67,12 +67,15 @@ //-------------------------------------------------------------------// //-------------------------------------------------------------------// // -// Simplified GUI Drawing Functions +// EkOnkar +// ( The LORD is ONE ) +// +// Simplified GUI Drawing Functions // CUI Enhancement Oriented // No Callbacks etc. // Pure Statics // . -// Pritpal Bedi +// Pritpal Bedi // 28Feb2009 // //-------------------------------------------------------------------// @@ -83,20 +86,225 @@ #include "gtwvg.h" +/*----------------------------------------------------------------------*/ +static PHB_GOBJS hb_wvg_ObjectNew( PHB_GTWVT pWVT ) +{ + int iHandle = ( pWVT->gObjs ? pWVT->gObjs->iHandle + 1 : 1 ); + HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); + + memset( gObj, 0, sizeof( HB_GOBJS ) ); + + gObj->iHandle = iHandle; + gObj->iState = GOBJ_OBJSTATE_ENABLED; + + hb_retni( iHandle ); + + return gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_RefreshRect( PHB_GTWVT pWVT, PHB_GOBJS gObj ) +{ + RECT rc = {0,0,0,0}; + + // Calculate the region occupied +- 3 pixels as most controls are outside of designated area + // + rc.top = ( pWVT->PTEXTSIZE.y * gObj->iTop ) + gObj->aOffset.iTop - 3; + rc.left = ( pWVT->PTEXTSIZE.x * gObj->iLeft ) + gObj->aOffset.iLeft - 3; + rc.bottom = ( pWVT->PTEXTSIZE.y * ( gObj->iBottom + 1 ) ) - 1 + gObj->aOffset.iBottom + 3; + rc.right = ( pWVT->PTEXTSIZE.x * ( gObj->iRight + 1 ) ) - 1 + gObj->aOffset.iRight + 3; + + InvalidateRect( pWVT->hWnd, &rc, FALSE ); +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_RestFromBuffer( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) +{ + BitBlt( pWVT->hdc, iLeft, iTop, iRight - iLeft, iBottom - iTop, + pWVT->hGuiDC, iLeft, iTop, SRCCOPY ); +} +/*----------------------------------------------------------------------*/ +// Wvg_ClearGUIObjects() -> NIL +// +HB_FUNC( WVG_CLEARGUIOBJECTS ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + + if( pWVT->gObjs ) + { + PHB_GOBJS gObj; + + while( pWVT->gObjs ) + { + gObj = pWVT->gObjs->gObjNext; + + if( pWVT->gObjs->lpText != NULL ) + HB_TCHAR_FREE( pWVT->gObjs->lpText ); + if( pWVT->gObjs->hFont != NULL ) + if( pWVT->gObjs->bDestroyFont ) + DeleteObject( pWVT->gObjs->hFont ); + if( pWVT->gObjs->hPen ) + if( pWVT->gObjs->bDestroyPen ) + DeleteObject( pWVT->gObjs->hPen ); + if( pWVT->gObjs->hBrush ) + if( pWVT->gObjs->bDestroyBrush ) + DeleteObject( pWVT->gObjs->hBrush ); +#if ! defined( HB_OS_WIN_CE ) + if( pWVT->gObjs->iPicture ) + if( pWVT->gObjs->bDestroyPicture ) + pWVT->gObjs->iPicture->lpVtbl->Release( pWVT->gObjs->iPicture ); +#endif + hb_xfree( pWVT->gObjs ); + pWVT->gObjs = gObj; + } + pWVT->gObjs = NULL; + } +} +/*----------------------------------------------------------------------*/ +HB_FUNC( WVG_SETGOBJSTATE ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + int iHandle = hb_parni( 1 ); + int iOState; + + if( iHandle && pWVT->gObjs ) + { + PHB_GOBJS gObj = pWVT->gObjs; + + while( gObj ) + { + if( iHandle == gObj->iHandle ) + { + iOState = gObj->iState; + + if( ISNUM( 2 ) ) + { + int iState = hb_parni( 2 ); + if( iOState != iState && iState > 0 && iState <= 4 ) + { + gObj->iState = iState; + hb_wvg_RefreshRect( pWVT, gObj ); + } + } + break; + } + gObj = gObj->gObjNext; + } + } + hb_retni( iOState ); +} +/*----------------------------------------------------------------------*/ +// Wvg_SetGuiObjectData( hObj, nGobjDataType, xData, xData1 ) -> lSuccess +// +HB_FUNC( WVG_SETGOBJDATA ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + int iHandle = hb_parni( 1 ); + BOOL bSuccess; + + if( iHandle ) + { + PHB_GOBJS gObj = pWVT->gObjs; + + while( gObj ) + { + if( iHandle == gObj->iHandle ) + { + int iDataType = hb_parni( 2 ); + + bSuccess = TRUE; + + switch( iDataType ) + { + case GOBJ_OBJDATA_TEXT: + if( gObj->lpText ) + HB_TCHAR_FREE( gObj->lpText ); + gObj->lpText = HB_TCHAR_CONVTO( ISCHAR( 3 ) ? hb_parc( 3 ) : "" ); + break; + +#if ! defined( HB_OS_WIN_CE ) + case GOBJ_OBJDATA_PICTURE: + if( ISNUM( 3 ) && hb_parni( 3 ) <= WVT_PICTURES_MAX ) + gObj->iPicture = pWVT->pGUI->iPicture[ hb_parni( 3 ) - 1 ]; + break; + case GOBJ_OBJDATA_IMAGE: + { + IPicture * iPicture; + + if( ISNUM( 3 ) ) + { + if( hb_parni( 3 ) <= WVT_PICTURES_MAX ) + iPicture = pWVT->pGUI->iPicture[ hb_parni( 3 ) - 1 ]; + } + else + { + iPicture = hb_wvt_gtLoadPicture( hb_parc( 3 ) ); + if( ! iPicture ) + iPicture = hb_wvt_gtLoadPictureFromResource( hb_parc( 3 ), hb_parc( 4 ) ); + } + if( iPicture ) + { + if( gObj->bDestroyPicture && gObj->iPicture ) + gObj->iPicture->lpVtbl->Release( gObj->iPicture ); + gObj->iPicture = iPicture; + gObj->bDestroyPicture = TRUE; + } + break; + } +#endif + case GOBJ_OBJDATA_HFONT: + if( gObj->hFont && gObj->bDestroyFont ) + DeleteObject( gObj->hFont ); + gObj->hFont = ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 3 ); + gObj->bDestroyFont = FALSE; + break; + case GOBJ_OBJDATA_HPEN: + if( gObj->hPen && gObj->bDestroyPen ) + DeleteObject( gObj->hPen ); + gObj->hPen = ( HPEN ) ( HB_PTRDIFF ) hb_parnint( 3 ); + gObj->bDestroyPen = FALSE; + break; + case GOBJ_OBJDATA_HBRUSH: + if( gObj->hBrush && gObj->bDestroyBrush ) + DeleteObject( gObj->hBrush ); + gObj->hBrush = ( HBRUSH ) ( HB_PTRDIFF ) hb_parnint( 3 ); + gObj->bDestroyBrush = TRUE; + break; + case GOBJ_OBJDATA_COLORTEXT: + if( !ISNIL( 3 ) ) + gObj->crRGBText = ( COLORREF ) ( HB_PTRDIFF ) hb_parnint( 3 ); + else + bSuccess = FALSE; + break; + case GOBJ_OBJDATA_COLORBK: + gObj->crRGBBk = ISNIL( 3 ) ? ( COLORREF ) NULL : ( COLORREF ) ( HB_PTRDIFF ) hb_parnint( 3 ); + break; + default: + bSuccess = FALSE; + break; + } + if( bSuccess ) + hb_wvg_RefreshRect( pWVT, gObj ); + + break; + } + gObj = gObj->gObjNext; + } + } + hb_retl( bSuccess ); +} /*----------------------------------------------------------------------*/ // Wvg_BoxRaised( nTop, nLeft, nBottom, nRight, aPxlOff ) // HB_FUNC( WVG_BOXRAISED ) { PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); - HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); - gObj->iObjType = GOBJ_OBJTYPE_BOXRAISED; + gObj->iObjType = GOBJ_OBJTYPE_BOXRAISED; - gObj->iTop = hb_parni( 1 ); - gObj->iLeft = hb_parni( 2 ); - gObj->iBottom = hb_parni( 3 ); - gObj->iRight = hb_parni( 4 ); + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); gObj->aOffset.iTop = hb_parni( 5,1 ); gObj->aOffset.iLeft = hb_parni( 5,2 ); @@ -107,103 +315,6 @@ HB_FUNC( WVG_BOXRAISED ) pWVT->gObjs = gObj; } /*----------------------------------------------------------------------*/ -// Wvg_BoxRecessed( nTop, nLeft, nBottom, nRight, aPxlOff ) -// -HB_FUNC( WVG_BOXRECESSED ) -{ - PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); - HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); - - gObj->iObjType = GOBJ_OBJTYPE_BOXRECESSED; - - gObj->iTop = hb_parni( 1 ); - gObj->iLeft = hb_parni( 2 ); - gObj->iBottom = hb_parni( 3 ); - gObj->iRight = hb_parni( 4 ); - - gObj->aOffset.iTop = hb_parni( 5,1 ); - gObj->aOffset.iLeft = hb_parni( 5,2 ); - gObj->aOffset.iBottom = hb_parni( 5,3 ); - gObj->aOffset.iRight = hb_parni( 5,4 ); - - gObj->gObjNext = pWVT->gObjs; - pWVT->gObjs = gObj; -} -/*----------------------------------------------------------------------*/ -// Wvt_DrawBoxGet( nRow, nCol, nWidth ) -// -HB_FUNC( WVG_BOXGET ) -{ - PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); - - HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); - - gObj->iObjType = GOBJ_OBJTYPE_BOXGET; - - gObj->iTop = hb_parni( 1 ); - gObj->iLeft = hb_parni( 2 ); - gObj->iBottom = hb_parni( 1 ); - gObj->iRight = hb_parni( 2 ) + hb_parni( 3 ) - 1; - - gObj->aOffset.iTop = 0; - gObj->aOffset.iLeft = 0; - gObj->aOffset.iBottom = 0; - gObj->aOffset.iRight = 0; - - gObj->gObjNext = pWVT->gObjs; - - pWVT->gObjs = gObj; -} -/*----------------------------------------------------------------------*/ -// Wvg_BoxGroup( nTop, nLeft, nBottom, nRight, aPxlOff ) -// -HB_FUNC( WVG_BOXGROUP ) -{ - PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); - HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); - - gObj->iObjType = GOBJ_OBJTYPE_BOXGROUP; - - gObj->iTop = hb_parni( 1 ); - gObj->iLeft = hb_parni( 2 ); - gObj->iBottom = hb_parni( 3 ); - gObj->iRight = hb_parni( 4 ); - - gObj->aOffset.iTop = hb_parni( 5,1 ); - gObj->aOffset.iLeft = hb_parni( 5,2 ); - gObj->aOffset.iBottom = hb_parni( 5,3 ); - gObj->aOffset.iRight = hb_parni( 5,4 ); - - gObj->gObjNext = pWVT->gObjs; - pWVT->gObjs = gObj; -} -/*----------------------------------------------------------------------*/ -// Wvg_BoxRaised( nTop, nLeft, nBottom, nRight, aPxlOff ) -// -HB_FUNC( WVG_BOXGROUPRAISED ) -{ - PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); - HB_GOBJS * gObj = ( HB_GOBJS *) hb_xgrab( sizeof( HB_GOBJS ) ); - - gObj->iObjType = GOBJ_OBJTYPE_BOXGROUPRAISED; - - gObj->iTop = hb_parni( 1 ); - gObj->iLeft = hb_parni( 2 ); - gObj->iBottom = hb_parni( 3 ); - gObj->iRight = hb_parni( 4 ); - - gObj->aOffset.iTop = hb_parni( 5,1 ); - gObj->aOffset.iLeft = hb_parni( 5,2 ); - gObj->aOffset.iBottom = hb_parni( 5,3 ); - gObj->aOffset.iRight = hb_parni( 5,4 ); - - gObj->gObjNext = pWVT->gObjs; - pWVT->gObjs = gObj; -} -/*-------------------------------------------------------------------// - - -//-------------------------------------------------------------------*/ static void hb_wvg_BoxRaised( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) { HDC hdc = pWVT->hdc; @@ -234,6 +345,29 @@ static void hb_wvg_BoxRaised( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, i LineTo( hdc, iRight+1, iBottom+1 ); } /*----------------------------------------------------------------------*/ +// Wvg_BoxRecessed( nTop, nLeft, nBottom, nRight, aPxlOff ) -> NIL +// +HB_FUNC( WVG_BOXRECESSED ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_BOXRECESSED; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ static void hb_wvg_BoxRecessed( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) { HDC hdc = pWVT->hdc; @@ -264,6 +398,30 @@ static void hb_wvg_BoxRecessed( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, LineTo( hdc, iRight + 1, iTop - 1 ); } /*----------------------------------------------------------------------*/ +// Wvt_DrawBoxGet( nRow, nCol, nWidth ) -> NIL +// +HB_FUNC( WVG_BOXGET ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_BOXGET; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 1 ); + gObj->iRight = hb_parni( 2 ) + hb_parni( 3 ) - 1; + + gObj->aOffset.iTop = 0; + gObj->aOffset.iLeft = 0; + gObj->aOffset.iBottom = 0; + gObj->aOffset.iRight = 0; + + gObj->gObjNext = pWVT->gObjs; + + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ static void hb_wvg_BoxGet( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) { HDC hdc = pWVT->hdc; @@ -282,6 +440,29 @@ static void hb_wvg_BoxGet( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int LineTo( hdc, iLeft-2, iBottom ); } /*----------------------------------------------------------------------*/ +// Wvg_BoxGroup( nTop, nLeft, nBottom, nRight, aPxlOff ) -> NIL +// +HB_FUNC( WVG_BOXGROUP ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_BOXGROUP; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ static void hb_wvg_BoxGroup( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) { HDC hdc = pWVT->hdc; @@ -317,6 +498,29 @@ static void hb_wvg_BoxGroup( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, in LineTo( hdc, iRight, iTop ); } /*----------------------------------------------------------------------*/ +// Wvg_BoxRaised( nTop, nLeft, nBottom, nRight, aPxlOff ) -> NIL +// +HB_FUNC( WVG_BOXGROUPRAISED ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_BOXGROUPRAISED; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*-------------------------------------------------------------------*/ static void hb_wvg_BoxGroupRaised( PHB_GTWVT pWVT, int iLeft, int iTop, int iRight, int iBottom ) { HDC hdc = pWVT->hdc; @@ -351,6 +555,848 @@ static void hb_wvg_BoxGroupRaised( PHB_GTWVT pWVT, int iLeft, int iTop, int iRig LineTo( hdc, iRight, iTop ); } /*----------------------------------------------------------------------*/ +// +// WVG_LABEL( nRow, nCol, aPxlOff, cLabel, nAlign, +// nEscapement, nTextColor, nBkColor, cFontFace, nFontHeight, +// nFontWidth, nFontWeight, nQuality, nCharSet, lItalics, +// lUnderline, lStrikeOut ) +// +HB_FUNC( WVG_LABEL ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + LOGFONT lf; + HFONT hFont; + + lf.lfEscapement = ( ISNIL( 6 ) ? 0 : ( hb_parni( 6 ) * 10 ) ); + lf.lfOrientation = 0; + lf.lfWeight = ( ISNIL( 12 ) ? 0 : hb_parni( 12 ) ); + lf.lfItalic = ( ISNIL( 15 ) ? 0 : ( BYTE ) hb_parl( 15 ) ); + lf.lfUnderline = ( ISNIL( 16 ) ? 0 : ( BYTE ) hb_parl( 16 ) ); + lf.lfStrikeOut = ( ISNIL( 17 ) ? 0 : ( BYTE ) hb_parl( 17 ) ); + lf.lfCharSet = ( ISNIL( 14 ) ? ( BYTE ) pWVT->CodePage : ( BYTE ) hb_parni( 14 ) ); + lf.lfOutPrecision = 0; + lf.lfClipPrecision = 0; + lf.lfQuality = ( ISNIL( 13 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 13 ) ); + lf.lfPitchAndFamily = FF_DONTCARE; + lf.lfHeight = ( ISNIL( 10 ) ? pWVT->fontHeight : hb_parni( 10 ) ); + lf.lfWidth = ( ISNIL( 11 ) ? (pWVT->fontWidth < 0 ? -pWVT->fontWidth : pWVT->fontWidth ) : hb_parni( 11 ) ); + // + HB_TCHAR_CPTO( lf.lfFaceName, ( ISNIL( 9 ) ? pWVT->fontFace : hb_parc( 9 ) ), sizeof( lf.lfFaceName )-1 ); + + hFont = CreateFontIndirect( &lf ); + if( hFont ) + { + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_LABEL; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 1 ); + gObj->iRight = hb_parni( 2 ); + + gObj->aOffset.iTop = hb_parni( 3,1 ); + gObj->aOffset.iLeft = hb_parni( 3,2 ); + gObj->aOffset.iBottom = hb_parni( 3,3 ); + gObj->aOffset.iRight = hb_parni( 3,4 ); + + gObj->lpText = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + + gObj->iAlign = ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ); + gObj->crRGBText = ( COLORREF ) hb_parnint( 7 ); + gObj->crRGBBk = ISNIL( 8 ) ? ( COLORREF ) NULL : ( COLORREF ) hb_parnint( 8 ); + gObj->hFont = hFont; + gObj->bDestroyFont = TRUE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; + } +} +//-------------------------------------------------------------------// +// WVG_LABELEX( nRow, nCol, aPxlOff, cLabel, nAlign, nTextColor, nBkColor, nSlotFont ) +// +HB_FUNC( WVG_LABELEX ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_LABEL; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 1 ); + gObj->iRight = hb_parni( 2 ); + + gObj->aOffset.iTop = hb_parni( 3,1 ); + gObj->aOffset.iLeft = hb_parni( 3,2 ); + gObj->aOffset.iBottom = hb_parni( 3,3 ); + gObj->aOffset.iRight = hb_parni( 3,4 ); + + gObj->lpText = HB_TCHAR_CONVTO( hb_parc( 4 ) ); + + gObj->iAlign = ISNIL( 5 ) ? TA_LEFT : hb_parni( 5 ); + gObj->crRGBText = ( COLORREF ) hb_parnint( 6 ); + gObj->crRGBBk = ISNIL( 7 ) ? ( COLORREF ) NULL : ( COLORREF ) hb_parnint( 7 ); + + gObj->hFont = pWVT->pGUI->hUserFonts[ hb_parni( 8 ) - 1 ]; + gObj->bDestroyFont = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_Label( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop ) +{ + HFONT hOldFont; + + if( gObj->crRGBBk != ( COLORREF ) NULL ) + { + SetBkColor( pWVT->hdc, gObj->crRGBBk ); + SetBkMode( pWVT->hdc, OPAQUE ); + } + else + SetBkMode( pWVT->hdc, TRANSPARENT ); + + SetTextColor( pWVT->hdc, gObj->crRGBText ); + SetTextAlign( pWVT->hdc, gObj->iAlign ); + + hOldFont = ( HFONT ) SelectObject( pWVT->hdc, gObj->hFont ); + + ExtTextOut( pWVT->hdc, iLeft, iTop, 0, NULL, gObj->lpText, lstrlen( gObj->lpText ), NULL ); + + SelectObject( pWVT->hdc, hOldFont ); +} +/*----------------------------------------------------------------------*/ +// 1 2 3 4 5 6 7 8 +// Wvg_Outline( nTop, nLeft, nBottom, nRight, aPxlOff, nThick, nShape, nRGBColor ) +// +HB_FUNC( WVG_OUTLINE ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_OUTLINE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iWidth = ISNIL( 6 ) ? 0 : hb_parni( 6 ); // iThick + gObj->iStyle = ISNIL( 7 ) ? 0 : hb_parni( 7 ); // iShape + gObj->crRGB = ISNIL( 8 ) ? 0 : ( COLORREF ) hb_parnl( 8 ); + + if ( gObj->iWidth > 0 ) + { + gObj->hPen = CreatePen( gObj->iWidth, gObj->iStyle, gObj->crRGB ); + gObj->bDestroyPen = TRUE; + } + else + { + gObj->hPen = pWVT->pGUI->penBlack; + gObj->bDestroyPen = FALSE; + } + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +// Wvg_OutlineEx( nTop, nLeft, nBottom, nRight, aPxlOff, nSlotPen ) +// +HB_FUNC( WVG_OUTLINEEX ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_OUTLINEEX; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + if ( pWVT->pGUI->hUserPens[ hb_parni( 6 )-1 ] ) + { + gObj->hPen = pWVT->pGUI->hUserPens[ hb_parni( 6 )-1 ]; + gObj->bDestroyPen = FALSE; + } + else + { + gObj->hPen = pWVT->pGUI->penBlack; + gObj->bDestroyPen = FALSE; + } + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +//----------------------------------------------------------------------// +static void hb_wvg_Outline( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + HDC hdc = pWVT->hdc; + + SelectObject( pWVT->hdc, gObj->hPen ); + + MoveToEx( hdc, iLeft, iTop, NULL ); // Top + LineTo( hdc, iRight, iTop ); + + MoveToEx( hdc, iLeft, iTop, NULL ); // Left + LineTo( hdc, iLeft, iBottom ); + + MoveToEx( hdc, iLeft, iBottom, NULL ); // Bottom + LineTo( hdc, iRight, iBottom ); + + MoveToEx( hdc, iRight, iTop, NULL ); // Right + LineTo( hdc, iRight, iBottom + 1); +} +/*----------------------------------------------------------------------*/ +// 1 2 3 4 5 6 7 8 9 10 11 +// Wvg_Line( nTop, nLeft, nBottom, nRight, aPxlOff, nOrient, nFormat, nAlign, nStyle, nThick, nColor ) +// +HB_FUNC( WVG_LINE ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_LINE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iOrient = ISNIL( 6 ) ? 0 : hb_parni( 6 ); + gObj->iFormat = ISNIL( 7 ) ? 0 : hb_parni( 7 ); + gObj->iAlign = ISNIL( 8 ) ? 0 : hb_parni( 8 ); + + gObj->iStyle = ISNIL( 9 ) ? 0 : hb_parni( 9 ); + gObj->iWidth = ISNIL(10 ) ? 0 : hb_parni(10 ); // iThick + gObj->crRGB = ISNIL(11 ) ? 0 : ( COLORREF ) hb_parnl( 11 ); + + gObj->hPen = CreatePen( gObj->iStyle, gObj->iWidth, gObj->crRGB ); + gObj->bDestroyPen = TRUE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +// 1 2 3 4 5 6 7 8 9 +// Wvg_LineEx( nTop, nLeft, nBottom, nRight, aPxlOff, nOrient, nFormat, nAlign, nSlotPen ) +// +HB_FUNC( WVG_LINEEX ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_LINE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iOrient = ISNIL( 6 ) ? 0 : hb_parni( 6 ); + gObj->iFormat = ISNIL( 7 ) ? 0 : hb_parni( 7 ); + gObj->iAlign = ISNIL( 8 ) ? 0 : hb_parni( 8 ); + + gObj->hPen = pWVT->pGUI->hUserPens[ hb_parni( 9 ) - 1 ]; + gObj->bDestroyPen = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_Line( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + HDC hdc = pWVT->hdc; + HPEN hPen, hOldPen; + + int iOffset; + int x = iLeft ; + int y = iTop ; + + switch ( gObj->iAlign ) + { + case 0: // Center + if ( gObj->iOrient == 0 ) // Horizontal + { + iOffset = ( ( iBottom - iTop ) / 2 ) ; + y = iTop + iOffset ; + } + else + { + iOffset = ( ( iRight - iLeft ) / 2 ) ; + x = iLeft + iOffset ; + } + break; + + case 1: // Top + break; + + case 2: // bottom + if ( gObj->iFormat == 0 || gObj->iFormat == 1 ) // Raised/Recessd + y = iBottom - 1; + else + y = iBottom; + break; + + case 3: // Left + break; + + case 4: // Right + if ( gObj->iFormat == 0 || gObj->iFormat == 1 ) // Raised/Recessd + x = iRight - 1; + else + x = iRight; + break; + } + + hPen = gObj->hPen; + hOldPen = ( HPEN ) SelectObject( hdc, gObj->hPen ); + + switch ( gObj->iFormat ) + { + case 0: // Raised + { + if ( gObj->iOrient == 0 ) // Horizontal + { + SelectObject( hdc, pWVT->pGUI->penWhite ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, iRight, y ); + SelectObject( hdc, hPen ); + MoveToEx( hdc, x, y+1, NULL ); + LineTo( hdc, iRight, y+1 ); + } + else // Vertical + { + SelectObject( hdc, pWVT->pGUI->penWhite ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, x, iBottom ); + SelectObject( hdc, hPen ); + MoveToEx( hdc, x+1, y, NULL ); + LineTo( hdc, x+1, iBottom ); + } + } + break; + + case 1: // Recessed + { + if ( gObj->iOrient == 0 ) // Horizontal + { + SelectObject( hdc, hPen ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, iRight, y ); + SelectObject( hdc, pWVT->pGUI->penWhite ); + MoveToEx( hdc, x, y+1, NULL ); + LineTo( hdc, iRight, y+1 ); + } + else // Vertical + { + SelectObject( hdc, hPen ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, x, iBottom ); + SelectObject( hdc, pWVT->pGUI->penWhite ); + MoveToEx( hdc, x+1, y, NULL ); + LineTo( hdc, x+1, iBottom ); + } + } + break; + + case 2: // Plain + { + if ( gObj->iOrient == 0 ) // Horizontal + { + SelectObject( hdc, hPen ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, iRight, y ); + } + else // Vertical + { + SelectObject( hdc, hPen ); + MoveToEx( hdc, x, y, NULL ); + LineTo( hdc, x, iBottom ); + } + } + break; + } + SelectObject( hdc, hOldPen ); +} +/*----------------------------------------------------------------------*/ +// Inside the area requested! +// Wvg_Ellipse( nTop, nLeft, nBottom, nRight, aPxlOff ) +// +HB_FUNC( WVG_ELLIPSE ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_ELLIPSE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->hPen = pWVT->currentPen; + gObj->bDestroyPen = FALSE; + gObj->hBrush = pWVT->currentBrush; + gObj->bDestroyBrush = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_Ellipse( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + HBRUSH hBrush = ( HBRUSH ) SelectObject( pWVT->hdc, gObj->hBrush ); + HPEN hPen = ( HPEN ) SelectObject( pWVT->hdc, gObj->hPen ); + + Ellipse( pWVT->hdc, iLeft, iTop, iRight, iBottom ); + + SelectObject( pWVT->hdc, hPen ); + SelectObject( pWVT->hdc, hBrush ); +} +/*----------------------------------------------------------------------*/ +// Wvg_Rectangle( nTop, nLeft, nBottom, nRight, aPxlOff ) +// +HB_FUNC( WVG_RECTANGLE ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_RECTANGLE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->hPen = pWVT->currentPen; + gObj->bDestroyPen = FALSE; + gObj->hBrush = pWVT->currentBrush; + gObj->bDestroyBrush = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_Rectangle( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + HBRUSH hBrush = ( HBRUSH ) SelectObject( pWVT->hdc, gObj->hBrush ); + HPEN hPen = ( HPEN ) SelectObject( pWVT->hdc, gObj->hPen ); + + Rectangle( pWVT->hdc, iLeft, iTop, iRight, iBottom ); + + SelectObject( pWVT->hdc, hPen ); + SelectObject( pWVT->hdc, hBrush ); +} +/*----------------------------------------------------------------------*/ +// Wvg_RoundRect( nTop, nLeft, nBottom, nRight, aPxlOff, nRoundHeight, nRoundWidth ) +// +HB_FUNC( WVG_ROUNDRECT ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_ROUNDRECT; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iHeight = hb_parni( 6 ); + gObj->iWidth = hb_parni( 7 ); + + gObj->hPen = pWVT->currentPen; + gObj->bDestroyPen = FALSE; + gObj->hBrush = pWVT->currentBrush; + gObj->bDestroyBrush = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_RoundRect( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + HBRUSH hBrush = ( HBRUSH ) SelectObject( pWVT->hdc, gObj->hBrush ); + HPEN hPen = ( HPEN ) SelectObject( pWVT->hdc, gObj->hPen ); + + RoundRect( pWVT->hdc, iLeft, iTop, iRight, iBottom, gObj->iWidth, gObj->iHeight ); + + SelectObject( pWVT->hdc, hPen ); + SelectObject( pWVT->hdc, hBrush ); +} +/*----------------------------------------------------------------------*/ +// Wvg_ColorRect( nTop, nLeft, nBottom, nRight, aPxlOff, nRGB ) +// +HB_FUNC( WVG_COLORRECT ) +{ + HBRUSH hBrush = CreateSolidBrush( ( COLORREF ) hb_parnint( 6 ) ); + + if( hBrush ) + { + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_COLORRECT; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->hBrush = hBrush; + gObj->bDestroyBrush = TRUE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; + } +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_ColorRect( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + RECT rc = { 0,0,0,0 }; + SetRect( &rc, iLeft, iTop, iRight, iBottom ); + FillRect( pWVT->hGuiDC, &rc, gObj->hBrush ); +} +/*----------------------------------------------------------------------*/ +// Wvg_ShadedRect( nTop, nLeft, nBottom, nRight, aPxlOff, nHorVert, aRGBb, aRGBe ) +// +HB_FUNC( WVG_SHADEDRECT ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + + if ( pWVT->pGUI->hMSImg32 ) + { + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_SHADEDRECT; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iData = ISNIL( 6 ) ? GRADIENT_FILL_RECT_H : hb_parni( 6 ) ; + + gObj->vert[ 0 ].x = 0; + gObj->vert[ 0 ].y = 0; + gObj->vert[ 0 ].Red = ( COLOR16 ) hb_parni( 7,1 ); + gObj->vert[ 0 ].Green = ( COLOR16 ) hb_parni( 7,2 ); + gObj->vert[ 0 ].Blue = ( COLOR16 ) hb_parni( 7,3 ); + gObj->vert[ 0 ].Alpha = ( COLOR16 ) hb_parni( 7,4 ); + + gObj->vert[ 1 ].x = 0; + gObj->vert[ 1 ].y = 0; + gObj->vert[ 1 ].Red = ( COLOR16 ) hb_parni( 8,1 ); + gObj->vert[ 1 ].Green = ( COLOR16 ) hb_parni( 8,2 ); + gObj->vert[ 1 ].Blue = ( COLOR16 ) hb_parni( 8,3 ); + gObj->vert[ 1 ].Alpha = ( COLOR16 ) hb_parni( 8,4 ); + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; + } +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_ShadedRect( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + BOOL bGF; + GRADIENT_RECT gRect = { 0,0 }; + + gRect.UpperLeft = 0; + gRect.LowerRight = 1; + + gObj->vert[ 0 ].x = iLeft; + gObj->vert[ 0 ].y = iTop; + + gObj->vert[ 1 ].x = iRight; + gObj->vert[ 1 ].y = iBottom; + + bGF = ( BOOL ) pWVT->pGUI->pfnGF( pWVT->hGuiDC, gObj->vert, 2, &gRect, 1, gObj->iData ); + + HB_SYMBOL_UNUSED( bGF ); +} +/*----------------------------------------------------------------------*/ +// Wvg_TextBox( nTop, nLeft, nBottom, nRight, aPxlOff, cText, ; +// nAlignHorz, nAlignVert, nTextColor, nBackColor, hFont ) +// +HB_FUNC( WVG_TEXTBOX ) +{ + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + int iAlignH; + + gObj->iObjType = GOBJ_OBJTYPE_TEXTBOX; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->lpText = HB_TCHAR_CONVTO( hb_parc( 6 ) ); + + switch ( hb_parni( 7 ) ) + { + case 0: + iAlignH = DT_LEFT; + break; + case 1: + iAlignH = DT_RIGHT; + break; + case 2: + iAlignH = DT_CENTER; + break; + } + gObj->iAlign = iAlignH; + + gObj->crRGBText = ( COLORREF ) hb_parnint( 9 ); + gObj->crRGBBk = ISNIL( 10 ) ? ( COLORREF ) NULL : ( COLORREF ) hb_parnint( 10 ); + + gObj->hFont = ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 11 ); + gObj->bDestroyFont = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_TextBox( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ + RECT rc = { 0,0,0,0 }; + HDC hdc = pWVT->hGuiDC; + + SetRect( &rc, iLeft, iTop, iRight, iBottom ); + + SetTextAlign( hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP ); + SetTextColor( hdc, gObj->crRGBText ); + if( gObj->crRGBBk == ( COLORREF ) NULL ) + SetBkMode( hdc, TRANSPARENT ); + else + { + SetBkMode( hdc, OPAQUE ); + SetBkColor( hdc, gObj->crRGBBk ); + } + SelectObject( hdc, gObj->hFont ); + + DrawText( hdc, gObj->lpText, lstrlen( gObj->lpText ), &rc, gObj->iAlign | DT_WORDBREAK | DT_TOP ); +} +/*----------------------------------------------------------------------*/ +// Wvt_DrawPicture( nTop, nLeft, nBottom, nRight, nSlot, aPxlOff ) -> lOk +// Wvg_Picture( nTop, nLeft, nBottom, nRight, aPxlOff, nSlot ) -> NIL +// +HB_FUNC( WVG_PICTURE ) +{ +#if ! defined( HB_OS_WIN_CE ) + if( ISNUM( 6 ) && hb_parni( 6 ) <= WVT_PICTURES_MAX ) + { + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_PICTURE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iPicture = pWVT->pGUI->iPicture[ hb_parni( 6 )-1 ]; + gObj->bDestroyPicture = FALSE; + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; + } + else + { + hb_retni( 0 ); + } +#else + hb_retni( 0 ); +#endif +} +/*----------------------------------------------------------------------*/ +// +// Wvg_Image( nTop, nLeft, nBottom, nRight, aPxlOff, nImageSource, cImage/nPictureSlot, cSection ) +// +HB_FUNC( WVG_IMAGE ) +{ +#if ! defined( HB_OS_WIN_CE ) + PHB_GTWVT pWVT = hb_wvt_gtGetWVT(); + int iSource = hb_parni( 6 ); + IPicture *iPicture; + + if( iSource == 0 ) + { + hb_retni( 0 ); + return; + } + + switch( iSource ) + { + case GOBJ_IMAGESOURCE_SLOT: + if( ISNUM( 7 ) && hb_parni( 7 ) <= WVT_PICTURES_MAX ) + { + iPicture = pWVT->pGUI->iPicture[ hb_parni( 7 ) - 1 ]; + } + break; + case GOBJ_IMAGESOURCE_RESOURCE: + iPicture = hb_wvt_gtLoadPictureFromResource( hb_parc( 7 ), hb_parc( 8 ) ); + break; + case GOBJ_IMAGESOURCE_FILE: + iPicture = hb_wvt_gtLoadPicture( hb_parc( 7 ) ); + break; + } + + if( iPicture ) + { + HB_GOBJS *gObj = hb_wvg_ObjectNew( pWVT ); + + gObj->iObjType = GOBJ_OBJTYPE_PICTURE; + + gObj->iTop = hb_parni( 1 ); + gObj->iLeft = hb_parni( 2 ); + gObj->iBottom = hb_parni( 3 ); + gObj->iRight = hb_parni( 4 ); + + gObj->aOffset.iTop = hb_parni( 5,1 ); + gObj->aOffset.iLeft = hb_parni( 5,2 ); + gObj->aOffset.iBottom = hb_parni( 5,3 ); + gObj->aOffset.iRight = hb_parni( 5,4 ); + + gObj->iPicture = iPicture; + + if( iSource == GOBJ_IMAGESOURCE_SLOT ) + { + gObj->bDestroyPicture = FALSE; + } + else + { + gObj->bDestroyPicture = TRUE; + } + + gObj->gObjNext = pWVT->gObjs; + pWVT->gObjs = gObj; + } + else + { + hb_retni( 0 ); + } +#else + hb_retni( 0 ); +#endif +} +/*----------------------------------------------------------------------*/ +static void hb_wvg_RenderPicture( PHB_GTWVT pWVT, PHB_GOBJS gObj, int iLeft, int iTop, int iRight, int iBottom ) +{ +#if ! defined( HB_OS_WIN_CE ) + LONG lWidth, lHeight; + int x, y, xe, ye; + int c = iLeft; + int r = iTop; + int dc = iRight - iLeft + 1; + int dr = iBottom - iTop + 1; + int toc = 0; + int tor = 0; + HRGN hrgn1; + POINT lpp; + HDC hdc = pWVT->hGuiDC; + IPicture * iPicture = gObj->iPicture; + + if( iPicture ) + { + iPicture->lpVtbl->get_Width( iPicture, &lWidth ); + iPicture->lpVtbl->get_Height( iPicture, &lHeight ); + + if( dc == 0 ) + dc = ( int ) ( ( float ) dr * lWidth / lHeight ); + if( dr == 0 ) + dr = ( int ) ( ( float ) dc * lHeight / lWidth ); + if( toc == 0 ) + toc = dc; + if( tor == 0 ) + tor = dr; + + x = c; + y = r; + xe = c + toc - 1; + ye = r + tor - 1; + + GetViewportOrgEx( hdc, &lpp ); + + hrgn1 = CreateRectRgn( c+lpp.x, r+lpp.y, xe+lpp.x, ye+lpp.y ); + SelectClipRgn( hdc, hrgn1 ); + + while( x < xe ) + { + while( y < ye ) + { + iPicture->lpVtbl->Render( iPicture, hdc, x, y, dc, dr, 0, lHeight, lWidth, -lHeight, NULL ); + y += dr; + } + y = r; + x += dc; + } + SelectClipRgn( hdc, NULL ); + DeleteObject( hrgn1 ); + } +#endif +} +/*----------------------------------------------------------------------*/ +/* Owner Draw Implementation */ +/*----------------------------------------------------------------------*/ void hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ) { PHB_GOBJS gObj = pWVT->gObjs; @@ -358,43 +1404,37 @@ void hb_gt_wvt_PaintGObjects( PHB_GTWVT pWVT, RECT *uRect ) while( gObj ) { - iTop = ( pWVT->PTEXTSIZE.y * gObj->iTop ) + gObj->aOffset.iTop; - iLeft = ( pWVT->PTEXTSIZE.x * gObj->iLeft ) + gObj->aOffset.iLeft; - iBottom = ( pWVT->PTEXTSIZE.y * ( gObj->iBottom + 1 ) ) - 1 + gObj->aOffset.iBottom; - iRight = ( pWVT->PTEXTSIZE.x * ( gObj->iRight + 1 ) ) - 1 + gObj->aOffset.iRight; - - switch( gObj->iObjType ) + if( gObj->iState == GOBJ_OBJSTATE_ENABLED ) { - case GOBJ_OBJTYPE_BOXRAISED: - case GOBJ_OBJTYPE_BOXRECESSED: - case GOBJ_OBJTYPE_BOXGET: - case GOBJ_OBJTYPE_BOXGROUP: - case GOBJ_OBJTYPE_BOXGROUPRAISED: + iTop = ( pWVT->PTEXTSIZE.y * gObj->iTop ) + gObj->aOffset.iTop; + iLeft = ( pWVT->PTEXTSIZE.x * gObj->iLeft ) + gObj->aOffset.iLeft; + iBottom = ( pWVT->PTEXTSIZE.y * ( gObj->iBottom + 1 ) ) - 1 + gObj->aOffset.iBottom; + iRight = ( pWVT->PTEXTSIZE.x * ( gObj->iRight + 1 ) ) - 1 + gObj->aOffset.iRight; + + switch( gObj->iObjType ) { -#if 0 -hb_ToOutDebug( "[uRect %i %i %i %i ][gObj %i %i %i %i ]", uRect->left, uRect->top, - uRect->right, uRect->bottom, iLeft, iTop, iRight, iBottom ); -#endif - if( ( uRect->left > iRight + 2 ) || ( uRect->top > iBottom + 2 ) || - ( uRect->bottom < iTop - 2 ) || ( uRect->right < iLeft - 2 ) - ) + case GOBJ_OBJTYPE_BOXRAISED: + case GOBJ_OBJTYPE_BOXRECESSED: + case GOBJ_OBJTYPE_BOXGET: + case GOBJ_OBJTYPE_BOXGROUP: + case GOBJ_OBJTYPE_BOXGROUPRAISED: { - // It is outside of the boundaries - } - else if( uRect->left >= iLeft && - uRect->right <= iRight && - uRect->top >= iTop && - uRect->bottom <= iBottom ) - { - // It is inside of the boundaries - } - else - { -#if 0 -hb_ToOutDebug( "Box Painted" ); -#endif - switch( gObj->iObjType ) + if( ( uRect->left > iRight + 2 ) || ( uRect->top > iBottom + 2 ) || + ( uRect->bottom < iTop - 2 ) || ( uRect->right < iLeft - 2 ) ) { + // It is outside of the boundaries + } + else if( uRect->left >= iLeft && + uRect->right <= iRight && + uRect->top >= iTop && + uRect->bottom <= iBottom ) + { + // It is inside of the boundaries + } + else + { + switch( gObj->iObjType ) + { case GOBJ_OBJTYPE_BOXRAISED: hb_wvg_BoxRaised( pWVT, iLeft-1, iTop-1, iRight+1, iBottom+1 ); break; @@ -410,10 +1450,104 @@ hb_ToOutDebug( "Box Painted" ); case GOBJ_OBJTYPE_BOXGROUPRAISED: hb_wvg_BoxGroupRaised( pWVT, iLeft-1, iTop-1, iRight+1, iBottom+1 ); break; + } } } + break; + + case GOBJ_OBJTYPE_PICTURE: + case GOBJ_OBJTYPE_LINE: + case GOBJ_OBJTYPE_LINEEX: + case GOBJ_OBJTYPE_ELLIPSE: + case GOBJ_OBJTYPE_RECTANGLE: + case GOBJ_OBJTYPE_ROUNDRECT: + case GOBJ_OBJTYPE_COLORRECT: + case GOBJ_OBJTYPE_SHADEDRECT: + case GOBJ_OBJTYPE_TEXTBOX: + { + if( ( uRect->left > iRight ) || ( uRect->top > iBottom ) || + ( uRect->bottom < iTop ) || ( uRect->right < iLeft ) ) + { + // Nothing to do + } + else + { + switch( gObj->iObjType ) + { + + case GOBJ_OBJTYPE_LINE: + case GOBJ_OBJTYPE_LINEEX: + hb_wvg_Line( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_ELLIPSE: + hb_wvg_Ellipse( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_RECTANGLE: + hb_wvg_Rectangle( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_ROUNDRECT: + hb_wvg_RoundRect( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_COLORRECT: + hb_wvg_ColorRect( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + hb_wvg_RestFromBuffer( pWVT, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_SHADEDRECT: + hb_wvg_ShadedRect( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + hb_wvg_RestFromBuffer( pWVT, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_PICTURE: + hb_wvg_RenderPicture( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + hb_wvg_RestFromBuffer( pWVT, iLeft, iTop, iRight, iBottom ); + break; + case GOBJ_OBJTYPE_TEXTBOX: + hb_wvg_TextBox( pWVT, gObj, iLeft, iTop, iRight, iBottom ); + hb_wvg_RestFromBuffer( pWVT, iLeft, iTop, iRight, iBottom ); + break; + } + } + } + break; + + case GOBJ_OBJTYPE_LABEL: + case GOBJ_OBJTYPE_LABELEX: + { + #if 0 + if( ( uRect->top > iTop + gObj->lf->lfHeight ) || + ( uRect->bottom < iTop ) || ( uRect->right < iLeft ) ) + { + // Nothing to do . + } + else + #endif + { + hb_wvg_Label( pWVT, gObj, iLeft, iTop ); + } + } + break; + + case GOBJ_OBJTYPE_OUTLINE: + case GOBJ_OBJTYPE_OUTLINEEX: + { + if( ( uRect->left > iRight ) || ( uRect->top > iBottom ) || + ( uRect->bottom < iTop ) || ( uRect->right < iLeft ) ) + { + // It is outside of the boundaries + } + else if( uRect->left >= iLeft && + uRect->right <= iRight && + uRect->top >= iTop && + uRect->bottom <= iBottom ) + { + // It is inside of the boundaries + } + else + { + hb_wvg_Outline( pWVT, gObj, iLeft-1, iTop-1, iRight+1, iBottom+1 ); + } + } + break; } - break; } gObj = gObj->gObjNext; } diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index e221a51022..9d52b3dde8 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -1045,13 +1045,16 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara SendMessage( hWnd, WM_SIZE, 0, 0 ); return 0; } +#if ! defined( HB_OS_WIN_CE ) case WM_SIZING: +#endif case WM_SIZE: { return hb_gt_wvt_SizeChanged( pWVT ); } case WM_SYSCOMMAND: { +#if ! defined( HB_OS_WIN_CE ) switch( wParam ) { case SC_MAXIMIZE: @@ -1059,6 +1062,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara // TODO } } +#endif break; } case WM_TIMER: @@ -1093,6 +1097,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_FireMenuEvent( pWVT, 2, ( int ) wParam ); return 0; } +#if ! defined( HB_OS_WIN_CE ) case WM_MOUSEHOVER: { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -1119,6 +1124,7 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara pWVT->bTracking = FALSE; break; } +#endif case WM_COMMAND: { if( ( int ) lParam == 0 ) @@ -1294,7 +1300,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT ) HB_TCHAR_FREE( szAppName ); - ShowWindow( pWVT->hWnd, pWVT->pPP->bVisible ? SW_NORMAL : SW_HIDE ); + ShowWindow( pWVT->hWnd, pWVT->pPP->bVisible ? SW_SHOWNORMAL : SW_HIDE ); UpdateWindow( pWVT->hWnd ); return hWnd; @@ -1806,11 +1812,14 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) SetWindowLong( pWVT->hWnd, GWL_STYLE, style ); #else SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, style ); +#endif +#if defined( HB_OS_WIN_CE ) + #define SWP_DEFERERASE 0 #endif SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); ShowWindow( pWVT->hWnd, SW_HIDE ); - ShowWindow( pWVT->hWnd, SW_NORMAL ); + ShowWindow( pWVT->hWnd, SW_SHOWNORMAL ); } } } @@ -2058,12 +2067,18 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } case HB_GTS_WS_MINIMIZED: +#if ! defined( HB_OS_WIN_CE ) SendNotifyMessage( pWVT->hWnd, WM_SYSCOMMAND, SC_MINIMIZE, 0 ); +#endif break; case HB_GTS_WS_MAXIMIZED: if( pWVT->bResizable ) + { +#if ! defined( HB_OS_WIN_CE ) SendNotifyMessage( pWVT->hWnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0 ); +#endif + } else ShowWindow( pWVT->hWnd, SW_RESTORE ); break; diff --git a/harbour/contrib/gtwvg/wvggui.h b/harbour/contrib/gtwvg/wvggui.h index d430e598ac..bd9c45604d 100644 --- a/harbour/contrib/gtwvg/wvggui.h +++ b/harbour/contrib/gtwvg/wvggui.h @@ -73,7 +73,9 @@ #include #include #include +#if ! defined( HB_OS_WIN_CE ) #include +#endif #include #include diff --git a/harbour/contrib/gtwvg/wvgsink.c b/harbour/contrib/gtwvg/wvgsink.c index 4da3d40971..25af133aba 100644 --- a/harbour/contrib/gtwvg/wvgsink.c +++ b/harbour/contrib/gtwvg/wvgsink.c @@ -80,6 +80,8 @@ */ //----------------------------------------------------------------------// +#define HB_OS_WIN_USED + #ifndef CINTERFACE #define CINTERFACE 1 #endif @@ -90,7 +92,7 @@ #include "hbvmint.h" #endif -#include +//#include #include #include "hbapi.h" #include "item.api" @@ -103,7 +105,9 @@ #include #include #include +#if ! defined( HB_OS_WIN_CE ) #include +#endif #include #include @@ -828,8 +832,11 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL ) if( hContainer ) { LPARAM lParam = MAKELPARAM( FALSE, 0 ); +#if ! defined( HB_OS_WIN_CE ) SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ), lParam ); - +#else + SendMessage( ( HWND ) hContainer, ( UINT ) WM_SETFONT, ( WPARAM ) GetStockObject( OEM_FIXED_FONT ), lParam ); +#endif 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 ); @@ -935,11 +942,17 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind if( hWnd ) { +#if ! defined( HB_OS_WIN_CE ) SendMessage( hWnd, ( ( UINT ) WM_SETFONT ), ( ( WPARAM ) GetStockObject( DEFAULT_GUI_FONT ) ), ( ( LPARAM ) ( MAKELPARAM( FALSE, 0 ) ) ) ); - +#else + SendMessage( hWnd, + ( ( UINT ) WM_SETFONT ), + ( ( WPARAM ) GetStockObject( OEM_FIXED_FONT ) ), + ( ( LPARAM ) ( MAKELPARAM( FALSE, 0 ) ) ) ); +#endif ( AtlAxGetControl )( hWnd, &pUnk ); if( pUnk ) diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 83c835f745..3387b769cf 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -133,8 +133,8 @@ HB_FUNC( WVT_UTILS ) // HB_FUNC( WVT_CHOOSEFONT ) { +#if ! defined( HB_OS_WIN_CE ) PHB_GTWVT _s = hb_wvt_gtGetWVT(); - CHOOSEFONT cf;// = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; LOGFONT lf;// = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; LONG PointSize = 0; @@ -207,6 +207,7 @@ HB_FUNC( WVT_CHOOSEFONT ) } return ; +#endif } //-------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index ddd0bfb1d0..61df68a90d 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -91,7 +91,13 @@ #define WIN_STATUSBAR_MAX_PARTS 256 -//----------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ + +#define WM_CHOOSEFONT_GETLOGFONT (WM_USER + 1) +#define WM_CHOOSEFONT_SETLOGFONT (WM_USER + 101) +#define WM_CHOOSEFONT_SETFLAGS (WM_USER + 102) + +/*----------------------------------------------------------------------*/ #define wvg_parwparam( n ) ( ( WPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) ) #define wvg_parlparam( n ) ( ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( n ) ) @@ -103,7 +109,7 @@ #define wvg_rethandle( n ) ( hb_retnint( ( HB_PTRDIFF ) n ) ) -//----------------------------------------------------------------------// +/*----------------------------------------------------------------------*/ #if defined(__BORLANDC__) && !defined(HB_ARCH_64BIT) #undef MAKELONG @@ -459,21 +465,12 @@ HB_FUNC( WIN_GETDC ) { hb_retnint( ( HB_PTRDIFF ) GetDC( ISNIL( 1 ) ? NULL : ( 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 ) ) ); } - -//-------------------------------------------------------------------// -#if 0 -HB_FUNC( WIN_RECTANGLE ) -{ - Rectangle( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ); -} -#endif //-------------------------------------------------------------------// HB_FUNC( WIN_CREATEBRUSH ) @@ -483,10 +480,12 @@ HB_FUNC( WIN_CREATEBRUSH ) 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 ); - +#if ! defined( HB_OS_WIN_CE ) hb_retnint( ( HB_PTRDIFF ) CreateBrushIndirect( &lb ) ); +#else + hb_retnint( ( HB_PTRDIFF ) CreateSolidBrush( lb.lbColor ) ); +#endif } - //-------------------------------------------------------------------// // // Win_DrawText( hDC, cText, aRect, nFormat ) @@ -986,6 +985,7 @@ static BITMAPINFO * PackedDibLoad( PTSTR szFileName ) return pbmi ; } +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetWidth( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -993,7 +993,9 @@ static int PackedDibGetWidth( BITMAPINFO * pPackedDib ) else return pPackedDib->bmiHeader.biWidth ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetHeight( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -1001,7 +1003,9 @@ static int PackedDibGetHeight( BITMAPINFO * pPackedDib ) else return abs( pPackedDib->bmiHeader.biHeight ) ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetBitCount( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -1009,7 +1013,9 @@ static int PackedDibGetBitCount( BITMAPINFO * pPackedDib ) else return pPackedDib->bmiHeader.biBitCount ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetInfoHeaderSize( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -1021,7 +1027,9 @@ static int PackedDibGetInfoHeaderSize( BITMAPINFO * pPackedDib ) else return pPackedDib->bmiHeader.biSize ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetColorsUsed( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -1029,7 +1037,9 @@ static int PackedDibGetColorsUsed( BITMAPINFO * pPackedDib ) else return pPackedDib->bmiHeader.biClrUsed ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetNumColors( BITMAPINFO * pPackedDib ) { int iNumColors ; @@ -1041,7 +1051,9 @@ static int PackedDibGetNumColors( BITMAPINFO * pPackedDib ) return iNumColors ; } +#endif +#if ! defined( HB_OS_WIN_CE ) static int PackedDibGetColorTableSize( BITMAPINFO * pPackedDib ) { if( pPackedDib->bmiHeader.biSize == sizeof( BITMAPCOREHEADER ) ) @@ -1049,6 +1061,7 @@ static int PackedDibGetColorTableSize( BITMAPINFO * pPackedDib ) else return PackedDibGetNumColors( pPackedDib ) * sizeof( RGBQUAD ) ; } +#endif #if 0 static RGBQUAD * PackedDibGetColorTablePtr( BITMAPINFO * pPackedDib ) @@ -1070,13 +1083,13 @@ static RGBQUAD * PackedDibGetColorTableEntry( BITMAPINFO * pPackedDib, int i ) return PackedDibGetColorTablePtr( pPackedDib ) + i ; } #endif - +#if ! defined( HB_OS_WIN_CE ) static BYTE * PackedDibGetBitsPtr( BITMAPINFO * pPackedDib ) { return ( ( BYTE * ) pPackedDib ) + PackedDibGetInfoHeaderSize( pPackedDib ) + PackedDibGetColorTableSize( pPackedDib ) ; } - +#endif static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap, int iExpWidth, int iExpHeight, BOOL bMap3Dcolors, @@ -1110,6 +1123,7 @@ static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap, if( !bMap3Dcolors ) { +#if ! defined( HB_OS_WIN_CE ) hBitmap = CreateDIBitmap( hdc, ( PBITMAPINFOHEADER ) pPackedDib, CBM_INIT, @@ -1123,6 +1137,9 @@ static HBITMAP hPrepareBitmap( char * szBitmapX, UINT uiBitmap, iWidth = PackedDibGetWidth( pPackedDib ); iHeight = PackedDibGetHeight( pPackedDib ); +#else + return NULL; +#endif } else { @@ -1525,30 +1542,30 @@ HB_FUNC( WVG_GETNMTREEVIEWINFO ) HB_FUNC( WIN_TREEVIEW_SETTEXTCOLOR ) { +#if ! defined( HB_OS_WIN_CE ) hb_retl( TreeView_SetTextColor( wvg_parhwnd( 1 ), wvg_parcolor( 2 ) ) ); +#endif } - //----------------------------------------------------------------------// HB_FUNC( WIN_TREEVIEW_SETBKCOLOR ) { +#if ! defined( HB_OS_WIN_CE ) hb_retl( TreeView_SetBkColor( wvg_parhwnd( 1 ), wvg_parcolor( 2 ) ) ); +#endif } - //----------------------------------------------------------------------// HB_FUNC( WIN_TREEVIEW_SETLINECOLOR ) { //hb_retl( TreeView_SetLineColor( wvg_parhwnd( 1 ), wvg_parcolor( 2 ) ) ); } - //----------------------------------------------------------------------// HB_FUNC( WIN_TREEVIEW_SELECTITEM ) { hb_retl( TreeView_SelectItem( wvg_parhwnd( 1 ), wvg_parhandle( 2 ) ) ); } - //----------------------------------------------------------------------// // Wvg_TreeView_GetSelectionInfo( ::hWnd, nlParam, @cParent, @cText, @hParentOfSelected, @hItemSelected ) // @@ -1724,21 +1741,26 @@ HB_FUNC( WIN_BUTTON_GETCHECK ) { hb_retnl( Button_GetCheck( wvg_parhwnd( 1 ) ) ); } - //----------------------------------------------------------------------// HB_FUNC( WIN_ISICONIC ) { +#if ! defined( HB_OS_WIN_CE ) hb_retl( IsIconic( wvg_parhwnd( 1 ) ) ); +#else + hb_retl( FALSE ); +#endif } - //----------------------------------------------------------------------// HB_FUNC( WIN_ISZOOMED ) { +#if ! defined( HB_OS_WIN_CE ) hb_retl( IsZoomed( wvg_parhwnd( 1 ) ) ); +#else + hb_retl( TRUE ); +#endif } - //----------------------------------------------------------------------// // Win_SetDCBrushColor( hDC, nRGB ) // @@ -1750,7 +1772,6 @@ HB_FUNC( WIN_SETDCBRUSHCOLOR ) wvg_rethandle( NULL ); #endif } - //----------------------------------------------------------------------// // Win_SetDCPenColor( hDC, nRGB ) // @@ -1825,7 +1846,7 @@ HB_FUNC( WIN_SETWINDOWPOSANDSIZE ) { hb_retl( SetWindowPos( wvg_parhwnd( 1 ), NULL, hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), - hb_parl( 6 ) ? 0 : SWP_NOREDRAW | SWP_NOZORDER | SWP_NOACTIVATE ) ); + ( hb_parl( 6 ) ? 0 : SWP_NOREDRAW ) | SWP_NOZORDER | SWP_NOACTIVATE ) ); } //----------------------------------------------------------------------// @@ -1886,6 +1907,7 @@ PHB_ITEM wvg_logfontTOarray( LPLOGFONT lf, BOOL bEmpty ) // HB_FUNC( WVG_CHOOSEFONT ) { +#if ! defined( HB_OS_WIN_CE ) CHOOSEFONT cf; // = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; LOGFONT lf; // = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 }; DWORD Flags; @@ -1964,6 +1986,7 @@ HB_FUNC( WVG_CHOOSEFONT ) hb_itemReturnRelease( aFont ); hb_itemRelease( aInfo ); } +#endif } //----------------------------------------------------------------------// @@ -2050,11 +2073,13 @@ HB_FUNC( WVG_HEIGHTTOPOINTSIZE ) //----------------------------------------------------------------------// HB_FUNC( WVG_SETCURRENTBRUSH ) { +#if ! defined( HB_OS_WIN_CE ) #if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_OS_WIN_CE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT) SetClassLong( wvg_parhwnd( 1 ), GCL_HBRBACKGROUND, ( DWORD ) hb_parnint( 2 ) ); #else SetClassLongPtr( wvg_parhwnd( 1 ), GCLP_HBRBACKGROUND, ( LONG_PTR ) hb_parnint( 2 ) ); #endif +#endif } //----------------------------------------------------------------------// // Win_SetLayeredWindowAttributes( hWnd, nRGB, nOpacityFactor [0-255] ) @@ -2140,9 +2165,9 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) tbb.iString = iNewString; bSuccess = ( BOOL ) SendMessage( hWndTB, TB_ADDBUTTONS, ( WPARAM ) 1, ( LPARAM ) ( LPTBBUTTON ) &tbb ); - +#if ! defined( HB_OS_WIN_CE ) SendMessage( hWndTB, TB_SETPADDING, ( WPARAM ) 0, ( LPARAM ) MAKELPARAM( 10,10 ) ); - +#endif hb_retl( bSuccess ); return; } @@ -2169,10 +2194,10 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) HB_FUNC( WIN_SENDTOOLBARMESSAGE ) { +//#if ! defined( HB_OS_WIN_CE ) HWND hTB = wapi_par_HWND( 1 ); int msg = wapi_par_INT( 2 ); - switch( msg ) { case TB_ADDBITMAP : @@ -2186,8 +2211,8 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) tbab.nID = ( UINT ) wapi_par_HBITMAP( 3 ); #endif wapi_ret_NI( ( int ) SendMessage( hTB, TB_ADDBITMAP, ( WPARAM ) 1, ( LPARAM ) &tbab ) ); + break; } - break; case TB_ADDBUTTONS : { TBBUTTON tbb; @@ -2200,8 +2225,8 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) tbb.iString = wapi_par_INT( 5 ); wapi_ret_L( ( BOOL ) SendMessage( hTB, TB_ADDBUTTONS, ( WPARAM ) 1, ( LPARAM ) ( LPTBBUTTON ) &tbb ) ); + break; } - break; case TB_ADDSTRING : { int iString; @@ -2212,402 +2237,134 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) HB_TCHAR_FREE( szCaption ); wapi_ret_NI( iString ); + break; } - break; case TB_AUTOSIZE : - { SendMessage( hTB, TB_AUTOSIZE, ( WPARAM ) 0, ( LPARAM ) 0 ); - } - break; + break; case TB_BUTTONCOUNT : - { - } - break; + break; case TB_BUTTONSTRUCTSIZE : - { SendMessage( hTB, TB_BUTTONSTRUCTSIZE, sizeof( TBBUTTON ), 0 ); - } - break; + break; case TB_CHANGEBITMAP : - { - } - break; case TB_CHECKBUTTON : - { - } - break; case TB_COMMANDTOINDEX : - { - } - break; - case TB_CUSTOMIZE : - { - } - break; case TB_DELETEBUTTON : - { - } - break; case TB_ENABLEBUTTON : - { - } - break; - case TB_GETANCHORHIGHLIGHT : - { - } - break; case TB_GETBITMAP : - { - } - break; case TB_GETBITMAPFLAGS : - { - } - break; case TB_GETBUTTON : - { - } - break; case TB_GETBUTTONINFO : - { - } - break; case TB_GETBUTTONSIZE : - { - } - break; case TB_GETBUTTONTEXT : - { - } - break; - case TB_GETCOLORSCHEME : - { - } - break; case TB_GETDISABLEDIMAGELIST : - { - } - break; - case TB_GETEXTENDEDSTYLE : - { - } - break; - case TB_GETHOTIMAGELIST : - { - } - break; - case TB_GETHOTITEM : - { - } - break; - #if 0 - case TB_GETIDEALSIZE : - { - } - break; - #endif case TB_GETIMAGELIST : - { - } - break; - #if 0 - case TB_GETIMAGELISTCOUNT : - { - } - break; - #endif - case TB_GETINSERTMARK : - { - } - break; - case TB_GETINSERTMARKCOLOR : - { - } - break; - #if 0 - case TB_GETITEMDROPDOWNRECT : - { - } - break; - #endif case TB_GETITEMRECT : - { - } - break; - case TB_GETMAXSIZE : - { - } - break; - #if 0 - case TB_GETMETRICS : - { - } - break; - #endif - case TB_GETOBJECT : - { - } - break; - case TB_GETPADDING : - { - } - break; - #if 0 - case TB_GETPRESSEDIMAGELIST : - { - } - break; - #endif case TB_GETRECT : - { - } - break; case TB_GETROWS : - { - } - break; case TB_GETSTATE : - { - } - break; - #if 0 - case TB_GETSTRING : - { - } - break; - #endif case TB_GETSTYLE : - { - } - break; case TB_GETTEXTROWS : - { - } - break; case TB_GETTOOLTIPS : - { - } - break; - case TB_GETUNICODEFORMAT : - { - } - break; case TB_HIDEBUTTON : - { - } - break; case TB_HITTEST : - { - } - break; case TB_INDETERMINATE : - { - } - break; case TB_INSERTBUTTON : - { - } - break; - case TB_INSERTMARKHITTEST : - { - } - break; case TB_ISBUTTONCHECKED : - { - } - break; case TB_ISBUTTONENABLED : - { - } - break; case TB_ISBUTTONHIDDEN : - { - } - break; case TB_ISBUTTONHIGHLIGHTED : - { - } - break; case TB_ISBUTTONINDETERMINATE: - { - } - break; case TB_ISBUTTONPRESSED : - { - } - break; case TB_LOADIMAGES : - { - } - break; - case TB_MAPACCELERATOR : - { - } - break; - case TB_MARKBUTTON : - { - SendMessage( hTB, TB_MARKBUTTON, ( WPARAM ) wapi_par_INT( 3 ), ( LPARAM ) MAKELONG( hb_parl( 4 ),0 ) ); - } - break; - case TB_MOVEBUTTON : - { - } - break; case TB_PRESSBUTTON : - { - } - break; case TB_REPLACEBITMAP : - { - } - break; - case TB_SAVERESTORE : - { - } - break; - case TB_SETANCHORHIGHLIGHT : - { - } - break; + break; case TB_SETBITMAPSIZE : - { SendMessage( hTB, TB_SETBITMAPSIZE, ( WPARAM ) 0, ( LPARAM ) MAKELONG( wapi_par_INT( 3 ), wapi_par_INT( 4 ) ) ); - } - break; + break; case TB_SETBUTTONINFO : - { - } - break; + break; case TB_SETBUTTONSIZE : - { SendMessage( hTB, TB_SETBUTTONSIZE, ( WPARAM ) 0, ( LPARAM ) MAKELONG( wapi_par_INT( 3 ), wapi_par_INT( 4 ) ) ); - } - break; + break; case TB_SETBUTTONWIDTH : - { SendMessage( hTB, TB_SETBUTTONWIDTH, ( WPARAM ) 0, ( LPARAM ) MAKELONG( wapi_par_INT( 3 ), wapi_par_INT( 4 ) ) ); - } - break; - case TB_SETCMDID : - { - } - break; - case TB_SETCOLORSCHEME : - { - } - break; - case TB_SETDISABLEDIMAGELIST : - { - } - break; - case TB_SETDRAWTEXTFLAGS : - { - } - break; - case TB_SETEXTENDEDSTYLE : - { - } - break; - case TB_SETHOTIMAGELIST : - { - } - break; - case TB_SETHOTITEM : - { - } - break; - #if 0 - case TB_SETHOTITEM2 : - { - } - break; - #endif + break; case TB_SETIMAGELIST : - { SendMessage( hTB, TB_SETIMAGELIST, ( WPARAM ) 0, ( LPARAM ) wapi_par_HIMAGELIST( 3 ) ); - } - break; + break; case TB_SETINDENT : - { SendMessage( hTB, TB_SETINDENT, ( WPARAM ) wapi_par_INT( 3 ), ( LPARAM ) 0 ); - } - break; - case TB_SETINSERTMARK : - { - } - break; - case TB_SETINSERTMARKCOLOR : - { - } - break; - #if 0 - case TB_SETLISTGAP : - { - } - break; - #endif + break; case TB_SETMAXTEXTROWS : - { SendMessage( hTB, TB_SETMAXTEXTROWS, ( WPARAM ) wapi_par_INT( 2 ), ( LPARAM ) 0 ); - } - break; + break; + case TB_SETPARENT : + case TB_SETROWS : + case TB_SETSTATE : + case TB_SETSTYLE : + case TB_SETTOOLTIPS : + case TB_SETCMDID : + case TB_SETDISABLEDIMAGELIST : + case TB_SETDRAWTEXTFLAGS : + break; + #if 0 + case TB_TRANSLATEACCELERATOR : + case TB_SETPRESSEDIMAGELIST : + case TB_SETWINDOWTHEME : + case TB_GETIDEALSIZE : + case TB_GETIMAGELISTCOUNT : + case TB_GETMETRICS : + case TB_GETPRESSEDIMAGELIST : + case TB_GETSTRING : + case TB_SETLISTGAP : + case TB_GETITEMDROPDOWNRECT : + case TB_SETHOTITEM2 : case TB_SETMETRICS : - { - } - break; + break; #endif + +#if ! defined( HB_OS_WIN_CE ) case TB_SETPADDING : - { SendMessage( hTB, TB_SETPADDING, ( WPARAM ) 0, ( LPARAM ) MAKELPARAM( wapi_par_INT( 2 ), wapi_par_INT( 3 ) ) ); - } - break; - case TB_SETPARENT : - { - } - break; - #if 0 - case TB_SETPRESSEDIMAGELIST : - { - } - break; - #endif - case TB_SETROWS : - { - } - break; - case TB_SETSTATE : - { - } - break; - case TB_SETSTYLE : - { - } - break; - case TB_SETTOOLTIPS : - { - } - break; + break; + case TB_MARKBUTTON : + SendMessage( hTB, TB_MARKBUTTON, ( WPARAM ) wapi_par_INT( 3 ), ( LPARAM ) MAKELONG( hb_parl( 4 ),0 ) ); + break; + case TB_SETINSERTMARK : + case TB_SETINSERTMARKCOLOR : + case TB_SETCOLORSCHEME : + case TB_SETEXTENDEDSTYLE : + case TB_SETHOTIMAGELIST : + case TB_SETHOTITEM : + case TB_INSERTMARKHITTEST : + case TB_MAPACCELERATOR : + case TB_MOVEBUTTON : + case TB_GETINSERTMARK : + case TB_GETCOLORSCHEME : + case TB_CUSTOMIZE : + case TB_GETANCHORHIGHLIGHT : + case TB_GETEXTENDEDSTYLE : + case TB_GETHOTIMAGELIST : + case TB_GETINSERTMARKCOLOR : + case TB_GETHOTITEM : + case TB_GETOBJECT : + case TB_GETUNICODEFORMAT : + case TB_GETMAXSIZE : + case TB_SAVERESTORE : + case TB_SETANCHORHIGHLIGHT : case TB_SETUNICODEFORMAT : - { - } - break; - #if 0 - case TB_SETWINDOWTHEME : - { - } - break; - case TB_TRANSLATEACCELERATOR : - { - } - break; - #endif + break; +#endif } - +//#endif } //----------------------------------------------------------------------// @@ -2658,6 +2415,7 @@ HB_FUNC( WVG_FILLRECT ) HB_FUNC( WVG_BEGINMOUSETRACKING ) { +#if ! defined( HB_OS_WIN_CE ) TRACKMOUSEEVENT tmi; tmi.cbSize = sizeof( TRACKMOUSEEVENT ); @@ -2665,6 +2423,9 @@ HB_FUNC( WVG_BEGINMOUSETRACKING ) tmi.hwndTrack = wapi_par_HWND( 1 ); tmi.dwHoverTime = 1; wapi_ret_L( _TrackMouseEvent( &tmi ) ); +#else + wapi_ret_L( FALSE ); +#endif } /*----------------------------------------------------------------------*/