diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1c41404338..5d1671d554 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,52 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-11 19:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * include/hbgtinfo.ch + * source/rtl/gtwvt/gtwvt.c + ! Fixed stupid typo from me. This is why maximized size + didn't want to get right. + ! Fixed to not reposition non-maximized windows while + resizing them and their top/left corner was off screen. + ! Fixed to not allow font screen below a certain limit + (3x4 pixels). This fixes some of the more obvious cases + when window gets trashed. + ! Fixed to not resize the windows when toggling the + resizing feature using HB_GTI_RESIZABLE. + + Added to disable maximize icon after maximizing and + reenable it on the first resize attempt. + - Removed TIMER related stuff as it's very difficult + (or impossible) to support on other platforms. + Timer support could be added to hbw32.lib, though. + * Some cleanups. + ; Remaining TOFIXes: + - Window trashing when settling on a size which + cannot be properly filled with the console. Try with + vertically or horizontally narrow window shapes. + - Mark&Copy is still trashing when swapping directions + with the selection compared to the starting position. + + * tests/wvtext.prg + ! Added missing SVN keywords properties. + ! Added missing SVN eol property. + ! Fixed to use the default font to have a more common + ground for testing. + + Added markers to the corners to easily spot chopped + borders. + + * contrib/xhb/Makefile + * contrib/xhb/common.mak + - Removed some xhb specific non-standard headers from + the list of those getting installed to the Harbour central + include dir. Only hbcompat.ch, hbcompat.h and xhb.ch + goes now to the official include dir. After this change + has been merged with RC1, xhb.lib may be included in + the default build. + [TOMERGE RC1] + + * contrib/hbw32/tests/testdll.prg + + Added some more DLL calling samples. + 2008-06-11 18:22 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/include/hbdate.h * harbour/source/rtl/dates.c diff --git a/harbour/contrib/hbw32/tests/testdll.prg b/harbour/contrib/hbw32/tests/testdll.prg index ddd42361c7..9dfd376f52 100644 --- a/harbour/contrib/hbw32/tests/testdll.prg +++ b/harbour/contrib/hbw32/tests/testdll.prg @@ -36,6 +36,51 @@ #define MB_RIGHT 0x00080000 #define MB_RTLREADING 0x00100000 +#define CSIDL_DESKTOP 0x0000 // +#define CSIDL_INTERNET 0x0001 // Internet Explorer (icon on desktop) +#define CSIDL_PROGRAMS 0x0002 // Start Menu\Programs +#define CSIDL_CONTROLS 0x0003 // My Computer\Control Panel +#define CSIDL_PRINTERS 0x0004 // My Computer\Printers +#define CSIDL_PERSONAL 0x0005 // My Documents +#define CSIDL_FAVORITES 0x0006 // \Favorites +#define CSIDL_STARTUP 0x0007 // Start Menu\Programs\Startup +#define CSIDL_RECENT 0x0008 // \Recent +#define CSIDL_SENDTO 0x0009 // \SendTo +#define CSIDL_BITBUCKET 0x000a // \Recycle Bin +#define CSIDL_STARTMENU 0x000b // \Start Menu +#define CSIDL_DESKTOPDIRECTORY 0x0010 // \Desktop +#define CSIDL_DRIVES 0x0011 // My Computer +#define CSIDL_NETWORK 0x0012 // Network Neighborhood +#define CSIDL_NETHOOD 0x0013 // \nethood +#define CSIDL_FONTS 0x0014 // windows\fonts +#define CSIDL_TEMPLATES 0x0015 +#define CSIDL_COMMON_STARTMENU 0x0016 // All Users\Start Menu +#define CSIDL_COMMON_PROGRAMS 0X0017 // All Users\Programs +#define CSIDL_COMMON_STARTUP 0x0018 // All Users\Startup +#define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019 // All Users\Desktop +#define CSIDL_APPDATA 0x001a // \Application Data +#define CSIDL_PRINTHOOD 0x001b // \PrintHood +#define CSIDL_LOCAL_APPDATA 0x001c // \Local Settings\Applicaiton Data (non roaming) +#define CSIDL_ALTSTARTUP 0x001d // non localized startup +#define CSIDL_COMMON_ALTSTARTUP 0x001e // non localized common startup +#define CSIDL_COMMON_FAVORITES 0x001f +#define CSIDL_INTERNET_CACHE 0x0020 +#define CSIDL_COOKIES 0x0021 +#define CSIDL_HISTORY 0x0022 +#define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data +#define CSIDL_WINDOWS 0x0024 // GetWindowsDirectory() +#define CSIDL_SYSTEM 0x0025 // GetSystemDirectory() +#define CSIDL_PROGRAM_FILES 0x0026 // C:\Program Files +#define CSIDL_MYPICTURES 0x0027 // C:\Program Files\My Pictures +#define CSIDL_PROFILE 0x0028 // USERPROFILE +#define CSIDL_PROGRAM_FILES_COMMON 0x002b // C:\Program Files\Common +#define CSIDL_COMMON_TEMPLATES 0x002d // All Users\Templates +#define CSIDL_COMMON_DOCUMENTS 0x002e // All Users\Documents +#define CSIDL_COMMON_ADMINTOOLS 0x002f // All Users\Start Menu\Programs\Administrative Tools +#define CSIDL_ADMINTOOLS 0x0030 // \Start Menu\Programs\Administrative Tools + +#define MAX_PATH 260 + PROCEDURE Main() LOCAL hDLL LOCAL cData @@ -68,8 +113,30 @@ PROCEDURE Main() hDLL := DllLoad( "libcurl.dll" ) ? GetProcAddress( hDLL, "curl_version" ) // ; This one doesn't work. - ? CallDllTyped( 10 /* return string */, GETPROCADDRESS( hDLL, "CURL_VERSION" ) ) + ? CallDllTyped( 10 /* return string */, GetProcAddress( hDLL, "CURL_VERSION" ) ) DllUnload( hDLL ) ENDIF + /* Force Windows not to show dragged windows contents */ + + #define SPI_SETDRAGFULLWINDOWS 37 + + ? "Full content drag: OFF" + ? DllCall( "user32.dll", NIL, "SystemParametersInfo", SPI_SETDRAGFULLWINDOWS, 0, 0, 0 ) + Inkey( 0 ) + + ? "Full content drag: ON" + ? DllCall( "user32.dll", NIL, "SystemParametersInfo", SPI_SETDRAGFULLWINDOWS, 1, 0, 0 ) + Inkey( 0 ) + + /* Get some standard Windows folders */ + + hDLL := DllLoad( "shell32.dll" ) + cData := Space( MAX_PATH ) + ? CallDllBool( GetProcAddress( hDLL, "SHGetSpecialFolderPath" ), 0, @cData, CSIDL_APPDATA, 0 ) + ? cData + ? CallDll( GetProcAddress( hDLL, "SHGetFolderPath" ), 0, CSIDL_ADMINTOOLS, 0, 0, @cData ) + ? cData + DllUnload( hDLL ) + RETURN diff --git a/harbour/contrib/xhb/Makefile b/harbour/contrib/xhb/Makefile index 57431d3dd9..07ec971ac5 100644 --- a/harbour/contrib/xhb/Makefile +++ b/harbour/contrib/xhb/Makefile @@ -22,9 +22,6 @@ C_SOURCES=\ C_HEADERS=\ hbcompat.h \ - hbcomprs.h \ - hbfast.h \ - hbxml.h \ PRG_SOURCES=\ txml.prg \ @@ -34,17 +31,8 @@ PRG_SOURCES=\ xhbcomp.prg \ PRG_HEADERS=\ - classex.ch \ - cstruct.ch \ hbcompat.ch \ - hbctypes.ch \ - hblog.ch \ - hblogdef.ch \ - math.ch \ - usrrdd.ch \ - wintypes.ch \ xhb.ch \ - xhbextrn.ch \ LIBNAME=xhb diff --git a/harbour/contrib/xhb/common.mak b/harbour/contrib/xhb/common.mak index 398bc28a1f..ac36617844 100644 --- a/harbour/contrib/xhb/common.mak +++ b/harbour/contrib/xhb/common.mak @@ -8,22 +8,10 @@ LIB_PATH = $(LIB_DIR)$(LIBNAME)$(LIBEXT) C_HEADERS = \ hbcompat.h \ - hbcomprs.h \ - hbfast.h \ - hbxml.h \ PRG_HEADERS = \ - classex.ch \ - cstruct.ch \ hbcompat.ch \ - hbctypes.ch \ - hblog.ch \ - hblogdef.ch \ - math.ch \ - usrrdd.ch \ - wintypes.ch \ xhb.ch \ - xhbextrn.ch \ LIB_OBJS = \ $(OBJ_DIR)freadlin$(OBJEXT) \ diff --git a/harbour/include/hbgtinfo.ch b/harbour/include/hbgtinfo.ch index d81f2446de..3ade255c15 100644 --- a/harbour/include/hbgtinfo.ch +++ b/harbour/include/hbgtinfo.ch @@ -125,8 +125,6 @@ /* Additional constants to enhance GT */ #define HB_GTI_NOTIFIERBLOCK 51 /* This optional codeblock gets called whenever certain events occur. See HB_GTE_* */ #define HB_GTI_SCREENSIZE 52 /* Get/Set height/width of application window in pixels */ -#define HB_GTI_SETTIMER 53 /* Sets the Timer with ID, callback will be defined with GTI_CALLBACK */ -#define HB_GTI_KILLTIMER 54 /* Deactivates the Timer set with GTI_SETTIMER */ /* Font weights */ #define HB_GTI_FONTW_THIN 1 @@ -156,12 +154,11 @@ #define HB_GTI_KBD_ACCENT4 32768 /* Harbour GT callback events - WORK IN PROGRESS */ -#define HB_GTE_TIMER 1 -#define HB_GTE_ACTIVATE 2 -#define HB_GTE_SETFOCUS 3 -#define HB_GTE_KILLFOCUS 4 -#define HB_GTE_CLOSE 5 -#define HB_GTE_RESIZED 6 +#define HB_GTE_ACTIVATE 1 +#define HB_GTE_SETFOCUS 2 +#define HB_GTE_KILLFOCUS 3 +#define HB_GTE_CLOSE 4 +#define HB_GTE_RESIZED 5 /* Compatibility #defines. These codes are deprecated, _don't use them_. Please upgrade to the above versions. @@ -215,13 +212,6 @@ #define GTI_ADDKEYMAP HB_GTI_ADDKEYMAP #define GTI_DELKEYMAP HB_GTI_DELKEYMAP #define GTI_ISUNICODE HB_GTI_ISUNICODE -#define GTI_MARKCOPY HB_GTI_MARKCOPY -#define GTI_RESIZEABLE HB_GTI_RESIZEABLE - -#define GTI_CALLBACK HB_GTI_CALLBACK -#define GTI_SCREENSIZE HB_GTI_SCREENSIZE -#define GTI_SETTIMER HB_GTI_SETTIMER -#define GTI_KILLTIMER HB_GTI_KILLTIMER /* Font weights */ #define GTI_FONTW_THIN HB_GTI_FONTW_THIN diff --git a/harbour/source/rtl/gtwvt/gtwvt.c b/harbour/source/rtl/gtwvt/gtwvt.c index 6d348755c4..3f4eaa77dd 100644 --- a/harbour/source/rtl/gtwvt/gtwvt.c +++ b/harbour/source/rtl/gtwvt/gtwvt.c @@ -1,4 +1,4 @@ -/* + /* * $Id$ */ @@ -466,31 +466,28 @@ static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT ) HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS ); } -static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode ) +static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT ) { RECT wi, ci; - BOOL bValid = TRUE; LONG maxWidth; LONG maxHeight; - LONG borderwidth; - LONG borderheight; + LONG borderWidth; + LONG borderHeight; SHORT left; SHORT top; - HB_SYMBOL_UNUSED( mode ); - GetClientRect( pWVT->hWnd, &ci ); GetWindowRect( pWVT->hWnd, &wi ); - borderwidth = ( wi.right - wi.left - ( ci.right - ci.left ) ); - borderheight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); + borderWidth = ( wi.right - wi.left - ( ci.right - ci.left ) ); + borderHeight = ( wi.bottom - wi.top - ( ci.bottom - ci.top ) ); if( pWVT->bMaximized ) { SystemParametersInfo( SPI_GETWORKAREA, 0, &wi, 0 ); - maxHeight = wi.bottom - wi.top - borderwidth; - maxWidth = wi.right - wi.left - borderheight; + maxHeight = wi.bottom - wi.top - borderHeight; + maxWidth = wi.right - wi.left - borderWidth; left = 0; top = 0; @@ -500,17 +497,13 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode ) maxHeight = ci.bottom - ci.top; maxWidth = ci.right - ci.left; - left = ( wi.left < 0 ? 0 : wi.left ); - top = ( wi.top < 0 ? 0 : wi.top ); + left = wi.left; + top = wi.top; } - if( bValid ) { - HDC hdc; HFONT hOldFont, hFont; USHORT fontHeight, fontWidth, n; - LONG width, height; - TEXTMETRIC tm; fontHeight = maxHeight / pWVT->ROWS; fontWidth = maxWidth / pWVT->COLS; @@ -518,6 +511,10 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode ) hFont = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage ); if( hFont ) { + HDC hdc; + LONG width, height; + TEXTMETRIC tm; + hdc = GetDC( pWVT->hWnd ); hOldFont = ( HFONT ) SelectObject( hdc, hFont ); SetTextCharacterExtra( hdc, 0 ); @@ -525,10 +522,13 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode ) SelectObject( hdc, hOldFont ); ReleaseDC( pWVT->hWnd, hdc ); - width = ( tm.tmAveCharWidth * pWVT->COLS ); - height = ( tm.tmHeight * pWVT->ROWS ); + width = tm.tmAveCharWidth * pWVT->COLS; + height = tm.tmHeight * pWVT->ROWS; - //if( width <= maxWidth && height <= maxHeight ) + if( width <= maxWidth && + height <= maxHeight && + tm.tmAveCharWidth >= 3 && + tm.tmHeight >= 4 ) { if( pWVT->hFont ) DeleteObject( pWVT->hFont ); @@ -550,13 +550,16 @@ static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT, USHORT mode ) for( n = 0; n < pWVT->COLS; n++ ) pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x; - width = ( ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderwidth; - height = ( ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderheight; + width = ( ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth; + height = ( ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight; if( pWVT->bMaximized ) { left = ( ( wi.right - width ) / 2 ); top = ( ( wi.bottom - height ) / 2 ); + + left = ( left < 0 ? 0 : left ); + top = ( top < 0 ? 0 : top ); } hb_gt_wvt_KillCaret( pWVT ); @@ -1495,28 +1498,23 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara hb_idleState(); return 0; -/* - case WM_TIMER: - if( pWVT->pSymWVT_TIMER ) - { - if( hb_vmRequestReenter() ) - { - hb_vmPushDynSym( pWVT->pSymWVT_TIMER ); - hb_vmPushNil(); - hb_vmPushNumInt( wParam ); - hb_vmDo( 1 ); - hb_vmRequestRestore(); - } - } - return 0; -*/ - /* Pritpal Bedi - 06 Jun 2008 */ case WM_ACTIVATE: hb_gt_wvt_FireEvent( pWVT, ( LOWORD( wParam ) == WA_INACTIVE ? HB_GTE_KILLFOCUS : HB_GTE_SETFOCUS ) ); return 0; case WM_ENTERSIZEMOVE: + if( pWVT->bMaximized ) + { + pWVT->bMaximized = FALSE; + + /* Enable "maximize" button */ + SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME ); + 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 ); + } return 0; case WM_EXITSIZEMOVE: @@ -1524,35 +1522,27 @@ static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wPara return 0; case WM_SIZE: - if( !pWVT->bMaximized ) - { - hb_gt_wvt_FitSize( pWVT, 0 ); - } - else - { - pWVT->bMaximized = FALSE; - } - return 0; - - /* NOTE: This message has more powerful features than what I implemented as above commented out */ - case WM_TIMER: - hb_gt_wvt_FireEvent( pWVT, HB_GTE_TIMER ); + hb_gt_wvt_FitSize( pWVT ); return 0; case WM_SYSCOMMAND: - switch(wParam) + switch( wParam ) { case SC_MAXIMIZE: { - RECT rc = {0,0,0,0}; - pWVT->bMaximized = TRUE; - hb_gt_wvt_FitSize( pWVT,1 ); - pWVT->bMaximized = FALSE; - SystemParametersInfo( SPI_GETWORKAREA, 0, &rc, 0 ); + hb_gt_wvt_FitSize( pWVT ); + + /* Disable "maximize" button */ + SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_THICKFRAME ); + 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 ); hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED ); + return 0; } @@ -2240,13 +2230,6 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) } break; } - case HB_GTI_SETTIMER: - SetTimer( pWVT->hWnd, hb_arrayGetNI( pInfo->pNewVal,1 ), hb_arrayGetNI( pInfo->pNewVal, 2 ), NULL ); - break; - - case HB_GTI_KILLTIMER: - KillTimer( pWVT->hWnd, hb_itemGetNI( pInfo->pNewVal ) ); - break; case HB_GTI_RESIZABLE: { @@ -2258,17 +2241,16 @@ static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo ) { LONG_PTR style; - if( bNewValue ) - style = WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX; + pWVT->bResizable = bNewValue; + + if( pWVT->bResizable ) + style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME; else style = WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_BORDER; - pWVT->bResizable = bNewValue; - SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, style ); SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOMOVE | - SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE ); ShowWindow( pWVT->hWnd, SW_HIDE ); ShowWindow( pWVT->hWnd, SW_NORMAL ); } diff --git a/harbour/tests/wvtext.prg b/harbour/tests/wvtext.prg index 3968eca581..75672f2f2e 100644 --- a/harbour/tests/wvtext.prg +++ b/harbour/tests/wvtext.prg @@ -1,104 +1,110 @@ -/* - * $Id: wcecon.prg 8236 2008-01-26 05:29:20Z vszakats $ - */ - -//----------------------------------------------------------------------// -//----------------------------------------------------------------------// -//----------------------------------------------------------------------// -// -// [x]Harbour Extended Features Deno -// . -// Pritpal Bedi -// -//----------------------------------------------------------------------// -//----------------------------------------------------------------------// -//----------------------------------------------------------------------// - -#include 'hbgtinfo.ch' -#include 'inkey.ch' - -//----------------------------------------------------------------------// - -FUNCTION Main() - Local nKey, lMark, lResize - Local nHeight := 20 - Local nWidth := Int( nHeight/2 ) - Local cFont - - //cFont := 'Courier New' - //cFont := 'Times New Roman' - cFont := 'Lucida Console' - - Hb_GtInfo( HB_GTI_FONTNAME , cFont ) - Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth ) - Hb_GtInfo( HB_GTI_FONTSIZE , nHeight ) - - SetMode( 25,80 ) - SetCursor( 0 ) - SetColor( 'n/w' ) - - HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| MyNotifier( nEvent, ... ) } ) - - DispScreen() - - DO WHILE .T. - nKey := Inkey() - if nKey == K_ESC - exit - endif - - DO CASE - CASE nKey == K_ENTER - Alert( ' Pressed' ) - - CASE nKey == K_F2 - lMark := Hb_GtInfo( HB_GTI_SELECTCOPY ) - Hb_GtInfo( HB_GTI_SELECTCOPY, !lMark ) - - CASE nKey == K_F3 - lResize := Hb_GtInfo( HB_GTI_RESIZABLE ) - Hb_GtInfo( HB_GTI_RESIZABLE, !lResize ) - - ENDCASE - ENDDO - - RETURN NIL -//----------------------------------------------------------------------// - -STATIC FUNCTION MyNotifier( nEvent, ... ) - - DO CASE - - CASE nEvent == HB_GTE_SETFOCUS - DispScreen() - Alert( "We got focus" ) - - CASE nEvent == HB_GTE_CLOSE - DispScreen() - if Alert( 'Close Application', {'Yes','No' } ) == 1 - QUIT - endif - - ENDCASE - - RETURN 0 - -//----------------------------------------------------------------------// - -STATIC FUNCTION DispScreen() - - CLS - DispOutAt( 0,0,padc( 'Harbour GT - New Features', maxcol()+1 ), 'N/GR*' ) - DispOutAt( maxrow(),0,padc( ' ', maxcol()+1 ), 'N/G*' ) - - RETURN NIL - -//----------------------------------------------------------------------// - -FUNCTION HB_GTSYS() - - REQUEST HB_GT_WVT_DEFAULT - - RETURN nil - -//----------------------------------------------------------------------// +/* + * $Id$ + */ + +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +// +// [x]Harbour Extended Features Deno +// . +// Pritpal Bedi +// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// +//----------------------------------------------------------------------// + +#include 'hbgtinfo.ch' +#include 'inkey.ch' + +//----------------------------------------------------------------------// + +FUNCTION Main() + Local nKey, lMark, lResize + Local nHeight := 20 + Local nWidth := Int( nHeight/2 ) + Local cFont + + //cFont := 'Courier New' // Harbour default + //cFont := 'Times New Roman' + //cFont := 'Lucida Console' + + Hb_GtInfo( HB_GTI_FONTNAME , cFont ) + Hb_GtInfo( HB_GTI_FONTWIDTH, nWidth ) + Hb_GtInfo( HB_GTI_FONTSIZE , nHeight ) + + SetCursor( 0 ) + SetColor( 'n/w' ) + + HB_GtInfo( HB_GTI_NOTIFIERBLOCK, {|nEvent, ...| MyNotifier( nEvent, ... ) } ) + + DispScreen() + + DO WHILE .T. + nKey := Inkey() + if nKey == K_ESC + exit + endif + + DO CASE + CASE nKey == K_ENTER + Alert( ' Pressed' ) + + CASE nKey == K_F2 + lMark := Hb_GtInfo( HB_GTI_SELECTCOPY ) + Hb_GtInfo( HB_GTI_SELECTCOPY, !lMark ) + + CASE nKey == K_F3 + lResize := Hb_GtInfo( HB_GTI_RESIZABLE ) + Hb_GtInfo( HB_GTI_RESIZABLE, !lResize ) + + ENDCASE + ENDDO + + RETURN NIL +//----------------------------------------------------------------------// + +STATIC FUNCTION MyNotifier( nEvent, ... ) + + DO CASE + + CASE nEvent == HB_GTE_SETFOCUS + DispScreen() + Alert( "We got focus" ) + + CASE nEvent == HB_GTE_CLOSE + DispScreen() + if Alert( 'Close Application', {'Yes','No' } ) == 1 + QUIT + endif + + ENDCASE + + RETURN 0 + +//----------------------------------------------------------------------// + +STATIC FUNCTION DispScreen() + + CLS + DispOutAt( 0, 0,padc( 'Harbour GT - New Features', maxcol()+1 ), 'N/GR*' ) + DispOutAt( maxrow() - 1, 0, padc( ' ', maxcol()+1 ), 'N/G*' ) + DispOutAt( maxrow(), 0, Space( maxcol()+1 ), 'N/G*' ) + DispOutAt( 0, 0, "TL" ) + DispOutAt( 0, MaxCol() - 1, "TR" ) + DispOutAt( MaxRow(), 0, "BL" ) + DispOutAt( MaxRow(), MaxCol() - 1, "BR" ) + + RETURN NIL + +//----------------------------------------------------------------------// + +PROCEDURE HB_GTSYS() + REQUEST HB_GT_WVT + REQUEST HB_GT_WIN + RETURN + +PROCEDURE HB_GT_WVT_DEFAULT() + RETURN + +//----------------------------------------------------------------------//