diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3f98e8fc51..29d273ef00 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,14 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-26 16:10 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/gtwvg.c + ! Some refinements is setting Window's style through + SetWindowLong(Ptr)(). + + * harbour/contrib/gtwvg/wvgwin.c + % Removed some test code. + 2009-02-25 18:57 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/gtwvg/gtwvg.c * harbour/contrib/gtwvg/gtwvg.h diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index f03666e1b4..62ad7217df 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -245,7 +245,7 @@ static void hb_gt_wvt_Free( PHB_GTWVT pWVT ) #endif if( pWVT->hFont ) DeleteObject( pWVT->hFont ); - + // Detach PRG callback pWVT->pSymWVT_PAINT = NULL; pWVT->pSymWVT_SETFOCUS = NULL; @@ -364,7 +364,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->ResizeMode = HB_GTI_RESIZEMODE_FONT; pWVT->bResizing = FALSE; - + pWVT->pPP = ( HB_GT_PARAMS * ) hb_xgrab( sizeof( HB_GT_PARAMS ) ); pWVT->pPP->style = WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; pWVT->pPP->exStyle = 0; @@ -392,7 +392,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) #endif #endif - + /* GUI Related members initialized */ hb_wvt_gtCreateObjects( pWVT ); @@ -2024,17 +2024,15 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara pWVT->bMaximized = FALSE; /* Enable "maximize" button */ - + { #if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_OS_WIN_CE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT) - SetWindowLong( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME ); + SetWindowLong( pWVT->hWnd, GWL_STYLE, GetWindowLong( pWVT->hWnd, GWL_STYLE ) | WS_MAXIMIZEBOX ); #else - SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME ); + SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, GetWindowLong( pWVT->hWnd, GWL_STYLE ) | WS_MAXIMIZEBOX ); #endif - + } SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0, - SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); - ShowWindow( pWVT->hWnd, SW_HIDE ); - ShowWindow( pWVT->hWnd, SW_NORMAL ); + SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); } pWVT->bResizing = TRUE; return 0; @@ -2053,16 +2051,17 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_FitSizeRows( pWVT ); /* Disable "maximize" button */ - + { #if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_OS_WIN_CE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT) - SetWindowLong( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_THICKFRAME ); + DWORD style = GetWindowLong( pWVT->hWnd, GWL_STYLE ); + SetWindowLong( pWVT->hWnd, GWL_STYLE, style &~ WS_MAXIMIZEBOX ); #else - SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_THICKFRAME ); + LONG_PTR style = GetWindowLongPtr( pWVT->hWnd, GWL_STYLE ); + SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, ( HB_PTRDIFF ) style &~ WS_MAXIMIZEBOX ); #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 ); + SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); return 0; } case SYS_EV_MARK: @@ -2351,7 +2350,7 @@ static HWND hb_gt_wvt_CreateWindow( PHB_GTWVT pWVT, BOOL bResizable ) if( ! bResizable ) pWVT->pPP->style = ( pWVT->pPP->style &~ ( WS_THICKFRAME | WS_MAXIMIZEBOX ) | WS_BORDER ); - + hWnd = CreateWindowEx( pWVT->pPP->exStyle, /* extended style */ s_szClassName, /* classname */ @@ -3112,21 +3111,16 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) LONG_PTR style = GetWindowLongPtr( pWVT->hWnd, GWL_STYLE ); #endif if( pWVT->bResizable ) - //style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME; style = style | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME; else - //style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_BORDER; - style = ( style & ~( WS_MAXIMIZEBOX | WS_THICKFRAME ) ); - + style = ( style & ~( WS_MAXIMIZEBOX | WS_THICKFRAME ) ) | WS_BORDER; #if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_OS_WIN_CE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT) SetWindowLong( pWVT->hWnd, GWL_STYLE, style ); #else SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, style ); #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 ); + SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); } } } diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index b679e3da4d..6163081941 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -1601,6 +1601,22 @@ HB_FUNC( WVG_TREEVIEW_GETSELECTIONINFO ) // HB_FUNC( WVG_TREEVIEW_ADDITEM ) { + #ifdef UNICODE + typedef struct tagTVINSERTSTRUCTW + { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + TV_ITEMW item; + } TVINSERTSTRUCTW, FAR *LPTVINSERTSTRUCTW; + #else + typedef struct tagTVINSERTSTRUCTA + { + HTREEITEM hParent; + HTREEITEM hInsertAfter; + TV_ITEMA item; + } TVINSERTSTRUCTA, FAR *LPTVINSERTSTRUCTA; + #endif + TVINSERTSTRUCT tvis; LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) ); @@ -2822,43 +2838,6 @@ HB_FUNC( WAPI_MEMBER_OSVERSIONINFO ) } /*----------------------------------------------------------------------*/ -static HB_GARBAGE_FUNC( WVG_WndProc_release ) -{ - void ** ph = ( void ** ) Cargo; - - /* Check if pointer is not NULL to avoid multiple freeing */ - if( ph && * ph ) - { - /* Destroy the object */ - hb_itemRelease( ( PHB_ITEM ) * ph ); - - /* set pointer to NULL to avoid multiple freeing */ - * ph = NULL; - } -} - -/*----------------------------------------------------------------------*/ - -static PHB_ITEM WVG_WndProc_par( int iParam ) -{ - void ** ph = ( void ** ) hb_parptrGC( WVG_WndProc_release, iParam ); - - return ph ? ( PHB_ITEM ) * ph : NULL; -} - -/*----------------------------------------------------------------------*/ - -HB_FUNC( WVG_GETWNDPROCPOINTER ) -{ - PHB_ITEM pBlock = hb_itemNew( hb_param( 1, HB_IT_BLOCK ) ); - void ** ph = ( void ** ) hb_gcAlloc( sizeof( PHB_ITEM ), WVG_WndProc_release ); - - * ph = ( void * ) pBlock; - hb_retptrGC( ph ); -} - -/*----------------------------------------------------------------------*/ - LRESULT CALLBACK ControlWindowProcedure( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam ) { PHB_ITEM pBlock = ( PHB_ITEM ) GetProp( hwnd, TEXT( "BLOCKCALLBACK" ) );