diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 330c95e968..3f30f3b3ac 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,46 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-02-18 16:25 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/gtwvg/Makefile + * harbour/contrib/gtwvg/common.mak + + Added wvgscrlb.prg. + + + harbour/contrib/gtwvg/wvgscrlb.prg + + Implemented WvgScrollBar() class ( work-in-progress ). + + * harbour/contrib/gtwvg/gtwvg.c + * harbour/contrib/gtwvg/gtwvg.h + * harbour/contrib/gtwvg/hbgtwvg.ch + * harbour/contrib/gtwvg/wvgcrt.prg + * harbour/contrib/gtwvg/wvgdarea.prg + * harbour/contrib/gtwvg/wvgdatar.prg + * harbour/contrib/gtwvg/wvgdlg.prg + * harbour/contrib/gtwvg/wvggui.c + * harbour/contrib/gtwvg/wvggui.h + * harbour/contrib/gtwvg/wvgparts.ch + * harbour/contrib/gtwvg/wvgphdlr.prg + * harbour/contrib/gtwvg/wvgstatb.prg + * harbour/contrib/gtwvg/wvgstatc.prg + * harbour/contrib/gtwvg/wvgwin.c + * harbour/contrib/gtwvg/wvgwnd.prg + * harbour/contrib/gtwvg/wvtwin.ch + * Numerous changes and fixes and behavioral shifts. + ! Started to implement CUI and GUI components in GTWVG. + ! Started to use C STRUCTURES. + + * harbour/contrib/hbwin/Makefile + * harbour/contrib/hbwin/common.mak + + Added wapi_winuser.c + + * harbour/contrib/hbwin/hbwapi.h + + added more WAPI macros to accomodate new types. + + + harbour/contrib/hbwin/wapi_winuser.c + + Introduced wrapper function to manipulate scrollbars. + + ; NOTE: GTWVG now needs xhb.lib alongwith hbwin.lib. + 2009-02-18 00:22 UTC+0100 Viktor Szakats (harbour.01 syenar hu) * utils/hbmk/hbmk2.prg + Added rest of default *nix system paths. diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index 76c6a20bce..08eaf69684 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -46,6 +46,7 @@ PRG_SOURCES=\ wvghtmlv.prg \ wvgsysw.prg \ wvgdarea.prg \ + wvgscrlb.prg \ PRG_HEADERS=\ hbgtwvg.ch \ diff --git a/harbour/contrib/gtwvg/common.mak b/harbour/contrib/gtwvg/common.mak index a5b801255c..d68e687761 100644 --- a/harbour/contrib/gtwvg/common.mak +++ b/harbour/contrib/gtwvg/common.mak @@ -38,6 +38,7 @@ LIB_OBJS = \ $(OBJ_DIR)wvghtmlv$(OBJEXT) \ $(OBJ_DIR)wvgsysw$(OBJEXT) \ $(OBJ_DIR)wvgdarea$(OBJEXT) \ + $(OBJ_DIR)wvgscrlb$(OBJEXT) \ \ $(OBJ_DIR)gtwvg$(OBJEXT) \ $(OBJ_DIR)wvgcore$(OBJEXT) \ diff --git a/harbour/contrib/gtwvg/gtwvg.c b/harbour/contrib/gtwvg/gtwvg.c index c0c11da741..e7edae01de 100644 --- a/harbour/contrib/gtwvg/gtwvg.c +++ b/harbour/contrib/gtwvg/gtwvg.c @@ -351,6 +351,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->pPP->bVisible = FALSE; pWVT->pPP->bConfigured = FALSE; pWVT->pPP->bRowCols = FALSE; + pWVT->pPP->iWndType = 0; #ifndef HB_CDP_SUPPORT_OFF pWVT->hostCDP = hb_vmCDP(); @@ -393,6 +394,7 @@ static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent, PHB_ITEM pParams ) hb_vmRequestRestore(); } } + hb_itemRelease( pParams ); return nResult; } @@ -406,8 +408,6 @@ static void hb_gt_wvt_FireMenuEvent( PHB_GTWVT pWVT, int iMode, int menuIndex ) hb_arraySetNI( pEvParams, 2, menuIndex ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_MENU, pEvParams ); - - hb_itemRelease( pEvParams ); } /* @@ -572,7 +572,6 @@ static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey ) PHB_ITEM pEvParams = hb_itemNew( NULL ); hb_itemPutNI( pEvParams, iKey ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_KEYBOARD, pEvParams ); - hb_itemRelease( pEvParams ); } } @@ -837,8 +836,6 @@ static BOOL hb_gt_wvt_FitSizeRows( PHB_GTWVT pWVT ) hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED, pEvParams ); hb_wvt_gtSaveGuiState( pWVT ); - - hb_itemRelease( pEvParams ); } else { @@ -1279,7 +1276,6 @@ static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, L hb_arraySetNI( pEvParams, 6, colrow.x ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); - hb_itemRelease( pEvParams ); } } @@ -1655,6 +1651,17 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) { hb_wvt_gtRestGuiState( pWVT, &updateRect ); ValidateRect( pWVT->hWnd, &updateRect ); + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 4 ); + hb_arraySetNI( pEvParams, 1, updateRect.left ); + hb_arraySetNI( pEvParams, 2, updateRect.top ); + hb_arraySetNI( pEvParams, 3, updateRect.right ); + hb_arraySetNI( pEvParams, 4, updateRect.bottom ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_GUIPARTS, pEvParams ); + } return; } if( pWVT->bGui && pWVT->bSetFocus ) @@ -1662,6 +1669,17 @@ static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect ) pWVT->bSetFocus = FALSE; hb_wvt_gtRestGuiState( pWVT, &updateRect ); ValidateRect( pWVT->hWnd, &updateRect ); + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 4 ); + hb_arraySetNI( pEvParams, 1, updateRect.left ); + hb_arraySetNI( pEvParams, 2, updateRect.top ); + hb_arraySetNI( pEvParams, 3, updateRect.right ); + hb_arraySetNI( pEvParams, 4, updateRect.bottom ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_GUIPARTS, pEvParams ); + } return; } @@ -1767,32 +1785,72 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara if( pWVT ) switch( message ) { - case WM_CREATE: - return hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS ); + #if 1 + case WM_HSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_HSCROLL, pEvParams ); + return( 0 ); + } + case WM_VSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_VSCROLL, pEvParams ); + return( 0 ); + } + #endif + case WM_CREATE: + { + if( pWVT->pPP->iWndType == HB_WNDTYPE_CRT ) + return hb_gt_wvt_InitWindow( pWVT, pWVT->ROWS, pWVT->COLS ); + else + return( 0 ); + } case WM_PAINT: { - RECT updateRect; - if( !pWVT->bDeferPaint ) + if( pWVT->pPP->iWndType == HB_WNDTYPE_CRT ) { - if( pWVT->bResizing ) + RECT updateRect; + if( !pWVT->bDeferPaint ) { - return DefWindowProc( hWnd, message, wParam, lParam ); + if( pWVT->bResizing ) + { + return DefWindowProc( hWnd, message, wParam, lParam ); + } + else + { + if( GetUpdateRect( hWnd, &updateRect, FALSE ) ) + { + hb_gt_wvt_PaintText( pWVT, updateRect ); + } + } } else { if( GetUpdateRect( hWnd, &updateRect, FALSE ) ) - { - hb_gt_wvt_PaintText( pWVT, updateRect ); - } + return DefWindowProc( hWnd, message, wParam, lParam ); } + { // To evoke if that portion is covered by GUI control + PHB_ITEM pEvParams = hb_itemNew( NULL ); + hb_itemPutNInt( pEvParams, ( HB_LONG ) ( HB_PTRDIFF ) hWnd ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_PAINT, pEvParams ); + } + return 0; } - else - { - if( GetUpdateRect( hWnd, &updateRect, FALSE ) ) - return DefWindowProc( hWnd, message, wParam, lParam ); - } - return 0; } case WM_MY_UPDATE_CARET: @@ -1824,6 +1882,16 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { pWVT->bGetFocus = TRUE; } + { // For mixing gui/cui items + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) hWnd ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) wParam ); + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_SETFOCUS, pEvParams ); + } return 0; case WM_KILLFOCUS: @@ -1843,6 +1911,16 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_vmRequestRestore(); } } + { // To mix gui/cui items + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) hWnd ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) wParam ); + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_KILLFOCUS, pEvParams ); + } return 0; case WM_KEYDOWN: @@ -1853,13 +1931,16 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara case WM_RBUTTONDOWN: case WM_LBUTTONDOWN: + case WM_MBUTTONDOWN: + // case WM_RBUTTONUP: case WM_LBUTTONUP: + case WM_MBUTTONUP: + // case WM_RBUTTONDBLCLK: case WM_LBUTTONDBLCLK: - case WM_MBUTTONDOWN: - case WM_MBUTTONUP: case WM_MBUTTONDBLCLK: + // case WM_MOUSEMOVE: case WM_MOUSEWHEEL: case WM_NCMOUSEMOVE: @@ -1875,12 +1956,14 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara PHB_ITEM pEvParams = hb_itemNew( NULL ); if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE, pEvParams ) == 0 ) { + hb_gt_wvt_AddCharToInputQueue( pWVT, 27 ); +#if 0 PHB_ITEM pItem = hb_itemPutL( NULL, TRUE ); hb_setSetItem( HB_SET_CANCEL, pItem ); hb_itemRelease( pItem ); hb_vmRequestCancel(); +#endif } - hb_itemRelease( pEvParams ); return 0; } case WM_QUIT: @@ -1897,7 +1980,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { PHB_ITEM pEvParams = hb_itemNew( NULL ); hb_gt_wvt_FireEvent( pWVT, ( LOWORD( wParam ) == WA_INACTIVE ? HB_GTE_KILLFOCUS : HB_GTE_SETFOCUS ), pEvParams ); - hb_itemRelease( pEvParams ); return 0; } case WM_ENTERSIZEMOVE: @@ -1987,9 +2069,27 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara { if( HIWORD( wParam ) == 0 ) { - hb_wvt_gtHandleMenuSelection( pWVT, ( int ) LOWORD( wParam ) ); + if( pWVT->pPP->iWndType == HB_WNDTYPE_CRT ) + { + hb_wvt_gtHandleMenuSelection( pWVT, ( int ) LOWORD( wParam ) ); + } hb_gt_wvt_FireMenuEvent( pWVT, 0, ( int ) LOWORD( wParam ) ); } + else + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + int iLo, iHi; + + iLo = LOWORD( wParam ); + iHi = HIWORD( wParam ); + + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNI( pEvParams, 1, iHi ); // Notification Code + hb_arraySetNI( pEvParams, 2, iLo ); // Control identifier + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) ( HWND ) lParam ); // Controls hWnd + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_COMMAND, pEvParams ); + } return 0; } case WM_ENTERMENULOOP: @@ -2013,8 +2113,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_arraySetNI( pEvParams, 4, HIWORD( lParam ) ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); - - hb_itemRelease( pEvParams ); return 0; } case WM_MOUSELEAVE: @@ -2027,10 +2125,76 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_FireEvent( pWVT, HB_GTE_MOUSE, pEvParams ); - hb_itemRelease( pEvParams ); pWVT->bTracking = FALSE; return DefWindowProc( hWnd, message, wParam, lParam );; } + case WM_NOTIFY: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 2 ); + + hb_arraySetNI( pEvParams , 1, ( int ) wParam ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_NOTIFY, pEvParams ); + break; + } + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLORSTATIC: + { + int iResult; + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 2 ); + + hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) wParam ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) lParam ); + + iResult = hb_gt_wvt_FireEvent( pWVT, HB_GTE_CTLCOLOR, pEvParams ); + + if( iResult == 0 ) + { + break; + } + else + { + return( iResult ); + } + } + #if 0 + case WM_HSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_HSCROLL, pEvParams ); + return( 0 ); + } + case WM_VSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_VSCROLL, pEvParams ); + return( 0 ); + } + #endif } return DefWindowProc( hWnd, message, wParam, lParam ); @@ -2087,7 +2251,7 @@ static BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFon SelectObject( hdc, hOldFont ); /* Put old font back */ ReleaseDC( hWnd, hdc ); - width = ( USHORT ) ( iWidth < 0 ? -iWidth : tm.tmAveCharWidth * cols ); /* Total pixel width this setting would take */ + width = ( USHORT ) ( ( iWidth < 0 ? -iWidth : tm.tmAveCharWidth ) * cols ); /* Total pixel width this setting would take */ height = ( USHORT ) ( tm.tmHeight * rows ); /* Total pixel height this setting would take */ return ( width <= maxWidth ) && ( height <= maxHeight ); @@ -3286,6 +3450,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { pWVT->pPP->bRowCols = hb_itemGetL( pSome ); } + pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WNDTYPE ); + if( hb_itemType( pSome ) & HB_IT_NUMERIC ) + { + pWVT->pPP->iWndType = hb_itemGetNI( pSome ); + } /* Flag that caller configured itself */ pWVT->pPP->bConfigured = TRUE; diff --git a/harbour/contrib/gtwvg/gtwvg.h b/harbour/contrib/gtwvg/gtwvg.h index fa55950672..4ded8c6be5 100644 --- a/harbour/contrib/gtwvg/gtwvg.h +++ b/harbour/contrib/gtwvg/gtwvg.h @@ -252,7 +252,7 @@ typedef struct BOOL bVisible; BOOL bRowCols; BOOL bConfigured; - + int iWndType; } HB_GT_PARAMS, * PHB_GT_PARAMS; typedef struct diff --git a/harbour/contrib/gtwvg/hbgtwvg.ch b/harbour/contrib/gtwvg/hbgtwvg.ch index 690918f303..4eda1d340b 100644 --- a/harbour/contrib/gtwvg/hbgtwvg.ch +++ b/harbour/contrib/gtwvg/hbgtwvg.ch @@ -70,6 +70,10 @@ #define HB_GTE_NOTIFY 10 #define HB_GTE_COMMAND 11 #define HB_GTE_CTLCOLOR 12 +#define HB_GTE_PAINT 13 +#define HB_GTE_GUIPARTS 14 +#define HB_GTE_HSCROLL 15 +#define HB_GTE_VSCROLL 16 #define HB_GTI_SETFONT 71 #define HB_GTI_PRESPARAMS 72 @@ -89,9 +93,12 @@ #define HB_GTI_PP_PARENT 7 #define HB_GTI_PP_VISIBLE 8 #define HB_GTI_PP_ROWCOLS 9 +#define HB_GTI_PP_WNDTYPE 10 -#define HB_GTI_PP_SIZE 9 +#define HB_GTI_PP_SIZE 10 +#define HB_WNDTYPE_CRT 0 +#define HB_WNDTYPE_DIALOG 1 #define HB_GTI_SPEC 1000 diff --git a/harbour/contrib/gtwvg/wvgcrt.prg b/harbour/contrib/gtwvg/wvgcrt.prg index 94828deeff..164faba97c 100644 --- a/harbour/contrib/gtwvg/wvgcrt.prg +++ b/harbour/contrib/gtwvg/wvgcrt.prg @@ -76,7 +76,7 @@ //----------------------------------------------------------------------// -CLASS WvgCrt INHERIT WvgPartHandler +CLASS WvgCrt INHERIT WvgWindow, WvgPartHandler DATA oMenu @@ -250,8 +250,8 @@ EXPORTED: DATA ClassName INIT 'WVGCRT' METHOD setFocus() - METHOD sendMessage() + DATA drawingArea DATA hWnd DATA aPos INIT { 0,0 } DATA aSize INIT { 24,79 } @@ -260,11 +260,6 @@ EXPORTED: DATA lHasInputFocus INIT .F. DATA nFrameState INIT 0 // normal - DATA nID INIT 0 - DATA nControlID INIT 200 - METHOD createControl() - METHOD getControlID() INLINE ++::nControlID - ENDCLASS //----------------------------------------------------------------------// @@ -273,7 +268,8 @@ EXPORTED: METHOD init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCrt - ::WvgPartHandler:init( oParent, oOwner ) + //::WvgPartHandler:init( oParent, oOwner ) + ::WvgWindow:init( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) if hb_isArray( aPos ) ::aPos := aPos @@ -314,7 +310,8 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr ::maxRow := ::aSize[ 1 ] ::maxCol := ::aSize[ 2 ] - ::WvgPartHandler:Create( oParent, oOwner ) + //::WvgPartHandler:Create( oParent, oOwner ) + ::WvgWindow:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) if ::lModal ::pGT := hb_gtCreate( 'WVG' ) @@ -325,7 +322,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr endif hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::maxRow+1, ::maxCol+1, ::pGTp, .F., lRowCol } ) + ::maxRow+1, ::maxCol+1, ::pGTp, .F., lRowCol, HB_WNDTYPE_CRT } ) hb_gtInfo( HB_GTI_SETFONT, { ::fontName, ::fontHeight, ::fontWidth } ) /* CreateWindow() be forced to execute */ @@ -356,6 +353,10 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgCr ::lHasInputFocus := .t. endif + // Drawing Area of oCrt will point to itself + // + ::drawingArea := self + HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| ::notifier( nEvent, ... ) } ) /* Not working yet. need to investigate how I have implemented it. */ @@ -1159,63 +1160,3 @@ METHOD setFocus() CLASS WvgCrt RETURN Self //----------------------------------------------------------------------// -METHOD sendMessage( nMessage, nlParam, nwParam ) CLASS WvgCrt - - Win_SendMessage( ::hWnd, nMessage, nlParam, nwParam ) - - RETURN Self -//----------------------------------------------------------------------// -METHOD createControl() CLASS WvgCrt - LOCAL hWnd - - DO CASE - - CASE ::objType == objTypeToolBar - - ::nID := ::oParent:GetControlId() - - #if 1 - hWnd := Win_CreateToolBarEx( ::oParent:hWnd,; // hWnd - window handle hosting the toolbar - ::style,; // ws - style of the toolbar - ::nID,; // wID - control identifier supplied with WM_COMMAND - 0,; // nBitmaps - number of button images - NIL,; // hBMInst - mudule instance which hosts the bitmap resource - NIL,; // wBPID - resource identifier of the bitmap - NIL,; // lpButton - TBUTTON structure - 0,; // number of buttons - ::buttonWidth,; // - ::buttonHeight,; - ::imageWidth,; - ::imageHeight ) - //Win_SendMessage( hWnd, TB_AUTOSIZE, 0, 0 ) - #else - hWnd := Win_CreateWindowEx( ::exStyle, ; - TOOLBARCLASSNAME, ; - NIL, ; // window name - ::style, ; - ::aPos[ 1 ], ::aPos[ 2 ],; - ::aSize[ 1 ], ::aSize[ 2 ],; - ::oParent:hWnd,; - NIL,; // hMenu - NIL,; // hInstance - NIL ) // lParam - #endif - OTHERWISE - hWnd := Win_CreateWindowEx( ::exStyle, ; - ::className, ; - "", ; // window name - ::style, ; - ::aPos[ 1 ], ::aPos[ 2 ],; - ::aSize[ 1 ], ::aSize[ 2 ],; - ::oParent:hWnd,; - NIL,; // hMenu - NIL,; // hInstance - NIL ) // lParam - ENDCASE - - IF ( hWnd <> 0 ) - ::hWnd := hWnd - ENDIF - - RETURN Self -//----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgdarea.prg b/harbour/contrib/gtwvg/wvgdarea.prg index 0b62690468..527eccb4bf 100644 --- a/harbour/contrib/gtwvg/wvgdarea.prg +++ b/harbour/contrib/gtwvg/wvgdarea.prg @@ -106,7 +106,7 @@ METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDrawi ::exStyle := 0 ::className := 'DrawingArea' ::objType := objTypeDA - ::visible := .f. + ::visible := .t. RETURN Self @@ -116,7 +116,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDr HB_SYMBOL_UNUSED( lVisible ) - ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, .f. ) + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, .t. ) ::oParent:addChild( SELF ) @@ -127,6 +127,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDr ::nWndProc := hb_AsCallBack( 'CONTROLWNDPROC', Self, 4 ) ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + ::show() RETURN Self //----------------------------------------------------------------------// @@ -158,9 +159,6 @@ METHOD handleEvent( nMessage, aNM ) CLASS WvgDrawingArea RETURN ( 0 ) ENDIF - CASE nMessage == HB_GTE_NOTIFY - - ENDCASE RETURN ( 1 ) diff --git a/harbour/contrib/gtwvg/wvgdatar.prg b/harbour/contrib/gtwvg/wvgdatar.prg index 12e9766bf0..a13163ddf9 100644 --- a/harbour/contrib/gtwvg/wvgdatar.prg +++ b/harbour/contrib/gtwvg/wvgdatar.prg @@ -163,6 +163,8 @@ METHOD setData( xValue, mp2 ) CLASS DataRef Win_SendMessageText( ::hWnd, WM_SETTEXT, 0, ::sl_editBuffer ) ENDIF + CASE ::className == "SCROLLBAR" + ENDCASE RETURN ::sl_editBuffer diff --git a/harbour/contrib/gtwvg/wvgdlg.prg b/harbour/contrib/gtwvg/wvgdlg.prg index 192eec44b5..d47ee841e1 100644 --- a/harbour/contrib/gtwvg/wvgdlg.prg +++ b/harbour/contrib/gtwvg/wvgdlg.prg @@ -129,7 +129,7 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi endif hb_gtInfo( HB_GTI_PRESPARAMS, { ::exStyle, ::style, ::aPos[ 1 ], ::aPos[ 2 ], ; - ::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .F. } ) + ::aSize[ 1 ], ::aSize[ 2 ], ::pGTp, .F., .F., HB_WNDTYPE_DIALOG } ) if ::visible hb_gtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, SW_NORMAL ) @@ -161,24 +161,13 @@ METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgDi ::lHasInputFocus := .t. endif - #if 1 oW := WvgDrawingArea():new( self ):create( , , {0,0}, self:currentSize(), , .f. ) IF !empty( oW:hWnd ) - //Win_SetLayeredWindowAttributes( oW:hWnd, RGB( 255,255,255 ), 0 ) // transparent ::drawingArea := oW ELSE - #if 1 - ::drawingArea := WvgStatic():New( self, , {0,0}, self:currentSize(), , .f. ) - ::drawingArea:create() - //Win_SetLayeredWindowAttributes( ::drawingArea:hWnd, RGB( 255,255,255 ), 0 ) // transparent - #else ::drawingArea := Self - #endif ENDIF - ::drawingArea:show() - #else - ::drawingArea := Self - #endif + hb_gtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| ::notifier( nEvent, ... ) } ) RETURN Self @@ -246,4 +235,3 @@ METHOD menuBar() CLASS WvgDialog RETURN ::oMenu //----------------------------------------------------------------------// - diff --git a/harbour/contrib/gtwvg/wvggui.c b/harbour/contrib/gtwvg/wvggui.c index c0c666c629..addd641a02 100644 --- a/harbour/contrib/gtwvg/wvggui.c +++ b/harbour/contrib/gtwvg/wvggui.c @@ -304,6 +304,7 @@ static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT, HINSTANCE hInstance, int iCmdShow ) pWVT->pPP->bVisible = FALSE; pWVT->pPP->bConfigured = FALSE; pWVT->pPP->bRowCols = FALSE; + pWVT->pPP->iWndType = 0; #ifndef HB_CDP_SUPPORT_OFF pWVT->hostCDP = hb_vmCDP(); @@ -974,17 +975,31 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara if( pWVT ) switch( message ) { + case WM_CREATE: + { + return 0; + } case WM_SETFOCUS: { PHB_ITEM pEvParams = hb_itemNew( NULL ); - hb_itemPutNL( pEvParams, ( HB_LONG ) ( HB_PTRDIFF ) hWnd ); + + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) hWnd ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) wParam ); + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) lParam ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_SETFOCUS, pEvParams ); return 0; } case WM_KILLFOCUS: { PHB_ITEM pEvParams = hb_itemNew( NULL ); - hb_itemPutNL( pEvParams, ( HB_LONG ) ( HB_PTRDIFF ) hWnd ); + + hb_arrayNew( pEvParams, 3 ); + hb_arraySetNInt( pEvParams, 1, ( HB_PTRDIFF ) hWnd ); + hb_arraySetNInt( pEvParams, 2, ( HB_PTRDIFF ) wParam ); + hb_arraySetNInt( pEvParams, 3, ( HB_PTRDIFF ) lParam ); + hb_gt_wvt_FireEvent( pWVT, HB_GTE_KILLFOCUS, pEvParams ); return 0; } @@ -1143,10 +1158,6 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_gt_wvt_FireEvent( pWVT, HB_GTE_NOTIFY, pEvParams ); break; } - case WM_CREATE: - { - return 0; - } case WM_CLOSE: /* Clicked 'X' on system menu */ { PHB_ITEM pEvParams = hb_itemNew( NULL ); @@ -1184,6 +1195,32 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara else return( iResult ); } + case WM_HSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_HSCROLL, pEvParams ); + return( 0 ); + } + case WM_VSCROLL: + { + PHB_ITEM pEvParams = hb_itemNew( NULL ); + + hb_arrayNew( pEvParams, 3 ); + + hb_arraySetNL( pEvParams, 1, ( HB_LONG ) LOWORD( wParam ) ); + hb_arraySetNL( pEvParams, 2, ( HB_LONG ) HIWORD( wParam ) ); + hb_arraySetNInt( pEvParams, 3, ( HB_LONG ) ( HB_PTRDIFF ) lParam ); + + hb_gt_wvt_FireEvent( pWVT, HB_GTE_VSCROLL, pEvParams ); + return( 0 ); + } } return DefWindowProc( hWnd, message, wParam, lParam ); @@ -2119,6 +2156,11 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { pWVT->pPP->bRowCols = hb_itemGetL( pSome ); } + pSome = hb_arrayGetItemPtr( pInfo->pNewVal, HB_GTI_PP_WNDTYPE ); + if( hb_itemType( pSome ) & HB_IT_NUMERIC ) + { + pWVT->pPP->iWndType = hb_itemGetNI( pSome ); + } /* Flag that caller configured itself */ pWVT->pPP->bConfigured = TRUE; diff --git a/harbour/contrib/gtwvg/wvggui.h b/harbour/contrib/gtwvg/wvggui.h index 57b68eeff8..5d0e2392ba 100644 --- a/harbour/contrib/gtwvg/wvggui.h +++ b/harbour/contrib/gtwvg/wvggui.h @@ -252,7 +252,7 @@ typedef struct BOOL bVisible; BOOL bRowCols; BOOL bConfigured; - + int iWndType; } HB_GT_PARAMS, * PHB_GT_PARAMS; typedef struct diff --git a/harbour/contrib/gtwvg/wvgparts.ch b/harbour/contrib/gtwvg/wvgparts.ch index f58666a425..bd14f4d816 100644 --- a/harbour/contrib/gtwvg/wvgparts.ch +++ b/harbour/contrib/gtwvg/wvgparts.ch @@ -82,6 +82,7 @@ #define objTypeSLE 18 #define objTypeMLE 19 #define objTypeDA 20 +#define objTypeScrollBar 21 //----------------------------------------------------------------------// // NMHDR info @@ -94,6 +95,11 @@ //----------------------------------------------------------------------// +#define EVENT_HANDELLED 0 +#define EVENT_UNHANDELLED 1 + +//----------------------------------------------------------------------// + #define WVG_AUTOSIZE -1 #define WVGALIGN_TOP 0 @@ -189,6 +195,19 @@ #define WVGMENUBAR_MIS_SEPARATOR 4 #define WVGMENUBAR_MIS_BUTTONSEPARATOR 512 +// SCROLLBAR +#define WVGSCROLL_HORIZONTAL 1 +#define WVGSCROLL_VERTICAL 2 +// +#define WVGSB_PREVPOS 1 +#define WVGSB_NEXTPOS 2 +#define WVGSB_PREVPAGE 3 +#define WVGSB_NEXTPAGE 4 +#define WVGSB_SLIDERTRACK 5 +#define WVGSB_ENDTRACK 6 +#define WVGSB_ENDSCROLL 7 +#define WVGSB_TOP 11 +#define WVGSB_BOTTOM 12 #endif // #ifndef _WVG_CH diff --git a/harbour/contrib/gtwvg/wvgphdlr.prg b/harbour/contrib/gtwvg/wvgphdlr.prg index ddb61b7c66..479c673f72 100644 --- a/harbour/contrib/gtwvg/wvgphdlr.prg +++ b/harbour/contrib/gtwvg/wvgphdlr.prg @@ -334,6 +334,9 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler ENDIF CASE nEvent == HB_GTE_SETFOCUS + // + //aeval( ::aChildren, {|o| Win_InvalidateRect( o:hWnd ) } ) + IF hb_isBlock( ::sl_setInputFocus ) eval( ::sl_setInputFocus, NIL, NIL, Self ) ENDIF @@ -345,6 +348,14 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler ENDIF ::lHasInputFocus := .f. + CASE nEvent == HB_GTE_PAINT + //aeval( ::aChildren, {|o| Win_InvalidateRect( o:hWnd ) } ) + + CASE nEvent == HB_GTE_GUIPARTS + // Eventally every window be checked if it falls within returned rectangle or not + // then it will avoid a lot of flickering + aeval( ::aChildren, {|o| Win_InvalidateRect( o:hWnd ) } ) + CASE nEvent == HB_GTE_CLOSE IF hb_isBlock( ::close ) nReturn := eval( ::close, NIL, NIL, Self ) @@ -406,6 +417,26 @@ METHOD notifier( nEvent, xParams ) CLASS WvgPartHandler RETURN oObj:handleEvent( HB_GTE_CTLCOLOR, xParams ) ENDIF + CASE nEvent == HB_GTE_HSCROLL + IF xParams[ 3 ] == ::hWnd + RETURN ::handleEvent( HB_GTE_VSCROLL, xParams ) + ELSE + oObj := ::findObjectByHandle( xParams[ 3 ] ) + IF hb_isObject( oObj ) + RETURN oObj:handleEvent( HB_GTE_VSCROLL, xParams ) + ENDIF + ENDIF + + CASE nEvent == HB_GTE_VSCROLL + IF xParams[ 3 ] == ::hWnd + RETURN ::handleEvent( HB_GTE_VSCROLL, xParams ) + ELSE + oObj := ::findObjectByHandle( xParams[ 3 ] ) + IF hb_isObject( oObj ) + RETURN oObj:handleEvent( HB_GTE_VSCROLL, xParams ) + ENDIF + ENDIF + ENDCASE RETURN nReturn diff --git a/harbour/contrib/gtwvg/wvgscrlb.prg b/harbour/contrib/gtwvg/wvgscrlb.prg new file mode 100644 index 0000000000..3aed0f64be --- /dev/null +++ b/harbour/contrib/gtwvg/wvgscrlb.prg @@ -0,0 +1,587 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * Source file for the Wvg*Classes + * + * Copyright 2008 Pritpal Bedi + * http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// EkOnkar +// ( The LORD is ONE ) +// +// Xbase++ xbpScrollBar Compatible Class +// +// Pritpal Bedi +// 17Feb2009 +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbclass.ch' +#include 'common.ch' +#include 'inkey.ch' +#include 'hbgtinfo.ch' + +#include 'hbgtwvg.ch' +#include 'wvtwin.ch' +#include 'wvgparts.ch' +#include 'xhb.ch' +#include 'cstruct.ch' +#include 'wintypes.ch' + +//----------------------------------------------------------------------// +#if 1 + +typedef struct tagPOINT {; + LONG x; + LONG y; +} POINT + +typedef struct tagRECT { ; + LONG left; + LONG top; + LONG right; + LONG bottom; +} RECT + +typedef struct tagSCROLLBARINFO {; + DWORD cbSize; + RECT rcScrollBar; + int dxyLineButton; + int xyThumbTop; + int xyThumbBottom; + int reserved; + DWORD x; //rgstate[CCHILDREN_SCROLLBAR+1]; +} SCROLLBARINFO + +#endif +//----------------------------------------------------------------------// + +#ifndef __DBG_PARTS__ +//#xtranslate hb_ToOutDebug( [] ) => +#endif + +//----------------------------------------------------------------------// + +CLASS WvgScrollBar INHERIT WvgWindow, DataRef + + DATA autoTrack INIT .t. + DATA range INIT {0,1} + DATA scrollBoxSize INIT -1 + DATA type INIT WVGSCROLL_HORIZONTAL + DATA excludeScrollBox INIT .f. + + DATA sl_xbeSB_Scroll + + METHOD new() + METHOD create() + METHOD configure() VIRTUAL + METHOD destroy() + + METHOD scroll( xParam ) SETGET + + METHOD handleEvent() + + METHOD setRange( aRange ) + METHOD setScrollBoxSize( nUnits ) + + ENDCLASS + +//----------------------------------------------------------------------// + +METHOD new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgScrollBar + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::WvgWindow:new( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + ::style := WS_CHILD //+ SBS_SIZEBOX //+ SBS_SIZEGRIP + ::className := "SCROLLBAR" + ::objType := objTypeScrollBar + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) CLASS WvgScrollBar + + ::Initialize( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + IF ::type == WVGSCROLL_VERTICAL + ::style += SBS_VERT + ELSE + ::style += SBS_HORZ + ENDIF + + ::oParent:AddChild( SELF ) + + ::createControl() + + ::nWndProc := HB_AsCallBack( 'CONTROLWNDPROC', Self ) + ::nOldProc := Win_SetWndProc( ::hWnd, ::nWndProc ) + + ::setRange( ::range ) + + IF ::visible + ::show() + ENDIF + + RETURN Self + +//----------------------------------------------------------------------// + +METHOD handleEvent( nMessage, aNM ) CLASS WvgScrollBar + LOCAL nScrollMsg, nScrPos, nCommand + +// hb_ToOutDebug( " %s:handleEvent( %i ) %i %i %i %i", __ObjGetClsName( self ), nMessage ) + + DO CASE + + CASE nMessage == HB_GTE_HSCROLL + IF !hb_isBlock( ::sl_xbeSB_Scroll ) + RETURN( EVENT_UNHANDELLED ) + ENDIF + + nScrollMsg := aNM[ 1 ] + nScrPos := aNM[ 2 ] // To be calculated + + DO CASE + + CASE nScrollMsg == SB_LEFT + nCommand := WVGSB_PREVPOS + CASE nScrollMsg == SB_RIGHT + nCommand := WVGSB_NEXTPOS + CASE nScrollMsg == SB_LINELEFT + nCommand := WVGSB_PREVPAGE + CASE nScrollMsg == SB_LINERIGHT + nCommand := WVGSB_NEXTPAGE + CASE nScrollMsg == SB_PAGELEFT + nCommand := WVGSB_PREVPAGE + CASE nScrollMsg == SB_PAGERIGHT + nCommand := WVGSB_NEXTPAGE + CASE nScrollMsg == SB_THUMBPOSITION + nCommand := WVGSB_SLIDERTRACK + CASE nScrollMsg == SB_THUMBTRACK + nCommand := WVGSB_ENDTRACK + CASE nScrollMsg == SB_ENDSCROLL + nCommand := WVGSB_ENDSCROLL + ENDCASE + + eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, self ) + RETURN( EVENT_HANDELLED ) + + CASE nMessage == HB_GTE_VSCROLL + IF !hb_isBlock( ::sl_xbeSB_Scroll ) + RETURN( EVENT_UNHANDELLED ) + ENDIF + + nScrollMsg := aNM[ 1 ] + nScrPos := aNM[ 2 ] + nScrPos := WAPI_GetScrollPos( ::hWnd, SB_CTL ) + + DO CASE + CASE nScrollMsg == SB_LINEUP + nCommand := WVGSB_PREVPOS + CASE nScrollMsg == SB_LINEDOWN + nCommand := WVGSB_NEXTPOS + IF nScrPos < ::range[ 2 ] + WAPI_SetScrollPos( ::hWnd, SB_CTL, nScrPos+1, .t. ) + ENDIF + + CASE nScrollMsg == SB_PAGEUP + nCommand := WVGSB_PREVPAGE + CASE nScrollMsg == SB_PAGEDOWN + nCommand := WVGSB_NEXTPAGE + CASE nScrollMsg == SB_TOP + nCommand := WVGSB_TOP + CASE nScrollMsg == SB_BOTTOM + nCommand := WVGSB_BOTTOM + CASE nScrollMsg == SB_THUMBPOSITION + nCommand := WVGSB_SLIDERTRACK + CASE nScrollMsg == SB_THUMBTRACK + nCommand := WVGSB_ENDTRACK +hb_ToOutDebug( "Parent %s", ::oParent:CLASSName ) + CASE nScrollMsg == SB_ENDSCROLL + nCommand := WVGSB_ENDSCROLL +hb_ToOutDebug( "Parent %s", ::oParent:CLASSName ) + OTHERWISE + nCommand := -99 + ENDCASE + + eval( ::sl_xbeSB_Scroll, { nScrPos, nCommand }, NIL, self ) + + RETURN( EVENT_HANDELLED ) + + CASE nMessage == HB_GTE_CTLCOLOR + IF hb_isNumeric( ::hBrushBG ) + Win_SetBkMode( aNM[ 1 ], 1 ) + RETURN ( ::hBrushBG ) + ENDIF + + ENDCASE + + RETURN EVENT_UNHANDELLED + +//----------------------------------------------------------------------// + +METHOD destroy() CLASS WvgScrollBar + + hb_ToOutDebug( " %s:destroy()", __objGetClsName( self ) ) + + ::WvgWindow:destroy() + + RETURN NIL + +//----------------------------------------------------------------------// + +METHOD scroll( xParam ) CLASS WvgScrollBar + + IF hb_isBlock( xParam ) + ::sl_xbeSB_Scroll := xParam + ENDIF + + RETURN self + +//----------------------------------------------------------------------// + +METHOD setRange( aRange ) CLASS WvgScrollBar + LOCAL aOldRange, nMin, nMax + + IF WAPI_GetScrollRange( ::hWnd, SB_CTL, @nMin, @nMax ) + aOldRange := { nMin, nMax } + ELSE + aOldRange := ::range + ENDIF + + IF WAPI_SetScrollRange( ::hWnd, SB_CTL, aRange[ 1 ], aRange[ 2 ], .t. ) + ::range := aRange + ENDIF + + RETURN aOldRange + +//----------------------------------------------------------------------// + +METHOD setScrollBoxSize( nUnits ) CLASS WvgScrollBar + LOCAL nOldUnits + + RETURN nOldUnits + +//----------------------------------------------------------------------// +#if 0 + +Scroll Bar +This section contains information about the programming elements used with scroll bars. +A window can display a data object, such as a document or a bitmap, that is larger than +the windows client area. When provided with a scroll bar, the user can scroll a data +object in the client area to bring into view the portions of the object that extend beyond +the borders of the window. + + +Overviews +About Scroll Bars +A scroll bar consists of a shaded shaft with an arrow button at each end and a scroll +box (sometimes called a thumb) between the arrow buttons. + +Using Scroll Bars +When creating an overlapped, pop-up, or child window, you can add standard scroll bars +by using the CreateWindowEx function and specifying WS_HSCROLL, WS_VSCROLL, or both styles. + + + +Functions +EnableScrollBar +The EnableScrollBar function enables or disables one or both scroll bar arrows. + +GetScrollBarInfo +The GetScrollBarInfo function retrieves information about the specified scroll bar. + +GetScrollInfo +The GetScrollInfo function retrieves the parameters of a scroll bar, including +the minimum and maximum scrolling positions, the page size, and the position of the +scroll box (thumb). + +GetScrollPos +The GetScrollPos function retrieves the current position of the scroll box (thumb) +in the specified scroll bar. The current position is a relative value that depends on +the current scrolling range. For example, if the scrolling range is 0 through 100 and the +scroll box is in the middle of the bar, the current position is 50. + +Note The GetScrollPos function is provided for backward compatibility. New applications +should use the GetScrollInfo function. + +GetScrollRange +The GetScrollRange function retrieves the current minimum and maximum scroll box +(thumb) positions for the specified scroll bar. + +Note The GetScrollRange function is provided for compatibility only. New applications +should use the GetScrollInfo function. + +ScrollDC +The ScrollDC function scrolls a rectangle of bits horizontally and vertically. + +ScrollWindow +The ScrollWindow function scrolls the contents of the specified windows client area. + +Note The ScrollWindow function is provided for backward compatibility. +New applications should use the ScrollWindowEx function. + +ScrollWindowEx +The ScrollWindowEx function scrolls the contents of the specified windows client area. + +SetScrollInfo +The SetScrollInfo function sets the parameters of a scroll bar, including the +minimum and maximum scrolling positions, the page size, and the position of the +scroll box (thumb). The function also redraws the scroll bar, if requested. + +SetScrollPos +The SetScrollPos function sets the position of the scroll box (thumb) in the specified +scroll bar and, if requested, redraws the scroll bar to reflect the new position of +the scroll box. + +Note The SetScrollPos function is provided for backward compatibility. +New applications should use the SetScrollInfo function. + +SetScrollRange +The SetScrollRange function sets the minimum and maximum scroll box positions for +the specified scroll bar. + +Note The SetScrollRange function is provided for backward compatibility. +New applications should use the SetScrollInfo function. + +ShowScrollBar +The ShowScrollBar function shows or hides the specified scroll bar. + + + +Messages +======== + +SBM_ENABLE_ARROWS +An application sends the SBM_ENABLE_ARROWS message to enable or disable one or +both arrows of a scroll bar control. + +SBM_GETPOS +The SBM_GETPOS message is sent to retrieve the current position of the scroll box +of a scroll bar control. The current position is a relative value that depends on the +current scrolling range. For example, if the scrolling range is 0 through 100 and the +scroll box is in the middle of the bar, the current position is 50. + +Applications should not send this message directly. Instead, they should use the +GetScrollPos function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to these messages +for the GetScrollPos function to function properly. + +SBM_GETRANGE +The SBM_GETRANGE message is sent to retrieve the minimum and maximum position values +for the scroll bar control. + +Applications should not send this message directly. Instead, they should use the +GetScrollRange function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to these +messages for the GetScrollRange function to work properly. + +SBM_GETSCROLLBARINFO +Sent by an application to retrieve information about the specified scroll bar. + +SBM_GETSCROLLINFO +The SBM_GETSCROLLINFO message is sent to retrieve the parameters of a scroll bar. + +Applications should not send this message directly. Instead, they should use +the GetScrollInfo function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to these +messages for the GetScrollInfo function to work properly. + +SBM_SETPOS +The SBM_SETPOS message is sent to set the position of the scroll box (thumb) and, +if requested, redraw the scroll bar to reflect the new position of the scroll box. + +Applications should not send this message directly. Instead, they should use the +SetScrollPos function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to +these messages for the SetScrollPos function to work properly. + +SBM_SETRANGE +The SBM_SETRANGE message is sent to set the minimum and maximum position values +for the scroll bar control. + +Applications should not send this message directly. Instead, they should use the +SetScrollRange function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to these +messages for the SetScrollRange function to work properly. + +SBM_SETRANGEREDRAW +An application sends the SBM_SETRANGEREDRAW message to a scroll bar control to +set the minimum and maximum position values and to redraw the control. + +SBM_SETSCROLLINFO +The SBM_SETSCROLLINFO message is sent to set the parameters of a scroll bar. + +Applications should not send this message directly. Instead, they should use +the SetScrollInfo function. A window receives this message through its WindowProc function. +Applications which implement a custom scroll bar control must respond to +these messages for the SetScrollInfo function to function properly. + + + +Notifications + +WM_CTLCOLORSCROLLBAR +The WM_CTLCOLORSCROLLBAR message is sent to the parent window of a +scroll bar control when the control is about to be drawn. By responding to this +message, the parent window can use the display context handle to set the background +color of the scroll bar control. + +A window receives this message through its WindowProc function. + +WM_HSCROLL +The WM_HSCROLL message is sent to a window when a scroll event occurs in the +windows standard horizontal scroll bar. This message is also sent to the owner +of a horizontal scroll bar control when a scroll event occurs in the control. + +A window receives this message through its WindowProc function. + +WM_VSCROLL +The WM_VSCROLL message is sent to a window when a scroll event occurs in the windows +standard vertical scroll bar. This message is also sent to the owner of a vertical +scroll bar control when a scroll event occurs in the control. + +A window receives this message through its WindowProc function. + + + +Structures +========== +SCROLLBARINFO +The SCROLLBARINFO structure contains scroll bar information. + +SCROLLINFO +The SCROLLINFO structure contains scroll bar parameters to be set by the SetScrollInfo function (or SBM_SETSCROLLINFO message), or retrieved by the GetScrollInfo function (or SBM_GETSCROLLINFO message). + + + +Constants +========= +Scroll Bar Control Styles + +To create a scroll bar control using the CreateWindow or CreateWindowEx +function specify the SCROLLBAR class, appropriate window style constants, +and a combination of the following scroll bar control styles. Some of the styles +create a scroll bar control that uses a default width or height. However, +you must always specify the x- and y-coordinates and the other dimensions of the +scroll bar when you call CreateWindow or CreateWindowEx. + + +SBS_BOTTOMALIGN + +Aligns the bottom edge of the scroll bar with the bottom edge of the rectangle +defined by the x, y, nWidth, and nHeight parameters of CreateWindowEx function. +The scroll bar has the default height for system scroll bars. Use this style with +the SBS_HORZ style. + +SBS_HORZ + +Designates a horizontal scroll bar. If neither the SBS_BOTTOMALIGN nor SBS_TOPALIGN +style is specified, the scroll bar has the height, width, and position specified by the +x, y, nWidth, and nHeight parameters of CreateWindowEx. + +SBS_LEFTALIGN + +Aligns the left edge of the scroll bar with the left edge of the rectangle defined +by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has +the default width for system scroll bars. Use this style with the SBS_VERT style. + +SBS_RIGHTALIGN + +Aligns the right edge of the scroll bar with the right edge of the rectangle defined +by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has the +default width for system scroll bars. Use this style with the SBS_VERT style. + +SBS_SIZEBOX + +Designates a size box. If you specify neither the SBS_SIZEBOXBOTTOMRIGHTALIGN nor the +SBS_SIZEBOXTOPLEFTALIGN style, the size box has the height, width, and position +specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. + +SBS_SIZEBOXBOTTOMRIGHTALIGN + +Aligns the lower right corner of the size box with the lower right corner of the +rectangle specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. +The size box has the default size for system size boxes. Use this style with the +SBS_SIZEBOX style. + +SBS_SIZEBOXTOPLEFTALIGN + +Aligns the upper left corner of the size box with the upper left corner of the +rectangle specified by the x, y, nWidth, and nHeight parameters of CreateWindowEx. +The size box has the default size for system size boxes. Use this style with the +SBS_SIZEBOX style. + +SBS_SIZEGRIP + +Same as SBS_SIZEBOX, but with a raised edge. + +SBS_TOPALIGN + +Aligns the top edge of the scroll bar with the top edge of the rectangle defined +by the x, y, nWidth, and nHeight parameters of CreateWindowEx. The scroll bar has +the default height for system scroll bars. Use this style with the SBS_HORZ style. + +SBS_VERT + +Designates a vertical scroll bar. If you specify neither the SBS_RIGHTALIGN nor +the SBS_LEFTALIGN style, the scroll bar has the height, width, and position specified +by the x, y, nWidth, and nHeight parameters of CreateWindowEx. + + +#endif +//----------------------------------------------------------------------// + + diff --git a/harbour/contrib/gtwvg/wvgstatb.prg b/harbour/contrib/gtwvg/wvgstatb.prg index fca5f91f9a..7e5bbaf0f5 100644 --- a/harbour/contrib/gtwvg/wvgstatb.prg +++ b/harbour/contrib/gtwvg/wvgstatb.prg @@ -218,12 +218,6 @@ METHOD destroy() CLASS WvgStatusBar ::WvgWindow:destroy() - #if 0 - IF Win_IsWindow( ::hWnd ) - Win_DestroyWindow( ::hWnd ) - ENDIF - HB_FreeCallback( ::nWndProc ) - #endif RETURN NIL //----------------------------------------------------------------------// diff --git a/harbour/contrib/gtwvg/wvgstatc.prg b/harbour/contrib/gtwvg/wvgstatc.prg index 8e568a6b79..095fcdcfe6 100644 --- a/harbour/contrib/gtwvg/wvgstatc.prg +++ b/harbour/contrib/gtwvg/wvgstatc.prg @@ -321,7 +321,7 @@ METHOD setCaption( xCaption, cDll ) Win_DeleteObject( ::hBitmap ) ENDIF - ::hBitmap := Win_LoadImage( ::caption, 2 ) + ::hBitmap := Win_LoadImage( ::caption, IF( hb_isNUmeric( ::caption ), 1, 2 ) ) //hb_toOutDebug( "setCaption %s %i %s",::caption, ::hBitmap, IF( file( ::caption ),'Yes','No') ) Win_SendMessage( ::hWnd, STM_SETIMAGE, IMAGE_BITMAP, ::hBitmap ) diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 49c156bd0f..9a28f3496d 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -2121,7 +2121,7 @@ HB_FUNC( WVG_ADDTOOLBARBUTTON ) case 3: // separator { - tbb.iBitmap = 0; + tbb.iBitmap = 10; tbb.idCommand = 0; tbb.fsState = TBSTATE_ENABLED; tbb.fsStyle = TBSTYLE_SEP; diff --git a/harbour/contrib/gtwvg/wvgwnd.prg b/harbour/contrib/gtwvg/wvgwnd.prg index 5ef1d424f8..96ca7d9dc1 100644 --- a/harbour/contrib/gtwvg/wvgwnd.prg +++ b/harbour/contrib/gtwvg/wvgwnd.prg @@ -77,7 +77,7 @@ //----------------------------------------------------------------------// #ifndef __DBG_PARTS__ -//#xtranslate hb_ToOutDebug( [] ) => +#xtranslate hb_ToOutDebug( [] ) => #endif //----------------------------------------------------------------------// @@ -1238,7 +1238,7 @@ METHOD createControl() CLASS WvgWindow METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow LOCAL nCtrlID, nNotifctn, hWndCtrl, nObj, aMenuItem, oObj, nReturn - #if 0 + #if 1 hb_ToOutDebug( "%s:wndProc( %i %i %i %i )", __ObjGetClsName( self ), hWnd, nMessage, nwParam, nlParam ) #endif @@ -1299,13 +1299,23 @@ METHOD ControlWndProc( hWnd, nMessage, nwParam, nlParam ) CLASS WvgWindow IF hb_isObject( oObj ) nReturn := oObj:handleEvent( HB_GTE_CTLCOLOR, { nwParam, nlParam } ) - IF nReturn == 0 + IF nReturn == 1 RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam ) ELSE RETURN nReturn ENDIF ENDIF EXIT + + CASE WM_HSCROLL + ::handleEvent( HB_GTE_HSCROLL, { Win_LoWord( nwParam ), Win_HiWord( nwParam ), nlParam } ) + RETURN 0 + + CASE WM_VSCROLL + nReturn := ::handleEvent( HB_GTE_VSCROLL, { Win_LoWord( nwParam ), Win_HiWord( nwParam ), nlParam } ) + IF nReturn == EVENT_HANDELLED + RETURN 0 + ENDIF END RETURN Win_CallWindowProc( ::nOldProc, hWnd, nMessage, nwParam, nlParam ) diff --git a/harbour/contrib/gtwvg/wvtwin.ch b/harbour/contrib/gtwvg/wvtwin.ch index 1a509b563a..2bde417bf3 100644 --- a/harbour/contrib/gtwvg/wvtwin.ch +++ b/harbour/contrib/gtwvg/wvtwin.ch @@ -1588,6 +1588,44 @@ #define WM_CHOOSEFONT_SETLOGFONT (WM_USER + 101) #define WM_CHOOSEFONT_SETFLAGS (WM_USER + 102) +//----------------------------------------------------------------------// +// SCROLLBARS +//----------------------------------------------------------------------// + +#define SB_HORZ 0 +#define SB_VERT 1 +#define SB_CTL 2 +#define SB_BOTH 3 + +#define SB_LINELEFT 0 +#define SB_LINERIGHT 1 +#define SB_PAGELEFT 2 +#define SB_PAGERIGHT 3 +#define SB_LEFT 6 +#define SB_RIGHT 7 +// +#define SB_LINEUP 0 +#define SB_LINEDOWN 1 +#define SB_PAGEUP 2 +#define SB_PAGEDOWN 3 +#define SB_TOP 6 +#define SB_BOTTOM 7 +// +#define SB_THUMBPOSITION 4 +#define SB_THUMBTRACK 5 +#define SB_ENDSCROLL 8 + +#define SBS_BOTTOMALIGN 4 +#define SBS_HORZ 0 +#define SBS_LEFTALIGN 2 +#define SBS_RIGHTALIGN 4 +#define SBS_SIZEBOX 8 +#define SBS_SIZEBOXBOTTOMRIGHTALIGN 4 +#define SBS_SIZEBOXTOPLEFTALIGN 2 +#define SBS_SIZEGRIP 16 +#define SBS_TOPALIGN 2 +#define SBS_VERT 1 + //----------------------------------------------------------------------// #endif //----------------------------------------------------------------------// diff --git a/harbour/contrib/hbwin/Makefile b/harbour/contrib/hbwin/Makefile index 93f94d49b8..adc8418ca5 100644 --- a/harbour/contrib/hbwin/Makefile +++ b/harbour/contrib/hbwin/Makefile @@ -19,6 +19,7 @@ C_SOURCES = \ win_regc.c \ wapi_commctrl.c \ wapi_winbase.c \ + wapi_winuser.c \ PRG_SOURCES = \ win_os.prg \ diff --git a/harbour/contrib/hbwin/common.mak b/harbour/contrib/hbwin/common.mak index 6d89c1cba7..c95178532c 100644 --- a/harbour/contrib/hbwin/common.mak +++ b/harbour/contrib/hbwin/common.mak @@ -24,6 +24,7 @@ LIB_OBJS = \ $(OBJ_DIR)win_regc$(OBJEXT) \ $(OBJ_DIR)wapi_commctrl$(OBJEXT) \ $(OBJ_DIR)wapi_winbase$(OBJEXT) \ + $(OBJ_DIR)wapi_winuser$(OBJEXT) \ \ $(OBJ_DIR)win_os$(OBJEXT) \ $(OBJ_DIR)win_reg$(OBJEXT) \ diff --git a/harbour/contrib/hbwin/hbwapi.h b/harbour/contrib/hbwin/hbwapi.h index 88cbc26aa2..cdc2c7c5eb 100644 --- a/harbour/contrib/hbwin/hbwapi.h +++ b/harbour/contrib/hbwin/hbwapi.h @@ -51,42 +51,35 @@ */ #ifndef __HBWAPI_H -#define __HBWAPI_H + #define __HBWAPI_H -/* - If we implement pointers than we need to return back pointers in all - those functions which return a handle. My existing code checks for the - return values and compare it against some numeric. So for time being - I am deferring the use of pointers till we come up with a common solution. + #define wapi_par_WNDPROC( n ) ( ( WNDPROC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_WPARAM( n ) ( ( WPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_LPARAM( n ) ( ( LPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HWND( n ) ( ( HWND ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HDC( n ) ( ( HDC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HANDLE( n ) ( ( HANDLE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HGDIOBJ( n ) ( ( HGDIOBJ ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HBRUSH( n ) ( ( HBRUSH ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HBITMAP( n ) ( ( HBITMAP ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HICON( n ) ( ( HICON ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HIMAGELIST( n ) ( ( HIMAGELIST ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HFONT( n ) ( ( HFONT ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_HINSTANCE( n ) ( ( HINSTANCE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_COLORREF( n ) ( ( COLORREF ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) - #define wapi_par_WPARAM( n ) ( ( WPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : hb_parptr( n ) ) ) -*/ + #define wapi_par_STRUCT( n ) ( hb_parc( n ) ) -#define wapi_par_WNDPROC( n ) ( ( WNDPROC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_WPARAM( n ) ( ( WPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_LPARAM( n ) ( ( LPARAM ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HWND( n ) ( ( HWND ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HDC( n ) ( ( HDC ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HANDLE( n ) ( ( HANDLE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HGDIOBJ( n ) ( ( HGDIOBJ ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HBRUSH( n ) ( ( HBRUSH ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HBITMAP( n ) ( ( HBITMAP ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HICON( n ) ( ( HICON ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HIMAGELIST( n ) ( ( HIMAGELIST ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HFONT( n ) ( ( HFONT ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_HINSTANCE( n ) ( ( HINSTANCE ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) -#define wapi_par_COLORREF( n ) ( ( COLORREF ) ( ISNUM( n ) ? ( HB_PTRDIFF ) hb_parnint( n ) : ( HB_PTRDIFF ) hb_parptr( n ) ) ) + #define wapi_par_BOOL( n ) ( hb_parl( n ) ) + #define wapi_par_INT( n ) ( hb_parni( n ) ) + #define wapi_par_UINT( n ) ( ( UINT ) hb_parni( n ) ) + #define wapi_par_LONG( n ) ( ( LONG ) hb_parnl( n ) ) -#define wapi_par_STRUCT( n ) ( hb_parc( n ) ) + #define wapi_ret_NI( i ) ( hb_retni( i ) ) + #define wapi_ret_L( b ) ( hb_retl( b ) ) -#define wapi_par_INT( n ) ( hb_parni( n ) ) -#define wapi_par_UINT( n ) ( ( UINT ) hb_parni( n ) ) - -#define wapi_ret_NI( i ) ( hb_retni( i ) ) -#define wapi_ret_L( b ) ( hb_retl( b ) ) - -#define wapi_ret_HANDLE( h ) ( hb_retptr( h ) ) -#define wapi_ret_HRESULT( hr ) ( hb_retptr( hr ) ) -#define wapi_ret_COLORREF( cr ) ( hb_retnint( ( HB_PTRDIFF ) cr ) ) + #define wapi_ret_HANDLE( h ) ( hb_retptr( h ) ) + #define wapi_ret_HRESULT( hr ) ( hb_retptr( hr ) ) + #define wapi_ret_COLORREF( cr ) ( hb_retnint( ( HB_PTRDIFF ) cr ) ) #endif /* __HBWAPI_H */ diff --git a/harbour/contrib/hbwin/wapi_winuser.c b/harbour/contrib/hbwin/wapi_winuser.c new file mode 100644 index 0000000000..de9a0a575a --- /dev/null +++ b/harbour/contrib/hbwin/wapi_winuser.c @@ -0,0 +1,230 @@ +/* + * $Id$ + */ + +/* + * + * Pritpal Bedi 17Feb2009 + * www - http://www.harbour.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the xHarbour Project gives permission for + * additional uses of the text contained in its release of xHarbour. + * + * The exception is that, if you link the xHarbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the xHarbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the xHarbour + * Project under the name xHarbour. If you copy code from other + * xHarbour Project or Free Software Foundation releases into a copy of + * xHarbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for xHarbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#define HB_OS_WIN_USED + +#include "hbapi.h" +#include "hbwapi.h" +#include + +/*-----------------------------------------------------------------------/ + BEGIN SCROLLBAR MANIPULATION WINAPI FUNCTIONS +/-----------------------------------------------------------------------*/ +/* +BOOL EnableScrollBar( HWND hWnd, UINT wSBflags, UINT wArrows ); +*/ +HB_FUNC( WAPI_ENABLESCROLLBAR ) +{ + wapi_ret_L( EnableScrollBar( wapi_par_HWND( 1 ), + wapi_par_UINT( 2 ), + wapi_par_UINT( 3 ) ) ); +} +/*----------------------------------------------------------------------*/ +/* +BOOL GetScrollBarInfo( HWND hwnd, LONG idObject, PSCROLLBARINFO psbi ); + $$ + Local strSCROLLBARINFO IS SCROLLBARINFO + Local cSCROLLBARINFO = strSCROLLBARINFO:value + Local nCtrlType = OBJID_CLIENT | OBJID_HSCROLL | OBJID_VSCROLL + + lSuccess := WAPI_GetScrollInfo( hWnd, nCtrType, @cSCROLLINFO ) + + strSCROLLBARINFO:buffer( cSCROLLBARINFO ) + ? strSCROLLINFO: + $$ +*/ +HB_FUNC( WAPI_GETSCROLLBARINFO ) +{ + PSCROLLBARINFO sbi = ( PSCROLLBARINFO ) wapi_par_STRUCT( 3 ); + BOOL bSuccess; + + memset( &sbi, 0, sizeof( SCROLLBARINFO ) ); + sbi->cbSize = sizeof( SCROLLBARINFO ); + + bSuccess = GetScrollBarInfo( wapi_par_HWND( 1 ), + wapi_par_LONG( 2 ), + sbi ); + if( bSuccess ) + { + hb_storclen( ( char* ) &sbi, sizeof( SCROLLBARINFO ), 3 ); + } + wapi_ret_L( bSuccess ); +} +/*----------------------------------------------------------------------*/ +/* +BOOL GetScrollInfo( HWND hwnd, int fnBar, LPSCROLLINFO lpsi ); +*/ +HB_FUNC( WAPI_GETSCROLLINFO ) +{ + LPSCROLLINFO si = ( LPSCROLLINFO ) wapi_par_STRUCT( 3 ); + BOOL bSuccess; + + memset( &si, 0, sizeof( SCROLLINFO ) ); + si->cbSize = sizeof( SCROLLINFO ); + + bSuccess = GetScrollInfo( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + si ); + if( bSuccess ) + { + hb_storclen( ( char* ) &si, 3, sizeof( SCROLLINFO ) ); + } + wapi_ret_L( bSuccess ); +} +/*----------------------------------------------------------------------*/ +/* +int GetScrollPos( HWND hWnd, int nBar ); +*/ +HB_FUNC( WAPI_GETSCROLLPOS ) +{ + wapi_ret_NI( GetScrollPos( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ) ) ); +} +/*----------------------------------------------------------------------*/ +/* +BOOL GetScrollRange( HWND hWnd, int nBar, LPINT lpMinPos, LPINT lpMaxPos ); +*/ +HB_FUNC( WAPI_GETSCROLLRANGE ) +{ + int minPos, maxPos; + + if( GetScrollRange( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + &minPos, + &maxPos ) ) + { + hb_storni( minPos, 3 ); + hb_storni( maxPos, 4 ); + + wapi_ret_L( TRUE ); + } + wapi_ret_L( FALSE ); +} +/*----------------------------------------------------------------------*/ +#if 0 +/* +BOOL ScrollDC( HDC hDC, int dx, int dy, const RECT *lprcScroll, const RECT *lprcClip, + HRGN hrgnUpdate, LPRECT lprcUpdate ); +*/ +HB_FUNC( WAPI_SCROLLDC ) +{ + +} +/*----------------------------------------------------------------------*/ +/* +BOOL ScrollWindow( HWND hWnd, int XAmount, int YAmount, const RECT *lpRect, + const RECT *lpClipRect ); +*/ +HB_FUNC( WAPI_SCROLLWINDOW ) +{ + +} +/*----------------------------------------------------------------------*/ +/* +int ScrollWindowEx( HWND hWnd, int dx, int dy, const RECT *prcScroll, const RECT *prcClip, + HRGN hrgnUpdate, LPRECT prcUpdate, UINT flags ); +*/ +HB_FUNC( WAPI_SCROLLWINDOWEX ) +{ + +} +#endif +/*----------------------------------------------------------------------*/ +/* +int SetScrollInfo( HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw ); +*/ +HB_FUNC( WAPI_SETSCROLLINFO ) +{ + LPSCROLLINFO si = ( LPSCROLLINFO ) wapi_par_STRUCT( 3 ); + + wapi_ret_NI( SetScrollInfo( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + si, + ISNIL( 4 ) ? TRUE : wapi_par_BOOL( 4 ) ) ); +} +/*----------------------------------------------------------------------*/ +/* +int SetScrollPos( HWND hWnd, int nBar, int nPos, BOOL bRedraw ); +*/ +HB_FUNC( WAPI_SETSCROLLPOS ) +{ + wapi_ret_NI( SetScrollPos( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + wapi_par_INT( 3 ), + wapi_par_BOOL( 4 ) ) ); +} +/*----------------------------------------------------------------------*/ +/* +BOOL SetScrollRange( HWND hWnd, int nBar, int nMinPos, int nMaxPos, BOOL bRedraw ); +*/ +HB_FUNC( WAPI_SETSCROLLRANGE ) +{ + wapi_ret_L( SetScrollRange( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + wapi_par_INT( 3 ), + wapi_par_INT( 4 ), + ( ISLOG( 5 ) ? wapi_par_BOOL( 5 ) : TRUE ) ) ); +} +/*----------------------------------------------------------------------*/ +/* +BOOL ShowScrollBar( HWND hWnd, int wBar, BOOL bShow ); +*/ +HB_FUNC( WAPI_SHOWSCROLLBAR ) +{ + wapi_ret_L( ShowScrollBar( wapi_par_HWND( 1 ), + wapi_par_INT( 2 ), + wapi_par_BOOL( 3 ) ) ); +} +/*----------------------------------------------------------------------*/ + + + +