Files
harbour-core/harbour/tests/wvtext.prg
Viktor Szakats e708033e0e 2008-06-13 19:19 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/rtl/gtwvt/gtwvt.h
   * source/rtl/gtwvt/gtwvt.c
   * tests/wvtext.prg
     + Added hb_gtInfo( HB_GTI_SELECTCOPY, <cMenuText> )
       to set the menu text ("Mark and Copy" on startup).
       cMenuText mustn't be zero length. Setting the menu text 
       also enables select&copy automatically. The call 
       will return the previously set menu text. To get 
       the menu text without setting a new one, use: 
       hb_gtInfo( HB_GTI_SELECTCOPY, "" )
       This is good if someone wants to adapt the menu 
       text to the OS's or app's language.

   * doc/en/hb_apiit.txt
   * include/hbapi.h
   * include/hbapiitm.h
   * source/rtl/gtwin/gtwin.c
   * source/rtl/hbgtcore.c
   * source/rtl/gtgui/gtgui.c
   * source/rtl/gtwvt/gtwvt.c
   * source/vm/macro.c
   * source/vm/debug.c
   * source/vm/itemapi.c
   * source/vm/hvm.c
   * source/vm/arrays.c
   * source/vm/extend.c
   * source/rdd/dbfntx/dbfntx1.c
   * source/rdd/sdf1.c
   * source/rdd/dbfcdx/dbfcdx1.c
   * source/rdd/delim1.c
   * source/rdd/dbf1.c
   * source/rdd/dbffpt/dbffpt1.c
   * contrib/hbw32/w32_ole.c
   * contrib/gtwvg/gtwvg.c
   * contrib/rddads/ads1.c
   * contrib/hbmisc/spd.c
   * contrib/hbbmcdx/bmdbfcdx1.c
   * contrib/examples/rdddbt/dbfdbt1.c
     * I did a mistake in 1999 by giving the name hb_itemPutCPtr() 
       to the function which would have to be correctly named 
       hb_itemPutCLPtr() (notice the 'L' for 'length').
       So, now this was renamed to hb_itemPutCLPtr(), and stub was 
       added with the old name, and Harbour code was changed to use 
       the new one. I've also added hb_itemPutCPtr2() as a version 
       not requiring len parameter, the proper name would be hb_itemPutCPtr() 
       for this, but we cannot use without breakin compatiblity.

       IMPORTANT: I'd strongly suggest all 3rd parties to update 
       their code to use the call hb_itemPutCLPtr() instead of 
       hb_itemPutCLPtr().

       The final goal would be to have hb_itemPutCPtr() with two 
       parameters instead of the hakish looking hb_itemPutCPtr2().

       I'd welcome any opinions how to reach this goal. I didn't want to 
       break compatiblity with 3rd parties this time, but IMO we may do 
       it in 1.1, or even before 1.0.

     ! The above also fixes the (potential) problem when hb_retc_buffer()'s 
       szText parameter was evaluated twice if HB_API_MACROS was #defined.
2008-06-13 17:26:48 +00:00

185 lines
5.3 KiB
Plaintext

/*
* $Id$
*/
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//
// [x]Harbour Extended Features Deno
// .
// Pritpal Bedi <pritpal@vouchcac.com>
//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
//----------------------------------------------------------------------//
#include 'hbgtinfo.ch'
#include 'inkey.ch'
#define RGB(r,g,b) ( r + ( g * 256 ) + ( b * 256 * 256 ) )
//----------------------------------------------------------------------//
FUNCTION Main()
Local nKey, lMark, lResize, lClose
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( '<Enter> 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 )
CASE nKey == K_F4
lClose := Hb_GtInfo( HB_GTI_CLOSABLE )
hb_GtInfo( HB_GTI_CLOSABLE, !lClose )
CASE nKey == K_F5
SetPalette( 1 )
CASE nKey == K_F6
SetPalette( 0 )
CASE nKey == K_F7
SetPaletteIndex()
CASE nKey == K_F8
Alert( "Menu text changed. Was: " + hb_GtInfo( HB_GTI_SELECTCOPY, DToS(Date()) + " " + Time() ) )
ENDCASE
ENDDO
RETURN NIL
//----------------------------------------------------------------------//
STATIC FUNCTION MyNotifier( nEvent, ... )
DO CASE
CASE nEvent == HB_GTE_SETFOCUS
DispScreen()
DispOutAt( maxrow(), 33, "We got focus", 'B/G*' )
CASE nEvent == HB_GTE_CLOSE
DispScreen()
if Alert( 'Close Application', {'Yes','No' } ) == 2
Return ( 1 )
endif
ENDCASE
RETURN 0
//----------------------------------------------------------------------//
STATIC FUNCTION DispScreen()
Local nRow := 15, nCol := 28
Local cColor := 'N/W'
Local nMaxCol := MaxCol()+1
DispBegin()
CLS
DispOutAt( 0, 0,padc( 'Harbour GT - New Features', maxcol()+1 ), 'N/GR*' )
// Contributed by Massimo Belgrano
DispOutAt( 2, 0, padc( "______ __ ______________________ ",nMaxCol ), 'W+/W' )
DispOutAt( 3, 0, padc( "___ / / /_____ ___________ /___________ _________ __ ____/____/",nMaxCol ), 'W+/W' )
DispOutAt( 4, 0, padc( "__ /_/ /_ __ `/_ ___/_ __ \ __ \ / / /_ ___/ _ / __ __/ ",nMaxCol ), 'W+/W' )
DispOutAt( 5, 0, padc( "_ __ / / /_/ /_ / _ /_/ / /_/ / /_/ /_ / / /_/ / _ / ",nMaxCol ), 'W+/W' )
DispOutAt( 6, 0, padc( "/_/ /_/ \__,_/ /_/ /_.___/\____/\__,_/ /_/ \____/ /_/ ",nMaxCol ), 'W+/W' )
DispOutAt( ++nRow, nCol, '< F2 MarkCopy Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F3 Resize Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F4 Closable Toggle >', cColor )
DispOutAt( ++nRow, nCol, '< F5 Palette L Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F6 Palette D Repeat >', cColor )
DispOutAt( ++nRow, nCol, '< F7 Palette By Index R >', cColor )
DispOutAt( ++nRow, nCol, '< F8 MarkCopy menu text >', cColor )
DispOutAt( ++nRow, nCol, '< Click Other Window >', cColor )
DispOutAt( ++nRow, nCol, '< Click X Button >', cColor )
DispOutAt( maxrow(), 0, Space( maxcol()+1 ), "N/G*" )
DispOutAt( 0, 0 , "TL", "N/GR*" )
DispOutAt( 0, MaxCol() - 1 , "TR", "N/GR*" )
DispOutAt( MaxRow(), 0 , "BL", "N/G*" )
DispOutAt( MaxRow(), MaxCol() - 1, "BR", "N/G*" )
DispEnd()
RETURN NIL
//----------------------------------------------------------------------//
PROCEDURE HB_GTSYS()
REQUEST HB_GT_WVT
REQUEST HB_GT_WIN
RETURN
//----------------------------------------------------------------------//
PROCEDURE HB_GT_WVT_DEFAULT()
RETURN
//----------------------------------------------------------------------//
FUNCTION SetPalette( nMode )
Local aPalette := Hb_GtInfo( HB_GTI_PALETTE )
static nR := 198
static nG := 198
static nB := 198
nR += if( nMode == 0, -5, 5 )
nG += if( nMode == 0, -5, 5 )
nB += if( nMode == 0, -5, 5 )
// Change 'W' to slightly gray everytime you press F5
//
aPalette[ 8 ] := RGB( nR, nG, nB )
Hb_GtInfo( HB_GTI_PALETTE, aPalette )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//
FUNCTION SetPaletteIndex()
Hb_GtInfo( HB_GTI_PALETTE, 8, RGB( 120, 200, 240 ) )
DispScreen()
RETURN NIL
//----------------------------------------------------------------------//