From 116c96a01612a1338012acacce01b6c8b3a7b197 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sat, 21 Feb 2009 08:18:38 +0000 Subject: [PATCH] 2009-02-21 00:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/gtwvg.c * harbour/contrib/gtwvg/wvggui.c * harbour/contrib/gtwvg/wvgsink.c * harbour/contrib/gtwvg/wvgwin.c * harbour/contrib/gtwvg/wvgutils.c * harbour/contrib/gtwvg/wvgtoolb.prg * harbour/contrib/gtwvg/wvgwnd.prg * harbour/contrib/gtwvg/wvgparts.ch * harbour/contrib/gtwvg/wvtwin.ch * harbour/contrib/hbwin/hbwapi.h * harbour/contrib/hbwin/wapi_commctrl.c * harbour/contrib/hbwin/wapi_winbase.c * harbour/contrib/hbwin/wapi_winuser.c ! Mostly warning fixes for 64bits. ; Viktor, review me and plese send list of warnings left after this. --- harbour/ChangeLog | 19 ++++++ harbour/contrib/gtwvg/gtwvg.c | 34 ++++++----- harbour/contrib/gtwvg/wvggui.c | 20 +++--- harbour/contrib/gtwvg/wvgparts.ch | 1 + harbour/contrib/gtwvg/wvgsink.c | 16 ++--- harbour/contrib/gtwvg/wvgtoolb.prg | 87 +++++++++++++++++---------- harbour/contrib/gtwvg/wvgutils.c | 3 +- harbour/contrib/gtwvg/wvgwin.c | 50 ++++++++++++--- harbour/contrib/gtwvg/wvgwnd.prg | 4 +- harbour/contrib/gtwvg/wvtwin.ch | 10 +++ harbour/contrib/hbwin/hbwapi.h | 1 + harbour/contrib/hbwin/wapi_commctrl.c | 20 ++---- harbour/contrib/hbwin/wapi_winbase.c | 19 ++++++ harbour/contrib/hbwin/wapi_winuser.c | 49 ++++++++++++++- 14 files changed, 241 insertions(+), 92 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 844f295f9d..87f4983e8f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,25 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-21 00:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/gtwvg.c + * harbour/contrib/gtwvg/wvggui.c + * harbour/contrib/gtwvg/wvgsink.c + * harbour/contrib/gtwvg/wvgwin.c + * harbour/contrib/gtwvg/wvgutils.c + * harbour/contrib/gtwvg/wvgtoolb.prg + * harbour/contrib/gtwvg/wvgwnd.prg + * harbour/contrib/gtwvg/wvgparts.ch + * harbour/contrib/gtwvg/wvtwin.ch + * harbour/contrib/hbwin/hbwapi.h + * harbour/contrib/hbwin/wapi_commctrl.c + * harbour/contrib/hbwin/wapi_winbase.c + * harbour/contrib/hbwin/wapi_winuser.c + ! Mostly warning fixes for 64bits. + + ; Viktor, review me and plese send list of warnings + left after this. + 2009-02-21 08:44 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * source/vm/hvm.c + Added hb_vmSetLinkedMain() function to replace direct diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index 1641ef2af7..f204f16a0f 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -142,7 +142,13 @@ static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance ) wndclass.lpszClassName = s_szClassName; if( ! RegisterClass( &wndclass ) ) - hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL ); + { + int iError = GetLastError(); + if( iError != 1410 ) + { + hb_errInternal( 10001, "Failed to register WVG window class", NULL, NULL ); + } + } } static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd ) @@ -3116,13 +3122,13 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { int iIndex = hb_itemGetNI( pInfo->pNewVal ); - if( iIndex >= 0 && iIndex < 16 ) + if( iIndex > 0 && iIndex <= 16 ) { - pInfo->pResult = hb_itemPutNL( pInfo->pResult, pWVT->COLORS[ iIndex ] ); + pInfo->pResult = hb_itemPutNL( pInfo->pResult, pWVT->COLORS[ iIndex - 1 ] ); if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC ) { - pWVT->COLORS[ iIndex ] = hb_itemGetNL( pInfo->pNewVal2 ); + pWVT->COLORS[ iIndex - 1 ] = hb_itemGetNL( pInfo->pNewVal2 ); if( pWVT->hWnd ) HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS ); @@ -3137,8 +3143,8 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pInfo->pResult = hb_itemNew( NULL ); } hb_arrayNew( pInfo->pResult, 16 ); - for( i = 0; i < 16; i++ ) - hb_arraySetNL( pInfo->pResult, i + 1, pWVT->COLORS[ i ] ); + for( i = 1; i <= 16; i++ ) + hb_arraySetNL( pInfo->pResult, i, pWVT->COLORS[ i - 1 ] ); if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY ) { @@ -3334,7 +3340,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) rect.top, 0, 0, - SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) ); + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ) ); break; } case HB_GTS_WS_SETASNORMAL: @@ -3346,7 +3352,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) rect.top, 0, 0, - SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) ); + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ) ); break; } @@ -3408,32 +3414,32 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_EXSTYLE ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->exStyle = hb_itemGetNInt( pSome ); + pWVT->pPP->exStyle = ( DWORD ) hb_itemGetNInt( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_STYLE ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->style = hb_itemGetNInt( pSome ); + pWVT->pPP->style = ( DWORD ) hb_itemGetNInt( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_X ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->x = hb_itemGetNInt( pSome ); + pWVT->pPP->x = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_Y ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->y = hb_itemGetNInt( pSome ); + pWVT->pPP->y = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WIDTH ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->width = hb_itemGetNInt( pSome ); + pWVT->pPP->width = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_HEIGHT ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->height = hb_itemGetNInt( pSome ); + pWVT->pPP->height = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT ); if( hb_itemType( pSome ) & HB_IT_POINTER ) diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index addd641a02..13349a2424 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -145,7 +145,7 @@ static void hb_gt_wvt_RegisterClass( HINSTANCE hInstance ) int iError = GetLastError(); if( iError != 1410 ) { - hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL ); + hb_errInternal( 10001, "Failed to register WGU window class", NULL, NULL ); } } } @@ -1950,7 +1950,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) hb_arrayGetNI( pInfo->pNewVal2, 2 ), rect.right - rect.left, rect.bottom - rect.top, - SWP_NOSIZE + SWP_NOZORDER ) ); + SWP_NOSIZE | SWP_NOZORDER ) ); } break; } @@ -2041,7 +2041,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) rect.top, 0, 0, - SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) ); + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ) ); break; } case HB_GTS_WS_SETASNORMAL: @@ -2053,7 +2053,7 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) rect.top, 0, 0, - SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) ); + SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE ) ); break; } @@ -2114,32 +2114,32 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_EXSTYLE ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->exStyle = hb_itemGetNInt( pSome ); + pWVT->pPP->exStyle = ( DWORD ) hb_itemGetNInt( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_STYLE ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->style = hb_itemGetNInt( pSome ); + pWVT->pPP->style = ( DWORD ) hb_itemGetNInt( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_X ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->x = hb_itemGetNInt( pSome ); + pWVT->pPP->x = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_Y ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->y = hb_itemGetNInt( pSome ); + pWVT->pPP->y = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WIDTH ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->width = hb_itemGetNInt( pSome ); + pWVT->pPP->width = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_HEIGHT ); if( hb_itemType( pSome ) & HB_IT_NUMERIC ) { - pWVT->pPP->height = hb_itemGetNInt( pSome ); + pWVT->pPP->height = hb_itemGetNI( pSome ); } pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_PARENT ); if( hb_itemType( pSome ) & HB_IT_POINTER ) diff --git a/harbour/contrib/gtwvg/wvgparts.ch b/harbour/contrib/gtwvg/wvgparts.ch index bd14f4d816..e71b002dd9 100644 --- a/harbour/contrib/gtwvg/wvgparts.ch +++ b/harbour/contrib/gtwvg/wvgparts.ch @@ -121,6 +121,7 @@ #define WVGTOOLBAR_STYLE_STANDARD 0 #define WVGTOOLBAR_STYLE_FLAT 1 +#define WVGTOOLBAR_STYLE_VERTICAL 2 #define WVGTOOLBAR_BUTTON_DEFAULT 0 diff --git a/harbour/contrib/gtwvg/wvgsink.c b/harbour/contrib/gtwvg/wvgsink.c index 439ee150db..8df3e0d25a 100644 --- a/harbour/contrib/gtwvg/wvgsink.c +++ b/harbour/contrib/gtwvg/wvgsink.c @@ -804,9 +804,9 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL ) HWND hContainer = NULL; RECT rc; char *class = hb_parc( 1 ); - HWND hParent = ( HWND ) hb_parnl(2); + HWND hParent = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 2 ); char *Caption = ISNIL( 4 ) ? "" : hb_parc( 3 ); - HMENU id = ISNIL( 4 ) ? ( HMENU )-1 : ( HMENU ) hb_parni( 4 ); + HMENU id = ISNIL( 4 ) ? ( HMENU )-1 : ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 4 ); int x = ISNIL( 5 ) ? 0 : hb_parni( 5 ); int y = ISNIL( 6 ) ? 0 : hb_parni( 6 ); int w = ISNIL( 7 ) ? 0 : hb_parni( 7 ); @@ -857,7 +857,7 @@ HB_FUNC( HB_AX_ATLAXCREATECONTROL ) { pUnk->lpVtbl->QueryInterface( pUnk, &IID_IDispatch, ( void** ) (void*) &obj ); pUnk->lpVtbl->Release( pUnk ); - hb_retnint( ( long ) obj ); + hb_retnint( ( HB_PTRDIFF ) obj ); GetClientRect( hContainer, &rc ); MoveWindow( GetDlgItem( hContainer, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE ); @@ -906,9 +906,9 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind RECT rc; HWND hWnd = NULL; char *lpcclass = hb_parc( 1 ); - HWND hParent = ( HWND ) hb_parnl( 2 ); + HWND hParent = ( HWND ) ( HB_PTRDIFF ) hb_parnint( 2 ); char *Caption = ISNIL( 4 ) ? "" : hb_parc( 3 ); - HMENU id = ISNIL( 4 ) ? ( HMENU )-1 : ( HMENU ) hb_parni( 4 ); + HMENU id = ISNIL( 4 ) ? ( HMENU )-1 : ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 4 ); int x = ISNIL( 5 ) ? 0 : hb_parni( 5 ); int y = ISNIL( 6 ) ? 0 : hb_parni( 6 ); int w = ISNIL( 7 ) ? 0 : hb_parni( 7 ); @@ -954,7 +954,7 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind pUnk->lpVtbl->Release( pUnk ); GetClientRect( hWnd, &rc ); MoveWindow( GetDlgItem( hParent, ( int ) id ), 0, 0, rc.right-rc.left, rc.bottom-rc.top, TRUE ); - hb_retnint( ( long ) obj ); + hb_retnint( ( HB_PTRDIFF ) obj ); } else { @@ -974,11 +974,11 @@ HB_FUNC( HB_AX_ATLAXGETCONTROL ) // HWND hWnd = handle of control container wind // return the control handle if ISBYREF( 12 ) { - hb_stornint( ( long ) hWnd, 12 ); + hb_stornint( ( HB_PTRDIFF ) hWnd, 12 ); } if ISBYREF( 13 ) { - hb_stornint( ( long ) pUnk, 13 ); + hb_stornint( ( HB_PTRDIFF ) pUnk, 13 ); } } diff --git a/harbour/contrib/gtwvg/wvgtoolb.prg b/harbour/contrib/gtwvg/wvgtoolb.prg index 0d189e6255..79e6b09802 100644 --- a/harbour/contrib/gtwvg/wvgtoolb.prg +++ b/harbour/contrib/gtwvg/wvgtoolb.prg @@ -77,7 +77,7 @@ //----------------------------------------------------------------------// #ifndef __DBG_PARTS__ -#xtranslate hb_ToOutDebug( [] ) => +//#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -100,6 +100,7 @@ CLASS WvgToolBar INHERIT WvgWindow //WvgActiveXControl DATA aItems INIT {} DATA hImageList + DATA lSized INIT .F. METHOD new() METHOD create() @@ -138,9 +139,10 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgToolB //::WvgActiveXControl:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + // + TBSTYLE_LIST caption to the right, otherwise caption to the bottom - ::style := WS_CHILD + TBSTYLE_FLAT + TBSTYLE_TOOLTIPS + CCS_ADJUSTABLE //+ CCS_NODIVIDER //+CCS_VERT - ::exStyle := TBSTYLE_EX_DOUBLEBUFFER //+ TBSTYLE_EX_MIXEDBUTTONS + //::style := WS_CHILD //+ TBSTYLE_FLAT + CCS_ADJUSTABLE //+ CCS_NODIVIDER //+CCS_VERT + ::exStyle := TBSTYLE_EX_DOUBLEBUFFER + TBSTYLE_EX_MIXEDBUTTONS ::className := TOOLBARCLASSNAME ::objType := objTypeToolBar @@ -152,9 +154,13 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - IF ::visible - ::style += WS_VISIBLE + IF ::style == WVGTOOLBAR_STYLE_FLAT + ::style := TBSTYLE_FLAT + ELSE + ::style := 0 ENDIF + ::style += WS_CHILD + // IF ::wrappable ::style += TBSTYLE_WRAPABLE ENDIF @@ -183,17 +189,12 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgTo #endif IF !empty( ::hWnd ) - #define ILC_COLOR8 8 - - ::hImageList := WAPI_ImageList_Create( ::imageWidth, ::imageHeight, ILC_COLOR8, 0, 20 ) + ::hImageList := WAPI_ImageList_Create( ::imageWidth, ::imageHeight, ILC_COLOR32+ILC_MASK, 0, 50 ) ::SendToolbarMessage( TB_SETIMAGELIST, ::hImageList ) ::SendToolbarMessage( TB_BUTTONSTRUCTSIZE ) - ::SendToolbarMessage( TB_SETBUTTONSIZE, ::buttonWidth+20, ::buttonHeight ) - - ::SendToolbarMessage( TB_AUTOSIZE ) + //::SendToolbarMessage( TB_SETINDENT, 10 ) ENDIF - ::sendToolbarMessage( TB_SETMAXTEXTROWS, IF( ::showToolTips, 0, 1 ) ) IF ::visible ::show() @@ -207,7 +208,7 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar LOCAL nHandled := 1 LOCAL nObj, aNMMouse - //hb_ToOutDebug( " %s:handleEvent( %i ) %i", __ObjGetClsName( self ), nMessage, ) + //hb_ToOutDebug( " %s:handleEvent( %i )", __ObjGetClsName( self ), nMessage ) SWITCH nMessage @@ -220,9 +221,10 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgToolBar CASE HB_GTE_NOTIFY aNMMouse := Wvg_GetNMMouseInfo( aNM[ 2 ] ) -hb_ToOutDebug( " %s:handleEvent( %i ) %i %i", __ObjGetClsName( self ), nMessage,; - aNMMouse[ NMH_code ], NM_CLICK ) - + #if 0 + hb_ToOutDebug( " %s:handleEvent( %i ) %i %i", __ObjGetClsName( self ), nMessage,; + aNMMouse[ NMH_code ], TBN_GETINFOTIPA ) + #endif DO CASE CASE aNMMouse[ NMH_code ] == NM_CLICK @@ -232,17 +234,25 @@ hb_ToOutDebug( " %s:handleEvent( %i ) %i %i", __ObjGetClsName( self ), nMe ENDIF ENDIF - RETURN 0 + RETURN EVENT_HANDELLED //0 + + #if 0 + CASE aNMMouse[ NMH_code ] == TBN_GETINFOTIPA + IF ( nObj := ascan( ::aItems, {|e_| e_[ 1 ] == aNMMouse[ NMH_dwItemSpec ] } ) ) > 0 + Wvg_SetToolbarButtonTip( aNM[ 2 ], 'This is grand tooltip' ) + RETURN EVENT_HANDELLED + ENDIF + #endif OTHERWISE - RETURN 1 + RETURN EVENT_UNHANDELLED ENDCASE EXIT END - RETURN nHandled + RETURN EVENT_UNHANDELLED //----------------------------------------------------------------------// @@ -265,6 +275,10 @@ METHOD destroy() CLASS WvgToolBar NEXT ENDIF + IF !empty( ::hImageList ) + WAPI_ImageList_Destroy( ::hImageList ) + ENDIF + ::WvgWindow:destroy() RETURN NIL @@ -279,25 +293,31 @@ METHOD configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS Wv //----------------------------------------------------------------------// -METHOD sendToolbarMessage( nMsg, p1, p2, p3, p4, p5 ) CLASS WvgToolBar - - RETURN Win_SendToolbarMessage( ::hWnd, nMsg, p1, p2, p3, p4, p5 ) +METHOD sendToolbarMessage( nMsg, p1, p2 ) CLASS WvgToolBar + RETURN Win_SendToolbarMessage( ::hWnd, nMsg, p1, p2 ) //----------------------------------------------------------------------// -METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey ) CLASS WvgToolBar +METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey, nMapRGB ) CLASS WvgToolBar LOCAL oBtn, hBitmap, cType, nBtn HB_SYMBOL_UNUSED( xDisabledImage ) HB_SYMBOL_UNUSED( xHotImage ) HB_SYMBOL_UNUSED( cDLL ) + // Issue this at the begining of first item + // + IF !( ::lSized ) + //::SendToolbarMessage( TB_SETBUTTONWIDTH, ::buttonWidth, ::buttonWidth ) + ::lSized := .t. + ENDIF + oBtn := WvgToolbarButton():new( cCaption, nStyle, cKey ) oBtn:index := ::numItems + 1 oBtn:command := 100 + oBtn:index - cType := valtype( xImage ) + cType := valtype( xImage ) hBitmap := 0 DO CASE @@ -314,19 +334,22 @@ METHOD addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nStyle, cKey ENDCASE - IF hBitmap <> 0 + IF !empty( hBitmap ) oBtn:image := hBitmap - nBtn := WAPI_ImageList_Add( ::hImageList, hBitmap ) - //nBtn := WAPI_ImageList_AddMasked( ::hImageList, hBitmap, RGB( 198,198,198 ) ) - /* Now as we are using ImageList, this will duplicate bitmaps */ - //nBtn := Win_SendToolbarMessage( ::hWnd, TB_ADDBITMAP, hBitmap ) + IF !empty( nMapRGB ) + nBtn := WAPI_ImageList_AddMasked( ::hImageList, hBitmap, nMapRGB ) + ELSE + nBtn := WAPI_ImageList_Add( ::hImageList, hBitmap ) + ENDIF - //nStr := ::sendToolbarMessage( TB_ADDSTRING, oBtn:caption ) + WVG_AddToolbarButton( ::hWnd, nBtn, oBtn:caption, oBtn:command, 1, ::showToolTips ) - //lRet := ::sendToolbarMessage( TB_ADDBUTTONS, nBtn, oBtn:command, nStr ) + // Set Button Size + ::SendToolbarMessage( TB_SETBUTTONSIZE, ::buttonWidth, ::buttonHeight ) - Wvg_AddToolbarButton( ::hWnd, nBtn/*hBitmap*/, oBtn:caption, oBtn:command, 1, ::showToolTips ) + //SendMessage( hWndTB, TB_SETPADDING, ( WPARAM ) 0, ( LPARAM ) MAKELPARAM( 10,10 ) ); + //::sendToolbarMessage( TB_SETPADDING, 10, 10 ) ::sendToolbarMessage( TB_AUTOSIZE ) ELSE diff --git a/harbour/contrib/gtwvg/wvgutils.c b/harbour/contrib/gtwvg/wvgutils.c index 44a8a50687..0710a8aa0c 100644 --- a/harbour/contrib/gtwvg/wvgutils.c +++ b/harbour/contrib/gtwvg/wvgutils.c @@ -1260,7 +1260,8 @@ HB_FUNC( WVT__MAKEDLGTEMPLATE ) p = lpwAlign( p ); - hb_retclen( ( LPSTR ) pdlgtemplate, ( ( HB_PTRDIFF ) p - ( HB_PTRDIFF ) pdlgtemplate ) ) ; + //hb_retclen( ( LPSTR ) pdlgtemplate, ( ( HB_PTRDIFF ) p - ( HB_PTRDIFF ) pdlgtemplate ) ) ; + hb_retclen( ( LPSTR ) pdlgtemplate, ( ( WORD ) p - ( WORD ) pdlgtemplate ) ) ; LocalFree( LocalHandle( pdlgtemplate ) ); } diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 7a4f8abf6c..dede908bca 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -115,6 +115,13 @@ static HANDLE wvg_hInstance( void ) //----------------------------------------------------------------------// +HB_FUNC( WVG_HINSTANCE ) +{ + wapi_ret_HANDLE( wvg_hInstance() ); +} + +/*----------------------------------------------------------------------*/ + HB_FUNC( WIN_SENDMESSAGE ) { LPTSTR cText = NULL; @@ -888,10 +895,10 @@ HB_FUNC( WIN_CREATEWINDOWEX ) szClassName = HB_TCHAR_CONVTO( hb_parc( 2 ) ); szWinName = HB_TCHAR_CONVTO( ISNIL( 3 ) ? "" : hb_parc( 3 ) ); - hWnd = CreateWindowEx( hb_parnint( 1 ), + hWnd = CreateWindowEx( ( HB_PTRDIFF ) hb_parnint( 1 ), szClassName, szWinName, - hb_parnint( 4 ), + ( HB_PTRDIFF ) hb_parnint( 4 ), hb_parni( 5 ), hb_parni( 6 ), hb_parni( 7 ), hb_parni( 8 ), ( HWND ) ( HB_PTRDIFF ) hb_parnint( 9 ), @@ -911,7 +918,7 @@ HB_FUNC( WIN_CREATETOOLBAREX ) HWND hWnd; hWnd = CreateToolbarEx( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), - hb_parnint( 2 ), + ( HB_PTRDIFF ) hb_parnint( 2 ), hb_parni( 3 ), hb_parni( 4 ), ISNIL( 5 ) ? NULL : ( HINSTANCE ) ( HB_PTRDIFF ) hb_parnint( 5 ), @@ -1465,6 +1472,20 @@ HB_FUNC( WVG_GETNMMOUSEINFO ) hb_itemReturnRelease( pEvParams ); } +/*----------------------------------------------------------------------*/ +// Wvg_SetToolbarButtonTip( nlParam, cToolTip ) +// +HB_FUNC( WVG_SETTOOLBARBUTTONTIP ) +{ + LPNMTBGETINFOTIP lptbgit = ( LPNMTBGETINFOTIP ) wapi_par_LPARAM( 1 ); + LPTSTR pszText = HB_TCHAR_CONVTO( hb_parc( 2 ) ); + + lptbgit->cchTextMax = strlen( hb_parc( 2 ) ); + //memcpy( lptbgit->pszText, pszText, strlen( hb_parc( 2 ) ) ); + lptbgit->pszText = pszText; +//hb_ToOutDebug( hb_parc( 2 ) ); +// HB_TCHAR_FREE( pszText ); +} //----------------------------------------------------------------------// // Wvg_GetNMTreeViewInfo( nlParam ) // @@ -2097,21 +2118,25 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) iNewString = SendMessage( hWndTB, TB_ADDSTRING, ( WPARAM ) 0, ( LPARAM ) szCaption ); HB_TCHAR_FREE( szCaption ); + #if 1 + if( ISLOG( 6 ) && ( hb_parl( 6 ) ) ) + { + SendMessage( hWndTB, TB_SETMAXTEXTROWS, ( WPARAM ) 0, ( LPARAM ) 0 ); + } + #endif // add button // tbb.iBitmap = iNewBitmap; tbb.idCommand = iCommand; tbb.fsState = TBSTATE_ENABLED; - if( ISLOG( 6 ) && hb_parl( 6 ) ) - tbb.fsStyle = TBSTYLE_BUTTON; - else - tbb.fsStyle = TBSTYLE_BUTTON;// | TBSTYLE_SHOWTEXT; - + tbb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE; tbb.dwData = 0; tbb.iString = iNewString; bSuccess = SendMessage( hWndTB, TB_ADDBUTTONS, ( WPARAM ) 1, ( LPARAM ) ( LPTBBUTTON ) &tbb ); + SendMessage( hWndTB, TB_SETPADDING, ( WPARAM ) 0, ( LPARAM ) MAKELPARAM( 10,10 ) ); + hb_retl( bSuccess ); return; } @@ -2121,7 +2146,7 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) case 3: // separator { - tbb.iBitmap = 10; + tbb.iBitmap = 0; // Can be width of the separator tbb.idCommand = 0; tbb.fsState = TBSTATE_ENABLED; tbb.fsStyle = TBSTYLE_SEP; @@ -2440,6 +2465,8 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) break; case TB_SETBITMAPSIZE : { + SendMessage( hTB, TB_SETBITMAPSIZE, ( WPARAM ) 0, + ( LPARAM ) MAKELONG( wapi_par_INT( 3 ), wapi_par_INT( 4 ) ) ); } break; case TB_SETBUTTONINFO : @@ -2454,6 +2481,8 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) break; case TB_SETBUTTONWIDTH : { + SendMessage( hTB, TB_SETBUTTONWIDTH, ( WPARAM ) 0, + ( LPARAM ) MAKELONG( wapi_par_INT( 3 ), wapi_par_INT( 4 ) ) ); } break; case TB_SETCMDID : @@ -2497,6 +2526,7 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) break; case TB_SETINDENT : { + SendMessage( hTB, TB_SETINDENT, ( WPARAM ) wapi_par_INT( 3 ), ( LPARAM ) 0 ); } break; case TB_SETINSERTMARK : @@ -2526,6 +2556,8 @@ HB_FUNC( WIN_SENDTOOLBARMESSAGE ) #endif case TB_SETPADDING : { + SendMessage( hTB, TB_SETPADDING, ( WPARAM ) 0, + ( LPARAM ) MAKELPARAM( wapi_par_INT( 2 ), wapi_par_INT( 3 ) ) ); } break; case TB_SETPARENT : diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index 6116911d1b..694d7640c8 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -1281,8 +1281,8 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow CASE WM_NOTIFY IF ( nObj := ascan( ::aChildren, {| o | o:nID == nwParam } ) ) > 0 nReturn := ::aChildren[ nObj ]:handleEvent( HB_GTE_NOTIFY, { nwParam, nlParam } ) - IF hb_isNumeric( nReturn ) .and. nReturn == 0 - RETURN 0 + IF hb_isNumeric( nReturn ) .and. nReturn == EVENT_HANDELLED + RETURN EVENT_HANDELLED ENDIF ENDIF EXIT diff --git a/harbour/contrib/gtwvg/wvtwin.ch b/harbour/contrib/gtwvg/wvtwin.ch index 2bde417bf3..ceda34a9b5 100644 --- a/harbour/contrib/gtwvg/wvtwin.ch +++ b/harbour/contrib/gtwvg/wvtwin.ch @@ -1626,6 +1626,16 @@ #define SBS_TOPALIGN 2 #define SBS_VERT 1 +#define ILC_COLOR 0 +#define ILC_COLOR4 4 +#define ILC_COLOR8 8 +#define ILC_COLOR16 16 +#define ILC_COLOR24 24 +#define ILC_COLOR32 32 +#define ILC_COLORDDB 254 +#define ILC_MASK 1 +#define ILC_PALETTE 2048 + //----------------------------------------------------------------------// #endif //----------------------------------------------------------------------// diff --git a/harbour/contrib/hbwin/hbwapi.h b/harbour/contrib/hbwin/hbwapi.h index 4e3fed4f66..0accce9c01 100644 --- a/harbour/contrib/hbwin/hbwapi.h +++ b/harbour/contrib/hbwin/hbwapi.h @@ -75,6 +75,7 @@ #define wapi_par_UINT( n ) ( ( UINT ) hb_parni( n ) ) #define wapi_par_LONG( n ) ( ( LONG ) hb_parnl( n ) ) +#define wapi_ret_NINT( i ) ( hb_retnint( i ) ) #define wapi_ret_NI( i ) ( hb_retni( i ) ) #define wapi_ret_L( b ) ( hb_retl( b ) ) diff --git a/harbour/contrib/hbwin/wapi_commctrl.c b/harbour/contrib/hbwin/wapi_commctrl.c index d59b92caec..79d0b03729 100644 --- a/harbour/contrib/hbwin/wapi_commctrl.c +++ b/harbour/contrib/hbwin/wapi_commctrl.c @@ -100,6 +100,7 @@ HB_FUNC( WAPI_IMAGELIST_COCREATEINSTANCE ) /* BOOL ImageList_Copy( HIMAGELIST himlDst, int iDst, HIMAGELIST himlSrc, int iSrc, UINT uFlags ); */ +#if (_WIN32_IE >= 0x0300) HB_FUNC( WAPI_IMAGELIST_COPY ) { wapi_ret_L( ImageList_Copy( wapi_par_HIMAGELIST( 1 ), @@ -108,31 +109,18 @@ HB_FUNC( WAPI_IMAGELIST_COPY ) wapi_par_INT( 4 ), wapi_par_UINT( 5 ) ) ); } +#endif /*----------------------------------------------------------------------*/ /* HIMAGELIST ImageList_Create( int cx, int cy, UINT flags, int cInitial, int cGrow ); */ HB_FUNC( WAPI_IMAGELIST_CREATE ) { - #if 0 /* Test */ - HIMAGELIST il; - - il = ImageList_Create( wapi_par_INT( 1 ), - wapi_par_INT( 2 ), - wapi_par_UINT( 3 ), - wapi_par_INT( 4 ), - wapi_par_INT( 5 ) ); - if( il ) - { - wapi_ret_HANDLE( il ); - } - #else wapi_ret_HANDLE( ImageList_Create( wapi_par_INT( 1 ), wapi_par_INT( 2 ), wapi_par_UINT( 3 ), wapi_par_INT( 4 ), wapi_par_INT( 5 ) ) ); - #endif } /*----------------------------------------------------------------------*/ /* @@ -220,10 +208,12 @@ HB_FUNC( WAPI_IMAGELIST_DRAWINDIRECT ) /* HIMAGELIST ImageList_Duplicate( HIMAGELIST himl ); */ +#if (_WIN32_IE >= 0x0400) HB_FUNC( WAPI_IMAGELIST_DUPLICATE ) { wapi_ret_HANDLE( ImageList_Duplicate( wapi_par_HIMAGELIST( 1 ) ) ); } +#endif /*----------------------------------------------------------------------*/ /* VOID ImageList_EndDrag( VOID ); @@ -434,11 +424,13 @@ HB_FUNC( WAPI_IMAGELIST_SETICONSIZE ) /* BOOL ImageList_SetImageCount( HIMAGELIST himl, UINT uNewCount ); */ +#if (_WIN32_IE >= 0x0400) HB_FUNC( WAPI_IMAGELIST_SETIMAGECOUNT ) { wapi_ret_L( ImageList_SetImageCount( wapi_par_HIMAGELIST( 1 ), wapi_par_UINT( 2 ) ) ); } +#endif /*----------------------------------------------------------------------*/ /* BOOL ImageList_SetOverlayImage( HIMAGELIST himl, int iImage, int iOverlay ); diff --git a/harbour/contrib/hbwin/wapi_winbase.c b/harbour/contrib/hbwin/wapi_winbase.c index e1d5bdf824..34fed40a95 100644 --- a/harbour/contrib/hbwin/wapi_winbase.c +++ b/harbour/contrib/hbwin/wapi_winbase.c @@ -53,6 +53,9 @@ #define HB_OS_WIN_USED #include "hbapi.h" +#include "hbwapi.h" + +/*----------------------------------------------------------------------*/ HB_FUNC( WAPI_GETCOMMANDLINE ) { @@ -71,3 +74,19 @@ HB_FUNC( WAPI_GETCOMMANDLINE ) HB_TCHAR_FREE( buffer ); } +/*----------------------------------------------------------------------*/ +/* +HMODULE WINAPI GetModuleHandle( __in_opt LPCTSTR lpModuleName ); +*/ +HB_FUNC( WAPI_GETMODULEHANDLE ) +{ + LPTSTR lpModuleName = ( LPTSTR ) ISNIL( 1 ) ? 0 : HB_TCHAR_CONVTO( hb_parc( 1 ) ); + + wapi_ret_HANDLE( GetModuleHandle( lpModuleName ) ); + + if( ISCHAR( 1 ) ) + HB_TCHAR_FREE( lpModuleName ); +} +/*----------------------------------------------------------------------*/ + + diff --git a/harbour/contrib/hbwin/wapi_winuser.c b/harbour/contrib/hbwin/wapi_winuser.c index d674607e95..bcd6d6f019 100644 --- a/harbour/contrib/hbwin/wapi_winuser.c +++ b/harbour/contrib/hbwin/wapi_winuser.c @@ -104,10 +104,11 @@ BOOL GetScrollInfo( HWND hwnd, int fnBar, LPSCROLLINFO lpsi ); HB_FUNC( WAPI_GETSCROLLINFO ) { LPSCROLLINFO si = ( LPSCROLLINFO ) wapi_par_STRUCT( 3 ); + //LPSCROLLINFO si; BOOL bSuccess; - memset( &si, 0, sizeof( SCROLLINFO ) ); - si->cbSize = sizeof( SCROLLINFO ); + //memset( si, 0, sizeof( SCROLLINFO ) ); + //si->cbSize = sizeof( SCROLLINFO ); bSuccess = GetScrollInfo( wapi_par_HWND( 1 ), wapi_par_INT( 2 ), @@ -223,3 +224,47 @@ HB_FUNC( WAPI_SHOWSCROLLBAR ) wapi_par_BOOL( 3 ) ) ); } /*----------------------------------------------------------------------*/ +/* */ +/*----------------------------------------------------------------------*/ +/* +HWND SetFocus( HWND hWnd ); +*/ +HB_FUNC( WAPI_SETFOCUS ) +{ + wapi_ret_HANDLE( SetFocus( wapi_par_HWND( 1 ) ) ); +} +/*----------------------------------------------------------------------*/ +#if 0 +HB_FUNC( WAPI_LOADBITMAP ) +{ + HINSTANCE hinst = wapi_par_HINSTANCE( 1 ); + LPTSTR lpBmp; + HBITMAP hbmp; + + if( ISNUM( 2 ) ) + { + lpBmp = ( LPTSTR ) MAKEINTRESOURCE( wapi_par_INT( 2 ) ); + } + else + { + lpBmp = ( LPTSTR ) HB_TCHAR_CONVTO( hb_parc( 2 ) ); + } + + hbmp = LoadBitmap( hinst, lpBmp ); + if( hbmp ) + { +hb_ToOutDebug( "hbmp loaded" ); + wapi_ret_NINT( (long) hbmp ); + } + else + wapi_ret_NI( 0 ); + //wapi_ret_NINT( ( long ) LoadBitmap( GetModuleHandle( 0 ), lpBmp ) ); + + if( !ISNUM( 2 ) ) + { + HB_TCHAR_FREE( lpBmp ); + } +} +#endif +/*----------------------------------------------------------------------*/ +