gtwvg

  Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic! Mail us feedback on this topic!  
c:\harbour\contrib\gtwvg
gtwvg.c
TypeFunctionSourceLine
STATIC PHB_GTWVThb_gt_wvt_Find( HWND hWnd )
static PHB_GTWVT hb_gt_wvt_Find( HWND hWnd )
{
   int iCount = s_wvtCount, iPos = 0;

   while( iCount && iPos < WVT_MAX_WINDOWS )
   {
      if( s_wvtWindows[iPos] )
      {
         if( s_wvtWindows[iPos]->hWnd == hWnd )
            return s_wvtWindows[iPos];
         --iCount;
      }
      ++iPos;
   }
   return NULL;
}
gtwvg.c133
STATIC BOOLhb_gt_wvt_Alloc( PHB_GTWVT pWVT )
static BOOL hb_gt_wvt_Alloc( PHB_GTWVT pWVT )
{
   if( s_wvtCount < WVT_MAX_WINDOWS )
   {
      int iPos = 0;
      do
      {
         if( s_wvtWindows[iPos] == NULL )
         {
            ++s_wvtCount;
            s_wvtWindows[iPos] = pWVT;
            pWVT->iHandle = iPos;
            return TRUE;
         }
         ++iPos;
      }
      while( iPos < WVT_MAX_WINDOWS );
   }
   return FALSE;
}
gtwvg.c150
STATIC VOIDhb_gt_wvt_Free( PHB_GTWVT pWVT )
static void hb_gt_wvt_Free( PHB_GTWVT pWVT )
{
   int iIndex;

   --s_wvtCount;
   s_wvtWindows[pWVT->iHandle] = NULL;

   if( pWVT->pszSelectCopy )
      hb_xfree( pWVT->pszSelectCopy );

   // Detach PRG callback
   pWVT->pSymWVT_PAINT      = NULL;
   pWVT->pSymWVT_SETFOCUS   = NULL;
   pWVT->pSymWVT_KILLFOCUS  = NULL;
   pWVT->pSymWVT_MOUSE      = NULL;
   pWVT->pSymWVT_TIMER      = NULL;
   pWVT->pSymWVT_KEY        = NULL;
   for ( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
   {
      if ( pWVT->pFunc[ iIndex ] != NULL && pWVT->iType[ iIndex ] == 2 )
      {
         hb_itemRelease( ( PHB_ITEM ) pWVT->pFunc[ iIndex ] );
         pWVT->pFunc[ iIndex ] = NULL;
      }
      if ( pWVT->pcbFunc[ iIndex ] != NULL )
      {
         hb_itemRelease( ( PHB_ITEM ) pWVT->pcbFunc[ iIndex ] );
         pWVT->pcbFunc[ iIndex ] = NULL;
      }
   }

   if( pWVT->hWnd )
   {
      DestroyWindow( pWVT->hWnd );
      pWVT->hWnd = NULL;
   }

   hb_xfree( pWVT );
}
gtwvg.c171
STATIC VOIDhb_gt_wvt_FreeAll( void )
static void hb_gt_wvt_FreeAll( void )
{
   if( s_wvtCount > 0 )
   {
      int iPos;

      for ( iPos = 1; iPos < WVT_MAX_WINDOWS; iPos++ )
      {
         if( s_wvtWindows[ iPos ] != NULL )
         {
            hb_gt_wvt_Free( s_wvtWindows[ iPos ] );
            HB_GTSUPER_EXIT( s_wvtWindows[ iPos ]->pGT );
         }
      }
   }
}
gtwvg.c211
STATIC PHB_GTWVThb_gt_wvt_New( PHB_GT pGT )
static PHB_GTWVT hb_gt_wvt_New( PHB_GT pGT )
{
   PHB_GTWVT pWVT;
   OSVERSIONINFO osvi;

   osvi.dwOSVersionInfoSize = sizeof( OSVERSIONINFO );
   GetVersionEx( &osvi );

   pWVT = ( PHB_GTWVT ) hb_xgrab( sizeof( HB_GTWVT ) );
   memset( pWVT, 0, sizeof( HB_GTWVT ) );
   pWVT->pGT               = pGT;

   if( !hb_gt_wvt_Alloc( pWVT ) )
   {
      hb_xfree( pWVT );
      return NULL;
   }

   pWVT->ROWS              = WVT_DEFAULT_ROWS;
   pWVT->COLS              = WVT_DEFAULT_COLS;

   pWVT->COLORS[ 0]        = BLACK;
   pWVT->COLORS[ 1]        = BLUE;
   pWVT->COLORS[ 2]        = GREEN;
   pWVT->COLORS[ 3]        = CYAN;
   pWVT->COLORS[ 4]        = RED;
   pWVT->COLORS[ 5]        = MAGENTA;
   pWVT->COLORS[ 6]        = BROWN;
   pWVT->COLORS[ 7]        = WHITE;
   pWVT->COLORS[ 8]        = LIGHT_GRAY;
   pWVT->COLORS[ 9]        = BRIGHT_BLUE;
   pWVT->COLORS[10]        = BRIGHT_GREEN;
   pWVT->COLORS[11]        = BRIGHT_CYAN;
   pWVT->COLORS[12]        = BRIGHT_RED;
   pWVT->COLORS[13]        = BRIGHT_MAGENTA;
   pWVT->COLORS[14]        = YELLOW;
   pWVT->COLORS[15]        = BRIGHT_WHITE;

   /* THEESE are the default font parameters, if not changed by user */
   pWVT->PTEXTSIZE.x       = WVT_DEFAULT_FONT_WIDTH;
   pWVT->PTEXTSIZE.y       = WVT_DEFAULT_FONT_HEIGHT;
   pWVT->fontWidth         = WVT_DEFAULT_FONT_WIDTH;
   pWVT->fontHeight        = WVT_DEFAULT_FONT_HEIGHT;
   pWVT->fontWeight        = FW_NORMAL;
   pWVT->fontQuality       = DEFAULT_QUALITY;
   hb_strncpy( pWVT->fontFace, WVT_DEFAULT_FONT_NAME, sizeof( pWVT->fontFace ) - 1 );

   pWVT->CaretExist        = FALSE;
   pWVT->CaretHidden       = FALSE;
   pWVT->CaretSize         = HB_MAX( ( pWVT->PTEXTSIZE.y >> 2 ) - 1, 1 );
   pWVT->MousePos.x        = 0;
   pWVT->MousePos.y        = 0;
   pWVT->MouseMove         = TRUE;
   pWVT->hWnd              = NULL;
   pWVT->keyPointerIn      = 0;
   pWVT->keyPointerOut     = 0;
   pWVT->keyLast           = 0;

   pWVT->CentreWindow      = TRUE;            /* Default is to always display window in centre of screen */
   pWVT->CodePage          = OEM_CHARSET;     /* GetACP(); - set code page to default system */

   pWVT->Win9X             = ( osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS );
   pWVT->AltF4Close        = FALSE;

   pWVT->IgnoreWM_SYSCHAR  = FALSE;

   pWVT->bMaximized        = FALSE;
   pWVT->bBeingMarked      = FALSE;
   pWVT->bBeginMarked      = FALSE;

   pWVT->pszSelectCopy     = hb_strdup( "Mark and Copy" );
   pWVT->bSelectCopy       = TRUE;
   pWVT->bResizable        = TRUE;
   pWVT->bClosable         = TRUE;

   /* GUI Related members initialized */
   hb_wvt_gtCreateObjects( pWVT );

   return pWVT;
}
gtwvg.c228
STATIC INThb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent )
static int hb_gt_wvt_FireEvent( PHB_GTWVT pWVT, int nEvent )
{
   int nResult = 0; /* Unhandled */

   if( pWVT->pGT->pNotifierBlock )
   {
      if( hb_vmRequestReenter() )
      {
         PHB_ITEM pEvent = hb_itemPutNI( NULL, nEvent );

         nResult = hb_itemGetNI( hb_vmEvalBlockV( ( PHB_ITEM ) pWVT->pGT->pNotifierBlock, 1, pEvent ) );

         hb_itemRelease( pEvent );

         hb_vmRequestRestore();
      }
   }

   return nResult;
}
gtwvg.c309
STATIC BOOLhb_gt_wvt_SetWindowSize( PHB_GTWVT pWVT, int iRow, int iCol )
static BOOL hb_gt_wvt_SetWindowSize( PHB_GTWVT pWVT, int iRow, int iCol )
{
   if( HB_GTSUPER_RESIZE( pWVT->pGT, iRow, iCol ) )
   {
      pWVT->ROWS = ( USHORT ) iRow;
      pWVT->COLS = ( USHORT ) iCol;
      return TRUE;
   }

   return FALSE;
}
gtwvg.c330
STATIC HFONThb_gt_wvt_GetFont( char * pszFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage )
static HFONT hb_gt_wvt_GetFont( char * pszFace, int iHeight, int iWidth, int iWeight, int iQuality, int iCodePage )
{
   HFONT hFont;

   if( iHeight > 0 )
   {
      LOGFONT logfont;

      logfont.lfEscapement     = 0;
      logfont.lfOrientation    = 0;
      logfont.lfWeight         = iWeight;
      logfont.lfItalic         = 0;
      logfont.lfUnderline      = 0;
      logfont.lfStrikeOut      = 0;
      logfont.lfCharSet        = ( BYTE ) iCodePage;    /* OEM_CHARSET; */
      logfont.lfOutPrecision   = 0;
      logfont.lfClipPrecision  = 0;
      logfont.lfQuality        = ( BYTE ) iQuality;     /* DEFAULT_QUALITY, DRAFT_QUALITY or PROOF_QUALITY */
      logfont.lfPitchAndFamily = FIXED_PITCH+FF_MODERN; /* all mapping depends on fixed width fonts! */
      logfont.lfHeight         = iHeight;
      logfont.lfWidth          = iWidth < 0 ? -iWidth : iWidth;

      HB_TCHAR_CPTO( logfont.lfFaceName, pszFace, sizeof( logfont.lfFaceName ) - 1 );

      hFont = CreateFontIndirect( &logfont );
   }
   else
   {
      /* hFont = ( HFONT ) GetStockObject( SYSTEM_FIXED_FONT ); */
      hFont = ( HFONT ) GetStockObject( OEM_FIXED_FONT );
   }
   return hFont;
}
gtwvg.c342
STATIC POINThb_gt_wvt_GetXYFromColRow( PHB_GTWVT pWVT, USHORT col, USHORT row )
static POINT hb_gt_wvt_GetXYFromColRow( PHB_GTWVT pWVT, USHORT col, USHORT row )
{
   POINT xy;

   xy.x = col * pWVT->PTEXTSIZE.x;
   xy.y = row * pWVT->PTEXTSIZE.y;

   return xy;
}
gtwvg.c379
STATIC RECThb_gt_wvt_GetXYFromColRowRect( PHB_GTWVT pWVT, RECT colrow )
static RECT hb_gt_wvt_GetXYFromColRowRect( PHB_GTWVT pWVT, RECT colrow )
{
   RECT xy;

   xy.left   = colrow.left * pWVT->PTEXTSIZE.x;
   xy.top    = colrow.top  * pWVT->PTEXTSIZE.y;
   xy.right  = ( colrow.right  + 1 ) * pWVT->PTEXTSIZE.x;
   xy.bottom = ( colrow.bottom + 1 ) * pWVT->PTEXTSIZE.y;

   return xy;
}
gtwvg.c389
STATIC VOIDhb_gt_wvt_UpdateCaret( PHB_GTWVT pWVT )
static void hb_gt_wvt_UpdateCaret( PHB_GTWVT pWVT )
{
   int iRow, iCol, iStyle, iCaretSize;

   HB_GTSELF_GETSCRCURSOR( pWVT->pGT, &iRow, &iCol, &iStyle );

   if( iRow < 0 || iCol < 0 || iRow >= pWVT->ROWS || iCol >= pWVT->COLS )
   {
      iCaretSize = 0;
   }
   else switch( iStyle )
   {
      case SC_INSERT:
         iCaretSize = pWVT->PTEXTSIZE.y >> 1;
         break;
      case SC_SPECIAL1:
         iCaretSize = pWVT->PTEXTSIZE.y;
         break;
      case SC_SPECIAL2:
         iCaretSize = - ( pWVT->PTEXTSIZE.y >> 1 );
         break;
      case SC_NORMAL:
         iCaretSize = HB_MAX( ( pWVT->PTEXTSIZE.y >> 2 ) - 1, 1 );
         break;
      default:
         iCaretSize = 0;
         break;
   }

   if( iCaretSize == 0 )
   {
      if( pWVT->CaretExist && !pWVT->CaretHidden )
      {
         HideCaret( pWVT->hWnd );
         pWVT->CaretHidden = TRUE;
      }
   }
   else
   {
      if( iCaretSize != pWVT->CaretSize || !pWVT->CaretExist )
      {
         pWVT->CaretSize = iCaretSize;
         pWVT->CaretExist = CreateCaret( pWVT->hWnd, ( HBITMAP ) NULL, pWVT->PTEXTSIZE.x,
                                      pWVT->CaretSize < 0 ? - pWVT->CaretSize : pWVT->CaretSize );
      }
      if( pWVT->CaretExist )
      {
         POINT xy;
         xy = hb_gt_wvt_GetXYFromColRow( pWVT, ( SHORT ) iCol, ( SHORT ) iRow );
         SetCaretPos( xy.x, pWVT->CaretSize < 0 ?
                      xy.y : xy.y + pWVT->PTEXTSIZE.y - pWVT->CaretSize );
         ShowCaret( pWVT->hWnd );
         pWVT->CaretHidden = FALSE;
      }
   }
}
gtwvg.c401
STATIC VOIDhb_gt_wvt_KillCaret( PHB_GTWVT pWVT )
static void hb_gt_wvt_KillCaret( PHB_GTWVT pWVT )
{
   if( pWVT->CaretExist )
   {
      DestroyCaret();
      pWVT->CaretExist = FALSE;
   }
}
gtwvg.c458
STATIC VOIDhb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
static void hb_gt_wvt_ResetWindowSize( PHB_GTWVT pWVT )
{
   HDC        hdc;
   HFONT      hFont, hOldFont;
   USHORT     height, width;
   RECT       wi, ci;
   TEXTMETRIC tm;
   RECT       rcWorkArea;
   int        n;

   /*
    * set the font and get it's size to determine the size of the client area
    * for the required number of rows and columns
    */
   hdc      = GetDC( pWVT->hWnd );
   hFont    = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth,
                                 pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );

   if( pWVT->hFont )
      DeleteObject( pWVT->hFont );
   pWVT->hFont = hFont;
   hOldFont = ( HFONT ) SelectObject( hdc, hFont );
   GetTextMetrics( hdc, &tm );
   SetTextCharacterExtra( hdc, 0 ); /* do not add extra char spacing even if bold */
   SelectObject( hdc, hOldFont );
   ReleaseDC( pWVT->hWnd, hdc );

  /*
   * we will need to use the font size to handle the transformations from
   * row column space in the future, so we keep it around in a static!
   */

   pWVT->PTEXTSIZE.x = pWVT->fontWidth < 0 ? -pWVT->fontWidth :
                    tm.tmAveCharWidth; /* For fixed FONT should == tm.tmMaxCharWidth */
   pWVT->PTEXTSIZE.y = tm.tmHeight;       /* but seems to be a problem on Win9X so */
                                       /* assume proportional fonts always for Win9X */
#if defined(HB_WINCE)
   pWVT->FixedFont = FALSE;
#else
   pWVT->FixedFont = !pWVT->Win9X && pWVT->fontWidth >= 0 &&
                  ( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) == 0 &&
                  ( pWVT->PTEXTSIZE.x == tm.tmMaxCharWidth );
#endif

   for( n = 0; n < pWVT->COLS; n++ )   /* pWVT->FixedSize[] is used by ExtTextOut() to emulate */
   {                                /* fixed font when a proportional font is used */
      pWVT->FixedSize[ n ] = pWVT->PTEXTSIZE.x;
   }

   /* resize the window to get the specified number of rows and columns */
   GetWindowRect( pWVT->hWnd, &wi );
   GetClientRect( pWVT->hWnd, &ci );

   height = ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS );
   width  = ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS );

   width  += ( USHORT ) ( wi.right - wi.left - ci.right );
   height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );

   /*
    * Centre the window within the CLIENT area on the screen
    * but only if pWVT->CentreWindow == TRUE
    */
   if( pWVT->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA,0, &rcWorkArea, 0 ) )
   {
      wi.left = rcWorkArea.left + ( ( rcWorkArea.right - rcWorkArea.left - width  ) / 2 );
      wi.top  = rcWorkArea.top  + ( ( rcWorkArea.bottom - rcWorkArea.top - height ) / 2 );
   }
   SetWindowPos( pWVT->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );

   if( pWVT->bGui )
   {
      hb_wvt_gtInitGui( pWVT );
   }
}
gtwvg.c467
STATIC VOIDhb_gt_wvt_FitSize( PHB_GTWVT pWVT )
static void hb_gt_wvt_FitSize( PHB_GTWVT pWVT )
{
   RECT wi;
   RECT ci;
   int maxWidth;
   int maxHeight;
   int borderWidth;
   int borderHeight;
   int left;
   int top;

   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 ) );

   if( pWVT->bMaximized )
   {
      SystemParametersInfo( SPI_GETWORKAREA, 0, &wi, 0 );

      maxHeight = wi.bottom - wi.top - borderHeight;
      maxWidth  = wi.right - wi.left - borderWidth;

      left = 0;
      top  = 0;
   }
   else
   {
      maxHeight = ci.bottom - ci.top;
      maxWidth  = ci.right  - ci.left;

      left = wi.left;
      top  = wi.top;
   }

   {
      HFONT      hOldFont;
      HFONT      hFont;
      int        fontHeight;
      int        fontWidth;
      int        n;

      fontHeight = maxHeight / pWVT->ROWS;
      fontWidth  = maxWidth  / pWVT->COLS;

      hFont = hb_gt_wvt_GetFont( pWVT->fontFace, fontHeight, fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
      if( hFont )
      {
         HDC        hdc;
         LONG       width;
         LONG       height;
         TEXTMETRIC tm;

         hdc       = GetDC( pWVT->hWnd );
         hOldFont  = ( HFONT ) SelectObject( hdc, hFont );
         SetTextCharacterExtra( hdc, 0 );
         GetTextMetrics( hdc, &tm );
         SelectObject( hdc, hOldFont );
         ReleaseDC( pWVT->hWnd, hdc );

         width     = tm.tmAveCharWidth * pWVT->COLS;
         height    = tm.tmHeight       * pWVT->ROWS;

         if( width <= maxWidth &&
             height <= maxHeight &&
             tm.tmAveCharWidth >= 3 &&
             tm.tmHeight >= 4 )
         {
            if( pWVT->hFont )
               DeleteObject( pWVT->hFont );

            pWVT->hFont       = hFont;
            pWVT->fontHeight  = tm.tmHeight;
            pWVT->fontWidth   = tm.tmAveCharWidth;

            pWVT->PTEXTSIZE.x = tm.tmAveCharWidth;
            pWVT->PTEXTSIZE.y = tm.tmHeight;

#if defined(HB_WINCE)
            pWVT->FixedFont = FALSE;
#else
            pWVT->FixedFont = !pWVT->Win9X && pWVT->fontWidth >= 0 &&
                        ( tm.tmPitchAndFamily & TMPF_FIXED_PITCH ) == 0 &&
                        ( pWVT->PTEXTSIZE.x == tm.tmMaxCharWidth );
#endif
            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;

            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 );
            hb_gt_wvt_UpdateCaret( pWVT );

            SetWindowPos( pWVT->hWnd, NULL, left, top, width, height, SWP_NOZORDER );
            HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
         }
         else
         {
            width  = ( ( USHORT ) ( pWVT->PTEXTSIZE.x * pWVT->COLS ) ) + borderWidth;
            height = ( ( USHORT ) ( pWVT->PTEXTSIZE.y * pWVT->ROWS ) ) + borderHeight;

            SetWindowPos( pWVT->hWnd, NULL, 0, 0, width, height, SWP_NOZORDER | SWP_NOMOVE );
            HB_GTSELF_EXPOSEAREA( pWVT->pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
         }
      }
   }
}
gtwvg.c543
STATIC VOIDhb_gt_wvt_SetWindowTitle( HWND hWnd, const char * title )
static void hb_gt_wvt_SetWindowTitle( HWND hWnd, const char * title )
{
   LPTSTR text = HB_TCHAR_CONVTO( title );
   SetWindowText( hWnd, text );
   HB_TCHAR_FREE( text );
}
gtwvg.c662
STATIC BOOLhb_gt_wvt_GetWindowTitle( HWND hWnd, char ** title )
static BOOL hb_gt_wvt_GetWindowTitle( HWND hWnd, char ** title )
{
   TCHAR buffer[WVT_MAX_TITLE_SIZE];
   int iResult;

   iResult = GetWindowText( hWnd, buffer, WVT_MAX_TITLE_SIZE );
   if( iResult > 0 )
   {
      *title = ( char * ) hb_xgrab( iResult + 1 );
      HB_TCHAR_GETFROM( *title, buffer, iResult );
      ( *title )[ iResult ] = '\0';
      return TRUE;
   }

   *title = NULL;
   return FALSE;
}
gtwvg.c669
STATIC BOOLhb_gt_wvt_InitWindow( PHB_GTWVT pWVT, int iRow, int iCol )
static BOOL hb_gt_wvt_InitWindow( PHB_GTWVT pWVT, int iRow, int iCol )
{
   BOOL fRet = hb_gt_wvt_SetWindowSize( pWVT, iRow, iCol );

   hb_gt_wvt_ResetWindowSize( pWVT );

   return fRet;
}
gtwvg.c687
STATIC POINThb_gt_wvt_GetColRowFromXY( PHB_GTWVT pWVT, USHORT x, USHORT y )
static POINT hb_gt_wvt_GetColRowFromXY( PHB_GTWVT pWVT, USHORT x, USHORT y )
{
   POINT colrow;

   colrow.x = x / pWVT->PTEXTSIZE.x;
   colrow.y = y / pWVT->PTEXTSIZE.y;

   return colrow;
}
gtwvg.c696
STATIC RECThb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy )
static RECT hb_gt_wvt_GetColRowFromXYRect( PHB_GTWVT pWVT, RECT xy )
{
   RECT colrow;

   colrow.left   = xy.left   / pWVT->PTEXTSIZE.x;
   colrow.top    = xy.top    / pWVT->PTEXTSIZE.y;
   colrow.right  = xy.right  / pWVT->PTEXTSIZE.x -
                   ( xy.right  % pWVT->PTEXTSIZE.x ? 0 : 1 ); /* Adjust for when rectangle */
   colrow.bottom = xy.bottom / pWVT->PTEXTSIZE.y -
                   ( xy.bottom % pWVT->PTEXTSIZE.y ? 0 : 1 ); /* EXACTLY overlaps characters */

   return colrow;
}
gtwvg.c710
STATIC VOIDhb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey )
static void hb_gt_wvt_AddCharToInputQueue( PHB_GTWVT pWVT, int iKey )
{
   int iPos = pWVT->keyPointerIn;

   if( iKey == K_MOUSEMOVE || iKey == K_NCMOUSEMOVE )
   {
      /* Clipper strips repeated mouse movemnt - let's do the same */
      if( pWVT->keyLast == iKey && pWVT->keyPointerIn != pWVT->keyPointerOut )
         return;
   }

   /*
    * When the buffer is full new event overwrite the last one
    * in the buffer - it's Clipper behavior, [druzus]
    */
   pWVT->Keys[ iPos ] = pWVT->keyLast = iKey;
   if( ++iPos >= WVT_CHAR_QUEUE_SIZE )
      iPos = 0;
   if( iPos != pWVT->keyPointerOut )
      pWVT->keyPointerIn = iPos;

   if( pWVT->pSymWVT_KEY )
   {
      if( hb_vmRequestReenter() )
      {
         hb_vmPushDynSym( pWVT->pSymWVT_KEY );
         hb_vmPushNil();
         hb_vmPushInteger( iKey );
         hb_vmDo( 1 );
         hb_vmRequestRestore();
      }
   }
}
gtwvg.c724
STATIC BOOLhb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey )
static BOOL hb_gt_wvt_GetCharFromInputQueue( PHB_GTWVT pWVT, int * iKey )
{
   if( pWVT->keyPointerOut != pWVT->keyPointerIn )
   {
      *iKey = pWVT->Keys[ pWVT->keyPointerOut ];
      if( ++pWVT->keyPointerOut >= WVT_CHAR_QUEUE_SIZE )
      {
         pWVT->keyPointerOut = 0;
      }
      return TRUE;
   }

   *iKey = 0;
   return FALSE;
}
gtwvg.c761
STATIC VOIDhb_gt_wvt_TranslateKey( PHB_GTWVT pWVT, int key, int shiftkey, int altkey, int controlkey )
static void hb_gt_wvt_TranslateKey( PHB_GTWVT pWVT, int key, int shiftkey, int altkey, int controlkey )
{
   int nVirtKey = GetKeyState( VK_MENU );

   if( nVirtKey & 0x8000 ) /* alt + key */
   {
      hb_gt_wvt_AddCharToInputQueue( pWVT, altkey );
   }
   else
   {
      nVirtKey = GetKeyState( VK_CONTROL );
      if( nVirtKey & 0x8000 ) /* control + key */
      {
         hb_gt_wvt_AddCharToInputQueue( pWVT, controlkey );
      }
      else
      {
         nVirtKey = GetKeyState( VK_SHIFT );
         if( nVirtKey & 0x8000 ) /* shift + key */
            hb_gt_wvt_AddCharToInputQueue( pWVT, shiftkey );
         else /* just key */
            hb_gt_wvt_AddCharToInputQueue( pWVT, key );
      }
   }
}
gtwvg.c777
STATIC INThb_gt_wvt_key_ansi_to_oem( int c )
static int hb_gt_wvt_key_ansi_to_oem( int c )
{
   BYTE pszAnsi[ 2 ];
   BYTE pszOem[ 2 ];

   pszAnsi[ 0 ] = ( BYTE ) c;
   pszAnsi[ 1 ] = 0;
   CharToOemBuffA( ( LPCSTR ) pszAnsi, ( LPSTR ) pszOem, 1 );

   return * pszOem;
}
gtwvg.c803
STATIC VOIDhb_gt_wvt_SetMousePos( PHB_GTWVT pWVT, int iRow, int iCol )
static void hb_gt_wvt_SetMousePos( PHB_GTWVT pWVT, int iRow, int iCol )
{
   pWVT->MousePos.y = ( SHORT ) iRow;
   pWVT->MousePos.x = ( SHORT ) iCol;
}
gtwvg.c815
STATIC VOIDhb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam )
static void hb_gt_wvt_MouseEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam )
{
   static RECT s_rectOld = { 0, 0, 0, 0 };
   static RECT s_rectNew = { 0, 0, 0, 0 };

   POINT xy, colrow;
   SHORT keyCode = 0;
   SHORT keyState;

   HB_SYMBOL_UNUSED( wParam );

   if( ! pWVT->bBeginMarked && ! pWVT->MouseMove && ( message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE ) )
      return;

   xy.x = LOWORD( lParam );
   xy.y = HIWORD( lParam );

   colrow = hb_gt_wvt_GetColRowFromXY( pWVT, ( USHORT ) xy.x, ( USHORT ) xy.y );
   hb_gt_wvt_SetMousePos( pWVT, colrow.y, colrow.x );

   switch( message )
   {
      case WM_LBUTTONDBLCLK:
         keyCode = K_LDBLCLK;
         break;

      case WM_RBUTTONDBLCLK:
         keyCode = K_RDBLCLK;
         break;

      case WM_LBUTTONDOWN:
      {
         if( pWVT->bBeginMarked )
         {
            pWVT->bBeingMarked = TRUE;

            s_rectNew.left     = xy.x;
            s_rectNew.top      = xy.y;
            s_rectNew.right    = xy.x;
            s_rectNew.bottom   = xy.y;

            s_rectOld.left   = 0;
            s_rectOld.top    = 0;
            s_rectOld.right  = 0;
            s_rectOld.bottom = 0;

            return;
         }
         else
         {
            keyCode = K_LBUTTONDOWN;
            break;
         }
      }
      case WM_RBUTTONDOWN:
         keyCode = K_RBUTTONDOWN;
         break;

      case WM_RBUTTONUP:
         keyCode = K_RBUTTONUP;
         break;

      case WM_LBUTTONUP:
      {
         if( pWVT->bBeingMarked )
         {
            pWVT->bBeginMarked = FALSE;
            pWVT->bBeingMarked = FALSE;

            RedrawWindow( pWVT->hWnd, NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW );

            {
               ULONG  ulSize;
               int    irow, icol, j, top, left, bottom, right;
               char * sBuffer;
               RECT   rect = { 0, 0, 0, 0 };
               RECT   colrowRC = { 0, 0, 0, 0 };

               rect.left   = HB_MIN( s_rectNew.left, s_rectNew.right  );
               rect.top    = HB_MIN( s_rectNew.top , s_rectNew.bottom );
               rect.right  = HB_MAX( s_rectNew.left, s_rectNew.right  );
               rect.bottom = HB_MAX( s_rectNew.top , s_rectNew.bottom );

               colrowRC = hb_gt_wvt_GetColRowFromXYRect( pWVT, rect );

               left   = colrowRC.left;
               top    = colrowRC.top;
               right  = colrowRC.right;
               bottom = colrowRC.bottom;

               ulSize = ( ( bottom - top + 1 ) * ( right - left + 1 + 2 ) );
               sBuffer = ( char * ) hb_xgrab( ulSize + 1 );

               for( j = 0, irow = top; irow <= bottom; irow++ )
               {
                  for( icol = left; icol <= right; icol++ )
                  {
                     BYTE bColor, bAttr;
                     USHORT usChar;

                     if( !HB_GTSELF_GETSCRCHAR( pWVT->pGT, irow, icol, &bColor, &bAttr, &usChar ) )
                        break;

                     sBuffer[ j++ ] = ( char ) usChar;
                  }

                  sBuffer[ j++ ] = '\r';
                  sBuffer[ j++ ] = '\n';
               }
               sBuffer[ j ] = '\0';

               if( j > 0 )
               {
                  hb_gt_w32_setClipboard( pWVT->CodePage == OEM_CHARSET ?
                                          CF_OEMTEXT : CF_TEXT,
                                          sBuffer,
                                          j );
               }

               hb_xfree( sBuffer );
            }
            return;
         }
         else
         {
            keyCode = K_LBUTTONUP;
            break;
         }
      }
      case WM_MBUTTONDOWN:
         keyCode = K_MBUTTONDOWN;
         break;

      case WM_MBUTTONUP:
         keyCode = K_MBUTTONUP;
         break;

      case WM_MBUTTONDBLCLK:
         keyCode = K_MDBLCLK;
         break;

      case WM_MOUSEMOVE:
      {
         if( pWVT->bBeingMarked )
         {
            RECT  rect = { 0, 0, 0, 0 };
            RECT  colrowRC = { 0, 0, 0, 0 };

            s_rectNew.right  = xy.x;
            s_rectNew.bottom = xy.y;

            rect.left   = HB_MIN( s_rectNew.left, s_rectNew.right  );
            rect.top    = HB_MIN( s_rectNew.top , s_rectNew.bottom );
            rect.right  = HB_MAX( s_rectNew.left, s_rectNew.right  );
            rect.bottom = HB_MAX( s_rectNew.top , s_rectNew.bottom );

            colrowRC = hb_gt_wvt_GetColRowFromXYRect( pWVT, rect );
            rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, colrowRC );

            if( rect.left   != s_rectOld.left   ||
                rect.top    != s_rectOld.top    ||
                rect.right  != s_rectOld.right  ||
                rect.bottom != s_rectOld.bottom  )
            {
#if !defined(HB_WINCE)  /* WinCE does not support InvertRgn */
               /* Concept forwarded by Andy Wos - thanks. */
               HRGN rgn1 = CreateRectRgn( s_rectOld.left, s_rectOld.top, s_rectOld.right, s_rectOld.bottom );
               HRGN rgn2 = CreateRectRgn( rect.left, rect.top, rect.right, rect.bottom );
               HRGN rgn3 = CreateRectRgn( 0, 0, 0, 0 );

               if( CombineRgn( rgn3, rgn1, rgn2, RGN_XOR ) != 0 )
               {
                  HDC hdc = GetDC( pWVT->hWnd );
                  InvertRgn( hdc, rgn3 );
                  ReleaseDC( pWVT->hWnd, hdc );
               }

               DeleteObject( rgn1 );
               DeleteObject( rgn2 );
               DeleteObject( rgn3 );
#endif
               s_rectOld.left   = rect.left;
               s_rectOld.top    = rect.top;
               s_rectOld.right  = rect.right;
               s_rectOld.bottom = rect.bottom;
            }
            return;
         }
         else
         {
            keyState = ( SHORT ) wParam;
            switch( keyState )
            {
               case MK_LBUTTON:
                  keyCode = K_MMLEFTDOWN;
                  break;
               case MK_RBUTTON:
                  keyCode = K_MMRIGHTDOWN;
                  break;
               case MK_MBUTTON:
                  keyCode = K_MMMIDDLEDOWN;
                  break;
               default:
                  keyCode = K_MOUSEMOVE;
            }
            break;
         }
      }
      case WM_MOUSEWHEEL:
         keyState = HIWORD( wParam );
         keyCode = keyState > 0 ? K_MWFORWARD : K_MWBACKWARD;
         break;

      case WM_NCMOUSEMOVE:
         keyCode = K_NCMOUSEMOVE;
         break;
   }

   if( keyCode != 0 )
      hb_gt_wvt_AddCharToInputQueue( pWVT, keyCode );
}
gtwvg.c821
STATIC BOOLhb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam )
static BOOL hb_gt_wvt_KeyEvent( PHB_GTWVT pWVT, UINT message, WPARAM wParam, LPARAM lParam )
{
   switch( message )
   {
      case WM_KEYDOWN:
      case WM_SYSKEYDOWN:
      {
         BOOL bAlt = GetKeyState( VK_MENU ) & 0x8000;

         pWVT->IgnoreWM_SYSCHAR = FALSE;

         switch( wParam )
         {
            case VK_LEFT:
               hb_gt_wvt_TranslateKey( pWVT, K_LEFT , K_SH_LEFT , K_ALT_LEFT , K_CTRL_LEFT  );
               break;
            case VK_RIGHT:
               hb_gt_wvt_TranslateKey( pWVT, K_RIGHT, K_SH_RIGHT, K_ALT_RIGHT, K_CTRL_RIGHT );
               break;
            case VK_UP:
               hb_gt_wvt_TranslateKey( pWVT, K_UP   , K_SH_UP   , K_ALT_UP   , K_CTRL_UP    );
               break;
            case VK_DOWN:
               hb_gt_wvt_TranslateKey( pWVT, K_DOWN , K_SH_DOWN , K_ALT_DOWN , K_CTRL_DOWN  );
               break;
            case VK_HOME:
               hb_gt_wvt_TranslateKey( pWVT, K_HOME , K_SH_HOME , K_ALT_HOME , K_CTRL_HOME  );
               break;
            case VK_END:
               hb_gt_wvt_TranslateKey( pWVT, K_END  , K_SH_END  , K_ALT_END  , K_CTRL_END   );
               break;
            case VK_DELETE:
               hb_gt_wvt_TranslateKey( pWVT, K_DEL  , K_SH_DEL  , K_ALT_DEL  , K_CTRL_DEL   );
               break;
            case VK_INSERT:
               hb_gt_wvt_TranslateKey( pWVT, K_INS  , K_SH_INS  , K_ALT_INS  , K_CTRL_INS   );
               break;
            case VK_PRIOR:
               hb_gt_wvt_TranslateKey( pWVT, K_PGUP , K_SH_PGUP , K_ALT_PGUP , K_CTRL_PGUP  );
               break;
            case VK_NEXT:
               hb_gt_wvt_TranslateKey( pWVT, K_PGDN , K_SH_PGDN , K_ALT_PGDN , K_CTRL_PGDN  );
               break;

            case VK_F1:
               hb_gt_wvt_TranslateKey( pWVT, K_F1   , K_SH_F1, K_ALT_F1   , K_CTRL_F1    );
               break;
            case VK_F2:
               hb_gt_wvt_TranslateKey( pWVT, K_F2   , K_SH_F2, K_ALT_F2   , K_CTRL_F2    );
               break;
            case VK_F3:
               hb_gt_wvt_TranslateKey( pWVT, K_F3   , K_SH_F3, K_ALT_F3   , K_CTRL_F3    );
               break;
            case VK_F4:
               if( pWVT->AltF4Close && bAlt )
                  return DefWindowProc( pWVT->hWnd, message, wParam, lParam ) != 0;
               hb_gt_wvt_TranslateKey( pWVT, K_F4   , K_SH_F4, K_ALT_F4   , K_CTRL_F4    );
               break;
            case VK_F5:
               hb_gt_wvt_TranslateKey( pWVT, K_F5   , K_SH_F5, K_ALT_F5   , K_CTRL_F5    );
               break;
            case VK_F6:
               hb_gt_wvt_TranslateKey( pWVT, K_F6   , K_SH_F6, K_ALT_F6   , K_CTRL_F6    );
               break;
            case VK_F7:
               hb_gt_wvt_TranslateKey( pWVT, K_F7   , K_SH_F7, K_ALT_F7   , K_CTRL_F7    );
               break;
            case VK_F8:
               hb_gt_wvt_TranslateKey( pWVT, K_F8   , K_SH_F8, K_ALT_F8   , K_CTRL_F8    );
               break;
            case VK_F9:
               hb_gt_wvt_TranslateKey( pWVT, K_F9   , K_SH_F9, K_ALT_F9   , K_CTRL_F9    );
               break;
            case VK_F10:
               hb_gt_wvt_TranslateKey( pWVT, K_F10  , K_SH_F10,K_ALT_F10  , K_CTRL_F10   );
               break;
            case VK_F11:
               hb_gt_wvt_TranslateKey( pWVT, K_F11  , K_SH_F11,K_ALT_F11  , K_CTRL_F11   );
               break;
            case VK_F12:
               hb_gt_wvt_TranslateKey( pWVT, K_F12  , K_SH_F12,K_ALT_F12  , K_CTRL_F12   );
               break;
            default:
            {
               BOOL bCtrl     = GetKeyState( VK_CONTROL ) & 0x8000;
               BOOL bShift    = GetKeyState( VK_SHIFT ) & 0x8000;
               int  iScanCode = HIWORD( lParam ) & 0xFF;

               if( bCtrl && iScanCode == 76 ) /* CTRL_VK_NUMPAD5 */
               {
                  hb_gt_wvt_AddCharToInputQueue( pWVT, KP_CTRL_5 );
               }
               else if( bCtrl && wParam == VK_TAB ) /* K_CTRL_TAB */
               {
                  hb_gt_wvt_AddCharToInputQueue( pWVT, bShift ? K_CTRL_SH_TAB : K_CTRL_TAB );
               }
               else if( iScanCode == 70 ) /* Ctrl_Break key OR Scroll Lock Key */
               {
                  if( bCtrl )  /* Not scroll lock */
                  {
                     hb_gt_wvt_AddCharToInputQueue( pWVT, HB_BREAK_FLAG ); /* Pretend Alt+C pressed */
                     pWVT->IgnoreWM_SYSCHAR = TRUE;
                  }
                  else
                  {
                      DefWindowProc( pWVT->hWnd, message, wParam, lParam );  /* Let windows handle ScrollLock */
                  }
               }
               else if( bCtrl && iScanCode == 53 && bShift )
               {
                  hb_gt_wvt_AddCharToInputQueue( pWVT, K_CTRL_QUESTION );
               }
               else if( ( bAlt || bCtrl ) && (
                        wParam == VK_MULTIPLY || wParam == VK_ADD ||
                        wParam == VK_SUBTRACT || wParam == VK_DIVIDE ) )
               {
                  if( bAlt )
                     pWVT->IgnoreWM_SYSCHAR = TRUE;

                  switch( wParam )
                  {
                     case VK_MULTIPLY:
                        hb_gt_wvt_TranslateKey( pWVT, '*','*', KP_ALT_ASTERISK, KP_CTRL_ASTERISK );
                        break;
                     case VK_ADD:
                        hb_gt_wvt_TranslateKey( pWVT, '+','+', KP_ALT_PLUS, KP_CTRL_PLUS );
                        break;
                     case VK_SUBTRACT:
                        hb_gt_wvt_TranslateKey( pWVT, '-','-', KP_ALT_MINUS, KP_CTRL_MINUS );
                        break;
                     case VK_DIVIDE:
                        hb_gt_wvt_TranslateKey( pWVT, '/','/', KP_ALT_SLASH, KP_CTRL_SLASH );
                        break;
                  }
               }
               else if( pWVT->EnableShortCuts )
               {
                  return DefWindowProc( pWVT->hWnd, message, wParam, lParam ) != 0;
               }
            }
         }
         break;
      }

      case WM_CHAR:
      {
         BOOL bCtrl     = GetKeyState( VK_CONTROL ) & 0x8000;
         int  iScanCode = HIWORD( lParam ) & 0xFF;
         int  c = ( int ) wParam;

         if( !pWVT->IgnoreWM_SYSCHAR )
         {
            if( bCtrl && iScanCode == 28 )  /* K_CTRL_RETURN */
            {
               hb_gt_wvt_AddCharToInputQueue( pWVT, K_CTRL_RETURN );
            }
            else if( bCtrl && ( c >= 1 && c <= 26 ) )  /* K_CTRL_A - Z */
            {
               hb_gt_wvt_AddCharToInputQueue( pWVT, K_Ctrl[c - 1]  );
            }
            else
            {
               switch( c )
               {
                  /* handle special characters */
                  case VK_BACK:
                     hb_gt_wvt_TranslateKey( pWVT, K_BS, K_SH_BS, K_ALT_BS, K_CTRL_BS );
                     break;
                  case VK_TAB:
                     hb_gt_wvt_TranslateKey( pWVT, K_TAB, K_SH_TAB, K_ALT_TAB, K_CTRL_TAB );
                     break;
                  case VK_RETURN:
                     hb_gt_wvt_TranslateKey( pWVT, K_RETURN, K_SH_RETURN, K_ALT_RETURN, K_CTRL_RETURN );
                     break;
                  case VK_ESCAPE:
                     hb_gt_wvt_AddCharToInputQueue( pWVT, K_ESC );
                     break;
                  default:
#if defined(UNICODE)
                     if( pWVT->inCDP )
                        c = hb_cdpGetChar( pWVT->inCDP, FALSE, ( USHORT ) c );
                     else
#endif
                     if( pWVT->CodePage == OEM_CHARSET )
                        c = hb_gt_wvt_key_ansi_to_oem( c );
                     hb_gt_wvt_AddCharToInputQueue( pWVT, c );
                     break;
               }
            }
         }
         pWVT->IgnoreWM_SYSCHAR = FALSE; /* As Suggested by Peter */
         break;
      }

      case WM_SYSCHAR:
      {
         if( !pWVT->IgnoreWM_SYSCHAR )
         {
            int c, iScanCode = HIWORD( lParam ) & 0xFF;
            switch( iScanCode )
            {
               case  2:
                  c = K_ALT_1;
                  break;
               case  3:
                  c = K_ALT_2;
                  break;
               case  4:
                  c = K_ALT_3;
                  break;
               case  5:
                  c = K_ALT_4;
                  break;
               case  6:
                  c = K_ALT_5;
                  break;
               case  7:
                  c = K_ALT_6;
                  break;
               case  8:
                  c = K_ALT_7;
                  break;
               case  9:
                  c = K_ALT_8;
                  break;
               case 10:
                  c = K_ALT_9;
                  break;
               case 11:
                  c = K_ALT_0;
                  break;
               case 13:
                  c = K_ALT_EQUALS;
                  break;
               case 14:
                  c = K_ALT_BS;
                  break;
               case 16:
                  c = K_ALT_Q;
                  break;
               case 17:
                  c = K_ALT_W;
                  break;
               case 18:
                  c = K_ALT_E;
                  break;
               case 19:
                  c = K_ALT_R;
                  break;
               case 20:
                  c = K_ALT_T;
                  break;
               case 21:
                  c = K_ALT_Y;
                  break;
               case 22:
                  c = K_ALT_U;
                  break;
               case 23:
                  c = K_ALT_I;
                  break;
               case 24:
                  c = K_ALT_O;
                  break;
               case 25:
                  c = K_ALT_P;
                  break;
               case 30:
                  c = K_ALT_A;
                  break;
               case 31:
                  c = K_ALT_S;
                  break;
               case 32:
                  c = K_ALT_D;
                  break;
               case 33:
                  c = K_ALT_F;
                  break;
               case 34:
                  c = K_ALT_G;
                  break;
               case 35:
                  c = K_ALT_H;
                  break;
               case 36:
                  c = K_ALT_J;
                  break;
               case 37:
                  c = K_ALT_K;
                  break;
               case 38:
                  c = K_ALT_L;
                  break;
               case 44:
                  c = K_ALT_Z;
                  break;
               case 45:
                  c = K_ALT_X;
                  break;
               case 46:
                  c = K_ALT_C;
                  break;
               case 47:
                  c = K_ALT_V;
                  break;
               case 48:
                  c = K_ALT_B;
                  break;
               case 49:
                  c = K_ALT_N;
                  break;
               case 50:
                  c = K_ALT_M;
                  break;
               default:
                  c = ( int ) wParam;
                  break;
            }
            hb_gt_wvt_AddCharToInputQueue( pWVT, c );
         }
         pWVT->IgnoreWM_SYSCHAR = FALSE;
      }
   }

   return 0;
}
gtwvg.c1043
STATIC BOOLhb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, USHORT col, USHORT row, BYTE attr, LPCTSTR lpString, USHORT cbString )
static BOOL hb_gt_wvt_TextOut( PHB_GTWVT pWVT, HDC hdc, USHORT col, USHORT row, BYTE attr, LPCTSTR lpString, USHORT cbString )
{
   POINT xy;
   RECT  rClip;

   /* set foreground color */
   SetTextColor( hdc, pWVT->COLORS[ attr & 0x0F ] );
   /* set background color */
   SetBkColor( hdc, pWVT->COLORS[ ( attr >> 4 ) & 0x0F ] );

   SetTextAlign( hdc, TA_LEFT );

   xy = hb_gt_wvt_GetXYFromColRow( pWVT, col, row );
   SetRect( &rClip, xy.x, xy.y, xy.x + cbString * pWVT->PTEXTSIZE.x, xy.y + pWVT->PTEXTSIZE.y );

   return ExtTextOut( hdc, xy.x, xy.y, ETO_CLIPPED|ETO_OPAQUE, &rClip,
                      lpString, cbString, pWVT->FixedFont ? NULL : pWVT->FixedSize );
}
gtwvg.c1371
STATIC VOIDhb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
static void hb_gt_wvt_PaintText( PHB_GTWVT pWVT, RECT updateRect )
{
   PAINTSTRUCT ps;
   HDC         hdc;
   RECT        rcRect;
   int         iRow, iCol, startCol, len;
   BYTE        bColor, bAttr, bOldColor = 0;
   USHORT      usChar;
   TCHAR       text[ WVT_MAX_ROWS ];

   if( pWVT->bGui && pWVT->bKillFocus )
   {
      hb_wvt_gtRestGuiState( pWVT, &updateRect );
      ValidateRect( pWVT->hWnd, &updateRect );
      return;
   }
   if( pWVT->bGui && pWVT->bSetFocus )
   {
      pWVT->bSetFocus  = FALSE;
      hb_wvt_gtRestGuiState( pWVT, &updateRect );
      ValidateRect( pWVT->hWnd, &updateRect );
      return;
   }

   hdc = BeginPaint( pWVT->hWnd, &ps );
   SelectObject( hdc, pWVT->hFont );
   if( pWVT->bGui )
   {
      SelectObject( pWVT->hGuiDC, pWVT->hFont );
   }

   rcRect = hb_gt_wvt_GetColRowFromXYRect( pWVT, updateRect );
   /* Required, GUI Paint mechanism is based on it */
   pWVT->rowStart = rcRect.top    ;
   pWVT->rowStop  = rcRect.bottom ;
   pWVT->colStart = rcRect.left   ;
   pWVT->colStop  = rcRect.right  ;

   for( iRow = rcRect.top; iRow <= rcRect.bottom; ++iRow )
   {
      iCol = startCol = rcRect.left;
      len = 0;

      while( iCol <= rcRect.right )
      {
         if( !HB_GTSELF_GETSCRCHAR( pWVT->pGT, iRow, iCol, &bColor, &bAttr, &usChar ) )
            break;

#if defined(UNICODE)
         usChar = hb_cdpGetU16( pWVT->hostCDP, TRUE, ( BYTE ) usChar );
#endif
         if( len == 0 )
         {
            bOldColor = bColor;
         }
         else if( bColor != bOldColor )
         {
            hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
            if( pWVT->bGui )
            {
               hb_gt_wvt_TextOut( pWVT, pWVT->hGuiDC, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
            }
            bOldColor = bColor;
            startCol = iCol;
            len = 0;
         }
         text[ len++ ] = ( TCHAR ) usChar;
         iCol++;
      }
      if( len > 0 )
      {
         hb_gt_wvt_TextOut( pWVT, hdc, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
         if( pWVT->bGui )
         {
            hb_gt_wvt_TextOut( pWVT, pWVT->hGuiDC, ( USHORT ) startCol, ( USHORT ) iRow, bOldColor, text, ( USHORT ) len );
         }
      }
   }

   EndPaint( pWVT->hWnd, &ps );

   if( pWVT->bPaint )
   {
      if( pWVT->pSymWVT_PAINT )
      {
         if( hb_vmRequestReenter() )
         {
            hb_vmPushDynSym( pWVT->pSymWVT_PAINT );
            hb_vmPushNil();
            hb_vmDo( 0 );
            hb_vmRequestRestore();
         }
      }
   }
   else
   {
      pWVT->bPaint = TRUE;
   }
}
gtwvg.c1394
STATIC LRESULT CALLBACKhb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
static LRESULT CALLBACK hb_gt_wvt_WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
   PHB_GTWVT pWVT = hb_gt_wvt_Find( hWnd );

   if( pWVT ) switch( message )
   {
      case HB_MSG_NOTIFYICON:
         if( lParam == WM_RBUTTONUP )
         {
            NOTIFYICONDATA tnid ;
            tnid.cbSize           = sizeof( NOTIFYICONDATA ) ;
            tnid.hWnd             = hWnd;
            tnid.uID              = HB_ID_NOTIFYICON;
            tnid.uCallbackMessage = HB_MSG_NOTIFYICON;
            tnid.hIcon            = NULL;
            Shell_NotifyIcon( NIM_DELETE, &tnid );
            ShowWindow( hWnd, SW_RESTORE );
         }
         return 0;

      case WM_CREATE:
         return hb_gt_wvt_InitWindow( pWVT, WVT_DEFAULT_ROWS, WVT_DEFAULT_COLS );

      case WM_COMMAND:
         hb_wvt_gtHandleMenuSelection( pWVT, ( int ) LOWORD( wParam ) );
         return 0;

      case WM_PAINT:
      {
         RECT updateRect;

         if( GetUpdateRect( hWnd, &updateRect, FALSE ) )
            hb_gt_wvt_PaintText( pWVT, updateRect );

         return 0;
      }

      case WM_MY_UPDATE_CARET:
         hb_gt_wvt_UpdateCaret( pWVT );
         return 0;
 /*
      case WM_ACTIVATE:
         if( LOWORD( wParam ) == WA_INACTIVE )
         {
            hb_gt_wvt_KillCaret();
            if( pWVT->bGui )
            {
               pWVT->bKillFocus = TRUE;
            }
            if( pWVT->pSymWVT_KILLFOCUS )
            {
               if( hb_vmRequestReenter() )
               {
                  hb_vmPushDynSym( pWVT->pSymWVT_KILLFOCUS );
                  hb_vmPushNil();
                  hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hWnd );
                  hb_vmDo( 1 );
                  hb_vmRequestRestore();
               }
            }
            hb_gt_wvt_FireEvent( pWVT, HB_GTE_KILLFOCUS );
         }
         else
         {
            hb_gt_wvt_UpdateCaret( pWVT );
            if( pWVT->bGui )
            {
               pWVT->bSetFocus  = TRUE;
               pWVT->bKillFocus = FALSE;
            }
            if( pWVT->bGetFocus )
            {
               if( pWVT->pSymWVT_SETFOCUS )
               {
                  if( hb_vmRequestReenter() )
                  {
                     hb_vmPushDynSym( pWVT->pSymWVT_SETFOCUS );
                     hb_vmPushNil();
                     hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hWnd );
                     hb_vmDo( 1 );
                     hb_vmRequestRestore();
                  }
               }
            }
            else
            {
               pWVT->bGetFocus = TRUE;
            }

            hb_gt_wvt_FireEvent( pWVT, HB_GTE_SETFOCUS );
         }
         return 0;
*/
      case WM_SETFOCUS:
         hb_gt_wvt_UpdateCaret( pWVT );
         if( pWVT->bGui )
         {
            pWVT->bSetFocus  = TRUE;
            pWVT->bKillFocus = FALSE;
         }
         if( pWVT->bGetFocus )
         {
            if( pWVT->pSymWVT_SETFOCUS )
            {
               if( hb_vmRequestReenter() )
               {
                  hb_vmPushDynSym( pWVT->pSymWVT_SETFOCUS );
                  hb_vmPushNil();
                  hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hWnd );
                  hb_vmDo( 1 );
                  hb_vmRequestRestore();
               }
            }
         }
         else
         {
            pWVT->bGetFocus = TRUE;
         }
         return 0;

      case WM_KILLFOCUS:
         hb_gt_wvt_KillCaret( pWVT );
         if( pWVT->bGui )
         {
            pWVT->bKillFocus = TRUE;
         }
         if( pWVT->pSymWVT_KILLFOCUS )
         {
            if( hb_vmRequestReenter() )
            {
               hb_vmPushDynSym( pWVT->pSymWVT_KILLFOCUS );
               hb_vmPushNil();
               hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hWnd );
               hb_vmDo( 1 );
               hb_vmRequestRestore();
            }
         }
         return 0;

      case WM_KEYDOWN:
      case WM_SYSKEYDOWN:
      case WM_CHAR:
      case WM_SYSCHAR:
         return hb_gt_wvt_KeyEvent( pWVT, message, wParam, lParam );

      case WM_RBUTTONDOWN:
      case WM_LBUTTONDOWN:
      case WM_RBUTTONUP:
      case WM_LBUTTONUP:
      case WM_RBUTTONDBLCLK:
      case WM_LBUTTONDBLCLK:
      case WM_MBUTTONDOWN:
      case WM_MBUTTONUP:
      case WM_MBUTTONDBLCLK:
      case WM_MOUSEMOVE:
      case WM_MOUSEWHEEL:
      case WM_NCMOUSEMOVE:
         hb_gt_wvt_MouseEvent( pWVT, message, wParam, lParam );
         return 0;

      case WM_QUERYENDSESSION: /* Closing down computer */
         hb_vmRequestQuit();
         return 0;

      case WM_CLOSE:  /* Clicked 'X' on system menu */
         if( hb_gt_wvt_FireEvent( pWVT, HB_GTE_CLOSE ) == 0 )
         {
            if( hb_setGetCancel() )
               hb_vmRequestCancel();
         }
         return 0;

      case WM_QUIT:
      case WM_DESTROY:
         return 0;

      case WM_ENTERIDLE:
         /* FSG - 12/05/2004 - Signal than i'm on idle */
         hb_idleState();
         return 0;

      case WM_ENTERSIZEMOVE:
         if( pWVT->bMaximized )
         {
            pWVT->bMaximized = FALSE;
            /* Enable "maximize" button */

#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_WINCE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT)
            SetWindowLong( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME );
#else
            SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX|WS_THICKFRAME );
#endif

            SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0,
                                      SWP_NOACTIVATE | SWP_DRAWFRAME | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE );
            ShowWindow( pWVT->hWnd, SW_HIDE );
            ShowWindow( pWVT->hWnd, SW_NORMAL );
         }
         pWVT->bResizing = TRUE;
         return 0;

      case WM_EXITSIZEMOVE:
         pWVT->bResizing = FALSE;
         hb_wvt_gtSaveGuiState( pWVT );
         hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED );
         return 0;

      case WM_SIZE:
         if( pWVT->bResizing )
            hb_gt_wvt_FitSize( pWVT );
         return 0;

      case WM_SYSCOMMAND:
         switch( wParam )
         {
            case SC_MAXIMIZE:
            {
               pWVT->bMaximized = TRUE;

               hb_gt_wvt_FitSize( pWVT );
               hb_wvt_gtSaveGuiState( pWVT );

               /* Disable "maximize" button */
#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_WINCE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT)
               SetWindowLong( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_THICKFRAME );
#else
               SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_THICKFRAME );
#endif
               SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0,
                                         SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE );
               ShowWindow( pWVT->hWnd, SW_HIDE );
               ShowWindow( pWVT->hWnd, SW_NORMAL );

               hb_gt_wvt_FireEvent( pWVT, HB_GTE_RESIZED );

               return 0;
            }

            case SYS_EV_MARK:
            {
               pWVT->bBeginMarked = TRUE;
               return 0;
            }
         }
         break;

      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;
   }

   return DefWindowProc( hWnd, message, wParam, lParam );
}
gtwvg.c1494
STATIC BOOLhb_gt_wvt_IsDialogMessage( PHB_GTWVT pWVT, LPMSG lpMsg )
static BOOL hb_gt_wvt_IsDialogMessage( PHB_GTWVT pWVT, LPMSG lpMsg )     /* Proprietory to GTWVG */
{
   int iIndex;

   for( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
   {
      if( pWVT->hDlgModeless[ iIndex ] != 0 )
      {
         if( IsDialogMessage( pWVT->hDlgModeless[ iIndex ], lpMsg ) )
            return TRUE;
      }
   }

   return FALSE;
}
gtwvg.c1758
STATIC DWORDhb_gt_wvt_ProcessMessages( PHB_GTWVT pWVT )
static DWORD hb_gt_wvt_ProcessMessages( PHB_GTWVT pWVT )
{
   MSG msg;

   while( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
   {
      if( ! hb_gt_wvt_IsDialogMessage( pWVT, &msg ) )
      {
         TranslateMessage( &msg );
         DispatchMessage( &msg );
      }
   }

   return ( DWORD ) msg.wParam;
}
gtwvg.c1774
STATIC BOOLhb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFont, int iWidth )
static BOOL hb_gt_wvt_ValidWindowSize( HWND hWnd, int rows, int cols, HFONT hFont, int iWidth )
{
   HDC        hdc;
   HFONT      hOldFont;
   USHORT     width, height, maxWidth, maxHeight;
   TEXTMETRIC tm;
   RECT       rcWorkArea;

   SystemParametersInfo( SPI_GETWORKAREA, 0, &rcWorkArea, 0 );

   maxWidth  = (USHORT) ( rcWorkArea.right - rcWorkArea.left );
   maxHeight = (USHORT) ( rcWorkArea.bottom - rcWorkArea.top );

   hdc       = GetDC( hWnd );
   hOldFont  = ( HFONT ) SelectObject( hdc, hFont );
   GetTextMetrics( hdc, &tm );
   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 */
   height    = (USHORT) ( tm.tmHeight * rows ); /* Total pixel height this setting would take */

   return ( width <= maxWidth ) && ( height <= maxHeight );
}
gtwvg.c1790
STATIC HWNDhb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
static HWND hb_gt_wvt_CreateWindow( HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow )
{
   HWND     hWnd;
   WNDCLASS wndclass;

   HB_SYMBOL_UNUSED( hPrevInstance );
   HB_SYMBOL_UNUSED( szCmdLine );

   InitCommonControls();

   wndclass.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
   wndclass.lpfnWndProc   = hb_gt_wvt_WndProc;
   wndclass.cbClsExtra    = 0;
   wndclass.cbWndExtra    = 0;
   wndclass.hInstance     = hInstance;
   wndclass.hIcon         = NULL;
   wndclass.hCursor       = LoadCursor( NULL, IDC_ARROW );
   wndclass.hbrBackground = NULL;
   wndclass.lpszMenuName  = NULL;
   wndclass.lpszClassName = s_szClassName;

   if( ! RegisterClass( &wndclass ) )
   {
      hb_errInternal( 10001, "Failed to register WVT window class", NULL, NULL );
   }

   hWnd = CreateWindow(
      s_szClassName,                                       /* classname */
      TEXT( "Harbour WVG" ),                               /* window name */
      WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|
         WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX,         /* style */
      0,                                                   /* x */
      0,                                                   /* y */
      CW_USEDEFAULT,                                       /* width */
      CW_USEDEFAULT,                                       /* height */
      NULL,                                                /* window parent */
      NULL,                                                /* menu */
      hInstance,                                           /* instance */
      NULL );                                              /* lpParam */

   if( hWnd == NULL )
   {
      hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
   }

   /*
    * If you wish to show window the way you want, put somewhere in your application
    * ANNOUNCE HB_NOSTARTUPWINDOW
    * If so compiled, then you need to issue Wvt_ShowWindow( SW_RESTORE )
    * at the point you desire in your code.
    */
   if( hb_dynsymFind( "HB_NOSTARTUPWINDOW" ) != NULL )
   {
      iCmdShow = SW_HIDE;
   }

   ShowWindow( hWnd, iCmdShow );

   UpdateWindow( hWnd );

   return hWnd;
}

/* ********************************************************************** */
gtwvg.c1815
STATIC VOIDhb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr )
static void hb_gt_wvt_Init( PHB_GT pGT, HB_FHANDLE hFilenoStdin, HB_FHANDLE hFilenoStdout, HB_FHANDLE hFilenoStderr )
{
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Init(%p,%p,%p,%p)", pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr ) );

   if( ! hb_winmainArgGet( &s_hInstance, &s_hPrevInstance, &s_iCmdShow ) )
   {
      hb_errInternal( 10001, "It's not a GUI program", NULL, NULL );
   }

   pWVT = hb_gt_wvt_New( pGT );
   if( !pWVT )
   {
      hb_errInternal( 10001, "Maximum number of WVT windows reached, cannot create another one", NULL, NULL );
   }

   HB_GTLOCAL( pGT ) = ( void * ) pWVT;

   pWVT->hWnd = hb_gt_wvt_CreateWindow( ( HINSTANCE ) s_hInstance,
                                     ( HINSTANCE ) s_hPrevInstance,
                                     "", s_iCmdShow );
   if( !pWVT->hWnd )
      return;

#ifndef HB_CDP_SUPPORT_OFF
   pWVT->hostCDP    = hb_vmCDP();
   pWVT->inCDP      = hb_vmCDP();
#endif

   /* Set default window title */
   {
      PHB_FNAME pFileName = hb_fsFNameSplit( hb_cmdargARGV()[0] );
      hb_gt_wvt_SetWindowTitle( pWVT->hWnd, pFileName->szName );
      hb_xfree( pFileName );
   }

   /* Create "Mark" prompt in SysMenu to allow console type copy operation */
   {
      HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );
      LPTSTR buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy );
      AppendMenu( hSysMenu, MF_STRING, SYS_EV_MARK, buffer );
      HB_TCHAR_FREE( buffer );
   }

   pWVT->hdc        = GetDC( pWVT->hWnd );
   pWVT->hCompDC    = CreateCompatibleDC( pWVT->hdc );
   hb_wvt_gtInitGui( pWVT );

   if( b_MouseEnable )
   {
      hb_wvt_gtCreateToolTipWindow( pWVT );
   }

   /* SUPER GT initialization */
   HB_GTSUPER_INIT( pGT, hFilenoStdin, hFilenoStdout, hFilenoStderr );
   HB_GTSUPER_RESIZE( pGT, pWVT->ROWS, pWVT->COLS );
   HB_GTSUPER_EXPOSEAREA( pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
}
gtwvg.c1884
STATIC VOIDhb_gt_wvt_Exit( PHB_GT pGT )
static void hb_gt_wvt_Exit( PHB_GT pGT )
{
   PHB_GTWVT pWVT;

   HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Exit(%p)", pGT));

   pWVT = HB_GTWVT_GET( pGT );
   HB_GTSUPER_EXIT( pGT );

   hb_gt_wvt_FreeAll();

   if( pWVT )
   {
      if( pWVT->hWnd )
      {
         hb_wvt_gtExitGui( pWVT );
      }
      UnregisterClass( s_szClassName, ( HINSTANCE ) s_hInstance );
      hb_gt_wvt_Free( pWVT );
   }
}
gtwvg.c1946
STATIC BOOLhb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol )
static BOOL hb_gt_wvt_SetMode( PHB_GT pGT, int iRow, int iCol )
{
   BOOL fResult = FALSE;
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_SetMode(%p,%d,%d)", pGT, iRow, iCol ) );

   pWVT = HB_GTWVT_GET( pGT );

   HB_SYMBOL_UNUSED( pGT );

   if( iRow <= WVT_MAX_ROWS && iCol <= WVT_MAX_COLS )
   {
      if( pWVT->hWnd ) /* Is the window already open */
      {
         HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, pWVT->fontHeight, pWVT->fontWidth,
                                          pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );

         if( hFont )
         {
            /*
             * make sure that the mode selected along with the current
             * font settings will fit in the window
             */
            if( hb_gt_wvt_ValidWindowSize( pWVT->hWnd, iRow, iCol, hFont, pWVT->fontWidth ) )
            {
               fResult = hb_gt_wvt_InitWindow( pWVT, iRow, iCol );
            }
            DeleteObject( hFont );
         }
      }
      else
      {
         hb_gt_wvt_SetWindowSize( pWVT, iRow, iCol );
      }
   }

   return fResult;
}
gtwvg.c1970
STATIC BOOLhb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol, BYTE bColor, BYTE bAttr, USHORT usChar )
static BOOL hb_gt_wvt_PutChar( PHB_GT pGT, int iRow, int iCol,
                               BYTE bColor, BYTE bAttr, USHORT usChar )
{
   if( HB_GTSUPER_PUTCHAR( pGT, iRow, iCol, bColor, bAttr, usChar ) )
   {
      HB_GTSELF_TOUCHCELL( pGT, iRow, iCol );
      return TRUE;
   }
   return FALSE;
}
gtwvg.c2012
STATIC CONST CHAR *hb_gt_wvt_Version( PHB_GT pGT, int iType )
static const char * hb_gt_wvt_Version( PHB_GT pGT, int iType )
{
   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Version(%p,%d)", pGT, iType ) );

   HB_SYMBOL_UNUSED( pGT );

   if( iType == 0 )
      return HB_GT_DRVNAME( HB_GT_NAME );

   return "Harbour Terminal: Win32 buffered Graphical WVG";
}
gtwvg.c2025
STATIC INThb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask )
static int hb_gt_wvt_ReadKey( PHB_GT pGT, int iEventMask )
{
   int  c = 0;
   BOOL fKey;
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_ReadKey(%p,%d)", pGT, iEventMask ) );

   pWVT = HB_GTWVT_GET( pGT );

   HB_SYMBOL_UNUSED( pGT );
   HB_SYMBOL_UNUSED( iEventMask ); /* we ignore the eventmask! */

   hb_gt_wvt_ProcessMessages( pWVT );
   fKey = hb_gt_wvt_GetCharFromInputQueue( pWVT, &c );

   return fKey ? c : 0;
}
gtwvg.c2039
STATIC VOIDhb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration )
static void hb_gt_wvt_Tone( PHB_GT pGT, double dFrequency, double dDuration )
{
   HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_Tone(%p,%lf,%lf)", pGT, dFrequency, dDuration));

   HB_SYMBOL_UNUSED( pGT );

   hb_gt_w32_tone( dFrequency, dDuration );
}
gtwvg.c2058
STATIC BOOLhb_gt_wvt_mouse_IsPresent( PHB_GT pGT )
static BOOL hb_gt_wvt_mouse_IsPresent( PHB_GT pGT )
{
   HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_mouse_IsPresent(%p)", pGT));

   HB_SYMBOL_UNUSED( pGT );

   return TRUE;
}
gtwvg.c2071
STATIC VOIDhb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol )
static void hb_gt_wvt_mouse_GetPos( PHB_GT pGT, int * piRow, int * piCol )
{
   PHB_GTWVT pWVT;

   HB_TRACE(HB_TR_DEBUG, ("hb_gt_wvt_mouse_GetPos(%p,%p,%p)", pGT, piRow, piCol));

   pWVT = HB_GTWVT_GET( pGT );

   HB_SYMBOL_UNUSED( pGT );

   *piRow = pWVT->MousePos.y;
   *piCol = pWVT->MousePos.x;
}
gtwvg.c2080
STATIC BOOLhb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton )
static BOOL hb_gt_wvt_mouse_ButtonState( PHB_GT pGT, int iButton )
{
   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_mouse_ButtonState(%p,%i)", pGT, iButton) );

   HB_SYMBOL_UNUSED( pGT );

   switch( iButton )
   {
      case 0:
         return ( GetKeyState( VK_LBUTTON ) & 0x8000 ) != 0;
      case 1:
         return ( GetKeyState( VK_RBUTTON ) & 0x8000 ) != 0;
      case 2:
         return ( GetKeyState( VK_MBUTTON ) & 0x8000 ) != 0;
   }
   return FALSE;
}
gtwvg.c2094
STATIC INThb_gt_wvt_mouse_CountButton( PHB_GT pGT )
static int hb_gt_wvt_mouse_CountButton( PHB_GT pGT )
{
   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_mouse_CountButton(%p)", pGT) );

   HB_SYMBOL_UNUSED( pGT );

   return GetSystemMetrics( SM_CMOUSEBUTTONS );
}
gtwvg.c2112
STATIC BOOLhb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
static BOOL hb_gt_wvt_Info( PHB_GT pGT, int iType, PHB_GT_INFO pInfo )
{
   int iVal;
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Info(%p,%d,%p)", pGT, iType, pInfo ) );

   pWVT = HB_GTWVT_GET( pGT );

   switch( iType )
   {
      case HB_GTI_FULLSCREEN:
      case HB_GTI_KBDSUPPORT:
      case HB_GTI_ISGRAPHIC:
         pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
         break;

      case HB_GTI_ISUNICODE:
#if defined(UNICODE)
         pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );
#else
         pInfo->pResult = hb_itemPutL( pInfo->pResult, FALSE );
#endif
         break;

      case HB_GTI_INPUTFD:
         pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
                              ( HB_PTRDIFF ) GetStdHandle( STD_INPUT_HANDLE ) );
         break;

      case HB_GTI_OUTPUTFD:
         pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
                              ( HB_PTRDIFF ) GetStdHandle( STD_OUTPUT_HANDLE ) );
         break;

      case HB_GTI_ERRORFD:
         pInfo->pResult = hb_itemPutNInt( pInfo->pResult,
                              ( HB_PTRDIFF ) GetStdHandle( STD_ERROR_HANDLE ) );
         break;

      case HB_GTI_SETFONT:
         pInfo->pResult = hb_itemPutL( pInfo->pResult, FALSE );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
         {
            HFONT hFont = hb_gt_wvt_GetFont( hb_arrayGetCPtr( pInfo->pNewVal, 1 ),
                                             hb_arrayGetNI( pInfo->pNewVal, 2 ),
                                             hb_arrayGetNI( pInfo->pNewVal, 3 ),
                                             hb_arrayGetNI( pInfo->pNewVal, 4 ),
                                             hb_arrayGetNI( pInfo->pNewVal, 5 ),
                                             pWVT->CodePage );
            if( hFont )
            {
               if( hb_gt_wvt_ValidWindowSize( pWVT->hWnd, pWVT->ROWS, pWVT->COLS, hFont, hb_arrayGetNI( pInfo->pNewVal, 3 ) ) )
               {
                  pInfo->pResult = hb_itemPutL( pInfo->pResult, TRUE );

                  hb_strncpy( pWVT->fontFace, hb_arrayGetCPtr( pInfo->pNewVal, 1 ), sizeof( pWVT->fontFace ) - 1 );
                  pWVT->fontHeight  = hb_arrayGetNI( pInfo->pNewVal, 2 );
                  pWVT->fontWidth   = hb_arrayGetNI( pInfo->pNewVal, 3 );
                  pWVT->fontWeight  = hb_arrayGetNI( pInfo->pNewVal, 4 );
                  pWVT->fontQuality = hb_arrayGetNI( pInfo->pNewVal, 5 );
                  if( pWVT->hWnd )
                  {
                     hb_gt_wvt_ResetWindowSize( pWVT );
                     hb_gt_wvt_UpdateCaret( pWVT );
                     HB_GTSELF_REFRESH( pGT );
                  }
               }
               DeleteObject( hFont );
            }
         }
         break;

      case HB_GTI_FONTSIZE:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y );
         iVal = hb_itemGetNI( pInfo->pNewVal );
         if( iVal > 0 )
         {
            HFONT hFont = hb_gt_wvt_GetFont( pWVT->fontFace, iVal, pWVT->fontWidth, pWVT->fontWeight, pWVT->fontQuality, pWVT->CodePage );
            if( hFont )
            {
               pWVT->fontHeight = iVal;
               if( pWVT->hWnd )
               {
                  hb_gt_wvt_ResetWindowSize( pWVT );
                  hb_gt_wvt_UpdateCaret( pWVT );
                  HB_GTSELF_REFRESH( pGT );
               }
               DeleteObject( hFont );
            }
         }
         break;

      case HB_GTI_FONTWIDTH:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWidth );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
            pWVT->fontWidth =  hb_itemGetNI( pInfo->pNewVal );

         break;

      case HB_GTI_FONTNAME:
         pInfo->pResult = hb_itemPutC( pInfo->pResult, pWVT->fontFace );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
         {
            hb_strncpy( pWVT->fontFace, hb_itemGetCPtr( pInfo->pNewVal ), sizeof( pWVT->fontFace ) - 1 );
         }
         break;

      case HB_GTI_FONTWEIGHT:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontWeight );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
            pWVT->fontWeight =  hb_itemGetNI( pInfo->pNewVal );

         break;

         /*
         switch( pWVT->fontWeight )
         {
            case FW_THIN:
            case FW_EXTRALIGHT:
            case FW_LIGHT:
               iVal = HB_GTI_FONTW_THIN;
            break;

            case FW_DONTCARE:
            case FW_NORMAL:
            case FW_MEDIUM:
               iVal = HB_GTI_FONTW_NORMAL;
            break;

            case FW_SEMIBOLD:
            case FW_BOLD:
            case FW_EXTRABOLD:
            case FW_HEAVY:
               iVal = HB_GTI_FONTW_BOLD;
            break;

            default:
               iVal = 0;
            break;
         }
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
         {
            // store font status for next operation on fontsize //
            switch( hb_itemGetNI( pInfo->pNewVal ) )
            {
               case HB_GTI_FONTW_THIN:
                  pWVT->fontWeight = FW_LIGHT;
                  break;
               case HB_GTI_FONTW_NORMAL:
                  pWVT->fontWeight = FW_NORMAL;
                  break;
               case HB_GTI_FONTW_BOLD:
                  pWVT->fontWeight = FW_BOLD;
                  break;
            }
         }
         break;
         */
      case HB_GTI_FONTQUALITY:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->fontQuality );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
            pWVT->fontQuality =  hb_itemGetNI( pInfo->pNewVal );

         break;
         /*
         switch( pWVT->fontQuality )
         {
            case ANTIALIASED_QUALITY:
               iVal = HB_GTI_FONTQ_HIGH;
               break;
            case DEFAULT_QUALITY:
            case DRAFT_QUALITY:
               iVal = HB_GTI_FONTQ_NORMAL;
               break;
            case NONANTIALIASED_QUALITY:
            case PROOF_QUALITY:
               iVal = HB_GTI_FONTQ_DRAFT;
               break;
            default:
               iVal = 0;
               break;
         }
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, iVal );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
         {
            switch( hb_itemGetNI( pInfo->pNewVal ) )
            {
               case HB_GTI_FONTQ_HIGH:
                  pWVT->fontQuality = ANTIALIASED_QUALITY;
                  break;
               case HB_GTI_FONTQ_NORMAL:
                  pWVT->fontQuality = DEFAULT_QUALITY;
                  break;
               case HB_GTI_FONTQ_DRAFT:
                  pWVT->fontQuality = DRAFT_QUALITY;
                  break;
            }
         }
         break;
         */

      case HB_GTI_SCREENHEIGHT:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.y * pWVT->ROWS );
         iVal = hb_itemGetNI( pInfo->pNewVal );
         if( iVal > 0 )
         {
            HB_GTSELF_SETMODE( pGT, (USHORT) ( iVal / pWVT->PTEXTSIZE.y ), pWVT->COLS );
         }
         break;

      case HB_GTI_SCREENWIDTH:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->PTEXTSIZE.x * pWVT->COLS );
         iVal = hb_itemGetNI( pInfo->pNewVal );
         if( iVal > 0 )
         {
            HB_GTSELF_SETMODE( pGT, pWVT->ROWS, (USHORT) ( iVal / pWVT->PTEXTSIZE.x ) );
         }
         break;

      case HB_GTI_DESKTOPWIDTH:
      {
         RECT rDesk;
         HWND hDesk;

         hDesk = GetDesktopWindow();
         GetWindowRect( hDesk, &rDesk );
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, rDesk.right - rDesk.left );
         break;
      }
      case HB_GTI_DESKTOPHEIGHT:
      {
         RECT rDesk;
         HWND hDesk = GetDesktopWindow();
         GetWindowRect( hDesk, &rDesk );
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, rDesk.bottom - rDesk.top );
         break;
      }
      case HB_GTI_DESKTOPCOLS:
      {
         RECT rDesk;
         HWND hDesk;
         hDesk = GetDesktopWindow();
         GetClientRect( hDesk, &rDesk );
         pInfo->pResult = hb_itemPutNI( pInfo->pResult,
                              ( rDesk.right - rDesk.left ) / pWVT->PTEXTSIZE.x );
         break;
      }
      case HB_GTI_DESKTOPROWS:
      {
         RECT rDesk;
         HWND hDesk;
         hDesk = GetDesktopWindow();
         GetClientRect( hDesk, &rDesk );
         pInfo->pResult = hb_itemPutNI( pInfo->pResult,
                              ( rDesk.bottom - rDesk.top ) / pWVT->PTEXTSIZE.y );
         break;
      }
      case HB_GTI_WINTITLE:
      {
         char * szTitle = NULL;
         if( hb_gt_wvt_GetWindowTitle( pWVT->hWnd, &szTitle ) )
            pInfo->pResult = hb_itemPutCPtr( pInfo->pResult, szTitle, strlen( szTitle ) );
         else
            pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
            hb_gt_wvt_SetWindowTitle( pWVT->hWnd, hb_itemGetCPtr( pInfo->pNewVal ) );
         break;
      }
      case HB_GTI_CODEPAGE:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->CodePage );
         iVal = hb_itemGetNI( pInfo->pNewVal );
         if( iVal > 0 && iVal != pWVT->CodePage )
         {
            pWVT->CodePage = iVal;
            hb_gt_wvt_ResetWindowSize( pWVT );
         }
         break;

      case HB_GTI_ICONFILE:
      {
         HICON hIcon = 0;
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
         {
            LPTSTR lpImage = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) );
            hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, lpImage,
                                         IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
            HB_TCHAR_FREE( lpImage );
            if( hIcon )
            {
               SendMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon );
               SendMessage( pWVT->hWnd, WM_SETICON, ICON_BIG  , ( LPARAM ) hIcon );
            }
         }
         pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRDIFF ) hIcon );
         break;
      }

      case HB_GTI_ICONRES:
      {
         HICON hIcon = 0;
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
         {
            LPTSTR lpIcon = HB_TCHAR_CONVTO( hb_itemGetCPtr( pInfo->pNewVal ) );
            hIcon = LoadIcon( ( HINSTANCE ) s_hInstance, lpIcon );
            HB_TCHAR_FREE( lpIcon );
         }
         else if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
         {
            hIcon = LoadIcon( ( HINSTANCE ) s_hInstance,
                              MAKEINTRESOURCE( ( HB_LONG )
                                          hb_itemGetNInt( pInfo->pNewVal ) ) );
         }
         if( hIcon )
         {
            SendMessage( pWVT->hWnd, WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon );
            SendMessage( pWVT->hWnd, WM_SETICON, ICON_BIG  , ( LPARAM ) hIcon );
         }
         pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRDIFF ) hIcon );
         break;
      }
      case HB_GTI_VIEWMAXWIDTH:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->COLS );
         break;

      case HB_GTI_VIEWMAXHEIGHT:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, pWVT->ROWS );
         break;

      case HB_GTI_KBDSHIFTS:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, hb_gt_w32_getKbdState() );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
            hb_gt_w32_setKbdState( hb_itemGetNI( pInfo->pNewVal ) );
         break;

      case HB_GTI_CLIPBOARDDATA:
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
         {
            hb_gt_w32_setClipboard( pWVT->CodePage == OEM_CHARSET ?
                                    CF_OEMTEXT : CF_TEXT,
                                    hb_itemGetCPtr( pInfo->pNewVal ),
                                    hb_itemGetCLen( pInfo->pNewVal ) );
         }
         else
         {
            char * szClipboardData;
            ULONG ulLen;
            if( hb_gt_w32_getClipboard( pWVT->CodePage == OEM_CHARSET ?
                                        CF_OEMTEXT : CF_TEXT,
                                        &szClipboardData, &ulLen ) )
            {
               pInfo->pResult = hb_itemPutCPtr( pInfo->pResult,
                                                szClipboardData,
                                                ulLen );
            }
            else
            {
               pInfo->pResult = hb_itemPutC( pInfo->pResult, NULL );
            }
         }
         break;

      case HB_GTI_CURSORBLINKRATE:
         pInfo->pResult = hb_itemPutNI( pInfo->pResult, GetCaretBlinkTime() );
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
            SetCaretBlinkTime( hb_itemGetNI( pInfo->pNewVal ) );
         break;

      case HB_GTI_SCREENSIZE:
      {
         int iX, iY;

         if( !pInfo->pResult )
         {
            pInfo->pResult = hb_itemNew( NULL );
         }
         hb_arrayNew( pInfo->pResult, 2 );
         hb_arraySetNI( pInfo->pResult, 2, pWVT->PTEXTSIZE.y * pWVT->ROWS );
         hb_arraySetNI( pInfo->pResult, 1, pWVT->PTEXTSIZE.x * pWVT->COLS );
         iY = hb_arrayGetNI( pInfo->pNewVal,2 );
         iX = hb_arrayGetNI( pInfo->pNewVal,1 );

         if( iY  > 0 )
         {
            BOOL bOldCentre = pWVT->CentreWindow;
            pWVT->CentreWindow = pWVT->bMaximized ? TRUE : FALSE;
            HB_GTSELF_SETMODE( pGT, (USHORT) ( iY / pWVT->PTEXTSIZE.y ), (USHORT) ( iX / pWVT->PTEXTSIZE.x ) );
            pWVT->CentreWindow = bOldCentre;
         }
         break;
      }
      case HB_GTI_RESIZABLE:
      {
         pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bResizable );
         if( pInfo->pNewVal )
         {
            BOOL bNewValue = hb_itemGetL( pInfo->pNewVal );
            if( bNewValue != pWVT->bResizable )
            {
#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_WINCE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT)
               LONG style;
#else
               LONG_PTR style;
#endif

               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;

#if (defined(_MSC_VER) && (_MSC_VER <= 1200 || defined(HB_WINCE)) || defined(__DMC__)) && !defined(HB_ARCH_64BIT)
               SetWindowLong( pWVT->hWnd, GWL_STYLE, style );
#else
               SetWindowLongPtr( pWVT->hWnd, GWL_STYLE, style );
#endif

               SetWindowPos( pWVT->hWnd, NULL, 0, 0, 0, 0,
                                         SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_DEFERERASE );
               ShowWindow( pWVT->hWnd, SW_HIDE );
               ShowWindow( pWVT->hWnd, SW_NORMAL );
            }
         }
         break;
      }
      case HB_GTI_SELECTCOPY:
      {
         pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bSelectCopy );

         if( hb_itemType( pInfo->pNewVal ) & HB_IT_STRING )
         {
            pInfo->pResult = hb_itemPutC( pInfo->pResult, pWVT->pszSelectCopy );

            if( hb_itemGetCLen( pInfo->pNewVal ) )
            {
               HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );
               LPTSTR buffer;

               if( pWVT->pszSelectCopy )
                  hb_xfree( pWVT->pszSelectCopy );

               pWVT->pszSelectCopy = hb_strdup( hb_itemGetCPtr( pInfo->pNewVal ) );
               pWVT->bSelectCopy = TRUE;

               buffer = HB_TCHAR_CONVTO( pWVT->pszSelectCopy );
               ModifyMenu( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | MF_STRING | MF_ENABLED, SYS_EV_MARK, buffer );
               HB_TCHAR_FREE( buffer );
            }
         }
         else if( pInfo->pNewVal )
         {
            BOOL bNewValue = hb_itemGetL( pInfo->pNewVal );
            if( bNewValue != pWVT->bSelectCopy )
            {
               HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );

               EnableMenuItem( hSysMenu, SYS_EV_MARK, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED )  );
               pWVT->bSelectCopy = bNewValue;
            }
         }
         break;
      }
      case HB_GTI_CLOSABLE:
      {
         pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->bClosable );
         if( pInfo->pNewVal )
         {
            BOOL bNewValue = hb_itemGetL( pInfo->pNewVal );
            if( bNewValue != pWVT->bClosable )
            {
               HMENU hSysMenu = GetSystemMenu( pWVT->hWnd, FALSE );

               EnableMenuItem( hSysMenu, SC_CLOSE, MF_BYCOMMAND | ( bNewValue ? MF_ENABLED : MF_GRAYED )  );
               pWVT->bClosable = bNewValue;
            }
         }
         break;
      }
      case HB_GTI_PALETTE:
      {
         if( hb_itemType( pInfo->pNewVal ) & HB_IT_NUMERIC )
         {
            int iIndex = hb_itemGetNI( pInfo->pNewVal );
            if( iIndex > 0 && iIndex <= 16 )
            {
               pInfo->pResult = hb_itemPutNL( pInfo->pResult, pWVT->COLORS[ iIndex - 1 ] );

               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
                  pWVT->COLORS[ iIndex - 1 ] = hb_itemGetNL( pInfo->pNewVal2 );
            }
         }
         else
         {
            int i;
            if( !pInfo->pResult )
            {
               pInfo->pResult = hb_itemNew( NULL );
            }
            hb_arrayNew( pInfo->pResult, 16 );
            for( i = 1; i <= 16; i++ )
               hb_arraySetNL( pInfo->pResult, i, pWVT->COLORS[ i - 1 ] );

            if( hb_itemType( pInfo->pNewVal ) & HB_IT_ARRAY )
            {
               if( hb_arrayLen( pInfo->pNewVal ) == 16 )
               {
                  for( i = 0; i < 16; i++ )
                     pWVT->COLORS[ i ] = hb_arrayGetNL( pInfo->pNewVal, i + 1 );
               }
            }
         }
         break;
      }
      case HB_GTI_SPEC:
      {
         int iMessage = hb_itemGetNI( pInfo->pNewVal );
         switch( iMessage )
         {
            case HB_GTS_WINDOWHANDLE:
               pInfo->pResult = hb_itemPutNInt( pInfo->pResult, ( HB_PTRDIFF ) pWVT->hWnd );
               break;

            case HB_GTS_CENTERWINDOW:
            {
               pInfo->pResult = hb_itemPutL( pInfo->pResult, pWVT->CentreWindow );
               if( pInfo->pNewVal2 )
               {
                  pWVT->CentreWindow = hb_arrayGetL( pInfo->pNewVal2, 1 );
                  if( hb_arrayGetL( pInfo->pNewVal2, 2 ) )
                  {
                     hb_gt_wvt_ResetWindowSize( pWVT );
                  }
               }
               break;
            }
            case HB_GTS_PROCESSMESSAGES:
               hb_gt_wvt_ProcessMessages( pWVT );
               break;

            case HB_GTS_KEYBOARD:
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
                  hb_gt_wvt_AddCharToInputQueue( pWVT, hb_itemGetNI( pInfo->pNewVal2 ) );
               break;

            case HB_GTS_RESETWINDOW:
               hb_gt_wvt_ResetWindowSize( pWVT );
               break;

            case HB_GTS_SETTIMER:
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY )
                  SetTimer( pWVT->hWnd, hb_arrayGetNI( pInfo->pNewVal2, 1 ), hb_arrayGetNI( pInfo->pNewVal2, 2 ), NULL );
               break;

            case HB_GTS_KILLTIMER:
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
                  KillTimer( pWVT->hWnd, hb_itemGetNI( pInfo->pNewVal2 ) );
               break;

            case HB_GTS_SETPOSITION:
            {
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY )
               {
                  RECT rect = { 0,0,0,0 };
                  GetWindowRect( pWVT->hWnd, &rect );
                  hb_retl( SetWindowPos( pWVT->hWnd, NULL,
                                         hb_arrayGetNI( pInfo->pNewVal2, 1 ),
                                         hb_arrayGetNI( pInfo->pNewVal2, 2 ),
                                         rect.right - rect.left,
                                         rect.bottom - rect.top,
                                         SWP_NOSIZE + SWP_NOZORDER ) );
               }
               break;
            }
            case HB_GTS_SHOWWINDOW:
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_NUMERIC )
                  ShowWindow( pWVT->hWnd, hb_itemGetNI( pInfo->pNewVal2 ) );
               break;

            case HB_GTS_UPDATEWINDOW:
               UpdateWindow( pWVT->hWnd );
               break;

            case HB_GTS_SYSTRAYICON:
            {
               if( hb_itemType( pInfo->pNewVal2 ) & HB_IT_ARRAY )
               {
                  int            mode = hb_arrayGetNI( pInfo->pNewVal2, 1 );
                  int            iIconType = hb_arrayGetNI( pInfo->pNewVal2, 2 );
                  HICON          hIcon = 0;
                  NOTIFYICONDATA tnid ;

                  if( iIconType == 0 )
                  {
                     LPTSTR lpImage = HB_TCHAR_CONVTO( hb_arrayGetCPtr( pInfo->pNewVal2, 3 ) );
                     hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, lpImage,
                                                     IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
                     HB_TCHAR_FREE( lpImage );
                  }
                  else if( iIconType == 1 )
                  {
                     LPTSTR lpIcon = HB_TCHAR_CONVTO( hb_arrayGetCPtr( pInfo->pNewVal2, 3 ) );
                     hIcon = LoadIcon( ( HINSTANCE ) s_hInstance, lpIcon );
                     HB_TCHAR_FREE( lpIcon );
                  }
                  else if( iIconType == 2 )
                  {
                     hIcon = LoadIcon( ( HINSTANCE ) s_hInstance,
                                          MAKEINTRESOURCE( ( HB_LONG )
                                                      hb_arrayGetNInt( pInfo->pNewVal2, 3 ) ) );
                  }
                  tnid.cbSize           = sizeof( NOTIFYICONDATA ) ;
                  tnid.hWnd             = pWVT->hWnd;
                  tnid.uID              = HB_ID_NOTIFYICON;
                  tnid.uFlags           = NIF_MESSAGE + NIF_ICON + NIF_TIP;
                  tnid.uCallbackMessage = HB_MSG_NOTIFYICON;
                  tnid.hIcon            = hIcon ;

                  HB_TCHAR_CPTO( tnid.szTip, hb_arrayGetCPtr( pInfo->pNewVal2, 4 ), sizeof( tnid.szTip ) - 1 );

                  Shell_NotifyIcon( mode, &tnid ) ;

                  if( hIcon )
                     DestroyIcon( hIcon );

                  ShowWindow( pWVT->hWnd, SW_HIDE );
               }
               break;
            }

            case HB_GTS_WNDSTATE:
            {
               int iSpec = hb_itemGetNI( pInfo->pNewVal2 );

               switch( iSpec )
               {
                  case WNDS_SETONTOP:
                  {
                     RECT rect = { 0,0,0,0 };
                     GetWindowRect( pWVT->hWnd, &rect );
                     hb_retl( SetWindowPos( pWVT->hWnd, HWND_TOPMOST,
                                            rect.left,
                                            rect.top,
                                            0,
                                            0,
                                            SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) );
                     break;
                  }
                  case WNDS_SETASNORMAL:
                  {
                     RECT rect = { 0,0,0,0 };
                     GetWindowRect( pWVT->hWnd, &rect );
                     hb_retl( SetWindowPos( pWVT->hWnd, HWND_NOTOPMOST,
                                            rect.left,
                                            rect.top,
                                            0,
                                            0,
                                            SWP_NOSIZE + SWP_NOMOVE + SWP_NOACTIVATE ) );
                     break;
                  }

                  case WNDS_MINIMIZED:
                     ShowWindow( pWVT->hWnd, SW_MINIMIZE );
                     break;

                  case WNDS_MAXIMIZED:
                     if( pWVT->bResizable )
                        ShowWindow( pWVT->hWnd, SW_MAXIMIZE );
                     else
                        ShowWindow( pWVT->hWnd, SW_RESTORE );
                     break;

                  case WNDS_HIDDEN:
                     ShowWindow( pWVT->hWnd, SW_HIDE );
                     break;

                  case WNDS_NORMAL:
                     ShowWindow( pWVT->hWnd, SW_SHOWNORMAL );
                     break;

               }
               break;
            }
         }
         break;
      }
      default:
         return HB_GTSUPER_INFO( pGT, iType, pInfo );
   }

   return TRUE;
}

/* ********************************************************************** */

/* ********** Graphics API ********** */
/*
 * NOTE:
 *      gfxPrimitive() parameters may have different meanings
 *      ie: - Desired color is 'iBottom' for PUTPIXEL and 'iRight' for CIRCLE
 *          - Red is iTop, Green iLeft and Blue is iBottom for MAKECOLOR
 *
 */

#define SetGFXContext(c) \
         do { \
            COLORREF color = RGB( (c) >> 16, ( (c) & 0xFF00 ) >> 8, (c) & 0xFF ); \
            hdc = GetDC( pWVT->hWnd ); \
            hPen = CreatePen( PS_SOLID, 1, color ); \
            hOldPen = ( HPEN ) SelectObject( hdc, hPen ); \
            hBrush = ( HBRUSH ) CreateSolidBrush( color ); \
            hOldBrush = ( HBRUSH ) SelectObject( hdc, hBrush ); \
         } while( 0 )

#define ClearGFXContext() \
         do { \
            SelectObject( hdc, hOldPen ); \
            SelectObject( hdc, hOldBrush ); \
            DeleteObject( hBrush ); \
            DeleteObject( hPen ); \
            ReleaseDC( pWVT->hWnd, hdc ); \
         } while( 0 )
gtwvg.c2123
STATIC INThb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor )
static int hb_gt_wvt_gfx_Primitive( PHB_GT pGT, int iType, int iTop, int iLeft, int iBottom, int iRight, int iColor )
{
   HDC      hdc;
   HPEN     hPen, hOldPen;
   HBRUSH   hBrush, hOldBrush;
   int      iRet = 0;
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_gfx_Primitive(%p,%d,%d,%d,%d,%d,%d)", pGT, iType, iTop, iLeft, iBottom, iRight, iColor ) );

   pWVT = HB_GTWVT_GET( pGT );

   if( pWVT->hWnd )
   {
      switch( iType )
      {
         case HB_GFX_ACQUIRESCREEN:
         case HB_GFX_RELEASESCREEN:
            iRet = 1;
            break;

         case HB_GFX_MAKECOLOR:
            iRet = (iTop << 16) | (iLeft << 8) | ( iBottom );
            break;

         case HB_GFX_PUTPIXEL:
            SetGFXContext( iBottom );

            MoveToEx( hdc, iLeft, iTop, NULL );
            LineTo( hdc, iLeft, iTop );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_LINE:
            SetGFXContext( iColor );

            MoveToEx( hdc, iLeft, iTop, NULL );
            LineTo( hdc, iRight, iBottom );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_RECT:
         {
            RECT r;

            r.left = iLeft;
            r.top = iTop;
            r.right = iRight;
            r.bottom = iBottom;

            SetGFXContext( iColor );

            FrameRect( hdc, &r, hBrush );

            ClearGFXContext();
            iRet = 1;
            break;
         }
         case HB_GFX_FILLEDRECT:
            SetGFXContext( iColor );

            Rectangle( hdc, iLeft, iTop, iRight, iBottom );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_CIRCLE:
            SetGFXContext( iRight );

            Arc( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2, 0, 0, 0, 0 );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_FILLEDCIRCLE:
            SetGFXContext( iRight );

            Ellipse( hdc, iLeft - iBottom / 2, iTop - iBottom / 2, iLeft + iBottom / 2, iTop + iBottom / 2 );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_ELLIPSE:
            SetGFXContext( iColor );

            Arc( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2, 0, 0, 0, 0 );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_FILLEDELLIPSE:
            SetGFXContext( iColor );

            Ellipse( hdc, iLeft - iRight / 2, iTop - iBottom / 2, iLeft + iRight / 2, iTop + iBottom / 2 );

            ClearGFXContext();
            iRet = 1;
            break;

         case HB_GFX_FLOODFILL:
            SetGFXContext( iBottom );

            FloodFill( hdc, iLeft, iTop, iColor );

            ClearGFXContext();
            iRet = 1;
            break;
      }
   }

   return iRet;
}

gtwvg.c2847
STATIC VOIDhb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
static void hb_gt_wvt_Redraw( PHB_GT pGT, int iRow, int iCol, int iSize )
{
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ( "hb_gt_wvt_Redraw(%p,%d,%d,%d)", pGT, iRow, iCol, iSize ) );

   pWVT = HB_GTWVT_GET( pGT );

   HB_SYMBOL_UNUSED( pGT );

   if( pWVT->hWnd )
   {
      RECT rect;

      rect.top = rect.bottom = ( SHORT ) iRow;
      rect.left = ( SHORT ) iCol;
      rect.right = ( SHORT ) ( iCol + iSize - 1 );

      rect = hb_gt_wvt_GetXYFromColRowRect( pWVT, rect );

      InvalidateRect( pWVT->hWnd, &rect, FALSE );
   }
}
gtwvg.c2983
STATIC VOIDhb_gt_wvt_Refresh( PHB_GT pGT )
static void hb_gt_wvt_Refresh( PHB_GT pGT )
{
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_Refresh(%p)", pGT) );

   pWVT = HB_GTWVT_GET( pGT );

   HB_GTSUPER_REFRESH( pGT );

   if( pWVT->hWnd )
   {
      SendMessage( pWVT->hWnd, WM_MY_UPDATE_CARET, 0, 0 );
      hb_gt_wvt_ProcessMessages( pWVT );
   }
}

/* ********************************************************************** */
gtwvg.c3009
STATIC INThb_gt_wvt_wnd_Create( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight )
static int hb_gt_wvt_wnd_Create( PHB_GT pGT, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_wnd_Create(%p,%d,%d,%d,%d)", pGT,iTop,iLeft,iBottom,iRight) );


   pWVT = hb_gt_wvt_New( pGT );
   if( !pWVT )
   {
      hb_errInternal( 10001, "Cannot allocate new window", NULL, NULL );
   }

   HB_GTLOCAL( pGT ) = ( void * ) pWVT;

// pGT->iLocalGTHandle = pWVT->iHandle;

   pWVT->ROWS = iBottom - iTop + 1;
   pWVT->COLS = iRight - iLeft + 1;

   pWVT->hWnd = CreateWindow( s_szClassName,               /* classname */
      TEXT( "Harbour WVT" ),                               /* window name */
      WS_THICKFRAME|WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX|WS_MAXIMIZEBOX,  /* style */
      0,                                                   /* x */
      0,                                                   /* y */
      CW_USEDEFAULT,                                       /* width */
      CW_USEDEFAULT,                                       /* height */
      NULL,                                                /* window parent */
      NULL,                                                /* menu */
      ( HINSTANCE ) s_hInstance,                           /* instance */
      NULL );                                              /* lpParam */

   if( !pWVT->hWnd )
   {
      hb_errInternal( 10001, "Failed to create WVT window", NULL, NULL );
   }

#ifndef HB_CDP_SUPPORT_OFF
   pWVT->hostCDP    = hb_vmCDP();
   pWVT->inCDP      = hb_vmCDP();
#endif

   hb_gt_wvt_SetMode( pGT, pWVT->ROWS, pWVT->COLS );

   /* SUPER GT initialization */
   HB_GTSELF_RESIZE( pGT, pWVT->ROWS, pWVT->COLS );
   HB_GTSELF_EXPOSEAREA( pGT, 0, 0, pWVT->ROWS, pWVT->COLS );
   ShowWindow( pWVT->hWnd, SW_NORMAL );
   UpdateWindow( pWVT->hWnd );

   return pWVT->iHandle;
}
gtwvg.c3032
STATIC VOIDhb_gt_wvt_wnd_Destroy( PHB_GT pGT )
static void hb_gt_wvt_wnd_Destroy( PHB_GT pGT )
{
   PHB_GTWVT pWVT;

   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_wnd_Destroy(%p)", pGT) );

   pWVT = HB_GTWVT_GET( pGT );

   if ( pWVT->hWnd )
   {
      DestroyWindow( pWVT->hWnd );
      pWVT->hWnd = NULL;
   }
   hb_gt_wvt_Free( pWVT );
   HB_GTSUPER_EXIT( pGT );
}
gtwvg.c3085
STATIC INThb_gt_wvt_wnd_Select( PHB_GT pGT )
static int hb_gt_wvt_wnd_Select( PHB_GT pGT )
{
   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_wnd_Select(%p)", pGT) );

   HB_SYMBOL_UNUSED( pGT );

   return 0;
}
gtwvg.c3102
STATIC INThb_gt_wvt_wnd_Current( PHB_GT pGT )
static int hb_gt_wvt_wnd_Current( PHB_GT pGT )
{
   HB_TRACE( HB_TR_DEBUG, ("hb_gt_wvt_wnd_Current(%p)", pGT) );

   HB_SYMBOL_UNUSED( pGT );

   return 0;
}
gtwvg.c3111
STATIC BOOLhb_gt_wvt_SetDispCP( PHB_GT pGT, char * pszTermCDP, char * pszHostCDP, BOOL fBox )
static BOOL hb_gt_wvt_SetDispCP( PHB_GT pGT, char * pszTermCDP, char * pszHostCDP, BOOL fBox )
{
   PHB_GTWVT pWVT;

   HB_GTSUPER_SETDISPCP( pGT, pszTermCDP, pszHostCDP, fBox );

   pWVT = HB_GTWVT_GET( pGT );

#ifndef HB_CDP_SUPPORT_OFF
   /*
    * We are displaying text in U16 so pszTermCDP is unimportant.
    * We only have to know what is the internal application codepage
    * to make proper translation
    */
   if( !pszHostCDP || !*pszHostCDP )
      pszHostCDP = hb_cdpID();

   if( pszHostCDP && *pszHostCDP )
   {
      PHB_CODEPAGE cdpHost = hb_cdpFind( pszHostCDP );
      if( cdpHost )
         pWVT->hostCDP = cdpHost;
   }
#endif

   return TRUE;
}
gtwvg.c3124
STATIC BOOLhb_gt_wvt_SetKeyCP( PHB_GT pGT, char * pszTermCDP, char * pszHostCDP )
static BOOL hb_gt_wvt_SetKeyCP( PHB_GT pGT, char * pszTermCDP, char * pszHostCDP )
{
   PHB_GTWVT pWVT;

   HB_GTSUPER_SETKEYCP( pGT, pszTermCDP, pszHostCDP );

   pWVT = HB_GTWVT_GET( pGT );

#ifndef HB_CDP_SUPPORT_OFF
   /*
    * We are receiving WM_CHAR events in U16 so pszTermCDP is unimportant.
    * We only have to know what is the internal application codepage
    * to make proper translation
    */
   if( !pszHostCDP || !*pszHostCDP )
      pszHostCDP = hb_cdpID();

   if( pszHostCDP && *pszHostCDP )
   {
      PHB_CODEPAGE cdpHost = hb_cdpFind( pszHostCDP );
      if( cdpHost )
         pWVT->inCDP = cdpHost;
   }
#endif

   return TRUE;
}
gtwvg.c3152
STATIC BOOLhb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
static BOOL hb_gt_FuncInit( PHB_GT_FUNCS pFuncTable )
{
   HB_TRACE(HB_TR_DEBUG, ("hb_gt_FuncInit(%p)", pFuncTable));

   pFuncTable->Init                 = hb_gt_wvt_Init;
   pFuncTable->Exit                 = hb_gt_wvt_Exit;
   pFuncTable->SetMode              = hb_gt_wvt_SetMode;
   pFuncTable->Redraw               = hb_gt_wvt_Redraw;
   pFuncTable->Refresh              = hb_gt_wvt_Refresh;
   pFuncTable->Version              = hb_gt_wvt_Version;
   pFuncTable->Tone                 = hb_gt_wvt_Tone;
   pFuncTable->Info                 = hb_gt_wvt_Info;
   pFuncTable->SetDispCP            = hb_gt_wvt_SetDispCP;
   pFuncTable->SetKeyCP             = hb_gt_wvt_SetKeyCP;

   pFuncTable->PutChar              = hb_gt_wvt_PutChar;

   pFuncTable->ReadKey              = hb_gt_wvt_ReadKey;

   pFuncTable->MouseIsPresent       = hb_gt_wvt_mouse_IsPresent;
   pFuncTable->MouseGetPos          = hb_gt_wvt_mouse_GetPos;
   pFuncTable->MouseButtonState     = hb_gt_wvt_mouse_ButtonState;
   pFuncTable->MouseCountButton     = hb_gt_wvt_mouse_CountButton;

   pFuncTable->GfxPrimitive         = hb_gt_wvt_gfx_Primitive;

/*                     MULTI WINDOW GT                    */
/* pFuncTable->WndCreate            = hb_gt_wvt_wnd_Create;
   pFuncTable->WndDestroy           = hb_gt_wvt_wnd_Destroy;
   pFuncTable->WndSelect            = hb_gt_wvt_wnd_Select;
   pFuncTable->WndCurrent           = hb_gt_wvt_wnd_Current; */
/*                     MULTI WINDOW GT                    */

   return TRUE;
}

/* ********************************************************************** */

static const HB_GT_INIT gtInit = { HB_GT_DRVNAME( HB_GT_NAME ),
                                   hb_gt_FuncInit,
                                   HB_GTSUPER,
                                   HB_GTID_PTR };

HB_GT_ANNOUNCE( HB_GT_NAME )

HB_CALL_ON_STARTUP_BEGIN( _hb_startup_gt_Init_ )
   hb_gtRegister( >Init );
HB_CALL_ON_STARTUP_END( _hb_startup_gt_Init_ )

#if defined( HB_PRAGMA_STARTUP )
   #pragma startup _hb_startup_gt_Init_
#elif defined( HB_MSC_STARTUP )
   #if defined( HB_OS_WIN_64 )
      #pragma section( HB_MSC_START_SEGMENT, long, read )
   #endif
   #pragma data_seg( HB_MSC_START_SEGMENT )
   static HB_$INITSYM hb_vm_auto__hb_startup_gt_Init_ = _hb_startup_gt_Init_;
gtwvg.c3183
STATIC VOIDhb_wvt_gtCreateObjects( PHB_GTWVT pWVT )
static void hb_wvt_gtCreateObjects( PHB_GTWVT pWVT )
{
   LOGBRUSH    lb;
   HINSTANCE   h;
   int         iIndex;

   pWVT->bResizing          = FALSE;

   pWVT->penWhite           = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 255,255,255 ) );
   pWVT->penBlack           = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB(   0,  0,  0 ) );
   pWVT->penWhiteDim        = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 205,205,205 ) );
   pWVT->penDarkGray        = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB( 150,150,150 ) );
   pWVT->penGray            = CreatePen( PS_SOLID, 0, ( COLORREF ) pWVT->COLORS[ 7 ] );
   pWVT->penNull            = CreatePen( PS_NULL , 0, ( COLORREF ) pWVT->COLORS[ 7 ] );

   pWVT->currentPen         = CreatePen( PS_SOLID, 0, ( COLORREF ) RGB(   0,  0,  0 ) );

   lb.lbStyle               = BS_NULL;
   lb.lbColor               = RGB( 198,198,198 );
   lb.lbHatch               = 0;
   pWVT->currentBrush       = CreateBrushIndirect( &lb );

   lb.lbStyle               = BS_HATCHED;
   lb.lbColor               = RGB( 210,210,210 );
   lb.lbHatch               = HS_DIAGCROSS; // HS_BDIAGONAL;
   pWVT->diagonalBrush      = CreateHatchBrush( HS_DIAGCROSS, RGB( 210,210,210 ) ); //CreateBrushIndirect( &lb );

   lb.lbStyle               = BS_SOLID;
   lb.lbColor               = 0; // NULL;  // RGB( 0,0,0 );
   lb.lbHatch               = 0;
   pWVT->solidBrush         = CreateSolidBrush( RGB( 0,0,0 ) ); //CreateBrushIndirect( &lb );

   lb.lbStyle               = BS_SOLID;
   lb.lbColor               = pWVT->COLORS[ 7 ];
   lb.lbHatch               = 0;
   pWVT->wvtWhiteBrush      = CreateSolidBrush( pWVT->COLORS[ 7 ] ); //CreateBrushIndirect( &lb );


   /* GUI members of global structure */
   pWVT->LastMenuEvent      = 0;
   pWVT->MenuKeyEvent       = 1024;

   pWVT->InvalidateWindow   = TRUE;
   pWVT->EnableShortCuts    = FALSE;
   pWVT->pSymWVT_PAINT      = hb_dynsymFind( "WVT_PAINT"     );
   pWVT->pSymWVT_SETFOCUS   = hb_dynsymFind( "WVT_SETFOCUS"  );
   pWVT->pSymWVT_KILLFOCUS  = hb_dynsymFind( "WVT_KILLFOCUS" );
   pWVT->pSymWVT_MOUSE      = hb_dynsymFind( "WVT_MOUSE"     );
   pWVT->pSymWVT_TIMER      = hb_dynsymFind( "WVT_TIMER"     );
   pWVT->pSymWVT_KEY        = hb_dynsymFind( "WVT_KEY"       );
   pWVT->rowStart           = 0;
   pWVT->rowStop            = 0;
   pWVT->colStart           = 0;
   pWVT->colStop            = 0;
   pWVT->bToolTipActive     = FALSE;

   h = LoadLibraryEx( TEXT( "msimg32.dll" ), NULL, 0 );
   if( h )
   {
      /* workaround for wrong declarations in some old C compilers */
#if defined( UNICODE ) && defined( GetProcAddress )
      pWVT->pfnGF = ( wvtGradientFill ) GetProcAddressW( h, TEXT( "GradientFill" ) );
#else
      pWVT->pfnGF = ( wvtGradientFill ) GetProcAddress( h, "GradientFill" );
#endif
      if( pWVT->pfnGF )
      {
         pWVT->hMSImg32 = h;
      }
   }

   for( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
   {
      pWVT->hDlgModeless[ iIndex ] = NULL;
      pWVT->pFunc[ iIndex ]        = NULL;
      pWVT->iType[ iIndex ]        = 0;
   }
   for( iIndex = 0; iIndex < WVT_DLGMD_MAX; iIndex++ )
   {
      pWVT->hDlgModal[ iIndex ]    = NULL;
      pWVT->pFuncModal[ iIndex ]   = NULL;
      pWVT->iTypeModal[ iIndex ]   = 0;
   }

   pWVT->bGui                      = FALSE;
   pWVT->bPaint                    = FALSE;
   pWVT->bGetFocus                 = FALSE;
   pWVT->bSetFocus                 = FALSE;
   pWVT->bKillFocus                = FALSE;
}
gtwvg.c3252
STATIC VOIDhb_wvt_gtExitGui( PHB_GTWVT pWVT )
static void hb_wvt_gtExitGui( PHB_GTWVT pWVT )
{
   int i;

   for( i = 0; i < WVT_DLGML_MAX; i++ )
   {
      if( pWVT->hDlgModeless[ i ] )
      {
         SendMessage( pWVT->hDlgModeless[ i ], WM_CLOSE, 0, 0 );
         pWVT->hDlgModeless[ i ] = NULL;
      }
   }

   DeleteObject( ( HPEN   ) pWVT->penWhite      );
   DeleteObject( ( HPEN   ) pWVT->penWhiteDim   );
   DeleteObject( ( HPEN   ) pWVT->penBlack      );
   DeleteObject( ( HPEN   ) pWVT->penDarkGray   );
   DeleteObject( ( HPEN   ) pWVT->penGray       );
   DeleteObject( ( HPEN   ) pWVT->penNull       );
   DeleteObject( ( HPEN   ) pWVT->currentPen    );
   DeleteObject( ( HBRUSH ) pWVT->currentBrush  );
   DeleteObject( ( HBRUSH ) pWVT->diagonalBrush );
   DeleteObject( ( HBRUSH ) pWVT->solidBrush    );
   DeleteObject( ( HBRUSH ) pWVT->wvtWhiteBrush );

   if( pWVT->hdc )
   {
      ReleaseDC( pWVT->hWnd, pWVT->hdc );
      pWVT->hdc = NULL;
   }
   if( pWVT->hFont )
   {
      DeleteObject( pWVT->hFont );
   }
   if( pWVT->hWndTT )
   {
      DestroyWindow( pWVT->hWndTT );
   }
   if( pWVT->hCompDC )
   {
      DeleteDC( pWVT->hCompDC );
      pWVT->hCompDC = NULL;
   }
   if( pWVT->hGuiDC )
   {
      DeleteDC( pWVT->hGuiDC );
      pWVT->hGuiDC = NULL;
   }
   if( pWVT->hGuiBmp )
   {
      DeleteObject( pWVT->hGuiBmp );
      pWVT->hGuiBmp = NULL;
   }

   for( i = 0; i < WVT_PICTURES_MAX; i++ )
   {
      if( pWVT->iPicture[ i ] )
      {
         pWVT->iPicture[ i ]->lpVtbl->Release( pWVT->iPicture[ i ] );
         pWVT->iPicture[ i ] = NULL;
      }
   }
   for( i = 0; i < WVT_FONTS_MAX; i++ )
   {
      if( pWVT->hUserFonts[ i ] )
      {
         DeleteObject( pWVT->hUserFonts[ i ] );
         pWVT->hUserFonts[ i ] = NULL;
      }
   }
   for( i = 0; i < WVT_PENS_MAX; i++ )
   {
      if( pWVT->hUserPens[ i ] )
      {
         DeleteObject( pWVT->hUserPens[ i ] );
         pWVT->hUserPens[ i ] = NULL;
      }
   }
   if( pWVT->hMSImg32 )
   {
      FreeLibrary( pWVT->hMSImg32 );
      pWVT->hMSImg32 = NULL;
   }
}
gtwvg.c3343
STATIC VOIDhb_wvt_gtInitGui( PHB_GTWVT pWVT )
static void hb_wvt_gtInitGui( PHB_GTWVT pWVT )
{
   pWVT->iGuiWidth  = pWVT->COLS * pWVT->PTEXTSIZE.x;
   pWVT->iGuiHeight = pWVT->ROWS * pWVT->PTEXTSIZE.y;

   if( pWVT->hGuiDC )
   {
      DeleteDC( pWVT->hGuiDC );
   }
   pWVT->hGuiDC = CreateCompatibleDC( pWVT->hdc );

   if( pWVT->hGuiBmp )
   {
      DeleteObject( pWVT->hGuiBmp );
   }
   pWVT->hGuiBmp = CreateCompatibleBitmap( pWVT->hdc, pWVT->iGuiWidth, pWVT->iGuiHeight );

   SelectObject( pWVT->hGuiDC, pWVT->hGuiBmp );
   SetTextCharacterExtra( pWVT->hGuiDC,0 );
   SelectObject( pWVT->hGuiDC, pWVT->hFont );
}
gtwvg.c3428
STATIC VOIDhb_wvt_gtRestGuiState( PHB_GTWVT pWVT, LPRECT rect )
static void hb_wvt_gtRestGuiState( PHB_GTWVT pWVT, LPRECT rect )
{
   if( pWVT->bGui )
      BitBlt( pWVT->hdc, rect->left, rect->top,
              rect->right - rect->left, rect->bottom - rect->top,
              pWVT->hGuiDC, rect->left, rect->top, SRCCOPY );
}
gtwvg.c3450
STATIC VOIDhb_wvt_gtSaveGuiState( PHB_GTWVT pWVT )
static void hb_wvt_gtSaveGuiState( PHB_GTWVT pWVT )
{
   if( pWVT->bGui )
   {
      RECT rc = { 0, 0, 0, 0 };

      GetClientRect( pWVT->hWnd, &rc );
      pWVT->iGuiWidth = rc.right - rc.left;
      pWVT->iGuiHeight = rc.bottom - rc.top;
      if( pWVT->hGuiBmp )
      {
         DeleteObject( pWVT->hGuiBmp );
      }
      pWVT->hGuiBmp = CreateCompatibleBitmap( pWVT->hdc, pWVT->iGuiWidth, pWVT->iGuiHeight );

      SelectObject( pWVT->hGuiDC, pWVT->hGuiBmp );
      SetTextCharacterExtra( pWVT->hGuiDC,0 );
      SelectObject( pWVT->hGuiDC, pWVT->hFont );
   }
}
gtwvg.c3458
STATIC VOIDhb_wvt_gtHandleMenuSelection( PHB_GTWVT pWVT, int menuIndex )
static void hb_wvt_gtHandleMenuSelection( PHB_GTWVT pWVT, int menuIndex )
{
   pWVT->LastMenuEvent = menuIndex;
   hb_gt_wvt_AddCharToInputQueue( pWVT, pWVT->MenuKeyEvent );
}
gtwvg.c3479
STATIC VOIDhb_wvt_gtCreateToolTipWindow( PHB_GTWVT pWVT )
static void hb_wvt_gtCreateToolTipWindow( PHB_GTWVT pWVT )
{
   INITCOMMONCONTROLSEX icex;
   HWND                 hwndTT;
   TOOLINFO             ti;

   /* Load the tooltip class from the DLL. */
   icex.dwSize = sizeof( icex );
   icex.dwICC  = ICC_BAR_CLASSES;

   if( !InitCommonControlsEx( &icex ) )
   {
      return;
   }

   /* Create the tooltip control. */
   hwndTT = CreateWindow( TOOLTIPS_CLASS, TEXT( "" ),
                          WS_POPUP | TTS_ALWAYSTIP ,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL,
                          ( HMENU ) NULL,
                          ( HINSTANCE ) s_hInstance,
                          NULL );
   SetWindowPos( hwndTT,
                 HWND_TOPMOST,
                 0,
                 0,
                 0,
                 0,
                 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE );

   /* Prepare TOOLINFO structure for use as tracking tooltip. */
   ti.cbSize    = sizeof( TOOLINFO );
   ti.uFlags    = TTF_SUBCLASS;
   ti.hwnd      = pWVT->hWnd;
   ti.uId       = 100000;
   ti.hinst     = ( HINSTANCE ) s_hInstance;
   ti.lpszText  = TEXT( "" );
   ti.rect.left = ti.rect.top = ti.rect.bottom = ti.rect.right = 0;

   /* Add the tool to the control, displaying an error if needed. */
   if( SendMessage( hwndTT, TTM_ADDTOOL, 0, ( LPARAM ) &ti ) )
      pWVT->hWndTT = hwndTT;
}
gtwvg.c3485
PHB_GTWVThb_wvt_gtGetWVT( void )
PHB_GTWVT hb_wvt_gtGetWVT( void )
{
   PHB_GTWVT pWVT = NULL;
   PHB_GT pGT = hb_gt_Base();

   if( pGT )
   {
      pWVT = HB_GTWVT_GET( pGT );
      hb_gt_BaseFree( pGT );
   }
   return pWVT;
}
gtwvg.c3541
wvgcore.c
TypeFunctionSourceLine
HB_FUNCWVT_CORE(void)
HB_FUNC( WVT_CORE )
{
   //  Retained for legacy code.
}
wvgcore.c95
HB_EXPORT VOIDhb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib )
HB_EXPORT void hb_wvt_GetStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib )
{
   USHORT irow, icol, j;

   HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_GetStringAttrib( %hu, %hu, %hu, %hu, %p, %p )", top, left, bottom, right, sBuffer, sAttrib ) );

   for( j = 0, irow = top; irow <= bottom; irow++ )
   {
      for( icol = left; icol <= right; icol++ )
      {
         BYTE bColor, bAttr;
         USHORT usChar;

         if( !hb_gtGetScrChar( irow, icol, &bColor, &bAttr, &usChar ) )
            break;

         sBuffer[ j ] = ( BYTE ) usChar;
         sAttrib[ j ] = bColor;
         j++;
      }
   }
}
wvgcore.c102
HB_EXPORT VOIDhb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib )
HB_EXPORT void hb_wvt_PutStringAttrib( USHORT top, USHORT left, USHORT bottom, USHORT right, BYTE * sBuffer, BYTE * sAttrib )
{
   USHORT irow, icol, j;

   HB_TRACE( HB_TR_DEBUG, ( "hb_wvt_PutStringAttrib( %hu, %hu, %hu, %hu, %p, %p )", top, left, bottom, right, sBuffer, sAttrib ) );

   hb_gtBeginWrite();
   for( j = 0, irow = top; irow <= bottom; irow++ )
   {
      for( icol = left; icol <= right; icol++ )
      {
         if( !hb_gtPutScrChar( irow, icol, sAttrib[ j ], 0, sBuffer[ j ] ) )
            break;
         j++;
      }
   }
   hb_gtEndWrite();
}
wvgcore.c127
HB_EXPORT IPICTURE *hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection )
HB_EXPORT IPicture * hb_wvt_gtLoadPictureFromResource( LPCSTR cResource, LPCSTR cSection )
{
   HRSRC  res      = 0;
   LPVOID iPicture = NULL;
   LPTSTR resource = HB_TCHAR_CONVTO( ( LPSTR ) cResource );
   LPTSTR section  = HB_TCHAR_CONVTO( ( LPSTR ) cSection );
   HANDLE hInstance;

   if( hb_winmainArgGet( &hInstance, NULL, NULL ) )
      res = FindResource( ( HINSTANCE ) hInstance, resource, section );

   if( res )
   {
      IStream *iStream  = NULL;
      HGLOBAL mem       = LoadResource( GetModuleHandle( NULL ), res );
      void    *data     = LockResource( mem );
      size_t  nFileSize = SizeofResource( GetModuleHandle( NULL ), res );
      HGLOBAL hGlobal   = GlobalAlloc( GMEM_MOVEABLE, nFileSize );
      LPVOID  pvData    = GlobalLock( hGlobal );

      memcpy( pvData, data, nFileSize );

      GlobalUnlock( hGlobal );

      CreateStreamOnHGlobal( hGlobal, TRUE, &iStream );

      OleLoadPicture( iStream, nFileSize, TRUE, HB_ID_REF( REFIID, IID_IPicture ), &iPicture );

      FreeResource( mem );
   }

   HB_TCHAR_FREE( resource );
   HB_TCHAR_FREE( section );

   return ( IPicture * ) iPicture;
}
wvgcore.c146
HB_EXPORT IPICTURE *hb_wvt_gtLoadPicture( char * cImage )
HB_EXPORT IPicture * hb_wvt_gtLoadPicture( char * cImage )
{
   IStream  *iStream;
   LPVOID   iPicture = NULL;
   HGLOBAL  hGlobal;
   HANDLE   hFile;
   DWORD    nFileSize;
   DWORD    nReadByte;
   LPTSTR   image = HB_TCHAR_CONVTO( cImage );

   hFile = CreateFile( image, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
   if( hFile != INVALID_HANDLE_VALUE )
   {
      nFileSize = GetFileSize( hFile, NULL );

      if( nFileSize != INVALID_FILE_SIZE )
      {
         hGlobal = GlobalAlloc( GPTR, nFileSize );

         if( hGlobal )
         {
            if( ReadFile( hFile, hGlobal, nFileSize, &nReadByte, NULL ) )
            {
               CreateStreamOnHGlobal( hGlobal, TRUE, &iStream );
               OleLoadPicture( iStream, nFileSize, TRUE, HB_ID_REF( REFIID, IID_IPicture ), &iPicture );
            }
            GlobalFree( hGlobal );
         }
      }
      CloseHandle( hFile );
   }

   HB_TCHAR_FREE( image );

   return ( IPicture * ) iPicture;
}
wvgcore.c189
BOOL HB_EXPORThb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture )
BOOL HB_EXPORT hb_wvt_gtRenderPicture( int x1, int y1, int wd, int ht, IPicture * iPicture )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   LONG     lWidth, lHeight;
   int      x, y, xe, ye;
   int      c   = x1;
   int      r   = y1;
   int      dc  = wd;
   int      dr  = ht;
   int      tor =  0;
   int      toc =  0;
   HRGN     hrgn1;
   POINT    lpp;
   BOOL     bResult = FALSE;

   if( iPicture )
   {
      iPicture->lpVtbl->get_Width( iPicture,&lWidth );
      iPicture->lpVtbl->get_Height( iPicture,&lHeight );

      if( dc  == 0 )
      {
         dc = ( int ) ( ( float ) dr * lWidth  / lHeight );
      }
      if( dr  == 0 )
      {
         dr = ( int ) ( ( float ) dc * lHeight / lWidth  );
      }
      if( tor == 0 )
      {
         tor = dr;
      }
      if( toc == 0 )
      {
         toc = dc;
      }
      x  = c;
      y  = r;
      xe = c + toc - 1;
      ye = r + tor - 1;

      GetViewportOrgEx( _s->hdc, &lpp );

      hrgn1 = CreateRectRgn( c+lpp.x, r+lpp.y, xe+lpp.x, ye+lpp.y );
      SelectClipRgn( _s->hdc, hrgn1 );

      while( x < xe )
      {
         while( y < ye )
         {
            iPicture->lpVtbl->Render( iPicture, _s->hdc, x, y, dc, dr, 0, lHeight, lWidth, -lHeight, NULL );
            y += dr;
         }
         y =  r;
         x += dc;
      }

      SelectClipRgn( _s->hdc, NULL );
      DeleteObject( hrgn1 );

      if( _s->bGui )
      {
         x  = c;
         y  = r;
         xe = c + toc - 1;
         ye = r + tor - 1;

         GetViewportOrgEx( _s->hGuiDC, &lpp );

         hrgn1 = CreateRectRgn( c+lpp.x, r+lpp.y, xe+lpp.x, ye+lpp.y );
         SelectClipRgn( _s->hGuiDC, hrgn1 );

         while( x < xe )
         {
            while( y < ye )
            {
               iPicture->lpVtbl->Render( iPicture, _s->hGuiDC, x, y, dc, dr, 0, lHeight, lWidth, -lHeight, NULL );
               y += dr;
            }
            y =  r;
            x += dc;
         }

         SelectClipRgn( _s->hGuiDC, NULL );
         DeleteObject( hrgn1 );
      }

      bResult = TRUE;
   }

   return bResult;
}
wvgcore.c228
BOOL HB_EXPORThb_wvt_gtDestroyPicture( IPicture * iPicture )
BOOL HB_EXPORT hb_wvt_gtDestroyPicture( IPicture * iPicture )
{
   BOOL bResult = FALSE;

   if( iPicture )
   {
      iPicture->lpVtbl->Release( iPicture );
      bResult = TRUE;
   }

   return bResult;
}
wvgcore.c324
POINT HB_EXPORThb_wvt_gtGetXYFromColRow( USHORT col, USHORT row )
POINT  HB_EXPORT hb_wvt_gtGetXYFromColRow( USHORT col, USHORT row )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy;

   xy.x = col * _s->PTEXTSIZE.x;
   xy.y = row * _s->PTEXTSIZE.y;

   return xy;
}
wvgcore.c339
HB_EXPORT BOOL CALLBACKhb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
HB_EXPORT BOOL CALLBACK hb_wvt_gtDlgProcMLess( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int      iIndex, iType;
   long int lReturn = 0;
   PHB_ITEM pFunc = NULL;

   iType = 0;

   for ( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
   {
      if ( ( _s->hDlgModeless[ iIndex ] != NULL ) && ( _s->hDlgModeless[ iIndex ] == hDlg ) )
      {
         if ( _s->pFunc[ iIndex ] != NULL )
         {
            pFunc = _s->pFunc[ iIndex ];
            iType = _s->iType[ iIndex ];
         }
         break;
      }
   }

   if ( pFunc )
   {
      switch ( iType )
      {
         case 1:  /* Function Name */
            if( hb_vmRequestReenter() )
            {
               hb_vmPushDynSym( ( PHB_DYNS ) pFunc );
               hb_vmPushNil();
               hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hDlg );
               hb_vmPushNumInt( message );
               hb_vmPushNumInt( wParam );
               hb_vmPushNumInt( lParam );
               hb_vmDo( 4 );
               lReturn = hb_parnl( -1 );
               hb_vmRequestRestore();
            }
            break;

         case 2:  /* Block */
            /* eval the codeblock */
            if ( HB_IS_BLOCK( pFunc ) )
            {
               if( hb_vmRequestReenter() )
               {
                  hb_vmPushEvalSym();
                  hb_vmPush( _s->pFunc[ iIndex ] );
                  hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hDlg );
                  hb_vmPushNumInt( message );
                  hb_vmPushNumInt( wParam );
                  hb_vmPushNumInt( lParam );
                  hb_vmSend( 4 );
                  lReturn = hb_parnl( -1 );
                  hb_vmRequestRestore();
               }
            }
            else
            {
               /* TODO: internal error: missing codeblock */
            }
            break;
      }
   }

   switch( message )
   {
      case WM_COMMAND:
         switch( LOWORD( wParam ) )
         {
            case IDOK:
               DestroyWindow( hDlg );
               lReturn = 1;
               break;

            case IDCANCEL:
               DestroyWindow( hDlg );
               lReturn = 0;
               break;
         }
         break;

      case WM_CLOSE:
         DestroyWindow( hDlg );
         lReturn = 0;
         break;

      case WM_NCDESTROY:
         if ( _s->pFunc[ iIndex ] != NULL && _s->iType[ iIndex ] == 2 )
         {
            hb_itemRelease( ( PHB_ITEM ) _s->pFunc[ iIndex ] );
         }
         _s->hDlgModeless[ iIndex ] = NULL;
         _s->pFunc[ iIndex ] = NULL;
         _s->iType[ iIndex ] = 0;
         lReturn = 0;
         break;
   }

   return lReturn;
}
wvgcore.c357
HB_EXPORT BOOL CALLBACKhb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
HB_EXPORT BOOL CALLBACK hb_wvt_gtDlgProcModal( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int      iIndex, iType;
   long int lReturn = 0;
   PHB_ITEM pFunc   = NULL;
   int      iFirst  = ( int ) lParam;

   if ( iFirst > 0 && iFirst <= WVT_DLGMD_MAX )
   {
      _s->hDlgModal[ iFirst-1 ] = hDlg ;
      SendMessage( hDlg, WM_INITDIALOG, 0, 0 );
      return lReturn;
   }

   iType = 0;

   for ( iIndex = 0; iIndex < WVT_DLGMD_MAX; iIndex++ )
   {
      if ( ( _s->hDlgModal[ iIndex ] != NULL ) && ( _s->hDlgModal[ iIndex ] == hDlg ) )
      {
         if ( _s->pFuncModal[ iIndex ] != NULL )
         {
            pFunc = _s->pFuncModal[ iIndex ];
            iType = _s->iTypeModal[ iIndex ];
         }
         break;
      }
   }

   if ( pFunc )
   {
      switch ( iType )
      {
         case 1:  /* Function Name */
            if( hb_vmRequestReenter() )
            {
               hb_vmPushDynSym( ( PHB_DYNS ) pFunc );
               hb_vmPushNil();
               hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hDlg );
               hb_vmPushNumInt( message );
               hb_vmPushNumInt( wParam );
               hb_vmPushNumInt( lParam );
               hb_vmDo( 4 );
               lReturn = hb_parnl( -1 );
               hb_vmRequestRestore();
            }
            break;

         case 2:  /* Block */
            /* eval the codeblock */
            if ( HB_IS_BLOCK( pFunc ) )
            {
               if( hb_vmRequestReenter() )
               {
                  hb_vmPushEvalSym();
                  hb_vmPush( pFunc );
                  hb_vmPushNumInt( ( HB_LONG ) ( HB_PTRDIFF ) hDlg );
                  hb_vmPushNumInt( message );
                  hb_vmPushNumInt( wParam );
                  hb_vmPushNumInt( lParam );
                  hb_vmSend( 4 );
                  lReturn = hb_parnl( -1 );
                  hb_vmRequestRestore();
               }
            }
            else
            {
               /* TODO: internal error: missing codeblock */
            }
            break;
      }
   }

   switch( message )
   {
      case WM_COMMAND:
         switch( LOWORD( wParam ) )
         {
            case IDOK:
               EndDialog( hDlg, IDOK );
               lReturn = 0;
               break;

            case IDCANCEL:
               EndDialog( hDlg, IDCANCEL );
               lReturn = 0;
               break;
         }
         break;

      case WM_CLOSE:
         EndDialog( hDlg, IDCANCEL );
         lReturn = 0;
         break;

      case WM_NCDESTROY:
         if ( _s->pFuncModal[ iIndex ] != NULL && _s->iTypeModal[ iIndex ] == 2 )
         {
            hb_itemRelease( ( PHB_ITEM ) _s->pFuncModal[ iIndex ] );
         }
         _s->hDlgModal[ iIndex ]  = NULL;
         _s->pFuncModal[ iIndex ] = NULL;
         _s->iTypeModal[ iIndex ] = 0;
         lReturn = 0;
         break;
   }

   return lReturn;
}
wvgcore.c463
HB_EXPORT BOOLhb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image )
HB_EXPORT BOOL hb_wvt_DrawImage( HDC hdc, int x1, int y1, int wd, int ht, char * image )
{
  HGLOBAL  hGlobal;
  HANDLE   hFile;
  DWORD    nFileSize;
  DWORD    nReadByte;
  LONG     lWidth,lHeight;
  int      x,y,xe,ye;
  int      c   = x1 ;
  int      r   = y1 ;
  int      dc  = wd ;
  int      dr  = ht ;
  int      tor =  0 ;
  int      toc =  0 ;
  HRGN     hrgn1;
  POINT    lpp = { 0,0 };
  BOOL     bResult = FALSE;
  LPTSTR   lpImage = HB_TCHAR_CONVTO( image );

  hFile = CreateFile( lpImage, GENERIC_READ, 0, NULL, OPEN_EXISTING,
                                      FILE_ATTRIBUTE_NORMAL, NULL );
  HB_TCHAR_FREE( lpImage );

  if ( hFile != INVALID_HANDLE_VALUE )
  {
    nFileSize = GetFileSize( hFile, NULL );

    if ( nFileSize != INVALID_FILE_SIZE )
    {
      hGlobal = GlobalAlloc( GPTR, nFileSize );

      if ( hGlobal )
      {
        if ( ReadFile( hFile, hGlobal, nFileSize, &nReadByte, NULL ) )
        {
          IStream  *iStream;
          IPicture *iPicture;
          IPicture ** iPictureRef = &iPicture;

          CreateStreamOnHGlobal( hGlobal, TRUE, &iStream );
          OleLoadPicture( iStream, nFileSize, TRUE, HB_ID_REF( REFIID, IID_IPicture ), ( LPVOID * ) iPictureRef );

          if ( iPicture )
          {
            iPicture->lpVtbl->get_Width( iPicture,&lWidth );
            iPicture->lpVtbl->get_Height( iPicture,&lHeight );

            if ( dc  == 0 )
            {
              dc = ( int ) ( ( float ) dr * lWidth  / lHeight );
            }
            if ( dr  == 0 )
            {
              dr = ( int ) ( ( float ) dc * lHeight / lWidth  );
            }
            if ( tor == 0 )
            {
              tor = dr;
            }
            if ( toc == 0 )
            {
              toc = dc;
            }
            x  = c;
            y  = r;
            xe = c + toc - 1;
            ye = r + tor - 1;

            GetViewportOrgEx( hdc, &lpp );

            hrgn1 = CreateRectRgn( c+lpp.x, r+lpp.y, xe+lpp.x, ye+lpp.y );
            SelectClipRgn( hdc, hrgn1 );

            while ( x < xe )
            {
              while ( y < ye )
              {
                iPicture->lpVtbl->Render( iPicture, hdc, x, y, dc, dr, 0,
                                          lHeight, lWidth, -lHeight, NULL );
                y += dr;
              }
              y =  r;
              x += dc;
            }

            SelectClipRgn( hdc, NULL );
            DeleteObject( hrgn1 );

            iPicture->lpVtbl->Release( iPicture );
            bResult = TRUE ;
          }
        }
        GlobalFree( hGlobal );
      }
    }
    CloseHandle( hFile );
  }
  return( bResult );
}
wvgcore.c577
STATIC VOIDhb_wvt_DrawBoxRaised( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawBoxRaised( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penWhiteDim );
   MoveToEx( hdc, iLeft, iTop, NULL );        //  Top Inner
   LineTo( hdc, iRight, iTop );
   MoveToEx( hdc, iLeft, iTop, NULL );        //  Left Inner
   LineTo( hdc, iLeft, iBottom );

   SelectObject( hdc, _s->penWhite );
   MoveToEx( hdc, iLeft-1, iTop-1, NULL );    //  Top Outer
   LineTo( hdc, iRight+1, iTop-1 );
   MoveToEx( hdc, iLeft-1, iTop-1, NULL );    //  Left Outer
   LineTo( hdc, iLeft-1, iBottom+1 );

   SelectObject( hdc, _s->penDarkGray );
   MoveToEx( hdc, iLeft, iBottom, NULL );     //  Bottom Inner
   LineTo( hdc, iRight, iBottom );
   MoveToEx( hdc, iRight, iBottom, NULL );    //  Right Inner
   LineTo( hdc, iRight, iTop );

   SelectObject( hdc, _s->penBlack );
   MoveToEx( hdc, iLeft-1, iBottom+1, NULL ); //  Bottom Outer
   LineTo( hdc, iRight+1+1, iBottom+1 );
   MoveToEx( hdc, iRight+1, iTop-1, NULL );   //  Right Outer
   LineTo( hdc, iRight+1, iBottom+1 );
}
wvgcore.c679
STATIC VOIDhb_wvt_DrawBoxRecessed( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawBoxRecessed( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penWhiteDim );
   MoveToEx( hdc, iRight, iTop, NULL );            // Right Inner
   LineTo( hdc, iRight, iBottom );
   MoveToEx( hdc, iLeft, iBottom, NULL );          // Bottom Inner
   LineTo( hdc, iRight, iBottom );

   SelectObject( hdc, _s->penWhite );
   MoveToEx( hdc, iRight+1, iTop-1, NULL );        // Right Outer
   LineTo( hdc, iRight + 1, iBottom + 1 );
   MoveToEx( hdc, iLeft - 1, iBottom + 1, NULL );  // Bottom Outer
   LineTo( hdc, iRight + 2, iBottom + 1 );

   SelectObject( hdc, _s->penBlack );
   MoveToEx( hdc, iLeft, iTop, NULL );             // Left Inner
   LineTo( hdc, iLeft, iBottom );
   MoveToEx( hdc, iLeft, iTop, NULL );             // Top Inner
   LineTo( hdc, iRight, iTop );

   SelectObject( hdc, _s->penDarkGray );
   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );     // Left Outer
   LineTo( hdc, iLeft - 1 , iBottom + 1 );
   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );     // Top Outer
   LineTo( hdc, iRight + 1, iTop - 1 );
}
wvgcore.c710
STATIC VOIDhb_wvt_DrawOutline( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawOutline( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   MoveToEx( hdc, iLeft, iTop, NULL );             //  Top
   LineTo( hdc, iRight, iTop );

   MoveToEx( hdc, iLeft, iTop, NULL );             //  Left
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iBottom, NULL );          //  Bottom
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iRight, iTop, NULL );            //  Right
   LineTo( hdc, iRight, iBottom + 1);
}
wvgcore.c741
STATIC VOIDhb_wvt_DrawBoxGet( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawBoxGet( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penBlack );
   MoveToEx( hdc, iLeft-1 , iTop-1, NULL );        // Top Inner
   LineTo(   hdc, iRight-1, iTop-1       );
   MoveToEx( hdc, iLeft-1 , iTop-1, NULL );        // Left Inner
   LineTo(   hdc, iLeft-1 , iBottom-1    );

   SelectObject( hdc, _s->penDarkGray );
   MoveToEx( hdc, iLeft-2, iTop-2, NULL );         // Top Outer
   LineTo(   hdc, iRight , iTop-2       );
   MoveToEx( hdc, iLeft-2, iTop-2, NULL );         // Left Outer
   LineTo(   hdc, iLeft-2, iBottom      );
}
wvgcore.c758
STATIC VOIDhb_wvt_DrawBoxGroup( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawBoxGroup( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penDarkGray );

   MoveToEx( hdc, iRight, iTop, NULL );            // Right Inner
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iLeft, iBottom, NULL );          // Bottom Inner
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );     // Left Outer
   LineTo( hdc, iLeft - 1, iBottom + 1 );

   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );     // Top Outer
   LineTo( hdc, iRight + 1, iTop - 1 );


   SelectObject( hdc, _s->penWhite );

   MoveToEx( hdc, iRight + 1, iTop, NULL );        // Right Outer
   LineTo( hdc, iRight + 1, iBottom + 1 );

   MoveToEx( hdc, iLeft -1, iBottom + 1, NULL );   // Bottom Outer
   LineTo( hdc, iRight + 1 + 1, iBottom + 1);

   MoveToEx( hdc, iLeft, iTop, NULL );             // Left Inner
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );             // Top Inner
   LineTo( hdc, iRight, iTop );
}
wvgcore.c777
STATIC VOIDhb_wvt_DrawBoxGroupRaised( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawBoxGroupRaised( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penWhite );

   MoveToEx( hdc, iRight, iTop, NULL );           // Right Inner
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iLeft, iBottom, NULL );         // Bottom Inner
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );    // Left Outer
   LineTo( hdc, iLeft - 1, iBottom + 1 );

   MoveToEx( hdc, iLeft - 1, iTop - 1, NULL );    // Top Outer
   LineTo( hdc, iRight + 1, iTop - 1 );

   SelectObject( hdc, _s->penDarkGray );

   MoveToEx( hdc, iRight + 1, iTop, NULL );       // Right Outer
   LineTo( hdc, iRight + 1, iBottom + 1 );

   MoveToEx( hdc, iLeft -1, iBottom + 1, NULL );  // Bottom Outer
   LineTo( hdc, iRight + 1 + 1, iBottom + 1);

   MoveToEx( hdc, iLeft, iTop, NULL );            // Left Inner
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Top Inner
   LineTo( hdc, iRight, iTop );
}
wvgcore.c813
STATIC VOIDhb_wvt_DrawToolButtonFlat( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawToolButtonFlat( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penGray );

   MoveToEx( hdc, iRight, iTop, NULL );           // Right
   LineTo( hdc, iRight, iBottom + 1);

   MoveToEx( hdc, iLeft, iBottom, NULL );         // Bottom
   LineTo( hdc, iRight, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Left
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Top
   LineTo( hdc, iRight, iTop );
}
wvgcore.c848
STATIC VOIDhb_wvt_DrawToolButtonUp( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawToolButtonUp( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penBlack );

   MoveToEx( hdc, iRight, iTop, NULL );           // Right
   LineTo( hdc, iRight, iBottom+1 );

   MoveToEx( hdc, iLeft, iBottom, NULL );         // Bottom
   LineTo( hdc, iRight, iBottom );

   SelectObject( hdc, _s->penWhite );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Left
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Top
   LineTo( hdc, iRight, iTop );
}
wvgcore.c869
STATIC VOIDhb_wvt_DrawToolButtonDown( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
static void hb_wvt_DrawToolButtonDown( HDC hdc, int iTop, int iLeft, int iBottom, int iRight )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SelectObject( hdc, _s->penWhite );

   MoveToEx( hdc, iRight, iTop, NULL );           // Right
   LineTo( hdc, iRight, iBottom+1 );

   MoveToEx( hdc, iLeft, iBottom, NULL );         // Bottom
   LineTo( hdc, iRight, iBottom );

   SelectObject( hdc, _s->penBlack );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Left
   LineTo( hdc, iLeft, iBottom );

   MoveToEx( hdc, iLeft, iTop, NULL );            // Top
   LineTo( hdc, iRight, iTop );
}
wvgcore.c892
STATIC COLORREFhb_wvt_BgColorParam( int iParam )
static COLORREF hb_wvt_BgColorParam( int iParam )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   COLORREF color;

   if( ISNUM( iParam ) )
      color = ( COLORREF ) hb_parnl( iParam );
   else
   {
      int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - 1;
      if( iColor == -1 )
         iColor = hb_gtGetCurrColor();
      color = _s->COLORS[ ( ( iColor >> 4 ) & 0x0f ) ];
   }

   return color;
}
wvgcore.c913
STATIC COLORREFhb_wvt_FgColorParam( int iParam )
static COLORREF hb_wvt_FgColorParam( int iParam )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   COLORREF color;

   if( ISNUM( iParam ) )
      color = ( COLORREF ) hb_parnl( iParam );
   else
   {
      int iColor = ISCHAR( iParam ) ? hb_gtColorToN( hb_parc( iParam ) ) : - 1;
      if( iColor == -1 )
         iColor = hb_gtGetCurrColor();
      color = _s->COLORS[ ( ( iColor >> 4 ) & 0x0f ) ];
   }

   return color;
}
wvgcore.c932
HB_FUNCWVT_SETPEN(void)
HB_FUNC( WVT_SETPEN )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int      iPenWidth, iPenStyle;
   COLORREF crColor;
   HPEN     hPen;

   if ( ISNIL( 1 ) )
   {
      hb_retl( FALSE );
   }

   iPenStyle = hb_parni( 1 ) ;
   iPenWidth = ISNIL( 2 ) ? 0 : hb_parni( 2 );
   crColor   = ISNIL( 3 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 3 );

   hPen      = CreatePen( iPenStyle, iPenWidth, crColor );

   if ( hPen )
   {
      if ( _s->currentPen )
      {
         DeleteObject( _s->currentPen );
      }
      _s->currentPen = hPen;

      hb_retl( TRUE );
   }
   else
   {
      hb_retl( FALSE );
   }
}
wvgcore.c951
HB_FUNCWVT_SETBRUSH(void)
HB_FUNC( WVT_SETBRUSH )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   HBRUSH   hBrush;
   LOGBRUSH lb = { 0,0,0 };

   if ( ISNIL( 1 ) )
   {
      hb_retl( FALSE );
   }

   lb.lbStyle = hb_parnl( 1 );
   lb.lbColor = ISNIL( 2 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 2 ) ;
   lb.lbHatch = ISNIL( 3 ) ? 0 : hb_parnl( 3 );

   hBrush     = CreateBrushIndirect( &lb );

   if ( hBrush )
   {
      if ( _s->currentBrush )
      {
         DeleteObject( _s->currentBrush );
      }
      _s->currentBrush = hBrush;

      hb_retl( TRUE );
   }
   else
   {
      hb_retl( FALSE );
   }
}
wvgcore.c990
HB_FUNCWVT_DRAWBOXGET(void)
HB_FUNC( WVT_DRAWBOXGET )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy = { 0,0 };
   POINT yz = { 0,0 };

   xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );
   yz = hb_wvt_gtGetXYFromColRow( ( USHORT ) ( hb_parni( 2 ) + hb_parni( 3 ) ), ( USHORT ) hb_parni( 1 ) + 1 );

   hb_wvt_DrawBoxGet( _s->hdc, xy.y, xy.x, yz.y, yz.x );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxGet( _s->hGuiDC, xy.y, xy.x, yz.y, yz.x );
   }
}
wvgcore.c1028
HB_FUNCWVT_DRAWBOXRAISED(void)
HB_FUNC( WVT_DRAWBOXRAISED )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   hb_wvt_DrawBoxRaised( _s->hdc, iTop-1, iLeft-1, iBottom+1, iRight+1 );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop-1, iLeft-1, iBottom+1, iRight+1 );
   }
}
wvgcore.c1049
HB_FUNCWVT_DRAWBOXRECESSED(void)
HB_FUNC( WVT_DRAWBOXRECESSED )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   hb_wvt_DrawBoxRecessed( _s->hdc, iTop-1, iLeft-1, iBottom+1, iRight+1 );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxRecessed( _s->hGuiDC, iTop-1, iLeft-1, iBottom+1, iRight+1 );
   }
}
wvgcore.c1069
HB_FUNCWVT_DRAWBOXGROUP(void)
HB_FUNC( WVT_DRAWBOXGROUP )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   hb_wvt_DrawBoxGroup( _s->hdc, iTop, iLeft, iBottom, iRight );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxGroup( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
   }
}
wvgcore.c1089
HB_FUNCWVT_DRAWBOXGROUPRAISED(void)
HB_FUNC( WVT_DRAWBOXGROUPRAISED )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   hb_wvt_DrawBoxGroupRaised( _s->hdc, iTop, iLeft, iBottom, iRight );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxGroupRaised( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
   }
}
wvgcore.c1109
HB_FUNCWVT_DRAWIMAGE(void)
HB_FUNC( WVT_DRAWIMAGE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy = { 0,0 };
   int   iLeft, iTop, iRight, iBottom;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );
   iTop    = xy.y + hb_parni( 6,1 );
   iLeft   = xy.x + hb_parni( 6,2 ) ;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom = xy.y - 1 + hb_parni( 6,3 );
   iRight  = xy.x - 1 + hb_parni( 6,4 );

   if ( ISNUM( 5 ) )
   {
      hb_wvt_gtRenderPicture( iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, _s->iPicture[ hb_parni( 5 )-1 ] );
   }
   else
   {
      hb_wvt_DrawImage( _s->hdc, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ) ;
      if ( _s->bGui )
      {
         hb_wvt_DrawImage( _s->hGuiDC, iLeft, iTop, ( iRight - iLeft ) + 1, ( iBottom - iTop ) + 1, hb_parcx( 5 ) ) ;
      }
   }

   hb_retl( TRUE );
}
wvgcore.c1129
HB_FUNCWVT_DRAWLABEL(void)
HB_FUNC( WVT_DRAWLABEL )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT    xy = { 0,0 };
   HFONT    hFont, hOldFont, hOldFontGui;
   LOGFONT  logfont;// = { 0 };

   logfont.lfEscapement     = ( ISNIL(  5 ) ? 0 : ( hb_parni( 5 ) * 10 ) );
   logfont.lfOrientation    = 0;
   logfont.lfWeight         = ( ISNIL( 11 ) ? 0 : hb_parni( 11 ) );
   logfont.lfItalic         = ( ISNIL( 14 ) ? 0 : ( BYTE ) hb_parl( 14 ) );
   logfont.lfUnderline      = ( ISNIL( 15 ) ? 0 : ( BYTE ) hb_parl( 15 ) );
   logfont.lfStrikeOut      = ( ISNIL( 16 ) ? 0 : ( BYTE ) hb_parl( 16 ) );
   logfont.lfCharSet        = ( ISNIL( 13 ) ? ( BYTE ) _s->CodePage : ( BYTE ) hb_parni( 13 ) );
   logfont.lfOutPrecision   = 0;
   logfont.lfClipPrecision  = 0;
   logfont.lfQuality        = ( ISNIL( 12 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 12 ) );
   logfont.lfPitchAndFamily = FF_DONTCARE;
   logfont.lfHeight         = ( ISNIL(  9 ) ? _s->fontHeight : hb_parni(  9 ) );
   logfont.lfWidth          = ( ISNIL( 10 ) ? (_s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ) : hb_parni( 10 ) );

   //strcpy( logfont.lfFaceName, ( ISNIL( 8 ) ? _s->fontFace : hb_parcx( 8 ) ) );
   HB_TCHAR_CPTO( logfont.lfFaceName, ( ISNIL( 8 ) ? _s->fontFace : hb_parcx( 8 ) ), sizeof( logfont.lfFaceName )-1 );

   hFont = CreateFontIndirect( &logfont );
   if ( hFont )
   {
      LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) );
      COLORREF fgClr = hb_wvt_FgColorParam( 6 ),
               bgClr = hb_wvt_BgColorParam( 7 );

      xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );
      xy.x += hb_parni( 17,2 );
      xy.y += hb_parni( 17,1 );

      SetBkColor( _s->hdc, bgClr );
      SetTextColor( _s->hdc, fgClr );
      SetTextAlign( _s->hdc, ( ISNIL( 4 ) ? TA_LEFT : hb_parni( 4 ) ) );
      hOldFont = ( HFONT ) SelectObject( _s->hdc, hFont );

      //ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL );
      ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );

      SelectObject( _s->hdc, hOldFont );

      if ( _s->bGui )
      {
         SetBkColor( _s->hGuiDC, bgClr );
         SetTextColor( _s->hGuiDC, fgClr );
         SetTextAlign( _s->hGuiDC, ( ISNIL( 4 ) ? TA_LEFT : hb_parni( 4 ) ) );
         hOldFontGui = ( HFONT ) SelectObject( _s->hGuiDC, hFont );

         //ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL );
         ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );
         SelectObject( _s->hGuiDC, hOldFontGui );
      }
      HB_TCHAR_FREE( text );
      DeleteObject( hFont );
      hb_retl( TRUE );
   }

   hb_retl( FALSE );
}
wvgcore.c1164
HB_FUNCWVT_DRAWOUTLINE(void)
HB_FUNC( WVT_DRAWOUTLINE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   HPEN  hPen, hOldPen, hOldPenGUI;
   POINT xy = { 0,0 };
   int   iTop, iLeft, iBottom, iRight;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop    = xy.y - 1 + hb_parni( 8,1 );
   iLeft   = xy.x - 1 + hb_parni( 8,2 );
   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom = xy.y + hb_parni( 8,3 );
   iRight  = xy.x + hb_parni( 8,4 );

   hOldPenGUI = hOldPen = 0;

   if ( ISNUM( 5 ) )
   {
      hPen = CreatePen( hb_parni( 5 ), 0, ( ISNIL( 7 ) ? 0 : ( COLORREF ) hb_parnl( 7 ) ) );
      if ( hPen )
      {
         hOldPen = (HPEN) SelectObject( _s->hdc, hPen );
      }
   }
   else
   {
      hPen = 0;
      SelectObject( _s->hdc, _s->penBlack );
   }

   hb_wvt_DrawOutline( _s->hdc, iTop, iLeft, iBottom, iRight );
   if ( _s->bGui )
   {
      if ( hPen )
      {
         hOldPenGUI = (HPEN) SelectObject( _s->hGuiDC, hPen );
      }
      else
      {
         hOldPenGUI = (HPEN) SelectObject( _s->hGuiDC, _s->penBlack );
         hb_wvt_DrawOutline( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
      }
   }

   if ( hPen )
   {
      SelectObject( _s->hdc, hOldPen );
      if ( hOldPenGUI )
      {
         SelectObject( _s->hGuiDC, hOldPenGUI );
      }
      DeleteObject( hPen );
   }
}
wvgcore.c1235
HB_FUNCWVT_DRAWLINE(void)
HB_FUNC( WVT_DRAWLINE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 11,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 11,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 11,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 11,4 );

   int      iOrient, iFormat, iAlign, iStyle, iThick;
   int      x, y, iOffset;
   COLORREF cr;
   HPEN     hPen, hOldPen, hOldPenGUI;

   //   Resolve Parameters
   iOrient = ISNIL( 5 ) ? 0 : hb_parni( 5 );
   iFormat = ISNIL( 6 ) ? 0 : hb_parni( 6 );
   iAlign  = ISNIL( 7 ) ? 0 : hb_parni( 7 );
   iStyle  = ISNIL( 8 ) ? 0 : hb_parni( 8 );
   iThick  = ISNIL( 9 ) ? 0 : hb_parni( 9 );
   cr      = ISNIL(10 ) ? 0 : ( COLORREF ) hb_parnl( 10 );

   x       = iLeft ;
   y       = iTop ;

   switch ( iAlign )
   {
      case 0:                  // Center
         if ( iOrient == 0 )   // Horizontal
         {
            iOffset = ( ( iBottom - iTop ) / 2 ) ;
            y       = iTop + iOffset ;
         }
         else
         {
            iOffset = ( ( iRight - iLeft ) / 2 ) ;
            x       = iLeft + iOffset ;
         }
         break;

      case 1:                  // Top
         break;

      case 2:                  // bottom
         if ( iFormat == 0 || iFormat == 1 )  // Raised/Recessd
         {
            y = iBottom - 1;
         }
         else
         {
            y = iBottom;
         }
         break;

      case 3:                  // Left
         break;

      case 4:                  // Right
         if ( iFormat == 0 || iFormat == 1 )  // Raised/Recessd
         {
            x = iRight - 1;
         }
         else
         {
            x = iRight;
         }
         break;
   }

   hPen = CreatePen( iStyle, iThick, cr );
   hOldPen = (HPEN) SelectObject( _s->hdc, hPen );
   hOldPenGUI = _s->bGui ? (HPEN) SelectObject( _s->hGuiDC, hPen ) : 0;

   switch ( iFormat )
   {
      case 0:                                       // Raised
      {
         if ( iOrient == 0 )                        //  Horizontal
         {
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y+1, NULL );
            LineTo( _s->hdc, iRight, y+1 );

            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y+1, NULL );
               LineTo( _s->hGuiDC, iRight, y+1 );
            }
         }
         else                                       //  Vertical
         {
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x+1, y, NULL );
            LineTo( _s->hdc, x+1, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x+1, y, NULL );
               LineTo( _s->hGuiDC, x+1, iBottom );
            }
         }
      }
      break;

      case 1:                                      // Recessed
      {
         if ( iOrient == 0 )                       // Horizontal
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y+1, NULL );
            LineTo( _s->hdc, iRight, y+1 );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y+1, NULL );
               LineTo( _s->hGuiDC, iRight, y+1 );
            }
         }
         else                                      //  Vertical
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x+1, y, NULL );
            LineTo( _s->hdc, x+1, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x+1, y, NULL );
               LineTo( _s->hGuiDC, x+1, iBottom );
            }
         }
      }
      break;

      case 2:                                      // Plain
      {
         if ( iOrient == 0 )                       // Horizontal
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
            }
         }
         else                                      //  Vertical
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
            }
         }
      }
      break;
   }

   SelectObject( _s->hdc, hOldPen );
   if ( hOldPenGUI )
   {
      SelectObject( _s->hGuiDC, hOldPenGUI );
   }
   DeleteObject( hPen );
   hb_retl( TRUE );
}
wvgcore.c1295
HB_FUNCWVT_DRAWELLIPSE(void)
HB_FUNC( WVT_DRAWELLIPSE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   SelectObject( _s->hdc, _s->currentBrush );
   SelectObject( _s->hdc, _s->currentPen   );

   hb_retl( Ellipse( _s->hdc, iLeft, iTop, iRight, iBottom ) );
   if ( _s->bGui )
   {
      hb_retl( Ellipse( _s->hGuiDC, iLeft, iTop, iRight, iBottom ) );
   }
}
wvgcore.c1496
HB_FUNCWVT_DRAWRECTANGLE(void)
HB_FUNC( WVT_DRAWRECTANGLE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   SelectObject( _s->hdc, _s->currentBrush );
   SelectObject( _s->hdc, _s->currentPen );

   hb_retl( Rectangle( _s->hdc, iLeft, iTop, iRight, iBottom ) );
   if ( _s->bGui )
   {
      hb_retl( Rectangle( _s->hGuiDC, iLeft, iTop, iRight, iBottom ) );
   }
}
wvgcore.c1520
HB_FUNCWVT_DRAWROUNDRECT(void)
HB_FUNC( WVT_DRAWROUNDRECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   int iHt, iWd;

   iHt     = ISNIL( 6 ) ? 0 : hb_parni( 6 );
   iWd     = ISNIL( 7 ) ? 0 : hb_parni( 7 );

   SelectObject( _s->hdc, _s->currentBrush );
   SelectObject( _s->hdc, _s->currentPen   );

   hb_retl( RoundRect( _s->hdc, iLeft, iTop, iRight, iBottom, iWd, iHt ) );
   if ( _s->bGui )
   {
      hb_retl( RoundRect( _s->hGuiDC, iLeft, iTop, iRight, iBottom, iWd, iHt ) );
   }
}
wvgcore.c1543
HB_FUNCWVT_DRAWFOCUSRECT(void)
HB_FUNC( WVT_DRAWFOCUSRECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   RECT rc = { 0,0,0,0 };

   rc.left   = iLeft;
   rc.top    = iTop;
   rc.right  = iRight;
   rc.bottom = iBottom;

   hb_retl( DrawFocusRect( _s->hdc, &rc ) );
   if ( _s->bGui )
   {
      hb_retl( DrawFocusRect( _s->hGuiDC, &rc ) );
   }
}
wvgcore.c1570
HB_FUNCWVT_DRAWCOLORRECT(void)
HB_FUNC( WVT_DRAWCOLORRECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   RECT rc = { 0,0,0,0 };
   HBRUSH hBrush;

   hBrush = CreateSolidBrush( ( COLORREF ) hb_parnl( 6 ) );

   if ( hBrush )
   {
      rc.left   = iLeft;
      rc.top    = iTop;
      rc.right  = iRight;
      rc.bottom = iBottom;

      hb_retl( FillRect( _s->hdc, &rc, hBrush ) );
      if ( _s->bGui )
      {
         hb_retl( FillRect( _s->hGuiDC, &rc, hBrush ) );
      }

      DeleteObject( hBrush );
   }
}
wvgcore.c1596
HB_FUNCWVT_DRAWGRIDHORZ(void)
HB_FUNC( WVT_DRAWGRIDHORZ )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int   iAtRow = hb_parni( 1 );
   int   iRows  = hb_parni( 4 );
   int   i, y;
   int   iLeft, iRight;

   iLeft  = ( hb_parni( 2 ) * _s->PTEXTSIZE.x );
   iLeft += hb_parni( 5,2 );
   iRight = ( ( ( hb_parni( 3 ) + 1 ) * _s->PTEXTSIZE.x ) - 1 );
   iRight += hb_parni( 5,4 );

   SelectObject( _s->hdc, _s->currentPen );

   for ( i = 0; i < iRows; i++ )
   {
      y = ( ( iAtRow ) * _s->PTEXTSIZE.y );

      MoveToEx( _s->hdc, iLeft, y, NULL );
      LineTo( _s->hdc, iRight, y );

      iAtRow++;
   }

   if ( _s->bGui )
   {
      iAtRow = hb_parni( 1 );

      SelectObject( _s->hGuiDC, _s->currentPen );

      for ( i = 0; i < iRows; i++ )
      {
         y = ( ( iAtRow ) * _s->PTEXTSIZE.y );

         MoveToEx( _s->hGuiDC, iLeft, y, NULL );
         LineTo( _s->hGuiDC, iRight, y );

         iAtRow++;
      }
   }
   hb_retl( TRUE );
}
wvgcore.c1630
HB_FUNCWVT_DRAWGRIDVERT(void)
HB_FUNC( WVT_DRAWGRIDVERT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop, iBottom, x, i, iCharHeight, iCharWidth;
   int iTabs = hb_parni( 4 );

   if ( ! iTabs )
   {
      hb_retl( FALSE );
   }

   iCharWidth  = _s->PTEXTSIZE.x;
   iCharHeight = _s->PTEXTSIZE.y;

   iTop    = ( hb_parni( 1 ) * iCharHeight );
   iTop += hb_parni( 5,1 );
   iBottom = ( ( hb_parni( 2 ) + 1 ) * iCharHeight ) - 1;
   iBottom += hb_parni( 5,3 );

   SelectObject( _s->hdc, _s->currentPen );

   for ( i = 1; i <= iTabs; i++ )
   {
      x = ( hb_parni( 3,i ) * iCharWidth );

      MoveToEx( _s->hdc, x, iTop, NULL );
      LineTo( _s->hdc, x, iBottom );
   }

   if ( _s->bGui )
   {
      SelectObject( _s->hGuiDC, _s->currentPen );
      for ( i = 1; i <= iTabs; i++ )
      {
         x = ( hb_parni( 3,i ) * iCharWidth );

         MoveToEx( _s->hGuiDC, x, iTop, NULL );
         LineTo( _s->hGuiDC, x, iBottom );
      }
   }

   hb_retl( TRUE );
}
wvgcore.c1680
HB_FUNCWVT_DRAWBUTTON(void)
HB_FUNC( WVT_DRAWBUTTON )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   SIZE     sz = { 0,0 };
   POINT    xy = { 0,0 };
   RECT     rc = { 0,0,0,0 };
   int      iTop, iLeft, iBottom, iRight;
   int      iAlign;
   int      iTextHeight /*, iTextWidth */ ;
   int      iImageWidth, iImageHeight;
   LOGBRUSH lb = { 0,0,0 };
   HBRUSH   hBrush;
   IPicture *iPicture;

   BOOL     bText     = ISCHAR( 5 );
   BOOL     bImage    = !( ISNIL( 6 ) );
   int      iFormat   = ISNIL(  7 ) ? 0 : hb_parni( 7 );
   COLORREF textColor = ISNIL(  8 ) ? _s->COLORS[ 0 ] : ( COLORREF ) hb_parnl( 8 ) ;
   COLORREF bkColor   = ISNIL(  9 ) ? _s->COLORS[ 7 ] : ( COLORREF ) hb_parnl( 9 ) ;
   // int      iImageAt  = ISNIL( 10 ) ? 0 : hb_parni( 10 );

   xy         = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop       = xy.y + hb_parni( 11,1 );
   iLeft      = xy.x + hb_parni( 11,2 );
   xy         = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom    = xy.y-1 + hb_parni( 11,3 );
   iRight     = xy.x-1 + hb_parni( 11,4 );

   lb.lbStyle = BS_SOLID;
   lb.lbColor = bkColor;
   lb.lbHatch = 0;

   hBrush     = CreateBrushIndirect( &lb );

   rc.left    = iLeft ;
   rc.top     = iTop ;
   rc.right   = iRight  + 1;
   rc.bottom  = iBottom + 1;

   FillRect( _s->hdc, &rc, hBrush );
   if ( _s->bGui )
   {
      FillRect( _s->hGuiDC, &rc, hBrush );
   }
   DeleteObject( hBrush );

   switch ( iFormat )
   {
      case 1:
         hb_wvt_DrawBoxRecessed( _s->hdc, iTop+1, iLeft+1, iBottom-1, iRight-1 );
         if ( _s->bGui )
         {
            hb_wvt_DrawBoxRecessed( _s->hGuiDC, iTop+1, iLeft+1, iBottom-1, iRight-1 );
         }
         break;
      case 2:
         break;
      case 3:
         hb_wvt_DrawOutline( _s->hdc, iTop, iLeft, iBottom, iRight );
         if ( _s->bGui )
         {
            hb_wvt_DrawOutline( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
         }
         break;
      case 4:
         break;
      default:
         hb_wvt_DrawBoxRaised( _s->hdc, iTop+1, iLeft+1, iBottom-1, iRight-1 );
         if ( _s->bGui )
         {
            hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop+1, iLeft+1, iBottom-1, iRight-1 );
         }
         break;
   }

   if ( bText )
   {
      LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 5 ) );

      SelectObject( _s->hdc, GetStockObject( DEFAULT_GUI_FONT ) );

      //GetTextExtentPoint32( _s->hdc, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), &sz );
      GetTextExtentPoint32( _s->hdc, text, lstrlen( text ), &sz );

      // iTextWidth   = sz.cx;
      iTextHeight  = sz.cy;

      xy.x = iLeft + ( ( iRight - iLeft + 1 ) / 2 ) ;

      if ( bImage )
      {
         xy.y = ( iBottom - 2 - iTextHeight );
      }
      else
      {
         xy.y = iTop + ( ( iBottom - iTop + 1 - iTextHeight ) / 2 ) ;
      }

      if ( iFormat == 1 )
      {
         xy.x = xy.x + 2;
         xy.y = xy.y + 2;
      }

      iAlign = TA_CENTER + TA_TOP ;

      SetTextAlign( _s->hdc, iAlign );
      SetBkMode( _s->hdc, TRANSPARENT );
      SetTextColor( _s->hdc, textColor );

      //ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL );
      ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );
      if ( _s->bGui )
      {
         SelectObject( _s->hGuiDC, GetStockObject( DEFAULT_GUI_FONT ) );
         SetTextAlign( _s->hGuiDC, iAlign );
         SetBkMode( _s->hGuiDC, TRANSPARENT );
         SetTextColor( _s->hGuiDC, textColor );

         //ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL );
         ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );
      }
      HB_TCHAR_FREE( text );
   }
   else
   {
      iTextHeight = -1;
   }

   if ( bImage )
   {
      iImageWidth  = ( iRight - iLeft + 1 - 8 );
      iImageHeight = ( iBottom - iTop + 1 - 8 - iTextHeight );

      if ( ISNUM( 6 ) )
      {
         iPicture = _s->iPicture[ hb_parni( 6 ) - 1 ];
         hb_wvt_gtRenderPicture( iLeft+4, iTop+4, iImageWidth, iImageHeight, iPicture );
      }
      else
      {
         hb_wvt_DrawImage( _s->hdc, iLeft+4, iTop+4, iImageWidth, iImageHeight, hb_parcx( 6 ) );
         if ( _s->bGui )
         {
            hb_wvt_DrawImage( _s->hGuiDC, iLeft+4, iTop+4, iImageWidth, iImageHeight, hb_parcx( 6 ) );
         }
      }
   }

   hb_retl( TRUE );
}
wvgcore.c1730
HB_FUNCWVT_DRAWSTATUSBAR(void)
HB_FUNC( WVT_DRAWSTATUSBAR )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int   iPanels   = hb_parni( 1 );
   int   i, iNext;
   int   iTop, iLeft, iBottom, iRight;
   POINT xy = { 0,0 };

   iNext = 0;

   for ( i = 0; i < iPanels; i++ )
   {
      xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2, iNext+2 ), ( USHORT ) hb_parni( 2, iNext+1 ) );
      iTop    = xy.y;
      iLeft   = xy.x + 1;

      xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2, iNext+4 ), ( USHORT ) hb_parni( 2, iNext+3 )+1 );
      iBottom = xy.y - 1;
      iRight  = xy.x - 2;

      SelectObject( _s->hdc, _s->penWhite );

      MoveToEx( _s->hdc, iRight, iTop, NULL );            // Right
      LineTo( _s->hdc, iRight, iBottom );

      MoveToEx( _s->hdc, iLeft, iBottom, NULL );          // Bottom
      LineTo( _s->hdc, iRight, iBottom );

      SelectObject( _s->hdc, _s->penDarkGray );

      MoveToEx( _s->hdc, iLeft, iTop, NULL );             // Left
      LineTo( _s->hdc, iLeft, iBottom );

      MoveToEx( _s->hdc, iLeft, iTop, NULL );             // Top
      LineTo( _s->hdc, iRight, iTop );

      iNext = iNext + 4;
   }

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2, 4 * iPanels ), ( USHORT ) hb_parni( 2, ( 4 * iPanels ) - 1 )+1 );
   iTop    = xy.y - 2;
   iLeft   = xy.x - 2;
   iBottom = iTop;
   iRight  = iLeft;

   SelectObject( _s->hdc, _s->penBlack );

   MoveToEx( _s->hdc, iLeft-4, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-4 );
   MoveToEx( _s->hdc, iLeft-7, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-7 );
   MoveToEx( _s->hdc, iLeft-10, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-10 );

   SelectObject( _s->hdc, _s->penWhite );

   MoveToEx( _s->hdc, iLeft-5, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-5 );
   MoveToEx( _s->hdc, iLeft-8, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-8 );
   MoveToEx( _s->hdc, iLeft-11, iBottom, NULL );
   LineTo( _s->hdc, iRight, iTop-11 );
}
wvgcore.c1888
HB_FUNCWVT_DRAWPICTURE(void)
HB_FUNC( WVT_DRAWPICTURE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT    xy = { 0,0 };
   int      iTop, iLeft, iBottom, iRight;
   int      iSlot   = hb_parni( 5 ) - 1;

   if ( iSlot < WVT_PICTURES_MAX )
   {
      if ( _s->iPicture[ iSlot ] )
      {
         xy       = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
         iTop     = xy.y + hb_parni( 6,1 );
         iLeft    = xy.x + hb_parni( 6,2 );

         xy       = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
         iBottom  = xy.y-1 + hb_parni( 6,3 );
         iRight   = xy.x-1 + hb_parni( 6,4 );

         hb_retl( hb_wvt_gtRenderPicture( iLeft, iTop, iRight - iLeft + 1, iBottom - iTop + 1, _s->iPicture[ iSlot ] ) );
      }
   }
}
wvgcore.c1957
HB_FUNCWVT_DRAWLABELEX(void)
HB_FUNC( WVT_DRAWLABELEX )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT    xy = { 0,0 };
   int      iSlot = hb_parni( 7 ) - 1;

   if ( _s->hUserFonts[ iSlot ] )
   {
      LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) );
      COLORREF fgClr = hb_wvt_FgColorParam( 5 ),
               bgClr = hb_wvt_BgColorParam( 6 );

      xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
      xy.x += hb_parni( 8,2 );
      xy.y += hb_parni( 8,1 );

      SetBkColor( _s->hdc, bgClr );
      SetTextColor( _s->hdc, fgClr );
      SetTextAlign( _s->hdc, ( ISNIL( 4 ) ? TA_LEFT : hb_parni( 4 ) ) );
      SelectObject( _s->hdc, _s->hUserFonts[ iSlot ] );

      //ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL );
      ExtTextOut( _s->hdc, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );
      if ( _s->bGui )
      {
         SetBkColor( _s->hGuiDC, bgClr );
         SetTextColor( _s->hGuiDC, fgClr );
         SetTextAlign( _s->hGuiDC, ( ISNIL( 4 ) ? TA_LEFT : hb_parni( 4 ) ) );
         SelectObject( _s->hGuiDC, _s->hUserFonts[ iSlot ] );

         //ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, hb_parcx( 3 ), strlen( hb_parcx( 3 ) ), NULL );
         ExtTextOut( _s->hGuiDC, xy.x, xy.y, 0, NULL, text, lstrlen( text ), NULL );
      }
      HB_TCHAR_FREE( text );
      hb_retl( TRUE );
   }

   hb_retl( FALSE );
}
wvgcore.c1987
HB_FUNCWVT_DRAWLINEEX(void)
HB_FUNC( WVT_DRAWLINEEX )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT    xy = { 0,0 };
   int      iTop, iLeft, iBottom, iRight, iOffset ;
   int      iOrient, iFormat, iAlign ;
   int      x, y;
   HPEN     hPen;
   int      iSlot = hb_parni( 8 ) - 1;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop    = xy.y + hb_parni( 9,1 );
   iLeft   = xy.x + hb_parni( 9,2 );

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom = xy.y-1 + hb_parni( 9,4 );
   iRight  = xy.x-1 + hb_parni( 9,4 );

   //   Resolve Parameters
   iOrient = ISNIL( 5 ) ? 0 : hb_parni( 5 );
   iFormat = ISNIL( 6 ) ? 0 : hb_parni( 6 );
   iAlign  = ISNIL( 7 ) ? 0 : hb_parni( 7 );

   x       = iLeft ;
   y       = iTop ;

   switch ( iAlign )
   {
      case 0:                  // Center
      {
         if ( iOrient == 0 )   // Horizontal
         {
            iOffset = ( ( iBottom - iTop ) / 2 ) ;
            y       = iTop + iOffset ;
         }
         else
         {
            iOffset = ( ( iRight - iLeft ) / 2 ) ;
            x       = iLeft + iOffset ;
         }
      }
      break;

      case 1:                  // Top
      break;

      case 2:                  // bottom
      {
         if ( iFormat == 0 || iFormat == 1 )  // Raised/Recessd
         {
            y = iBottom - 1;
         }
         else
         {
            y = iBottom;
         }
      }
      break;

      case 3:                  // Left
      break;

      case 4:                  // Right
      {
         if ( iFormat == 0 || iFormat == 1 )  // Raised/Recessd
         {
            x = iRight - 1;
         }
         else
         {
            x = iRight;
         }
      }
      break;
   }

   hPen = _s->hUserPens[ iSlot ];

   switch ( iFormat )
   {
      case 0:                                       // Raised
      {
         if ( iOrient == 0 )                        //  Horizontal
         {
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y+1, NULL );
            LineTo( _s->hdc, iRight, y+1 );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y+1, NULL );
               LineTo( _s->hGuiDC, iRight, y+1 );
            }
         }
         else                                       //  Vertical
         {
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x+1, y, NULL );
            LineTo( _s->hdc, x+1, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x+1, y, NULL );
               LineTo( _s->hGuiDC, x+1, iBottom );
            }
         }
      }
      break;

      case 1:                                      // Recessed
      {
         if ( iOrient == 0 )                       // Horizontal
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x, y+1, NULL );
            LineTo( _s->hdc, iRight, y+1 );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x, y+1, NULL );
               LineTo( _s->hGuiDC, iRight, y+1 );
            }
         }
         else                                      //  Vertical
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            SelectObject( _s->hdc, _s->penWhite );
            MoveToEx( _s->hdc, x+1, y, NULL );
            LineTo( _s->hdc, x+1, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
               SelectObject( _s->hGuiDC, _s->penWhite );
               MoveToEx( _s->hGuiDC, x+1, y, NULL );
               LineTo( _s->hGuiDC, x+1, iBottom );
            }
         }
      }
      break;

      case 2:                                      // Plain
      {
         if ( iOrient == 0 )                       // Horizontal
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, iRight, y );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, iRight, y );
            }
         }
         else                                      //  Vertical
         {
            SelectObject( _s->hdc, hPen );
            MoveToEx( _s->hdc, x, y, NULL );
            LineTo( _s->hdc, x, iBottom );
            if ( _s->bGui )
            {
               SelectObject( _s->hGuiDC, hPen );
               MoveToEx( _s->hGuiDC, x, y, NULL );
               LineTo( _s->hGuiDC, x, iBottom );
            }
         }
       }
      break;
   }

   hb_retl( TRUE );
}
wvgcore.c2032
HB_FUNCWVT_DRAWOUTLINEEX(void)
HB_FUNC( WVT_DRAWOUTLINEEX )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy = { 0,0 };
   int   iTop, iLeft, iBottom, iRight;
   int   iSlot = hb_parni( 5 ) - 1;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop    = xy.y - 1 + hb_parni( 6,1 );
   iLeft   = xy.x - 1 + hb_parni( 6,2 );
   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom = xy.y + hb_parni( 6,3 );
   iRight  = xy.x + hb_parni( 6,4 );

   if ( _s->hUserPens[ iSlot ] )
   {
      SelectObject( _s->hdc, _s->hUserPens[ iSlot ] );
   }
   else
   {
      SelectObject( _s->hdc, _s->penBlack );
   }

   hb_wvt_DrawOutline( _s->hdc, iTop, iLeft, iBottom, iRight );
   if ( _s->bGui )
   {
      hb_wvt_DrawOutline( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
   }
}
wvgcore.c2232
HB_FUNCWVT_DRAWLABELOBJ(void)
HB_FUNC( WVT_DRAWLABELOBJ )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT    xy = { 0,0 };
   RECT     rect = { 0,0,0,0 };
   int      iTop, iLeft, iBottom, iRight, x, y;
   int      iAlignHorz, iAlignVert, iAlignH, iAlignV;
   UINT     uiOptions;
   SIZE     sz = { 0,0 };
   LPTSTR   text = HB_TCHAR_CONVTO( hb_parc( 5 ) );
   COLORREF fgClr = hb_wvt_FgColorParam( 8 ),
            bgClr = hb_wvt_BgColorParam( 9 );

   xy           = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop         = xy.y + hb_parni( 11,1 );
   iLeft        = xy.x + hb_parni( 11,2 );
   xy           = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom      = xy.y - 1 + hb_parni( 11,3 );
   iRight       = xy.x - 1 + hb_parni( 11,4 );

   iAlignHorz   = hb_parni( 6 ); /* default is 0 */
   iAlignVert   = hb_parni( 7 ); /* default is 0 */

   SetTextColor( _s->hdc, fgClr );
   SetBkColor( _s->hdc, bgClr );
   SelectObject( _s->hdc, ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 10 ) );

   //GetTextExtentPoint32( _s->hdc, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), &sz );
   GetTextExtentPoint32( _s->hdc, text, lstrlen( text ), &sz );

   x = iLeft;
   y = iTop;

   switch ( iAlignHorz )
   {
      case 0:
         iAlignH = TA_LEFT;
         break;

      case 1:
         iAlignH = TA_RIGHT;
         x = iRight;
         break;

      case 2:
         iAlignH = TA_CENTER;
         x = iLeft + ( ( iRight - iLeft + 1 ) / 2 );
         break;

      default:
         iAlignH = 0;
   }

   iAlignV = TA_TOP;

   switch ( iAlignVert )
   {
      case 1:
         y = iBottom - sz.cy;
         break;

      case 2:
         y = iTop + ( ( iBottom - iTop + 1 - sz.cy ) / 2 );
         break;
   }

   SetTextAlign( _s->hdc, iAlignH | iAlignV );

   rect.top     = iTop;
   rect.left    = iLeft;
   rect.bottom  = iBottom;
   rect.right   = iRight;

   uiOptions    = ETO_CLIPPED | ETO_OPAQUE ;

   //  Ground is Ready, Draw Text
   //
   //ExtTextOut( _s->hdc, x, y, uiOptions, &rect, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL );
   ExtTextOut( _s->hdc, x, y, uiOptions, &rect, text, lstrlen( text ), NULL );
   if ( _s->bGui )
   {
      SetTextColor( _s->hGuiDC, fgClr );
      SetBkColor( _s->hGuiDC, bgClr );
      SelectObject( _s->hGuiDC, ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 10 ) );
      SetTextAlign( _s->hGuiDC, iAlignH | iAlignV );

      //ExtTextOut( _s->hGuiDC, x, y, uiOptions, &rect, hb_parcx( 5 ), strlen( hb_parcx( 5 ) ), NULL );
      ExtTextOut( _s->hGuiDC, x, y, uiOptions, &rect, text, lstrlen( text ), NULL );
   }
   HB_TCHAR_FREE( text );
   hb_retl( TRUE );
}
wvgcore.c2267
HB_FUNCWVT_DRAWTOOLBUTTONSTATE(void)
HB_FUNC( WVT_DRAWTOOLBUTTONSTATE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop     = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft    = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom  = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight   = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   switch ( hb_parni( 6 ) )
   {
      case 0:     // Flat
      {
         hb_wvt_DrawToolButtonFlat( _s->hdc, iTop, iLeft, iBottom, iRight );
         if ( _s->bGui )
         {
            hb_wvt_DrawToolButtonFlat( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
         }
      }
      break;

      case 1:     // Raised
      {
         hb_wvt_DrawToolButtonUp( _s->hdc, iTop, iLeft, iBottom, iRight );
         if ( _s->bGui )
         {
            hb_wvt_DrawToolButtonUp( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
         }
      }
      break;

      case 2:     // Recessed
      {
         hb_wvt_DrawToolButtonDown( _s->hdc, iTop, iLeft, iBottom, iRight );
         if ( _s->bGui )
         {
            hb_wvt_DrawToolButtonDown( _s->hGuiDC, iTop, iLeft, iBottom, iRight );
         }
      }
      break;
   }
   hb_retl( TRUE );
}
wvgcore.c2365
HB_FUNCWVT_DRAWSCROLLBUTTON(void)
HB_FUNC( WVT_DRAWSCROLLBUTTON )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   POINT    * Point;
   POINT    xy = { 0,0 };
   int      iHeight, iOff;
   BOOL     bDepressed = ISNIL( 7 ) ? FALSE : hb_parl( 7 ) ;

   Point      = ( POINT * ) hb_xgrab( 3 * sizeof( POINT ) );
   iOff       = 6;

   iHeight    = iBottom - iTop + 1;

   if ( bDepressed )
   {
      hb_wvt_DrawBoxRecessed( _s->hdc, iTop+1, iLeft+1, iBottom-2, iRight-2 );
      if ( _s->bGui )
      {
         hb_wvt_DrawBoxRecessed( _s->hGuiDC, iTop+1, iLeft+1, iBottom-2, iRight-2 );
      }
   }
   else
   {
      hb_wvt_DrawBoxRaised( _s->hdc, iTop+1, iLeft+1, iBottom-2, iRight-2 );
      if ( _s->bGui )
      {
         hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop+1, iLeft+1, iBottom-2, iRight-2 );
      }
   }

   switch ( hb_parni( 6 ) )
   {
      case 1:   // Top
      {
         xy.y       = iTop + iOff - 1;
         xy.x       = iLeft + ( ( iRight - iLeft + 1 ) / 2 );
         Point[ 0 ] = xy ;
         xy.y       = iBottom - iOff - 1;
         xy.x       = iLeft + iOff - 1;
         Point[ 1 ] = xy;
         xy.x       = iRight - iOff + 1;
         Point[ 2 ] = xy;
      }
      break;

      case 2:  // Left
      {
         xy.y       = iTop + ( ( iBottom - iTop + 1 ) / 2 );
         xy.x       = iLeft + iOff;
         Point[ 0 ] = xy ;
         xy.x       = iRight - iOff - 1;
         xy.y       = iTop + iOff - 1;
         Point[ 1 ] = xy;
         xy.y       = iBottom - iOff + 1;
         Point[ 2 ] = xy;
      }
      break;

      case 3:  //  Bottom
      {
         xy.x       = iLeft + ( ( iRight - iLeft + 1 ) / 2 );
         xy.y       = iBottom - iOff;
         Point[ 0 ] = xy ;
         xy.x       = iLeft + iOff - 1;
         xy.y       = iBottom - iHeight + iOff + 1;
         Point[ 1 ] = xy;
         xy.x       = iRight - iOff + 1;
         Point[ 2 ] = xy;
      }
      break;

      case 4:  // Right
      {
         xy.x       = iRight - iOff - 1;
         xy.y       = iTop + ( ( iBottom - iTop + 1 ) / 2 );
         Point[ 0 ] = xy ;
         xy.x       = iLeft + iOff + 1;
         xy.y       = iTop + iOff - 1;
         Point[ 1 ] = xy;
         xy.y       = iBottom - iOff + 1;
         Point[ 2 ] = xy;
      }
      break;
   }

   SelectObject( _s->hdc, _s->solidBrush );
   Polygon( _s->hdc, Point, 3 );
   if ( _s->bGui )
   {
      SelectObject( _s->hGuiDC, _s->solidBrush );
      Polygon( _s->hGuiDC, Point, 3 );
   }

   hb_xfree( Point );
}
wvgcore.c2413
HB_FUNCWVT_DRAWSCROLLTHUMBVERT(void)
HB_FUNC( WVT_DRAWSCROLLTHUMBVERT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop        = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft       = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom     = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight      = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   int iTabTop, iTabLft, iTabBtm, iTabRgt;

   //  Background
   //
   SetBkMode( _s->hdc, OPAQUE );
   SetBkColor( _s->hdc, RGB( 230,230,230 ) );
   SelectObject( _s->hdc, _s->diagonalBrush );
   SelectObject( _s->hdc, _s->penNull );
   Rectangle( _s->hdc, iLeft, iTop, iRight+1, iBottom+1 );
   if ( _s->bGui )
   {
      SetBkMode( _s->hGuiDC, OPAQUE );
      SetBkColor( _s->hGuiDC, RGB( 230,230,230 ) );
      SelectObject( _s->hGuiDC, _s->diagonalBrush );
      SelectObject( _s->hGuiDC, _s->penNull );
      Rectangle( _s->hGuiDC, iLeft, iTop, iRight+1, iBottom+1 );
   }

   //  Thumb
   //
   iTabTop  = _s->PTEXTSIZE.y * hb_parni( 6 );
   iTabLft  = iLeft;
   iTabBtm  = iTabTop + _s->PTEXTSIZE.y - 1;
   iTabRgt  = iRight;

   SelectObject( _s->hdc, _s->wvtWhiteBrush );
   SelectObject( _s->hdc, _s->penGray );
   Rectangle( _s->hdc, iTabLft, iTabTop, iTabRgt+1, iTabBtm );
   if ( _s->bGui )
   {
      SelectObject( _s->hGuiDC, _s->wvtWhiteBrush );
      SelectObject( _s->hGuiDC, _s->penGray );
      Rectangle( _s->hGuiDC, iTabLft, iTabTop, iTabRgt+1, iTabBtm );
   }

   hb_wvt_DrawBoxRaised( _s->hdc, iTabTop+1, iTabLft+1, iTabBtm-2, iTabRgt-2 );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxRaised( _s->hGuiDC, iTabTop+1, iTabLft+1, iTabBtm-2, iTabRgt-2 );
   }
}
wvgcore.c2519
HB_FUNCWVT_DRAWSCROLLTHUMBHORZ(void)
HB_FUNC( WVT_DRAWSCROLLTHUMBHORZ )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop        = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft       = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom     = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight      = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   int iThumbLeft, iThumbRight;

   iThumbLeft  = _s->PTEXTSIZE.x * hb_parni( 6 );
   iThumbRight = iThumbLeft + ( _s->PTEXTSIZE.x * 2 ) - 1;

   //  Background
   //
   SetBkMode( _s->hdc, OPAQUE );
   SetBkColor( _s->hdc, RGB( 230,230,230 ) );
   SelectObject( _s->hdc, _s->diagonalBrush );
   SelectObject( _s->hdc, _s->penNull );
   Rectangle( _s->hdc, iLeft, iTop, iRight+1, iBottom+1 );
   if ( _s->bGui )
   {
      SetBkMode( _s->hGuiDC, OPAQUE );
      SetBkColor( _s->hGuiDC, RGB( 230,230,230 ) );
      SelectObject( _s->hGuiDC, _s->diagonalBrush );
      SelectObject( _s->hGuiDC, _s->penNull );
      Rectangle( _s->hGuiDC, iLeft, iTop, iRight+1, iBottom+1 );
   }

   //  Thumb
   //
   SelectObject( _s->hdc, _s->wvtWhiteBrush );
   SelectObject( _s->hdc, _s->penGray );
   Rectangle( _s->hdc, iThumbLeft, iTop, iThumbRight, iBottom );
   if ( _s->bGui )
   {
      SelectObject( _s->hGuiDC, _s->wvtWhiteBrush );
      SelectObject( _s->hGuiDC, _s->penGray );
      Rectangle( _s->hGuiDC, iThumbLeft, iTop, iThumbRight, iBottom );
   }

   hb_wvt_DrawBoxRaised( _s->hdc, iTop+1, iThumbLeft+1, iBottom-2, iThumbRight-2 );
   if ( _s->bGui )
   {
      hb_wvt_DrawBoxRaised( _s->hGuiDC, iTop+1, iThumbLeft+1, iBottom-2, iThumbRight-2 );
   }
}
wvgcore.c2573
HB_FUNCWVT_DRAWSHADEDRECT(void)
HB_FUNC( WVT_DRAWSHADEDRECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   BOOL bGF = FALSE;

   if ( _s->hMSImg32 )
   {
      TRIVERTEX     vert[ 2 ] ;
      GRADIENT_RECT gRect = { 0,0 };

      int iTop        = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
      int iLeft       = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
      int iBottom     = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
      int iRight      = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

      int iMode       = ISNIL( 6 ) ? GRADIENT_FILL_RECT_H : hb_parni( 6 ) ;

      vert[ 0 ].x     = iLeft;
      vert[ 0 ].y     = iTop;
      vert[ 0 ].Red   = ( COLOR16 ) hb_parni( 7,1 );
      vert[ 0 ].Green = ( COLOR16 ) hb_parni( 7,2 );
      vert[ 0 ].Blue  = ( COLOR16 ) hb_parni( 7,3 );
      vert[ 0 ].Alpha = ( COLOR16 ) hb_parni( 7,4 );

      vert[ 1 ].x     = iRight;
      vert[ 1 ].y     = iBottom;
      vert[ 1 ].Red   = ( COLOR16 ) hb_parni( 8,1 );
      vert[ 1 ].Green = ( COLOR16 ) hb_parni( 8,2 );
      vert[ 1 ].Blue  = ( COLOR16 ) hb_parni( 8,3 );
      vert[ 1 ].Alpha = ( COLOR16 ) hb_parni( 8,4 );

      gRect.UpperLeft = 0;
      gRect.LowerRight= 1;

      bGF = ( BOOL ) _s->pfnGF( _s->hdc, vert, 2, &gRect, 1, iMode );
      if ( _s->bGui )
      {
         bGF = ( BOOL ) _s->pfnGF( _s->hGuiDC, vert, 2, &gRect, 1, iMode );
      }
   }
   hb_retl( bGF );
}
wvgcore.c2625
HB_FUNCWVT_DRAWTEXTBOX(void)
HB_FUNC( WVT_DRAWTEXTBOX )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTop    = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int iLeft   = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int iBottom = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int iRight  = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );

   int iAlignHorz = hb_parni( 7 ); /* default to 0 */
   int iAlignH = 0;

   RECT     rc = { 0,0,0,0 };
   LPTSTR   text = HB_TCHAR_CONVTO( hb_parc( 6 ) );
   COLORREF fgClr = hb_wvt_FgColorParam( 9 ),
            bgClr = hb_wvt_BgColorParam( 10 );

   switch ( iAlignHorz )
   {
      case 0:
         iAlignH = DT_LEFT;
         break;

      case 1:
         iAlignH = DT_RIGHT;
         break;

      case 2:
         iAlignH = DT_CENTER;
         break;
   }

   rc.top       = iTop;
   rc.left      = iLeft;
   rc.bottom    = iBottom;
   rc.right     = iRight;

   SetTextAlign( _s->hdc, TA_TOP | TA_LEFT | TA_NOUPDATECP );
   SetTextColor( _s->hdc, fgClr );
   SetBkColor( _s->hdc, bgClr );
   SetBkMode( _s->hdc, ISNIL( 11 ) ? OPAQUE : hb_parni( 11 ) );
   SelectObject( _s->hdc, ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 12 ) );

   //DrawText( _s->hdc, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &rc, iAlignH | DT_WORDBREAK | DT_TOP );
   DrawText( _s->hdc, text, lstrlen( text ), &rc, iAlignH | DT_WORDBREAK | DT_TOP );
   if ( _s->bGui )
   {
      SetTextAlign( _s->hGuiDC, TA_TOP | TA_LEFT | TA_NOUPDATECP );
      SetTextColor( _s->hGuiDC, fgClr );
      SetBkColor( _s->hGuiDC, bgClr );
      SetBkMode( _s->hGuiDC, ISNIL( 11 ) ? OPAQUE : hb_parni( 11 ) );
      SelectObject( _s->hGuiDC, ( HFONT ) ( HB_PTRDIFF ) hb_parnint( 12 ) );

      //DrawText( _s->hGuiDC, hb_parcx( 6 ), strlen( hb_parcx( 6 ) ), &rc, iAlignH | DT_WORDBREAK | DT_TOP );
      DrawText( _s->hGuiDC, text, lstrlen( text ), &rc, iAlignH | DT_WORDBREAK | DT_TOP );
   }
   HB_TCHAR_FREE( text );
}
wvgcore.c2675
HB_FUNCWVT_DRAWPROGRESSBAR(void)
HB_FUNC( WVT_DRAWPROGRESSBAR )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int      iTop     = ( _s->PTEXTSIZE.y * hb_parni( 1 ) ) + hb_parni( 5,1 );
   int      iLeft    = ( _s->PTEXTSIZE.x * hb_parni( 2 ) ) + hb_parni( 5,2 );
   int      iBottom  = ( _s->PTEXTSIZE.y * ( hb_parni( 3 ) + 1 ) ) - 1 + hb_parni( 5,3 );
   int      iRight   = ( _s->PTEXTSIZE.x * ( hb_parni( 4 ) + 1 ) ) - 1 + hb_parni( 5,4 );
   int      iPercent,  iBarUpto, iDirection;
   BOOL     bVertical, bImage;
   COLORREF crBarColor;
   HBRUSH   hBrush;
   LOGBRUSH lb = { 0,0,0 };
   RECT     rc = { 0,0,0,0 };

   iPercent   = hb_parni( 6 );
   bImage     = ISNIL(  9 ) ? FALSE : TRUE ;
   bVertical  = ISNIL( 10 ) ? FALSE : hb_parl( 10 ) ;
   iDirection = ISNIL( 11 ) ? 0 : hb_parni( 11 );

   if ( bVertical )
   {
      if ( iDirection == 0 )
      {
         iBarUpto  = iTop + ( ( iBottom - iTop ) * iPercent / 100 );
         rc.top    = iTop;
         rc.left   = iLeft;
         rc.bottom = iBarUpto;
         rc.right  = iRight;
      }
      else
      {
         iBarUpto  = iBottom - ( ( iBottom - iTop ) * iPercent / 100 );
         rc.top    = iBarUpto;
         rc.left   = iLeft;
         rc.bottom = iBottom;
         rc.right  = iRight;
      }
   }
   else
   {
      if ( iDirection == 0 )
      {
         iBarUpto  = iLeft + ( ( iRight - iLeft ) * iPercent / 100 );
         rc.top    = iTop;
         rc.left   = iLeft;
         rc.bottom = iBottom;
         rc.right  = iBarUpto;
      }
      else
      {
         iBarUpto  = iRight - ( ( iRight - iLeft ) * iPercent / 100 );
         rc.top    = iTop;
         rc.left   = iBarUpto;
         rc.bottom = iBottom;
         rc.right  = iRight;
      }
   }

   if ( bImage )
   {
      hb_wvt_DrawImage( _s->hdc, rc.left, rc.top, rc.right-rc.left+1, rc.bottom-rc.top+1, hb_parc( 9 ) );
      if ( _s->bGui )
      {
         hb_wvt_DrawImage( _s->hGuiDC, rc.left, rc.top, rc.right-rc.left+1, rc.bottom-rc.top+1, hb_parc( 9 ) );
      }
   }
   else
   {
      crBarColor  = ISNIL( 8 ) ? _s->COLORS[ 0 ] : ( COLORREF ) hb_parnl( 8 );

      lb.lbStyle  = BS_SOLID;
      lb.lbColor  = crBarColor;
      lb.lbHatch  = 0;

      hBrush      = CreateBrushIndirect( &lb );

      rc.bottom++;
      rc.right++;

      FillRect( _s->hdc, &rc, hBrush );
      if ( _s->bGui )
      {
         FillRect( _s->hGuiDC, &rc, hBrush );
      }
      DeleteObject( hBrush );
   }
}
wvgcore.c2740
HB_FUNCWVT_CREATEFONT(void)
HB_FUNC( WVT_CREATEFONT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   LOGFONT  logfont;// = { 0,0,0 };

   logfont.lfEscapement     = ( ISNIL( 10 ) ? 0 : ( hb_parni( 10 ) * 10 ) );
   logfont.lfOrientation    = 0;
   logfont.lfWeight         = ( ISNIL(  4 ) ? 0 : hb_parni( 4 ) );
   logfont.lfItalic         = ( ISNIL(  5 ) ? 0 : ( BYTE ) hb_parl(  5 ) );
   logfont.lfUnderline      = ( ISNIL(  6 ) ? 0 : ( BYTE ) hb_parl(  6 ) );
   logfont.lfStrikeOut      = ( ISNIL(  7 ) ? 0 : ( BYTE ) hb_parl(  7 ) );
   logfont.lfCharSet        = ( ISNIL(  8 ) ? ( BYTE ) _s->CodePage : ( BYTE ) hb_parni( 8 ) );
   logfont.lfOutPrecision   = 0;
   logfont.lfClipPrecision  = 0;
   logfont.lfQuality        = ( ISNIL( 9 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 9 ) );
   logfont.lfPitchAndFamily = FF_DONTCARE;
   logfont.lfHeight         = ( ISNIL(  2 ) ? _s->fontHeight : hb_parni( 2 ) );
   logfont.lfWidth          = ( ISNIL(  3 ) ? ( _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ) : hb_parni( 3 ) );

   //strcpy( logfont.lfFaceName, ( ISNIL( 1 ) ? _s->fontFace : hb_parcx( 1 ) ) );
   HB_TCHAR_CPTO( logfont.lfFaceName, ( ISNIL( 1 ) ? _s->fontFace : hb_parcx( 1 ) ), sizeof( logfont.lfFaceName )-1 );

   hb_retnint( ( HB_PTRDIFF ) CreateFontIndirect( &logfont ) );
}
wvgcore.c2834
HB_FUNCWVT_LOADPICTURE(void)
HB_FUNC( WVT_LOADPICTURE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   IPicture * iPicture = hb_wvt_gtLoadPicture( hb_parcx( 2 ) );
   BOOL       bResult  = FALSE;
   int        iSlot    = hb_parni( 1 ) - 1 ;

   if ( iPicture )
   {
      if ( _s->iPicture[ iSlot ] )
      {
         hb_wvt_gtDestroyPicture( _s->iPicture[ iSlot ] );
      }

      _s->iPicture[ iSlot ] = iPicture;
      bResult = TRUE;
   }
   hb_retl( bResult );
}
wvgcore.c2865
HB_FUNCWVT_LOADPICTUREFROMRESOURCE(void)
HB_FUNC( WVT_LOADPICTUREFROMRESOURCE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   IPicture * iPicture = hb_wvt_gtLoadPictureFromResource( hb_parcx( 2 ),hb_parcx( 3 ) );
   BOOL       bResult  = FALSE;
   int        iSlot    = hb_parni( 1 ) - 1 ;

   if ( iPicture )
   {
      if ( _s->iPicture[ iSlot ] )
      {
         hb_wvt_gtDestroyPicture( _s->iPicture[ iSlot ] );
      }

      _s->iPicture[ iSlot ] = iPicture;
      bResult = TRUE;
   }
   hb_retl( bResult );
}
wvgcore.c2892
HB_FUNCWVT_LOADFONT(void)
HB_FUNC( WVT_LOADFONT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   LOGFONT  logfont;// = { 0 };
   int      iSlot = hb_parni( 1 ) - 1;
   HFONT    hFont;

   logfont.lfEscapement     = ( ISNIL( 11 ) ? 0 : ( hb_parni( 11 ) * 10 ) );
   logfont.lfOrientation    = 0;
   logfont.lfWeight         = ( ISNIL(  5 ) ? 0 : hb_parni( 5 ) );
   logfont.lfItalic         = ( ISNIL(  6 ) ? 0 : ( BYTE ) hb_parl(  6 ) );
   logfont.lfUnderline      = ( ISNIL(  7 ) ? 0 : ( BYTE ) hb_parl(  7 ) );
   logfont.lfStrikeOut      = ( ISNIL(  8 ) ? 0 : ( BYTE ) hb_parl(  8 ) );
   logfont.lfCharSet        = ( ISNIL(  9 ) ? ( BYTE ) _s->CodePage : ( BYTE ) hb_parni( 9 ) );
   logfont.lfOutPrecision   = 0;
   logfont.lfClipPrecision  = 0;
   logfont.lfQuality        = ( ISNIL( 10 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 10 ) );
   logfont.lfPitchAndFamily = FF_DONTCARE;
   logfont.lfHeight         = ( ISNIL(  3 ) ? _s->fontHeight : hb_parni( 3 ) );
   logfont.lfWidth          = ( ISNIL(  4 ) ? ( _s->fontWidth < 0 ? -_s->fontWidth : _s->fontWidth ) : hb_parni( 4 ) );

   //strcpy( logfont.lfFaceName, ( ISNIL( 2 ) ? _s->fontFace : hb_parcx( 2 ) ) );
   HB_TCHAR_CPTO( logfont.lfFaceName, ( ISNIL( 2 ) ? _s->fontFace : hb_parcx( 2 ) ), sizeof( logfont.lfFaceName )-1 );

   hFont = CreateFontIndirect( &logfont );
   if ( hFont )
   {
      if ( _s->hUserFonts[ iSlot ] )
      {
         DeleteObject( _s->hUserFonts[ iSlot ] );
      }
      _s->hUserFonts[ iSlot ] = hFont;
   }
}
wvgcore.c2913
HB_FUNCWVT_LOADPEN(void)
HB_FUNC( WVT_LOADPEN )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int      iPenWidth, iPenStyle;
   COLORREF crColor;
   HPEN     hPen;
   int      iSlot = hb_parni( 1 ) - 1;

   iPenStyle = ISNIL( 2 ) ? 0 : hb_parni( 2 ) ;
   iPenWidth = ISNIL( 3 ) ? 0 : hb_parni( 3 );
   crColor   = ISNIL( 4 ) ? RGB( 0,0,0 ) : ( COLORREF ) hb_parnl( 4 );

   hPen      = CreatePen( iPenStyle, iPenWidth, crColor );

   if ( hPen )
   {
      if ( _s->hUserPens[ iSlot ] )
      {
         DeleteObject( _s->hUserPens[ iSlot ] );
      }
      _s->hUserPens[ iSlot ] = hPen;

      hb_retl( TRUE );
   }
   else
   {
      hb_retl( FALSE );
   }
}
wvgcore.c2954
HB_FUNCWVT_SAVESCREEN(void)
HB_FUNC( WVT_SAVESCREEN )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   HBITMAP  hBmp, oldBmp;
   POINT    xy = { 0,0 };
   int      iTop, iLeft, iBottom, iRight, iWidth, iHeight;
   PHB_ITEM info = hb_itemArrayNew( 3 );

   xy        = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop      = xy.y;
   iLeft     = xy.x;

   xy        = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom   = xy.y-1;
   iRight    = xy.x-1;

   iWidth    = iRight - iLeft + 1;
   iHeight   = iBottom - iTop + 1;

   hBmp      = CreateCompatibleBitmap( _s->hdc, iWidth, iHeight ) ;
   oldBmp = (HBITMAP) SelectObject( _s->hCompDC, hBmp );
   BitBlt( _s->hCompDC, 0, 0, iWidth, iHeight, _s->hdc, iLeft, iTop, SRCCOPY );
   SelectObject( _s->hCompDC, oldBmp );

   hb_arraySetNI( info, 1, iWidth );
   hb_arraySetNI( info, 2, iHeight );
   hb_arraySetNInt( info, 3, ( HB_PTRDIFF ) hBmp );

   hb_itemReturnRelease( info );
}
wvgcore.c2989
HB_FUNCWVT_RESTSCREEN(void)
HB_FUNC( WVT_RESTSCREEN )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT   xy = { 0,0 };
   int     iTop, iLeft, iBottom, iRight, iWidth, iHeight;
   HBITMAP hBmp;

   BOOL    bResult = FALSE;
   BOOL    bDoNotDestroyBMP = ISNIL( 6 ) ? FALSE : hb_parl( 6 );

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );;
   iTop    = xy.y;
   iLeft   = xy.x;

   xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 ) + 1, ( USHORT ) hb_parni( 3 ) + 1 );
   iBottom = xy.y-1;
   iRight  = xy.x-1;

   iWidth  = iRight - iLeft + 1 ;
   iHeight = iBottom - iTop + 1 ;

   hBmp    = (HBITMAP) SelectObject( _s->hCompDC, ( HBITMAP ) ( HB_PTRDIFF ) hb_parnint( 5,3 ) );
   if ( hBmp )
   {
      if ( ( iWidth == hb_parni( 5,1 ) )  && ( iHeight == hb_parni( 5,2 ) ) )
      {
         if ( BitBlt( _s->hdc,
                      iLeft,
                      iTop,
                      iWidth,
                      iHeight,
                      _s->hCompDC,
                      0,
                      0,
                      SRCCOPY ) )
         {
            bResult = TRUE;
         }
      }
      else
      {
         if ( StretchBlt( _s->hdc,
                          iLeft,
                          iTop,
                          iWidth,
                          iHeight,
                          _s->hCompDC,
                          0,
                          0,
                          hb_parni( 5,1 ),
                          hb_parni( 5,2 ),
                          SRCCOPY ) )
         {
            bResult = TRUE;
         }
      }
   }

   SelectObject( _s->hCompDC, hBmp );

   if ( ! bDoNotDestroyBMP )
   {
      DeleteObject( ( HBITMAP ) ( HB_PTRDIFF ) hb_parnint( 5,3 ) );
   }

   hb_retl( bResult );
}
wvgcore.c3025
wvgutils.c
TypeFunctionSourceLine
HB_EXTERN_END STATIC HANDLEwvg_hInstance( void )
static HANDLE wvg_hInstance( void )
{
   HANDLE hInstance;

   hb_winmainArgGet( &hInstance, NULL, NULL );

   return hInstance;
}
wvgutils.c104
HB_FUNCWVT_UTILS(void)
HB_FUNC( WVT_UTILS )
{
   // Retained for legacy code.
}
wvgutils.c123
HB_FUNCWVT_CHOOSEFONT(void)
HB_FUNC( WVT_CHOOSEFONT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   CHOOSEFONT  cf;// = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
   LOGFONT     lf;// = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
   LONG        PointSize = 0;

   if ( ! ISNIL( 2 ) )
   {
      PointSize = -MulDiv( ( LONG ) hb_parnl( 2 ), GetDeviceCaps( _s->hdc, LOGPIXELSY ), 72 ) ;
   }

   lf.lfHeight         = PointSize;
   lf.lfWidth          = ISNIL( 3 ) ? 0 : hb_parni( 3 );
   lf.lfWeight         = ISNIL( 4 ) ? 0 : hb_parni( 4 );
   lf.lfItalic         = ISNIL( 6 ) ? 0 : ( BYTE ) hb_parl( 6 );
   lf.lfUnderline      = ISNIL( 7 ) ? 0 : ( BYTE ) hb_parl( 7 );
   lf.lfStrikeOut      = ISNIL( 8 ) ? 0 : ( BYTE ) hb_parl( 8 );
   lf.lfCharSet        = DEFAULT_CHARSET;
   lf.lfQuality        = ISNIL( 5 ) ? DEFAULT_QUALITY : ( BYTE ) hb_parni( 5 );
   lf.lfPitchAndFamily = FF_DONTCARE;
   if ( ISCHAR( 1 ) )
   {
      HB_TCHAR_CPTO( lf.lfFaceName, hb_parc( 1 ), sizeof( lf.lfFaceName ) - 1 );
   }

   cf.lStructSize      = sizeof( CHOOSEFONT );
   cf.hwndOwner        = _s->hWnd;
   cf.hDC              = ( HDC ) NULL;
   cf.lpLogFont        = &lf;
   cf.iPointSize       = 0;
   cf.Flags            = CF_SCREENFONTS | CF_EFFECTS | CF_SHOWHELP | CF_INITTOLOGFONTSTRUCT ;
   cf.rgbColors        = RGB( 0,0,0 );
   cf.lCustData        = 0L;
   cf.lpfnHook         = ( LPCFHOOKPROC ) NULL;
   cf.lpTemplateName   = ( LPTSTR ) NULL;
   cf.hInstance        = ( HINSTANCE ) NULL;
   cf.lpszStyle        = ( LPTSTR ) NULL;
   cf.nFontType        = SCREEN_FONTTYPE;
   cf.nSizeMin         = 0;
   cf.nSizeMax         = 0;

   if ( ChooseFont( &cf ) )
   {
      char * szFaceName = HB_TCHAR_CONVFROM( lf.lfFaceName );

      PointSize = -MulDiv( lf.lfHeight, 72, GetDeviceCaps( _s->hdc, LOGPIXELSY ) ) ;

      hb_reta( 8 );
      hb_storc(  szFaceName        , -1, 1 );
      hb_stornl( ( LONG ) PointSize, -1, 2 );
      hb_storni( lf.lfWidth        , -1, 3 );
      hb_storni( lf.lfWeight       , -1, 4 );
      hb_storni( lf.lfQuality      , -1, 5 );
      hb_storl(  lf.lfItalic       , -1, 6 );
      hb_storl(  lf.lfUnderline    , -1, 7 );
      hb_storl(  lf.lfStrikeOut    , -1, 8 );

      HB_TCHAR_FREE( szFaceName );
   }
   else
   {
      hb_reta( 8 );

      hb_storc(  ""        , -1, 1 );
      hb_stornl( ( LONG ) 0, -1, 2 );
      hb_storni( 0         , -1, 3 );
      hb_storni( 0         , -1, 4 );
      hb_storni( 0         , -1, 5 );
      hb_storl(  0         , -1, 6 );
      hb_storl(  0         , -1, 7 );
      hb_storl(  0         , -1, 8 );
   }

   return ;
}
wvgutils.c128
HB_FUNCWVT_CHOOSECOLOR(void)
HB_FUNC( WVT_CHOOSECOLOR )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   CHOOSECOLOR cc ;
   COLORREF    crCustClr[ 16 ] ;
   int         i ;

   for( i = 0 ; i < 16 ; i++ )
   {
     crCustClr[ i ] = ( ISARRAY( 2 ) ? ( COLORREF ) hb_parnl( 2, i+1 ) : GetSysColor( COLOR_BTNFACE ) ) ;
   }

   cc.lStructSize   = sizeof( CHOOSECOLOR ) ;
   cc.hwndOwner     = _s->hWnd ;
   cc.rgbResult     = ISNIL( 1 ) ?  0 : ( COLORREF ) hb_parnl( 1 ) ;
   cc.lpCustColors  = crCustClr ;
   cc.Flags         = ( WORD ) ( ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) );

   if ( ChooseColor( &cc ) )
   {
      hb_retnl( cc.rgbResult ) ;
   }
   else
   {
      hb_retnl( -1 );
   }
}
wvgutils.c211
HB_FUNCWVT_MESSAGEBOX(void)
HB_FUNC( WVT_MESSAGEBOX )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   LPTSTR title = HB_TCHAR_CONVTO( hb_parc( 1 ) );
   LPTSTR msg = HB_TCHAR_CONVTO( hb_parc( 2 ) );
   hb_retni( MessageBox( _s->hWnd, title, msg, ISNIL( 3 ) ? MB_OK : hb_parni( 3 ) ) ) ;
   HB_TCHAR_FREE( title );
   HB_TCHAR_FREE( msg );
}
wvgutils.c244
HB_FUNCWVT_SETTOOLTIPACTIVE(void)
HB_FUNC( WVT_SETTOOLTIPACTIVE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   BOOL bActive = _s->bToolTipActive;

   if ( ! ISNIL( 1 ) )
   {
      _s->bToolTipActive = hb_parl( 1 );
   }

   hb_retl( bActive );
}
wvgutils.c267
HB_FUNCWVT_SETTOOLTIP(void)
HB_FUNC( WVT_SETTOOLTIP )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   TOOLINFO ti;
   POINT    xy = { 0,0 };
   int      iTop, iLeft, iBottom, iRight;

   if ( ! _s->bToolTipActive )
   {
      return;
   }

   memset( &ti, 0, sizeof( ti ) );
   ti.cbSize    = sizeof( TOOLINFO );
   ti.hwnd      = _s->hWnd;
   ti.uId       = 100000;

   if ( SendMessage( _s->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) )
   {
      LPTSTR text = HB_TCHAR_CONVTO( hb_parcx( 5 ) );

      xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );
      iTop    = xy.y;
      iLeft   = xy.x;

      xy      = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 )+1, ( USHORT ) hb_parni( 3 )+1 );
      iBottom = xy.y - 1;
      iRight  = xy.x - 1;

      ti.lpszText = text;

      ti.rect.left   = iLeft;
      ti.rect.top    = iTop;
      ti.rect.right  = iRight;
      ti.rect.bottom = iBottom;

      SendMessage( _s->hWndTT, TTM_SETTOOLINFO, 0, ( LPARAM ) &ti );

      HB_TCHAR_FREE( text );
   }
}
wvgutils.c281
HB_FUNCWVT_SETTOOLTIPTEXT(void)
HB_FUNC( WVT_SETTOOLTIPTEXT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   TOOLINFO ti;

   ti.cbSize = sizeof( TOOLINFO );
   ti.hwnd   = _s->hWnd;
   ti.uId    = 100000;

   if ( SendMessage( _s->hWndTT, TTM_GETTOOLINFO, 0, ( LPARAM ) &ti ) )
   {
      LPTSTR text = HB_TCHAR_CONVTO( hb_parcx( 1 ) );
      ti.lpszText = text;
      SendMessage( _s->hWndTT, TTM_UPDATETIPTEXT, 0, ( LPARAM ) &ti );
      HB_TCHAR_FREE( text );
   }
}
wvgutils.c330
HB_FUNCWVT_SETTOOLTIPMARGIN(void)
HB_FUNC( WVT_SETTOOLTIPMARGIN )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   RECT rc = { 0,0,0,0 };

   rc.left   = hb_parni( 2 );
   rc.top    = hb_parni( 1 );
   rc.right  = hb_parni( 4 );
   rc.bottom = hb_parni( 3 );

   SendMessage( _s->hWndTT, TTM_SETMARGIN, 0, ( LPARAM ) &rc );
#endif
}
wvgutils.c351
HB_FUNCWVT_SETTOOLTIPWIDTH(void)
HB_FUNC( WVT_SETTOOLTIPWIDTH )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iTipWidth = ( int ) SendMessage( _s->hWndTT, TTM_GETMAXTIPWIDTH, 0, 0 );

   if ( ISNUM( 1 ) )
   {
      SendMessage( _s->hWndTT, TTM_SETMAXTIPWIDTH, 0, ( LPARAM ) ( HB_PTRDIFF ) hb_parnint( 1 ) );
   }

   hb_retni( iTipWidth );
#endif
}
wvgutils.c369
HB_FUNCWVT_SETTOOLTIPBKCOLOR(void)
HB_FUNC( WVT_SETTOOLTIPBKCOLOR )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   COLORREF cr = ( COLORREF ) SendMessage( _s->hWndTT, TTM_GETTIPBKCOLOR, 0, 0 );

   if ( ISNUM( 1 ) )
   {
      SendMessage( _s->hWndTT, TTM_SETTIPBKCOLOR, ( WPARAM ) ( COLORREF ) hb_parnl( 1 ), 0 );
   }
   hb_retnl( ( COLORREF ) cr );
#endif
}
wvgutils.c387
HB_FUNCWVT_SETTOOLTIPTEXTCOLOR(void)
HB_FUNC( WVT_SETTOOLTIPTEXTCOLOR )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   COLORREF cr = ( COLORREF ) SendMessage( _s->hWndTT, TTM_GETTIPTEXTCOLOR, 0, 0 );

   if ( ISNUM( 1 ) )
   {
      SendMessage( _s->hWndTT, TTM_SETTIPTEXTCOLOR, ( WPARAM ) ( COLORREF ) hb_parnl( 1 ), 0 );
   }

   hb_retnl( ( COLORREF ) cr );
#endif
}
wvgutils.c404
HB_FUNCWVT_SETTOOLTIPTITLE(void)
HB_FUNC( WVT_SETTOOLTIPTITLE )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iIcon;

   if ( ! ISNIL( 2 ) )
   {
      iIcon = ISNIL( 1 ) ? 0 : hb_parni( 1 );
      if ( iIcon > 3 )
      {
         iIcon = 0 ;
      }
      SendMessage( _s->hWndTT, TTM_SETTITLE, ( WPARAM ) iIcon, ( LPARAM ) hb_parc( 2 ) );
   }
#endif
}
wvgutils.c423
HB_FUNCWVT_GETTOOLTIPWIDTH(void)
HB_FUNC( WVT_GETTOOLTIPWIDTH )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   hb_retni( ( int ) SendMessage( _s->hWndTT, TTM_GETMAXTIPWIDTH, 0, 0 ) );
#endif
}
wvgutils.c445
HB_FUNCWVT_GETTOOLTIPBKCOLOR(void)
HB_FUNC( WVT_GETTOOLTIPBKCOLOR )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   hb_retnl( ( COLORREF ) SendMessage( _s->hWndTT, TTM_GETTIPBKCOLOR, 0, 0 ) );
#endif
}
wvgutils.c456
HB_FUNCWVT_GETTOOLTIPTEXTCOLOR(void)
HB_FUNC( WVT_GETTOOLTIPTEXTCOLOR )
{
#if !defined( __WINCE__ )
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   hb_retnl( ( COLORREF ) SendMessage( _s->hWndTT, TTM_GETTIPTEXTCOLOR, 0, 0 ) );
#endif
}
wvgutils.c467
HB_FUNCWVT_SETGUI(void)
HB_FUNC( WVT_SETGUI )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   BOOL bGui = _s->bGui;

   if ( ISLOG( 1 ) )
   {
      _s->bGui = hb_parl( 1 );
   }

   hb_retl( bGui );
}
wvgutils.c480
HB_FUNCWVT_SETMOUSEPOS(void)
HB_FUNC( WVT_SETMOUSEPOS )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy = { 0,0 };

   xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );

   if ( ClientToScreen( _s->hWnd, &xy ) )
   {
      hb_retl( SetCursorPos( xy.x, xy.y + ( _s->PTEXTSIZE.y / 2 ) ) );
   }
   else
   {
      hb_retl( FALSE );
   }
}
wvgutils.c496
HB_FUNCWVT_GETPAINTRECT(void)
HB_FUNC( WVT_GETPAINTRECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   PHB_ITEM info = hb_itemArrayNew( 4 );

   hb_arraySetNI( info, 1, _s->rowStart );
   hb_arraySetNI( info, 2, _s->colStart );
   hb_arraySetNI( info, 3, _s->rowStop  );
   hb_arraySetNI( info, 4, _s->colStop  );

   hb_itemReturnRelease( info );
}
wvgutils.c516
HB_FUNCWVT_SETPOINTER(void)
HB_FUNC( WVT_SETPOINTER )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int     iCursor = hb_parni( 1 );
   HCURSOR hCursor;

   switch ( iCursor )
   {
   case 1:
      hCursor = LoadCursor( NULL, IDC_ARROW    );
      break;

   case 2:
      hCursor = LoadCursor( NULL, IDC_IBEAM    );
      break;

   case 3:
      hCursor = LoadCursor( NULL, IDC_WAIT     );
      break;

   case 4:
      hCursor = LoadCursor( NULL, IDC_CROSS    );
      break;

   case 5:
      hCursor = LoadCursor( NULL, IDC_UPARROW  );
      break;

   case 6:
      hCursor = LoadCursor( NULL, IDC_SIZE     );
      break;

   case 7:
      hCursor = LoadCursor( NULL, IDC_ICON     );
      break;

   case 8:
      hCursor = LoadCursor( NULL, IDC_SIZENWSE );
      break;

   case 9:
      hCursor = LoadCursor( NULL, IDC_SIZENESW );
      break;

   case 10:
      hCursor = LoadCursor( NULL, IDC_SIZEWE   );
      break;

   case 11:
      hCursor = LoadCursor( NULL, IDC_SIZENS   );
      break;

   case 12:
      hCursor = LoadCursor( NULL, IDC_SIZEALL  );
      break;

   case 13:
      hCursor = LoadCursor( NULL, IDC_NO       );
      break;

   case 14:
      hCursor = LoadCursor( NULL, IDC_HAND     );
      break;

   case 15:
      hCursor = LoadCursor( NULL, IDC_APPSTARTING );
      break;

   case 16:
      hCursor = LoadCursor( NULL, IDC_HELP     );
      break;

   default:
      hCursor = LoadCursor( NULL, IDC_ARROW    );
      break;
   }

#if !defined(HB_ARCH_64BIT) && ( defined( __WATCOMC__ ) || defined(__DMC__) || \
    ( defined(_MSC_VER) && ( _MSC_VER <= 1200 || defined(HB_WINCE) ) ) )
   SetClassLong( _s->hWnd, GCLP_HCURSOR, ( DWORD ) hCursor );
#else
   SetClassLongPtr( _s->hWnd, GCLP_HCURSOR, ( LONG_PTR ) hCursor );
#endif
}
wvgutils.c532
HB_FUNCWVT_SETMOUSEMOVE(void)
HB_FUNC( WVT_SETMOUSEMOVE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   BOOL bMouseMove = _s->MouseMove;

   if( ISLOG( 1 ) )
     _s->MouseMove = hb_parl( 1 );

   hb_retl( bMouseMove );
}
wvgutils.c620
HB_FUNCWVT_GETXYFROMROWCOL(void)
HB_FUNC( WVT_GETXYFROMROWCOL )
{
   PHB_ITEM info = hb_itemArrayNew( 2 );
   POINT    xy = { 0,0 };

   xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );

   hb_arraySetNL( info, 1, xy.x );
   hb_arraySetNL( info, 2, xy.y );

   hb_itemReturnRelease( info );
}
wvgutils.c634
HB_FUNCWVT_GETFONTINFO(void)
HB_FUNC( WVT_GETFONTINFO )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   PHB_ITEM info = hb_itemArrayNew( 7 );

   hb_arraySetC(  info, 1, _s->fontFace    );
   hb_arraySetNL( info, 2, _s->fontHeight  );
   hb_arraySetNL( info, 3, _s->fontWidth   );
   hb_arraySetNL( info, 4, _s->fontWeight  );
   hb_arraySetNL( info, 5, _s->fontQuality );
   hb_arraySetNL( info, 6, _s->PTEXTSIZE.y );
   hb_arraySetNL( info, 7, _s->PTEXTSIZE.x );

   hb_itemReturnRelease( info );
}
wvgutils.c649
HB_FUNCWVT_SETMENU(void)
HB_FUNC( WVT_SETMENU )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   RECT wi = { 0, 0, 0, 0 };
   RECT ci = { 0, 0, 0, 0 };
   RECT rc = { 0, 0, 0, 0 };
   USHORT height, width;

   SetMenu( _s->hWnd, ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) ;

   GetWindowRect( _s->hWnd, &wi );
   GetClientRect( _s->hWnd, &ci );

   height = ( USHORT ) ( _s->PTEXTSIZE.y * _s->ROWS );
   width  = ( USHORT ) ( _s->PTEXTSIZE.x * _s->COLS );

   width  += ( USHORT ) ( wi.right - wi.left - ci.right );
   height += ( USHORT ) ( wi.bottom - wi.top - ci.bottom );

   if( _s->CentreWindow && SystemParametersInfo( SPI_GETWORKAREA, 0, &rc, 0 ) )
   {
      wi.left = rc.left + ( ( rc.right - rc.left - width  ) / 2 );
      wi.top  = rc.top  + ( ( rc.bottom - rc.top - height ) / 2 );
   }
   SetWindowPos( _s->hWnd, NULL, wi.left, wi.top, width, height, SWP_NOZORDER );
}
wvgutils.c676
HB_FUNCWVT_SETPOPUPMENU(void)
HB_FUNC( WVT_SETPOPUPMENU )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   HMENU hPopup = _s->hPopup ;

   _s->hPopup = ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 );
   if ( hPopup )
   {
      hb_retnint( ( HB_PTRDIFF ) hPopup );
   }
}
wvgutils.c706
HB_FUNCWVT_CREATEMENU(void)
HB_FUNC( WVT_CREATEMENU )
{
  hb_retnint( ( HB_PTRDIFF ) CreateMenu() );
}
wvgutils.c721
HB_FUNCWVT_CREATEPOPUPMENU(void)
HB_FUNC( WVT_CREATEPOPUPMENU )
{
  hb_retnint( ( HB_PTRDIFF ) CreatePopupMenu() );
}
wvgutils.c728
HB_FUNCWVT_APPENDMENU(void)
HB_FUNC( WVT_APPENDMENU )
{
  char    ucBuf[ 256 ];
  int     i,iLen ;
  LPCTSTR lpszCaption;

  if ( ISCHAR( 4 ) )
  {
    iLen = hb_parclen( 4 );
    if ( iLen > 0 && iLen < 256 )   // Translate '~' to '&'
    {
      //lpszCaption = hb_parc( 4 ) ;
      lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) );
      for ( i = 0; i < iLen; i++ )
      {
        ucBuf[ i ] = ( *lpszCaption == '~' ) ? '&' : ( char ) *lpszCaption;
        lpszCaption++;
      }
      ucBuf[ iLen ]= '\0';
      //lpszCaption = ucBuf ;
      lpszCaption = HB_TCHAR_CONVTO( ucBuf );
    }
    else
    {
       //lpszCaption = hb_parc( 4 ) ;
       lpszCaption = HB_TCHAR_CONVTO( hb_parc( 4 ) );
    }
  }
  else
  {
    lpszCaption = ( LPCTSTR ) ( HB_PTRDIFF ) hb_parnint( 4 ) ; // It is a SEPARATOR or Submenu
  }

  hb_retl( AppendMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( HB_PTRDIFF ) hb_parnint( 3 ), ( LPCTSTR ) lpszCaption ) ) ;
}
wvgutils.c735
HB_FUNCWVT_DELETEMENU(void)
HB_FUNC( WVT_DELETEMENU )
{
  hb_retl( DeleteMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) );
}
wvgutils.c773
HB_FUNCWVT_DESTROYMENU(void)
HB_FUNC( WVT_DESTROYMENU )
{
  hb_retl( DestroyMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
wvgutils.c780
HB_FUNCWVT_ENABLEMENUITEM(void)
HB_FUNC( WVT_ENABLEMENUITEM )
{
   hb_retni( EnableMenuItem( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ), ( UINT ) hb_parni( 3 ) ) );
}
wvgutils.c787
HB_FUNCWVT_GETLASTMENUEVENT(void)
HB_FUNC( WVT_GETLASTMENUEVENT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   hb_retni( _s->LastMenuEvent );
}
wvgutils.c794
HB_FUNCWVT_SETLASTMENUEVENT(void)
HB_FUNC( WVT_SETLASTMENUEVENT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iEvent = _s->LastMenuEvent;
   if ( ISNUM( 1 ) )
      _s->LastMenuEvent = hb_parni( 1 );

   hb_retni( iEvent );
}
wvgutils.c803
HB_FUNCWVT_SETMENUKEYEVENT(void)
HB_FUNC( WVT_SETMENUKEYEVENT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   int iOldEvent = _s->MenuKeyEvent;

   if( ISNUM( 1 ) )
     _s->MenuKeyEvent = hb_parni( 1 );

   hb_retni( iOldEvent ) ;
}
wvgutils.c816
HB_FUNCWVT_DRAWMENUBAR(void)
HB_FUNC( WVT_DRAWMENUBAR )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   DrawMenuBar( _s->hWnd ) ;
}
wvgutils.c830
HB_FUNCWVT_ENABLESHORTCUTS(void)
HB_FUNC( WVT_ENABLESHORTCUTS )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   BOOL bWas = _s->EnableShortCuts;

   if( ISLOG( 1 ) )
      _s->EnableShortCuts = hb_parl( 1 );

   hb_retl( bWas );
}
wvgutils.c839
HB_FUNCWVT_INVALIDATERECT(void)
HB_FUNC( WVT_INVALIDATERECT )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   RECT  rc = { 0,0,0,0 };
   POINT xy = { 0,0 };

   xy           = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );
   rc.top       = xy.y;
   rc.left      = xy.x;
   xy           = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 4 )+1, ( USHORT ) hb_parni( 3 )+1 );
   rc.bottom    = xy.y - 1;
   rc.right     = xy.x - 1;

   InvalidateRect( _s->hWnd, &rc, TRUE );
}
wvgutils.c853
HB_FUNCWVT_ISLBUTTONPRESSED(void)
HB_FUNC( WVT_ISLBUTTONPRESSED )
{
   hb_retl( GetKeyState( VK_LBUTTON ) & 0x8000 );
}
wvgutils.c872
HB_FUNCWVT_CLIENTTOSCREEN(void)
HB_FUNC( WVT_CLIENTTOSCREEN )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   PHB_ITEM info = hb_itemArrayNew( 2 );
   POINT    xy = { 0,0 };

   xy = hb_wvt_gtGetXYFromColRow( ( USHORT ) hb_parni( 2 ), ( USHORT ) hb_parni( 1 ) );

   ClientToScreen( _s->hWnd, &xy );

   hb_arraySetNL( info, 1, xy.x );
   hb_arraySetNL( info, 2, xy.y );

   hb_itemReturnRelease( info );
}
wvgutils.c879
HB_FUNCWVT_GETCURSORPOS(void)
HB_FUNC( WVT_GETCURSORPOS )
{
   POINT    xy = { 0,0 };
   PHB_ITEM info = hb_itemArrayNew( 2 );

   GetCursorPos( &xy );

   hb_arraySetNI( info, 1, xy.x );
   hb_arraySetNI( info, 2, xy.y );

   hb_itemReturnRelease( info );
}
wvgutils.c898
HB_FUNCWVT_TRACKPOPUPMENU(void)
HB_FUNC( WVT_TRACKPOPUPMENU )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   POINT xy = { 0,0 };

   GetCursorPos( &xy );

   hb_retnl( TrackPopupMenu( ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 ) ,
                     TPM_CENTERALIGN | TPM_RETURNCMD ,
                                                xy.x ,
                                                xy.y ,
                                                   0 ,
                                            _s->hWnd ,
                                                NULL ) );
}
wvgutils.c913
HB_FUNCWVT_GETMENU(void)
HB_FUNC( WVT_GETMENU )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   hb_retnint( ( HB_PTRDIFF ) GetMenu( _s->hWnd ) );
}
wvgutils.c932
HB_FUNCWVT_CREATEDIALOGDYNAMIC(void)
HB_FUNC( WVT_CREATEDIALOGDYNAMIC )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   PHB_ITEM pFirst = hb_param( 3,HB_IT_ANY );
   PHB_ITEM pFunc  = NULL ;
   PHB_DYNS pExecSym;
   HWND     hDlg   = 0;
   int      iType  = 0;
   int      iIndex;
   int      iResource = hb_parni( 4 );

   /* check if we still have room for a new dialog */
   for ( iIndex = 0; iIndex < WVT_DLGML_MAX; iIndex++ )
   {
      if ( _s->hDlgModeless[ iIndex ] == NULL )
      {
         break;
      }
   }

   if ( iIndex >= WVT_DLGML_MAX )
   {
      /* no more room */
      hb_retnint( 0 );
      return;
   }

   if ( HB_IS_BLOCK( pFirst ) )
   {
      /* pFunc is pointing to stored code block (later) */
      pFunc = hb_itemNew( pFirst );
      iType = 2;
   }
   else if( hb_itemType( pFirst ) == HB_IT_STRING )
   {
      #ifdef __XHARBOUR__
      hb_dynsymLock();
      #endif
      pExecSym = hb_dynsymFindName( hb_itemGetCPtr( pFirst ) );
      #ifdef __XHARBOUR__
      hb_dynsymUnlock();
      #endif
      if ( pExecSym )
      {
         pFunc = ( PHB_ITEM ) pExecSym;
      }
      iType = 1;
   }

   {
      if ( ISNUM( 3 ) )
      {
         LPTSTR lpTemplate = HB_TCHAR_CONVTO( hb_parc( 1 ) );
         hDlg = CreateDialogIndirect( ( HINSTANCE     ) wvg_hInstance(),
                                      ( LPDLGTEMPLATE ) lpTemplate,
                                                        hb_parl( 2 ) ? _s->hWnd : NULL,
                                      ( DLGPROC       ) ( HB_PTRDIFF ) hb_parnint( 3 ) );
         HB_TCHAR_FREE( lpTemplate );
      }
      else
      {
         switch ( iResource )
         {
            case 0:
            {
               LPTSTR lpTemplate = HB_TCHAR_CONVTO( hb_parc( 1 ) );
               hDlg = CreateDialog( ( HINSTANCE ) wvg_hInstance(),
                                                  lpTemplate,
                                                  hb_parl( 2 ) ? _s->hWnd : NULL,
                                      ( DLGPROC ) hb_wvt_gtDlgProcMLess );
               HB_TCHAR_FREE( lpTemplate );
            }
            break;

            case 1:
            {
               hDlg = CreateDialog( ( HINSTANCE ) wvg_hInstance(),
                                    MAKEINTRESOURCE( ( WORD ) hb_parni( 1 ) ),
                                    hb_parl( 2 ) ? _s->hWnd : NULL,
                                    ( DLGPROC ) hb_wvt_gtDlgProcMLess );
            }
            break;

            case 2:
            {
               /* hb_parc( 1 ) is already unicode compliant, so no conversion */
               hDlg = CreateDialogIndirect( ( HINSTANCE     ) wvg_hInstance(),
                                            ( LPDLGTEMPLATE ) hb_parc( 1 ),
                                            hb_parl( 2 ) ? _s->hWnd : NULL,
                                            ( DLGPROC ) hb_wvt_gtDlgProcMLess );
            }
            break;
         }
      }

      if ( hDlg )
      {
         _s->hDlgModeless[ iIndex ] = hDlg;

         if ( pFunc )
         {
            /* if codeblock, store the codeblock and lock it there */
            if (HB_IS_BLOCK( pFirst ))
            {
               _s->pcbFunc[ iIndex ] = pFunc;
            }

            _s->pFunc[ iIndex ] = pFunc;
            _s->iType[ iIndex ] = iType;
         }
         else
         {
            _s->pFunc[ iIndex ] = NULL;
            _s->iType[ iIndex ] = 0;
         }
         SendMessage( hDlg, WM_INITDIALOG, 0, 0 );
      }
      else
      {
         /* if codeblock item created earlier, release it */
         if (iType==2 && pFunc)
         {
            hb_itemRelease( pFunc );
         }
         _s->hDlgModeless[ iIndex ] = NULL;
      }
   }

   hb_retnint( ( HB_PTRDIFF ) hDlg );
}
wvgutils.c949
HB_FUNCWVT_CREATEDIALOGMODAL(void)
HB_FUNC( WVT_CREATEDIALOGMODAL )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   PHB_ITEM pFirst    = hb_param( 3,HB_IT_ANY );
   PHB_ITEM pFunc     = NULL ;
   PHB_DYNS pExecSym;
   int      iIndex;
   int      iResource = hb_parni( 4 );
   HB_PTRDIFF iResult = 0;
   HWND     hParent   = ISNIL( 5 ) ? _s->hWnd : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 5 );

   /* check if we still have room for a new dialog */
   for ( iIndex = 0; iIndex < WVT_DLGMD_MAX; iIndex++ )
   {
      if ( _s->hDlgModal[ iIndex ] == NULL )
      {
         break;
      }
   }

   if ( iIndex >= WVT_DLGMD_MAX )
   {
      /* no more room */
      hb_retnint( 0 );
      return;
   }

   if ( HB_IS_BLOCK( pFirst ) )
   {
      /* pFunc is pointing to stored code block (later) */

      _s->pcbFuncModal[ iIndex ] = hb_itemNew( pFirst );

      pFunc = _s->pcbFuncModal[ iIndex ];
      _s->pFuncModal[ iIndex ] = pFunc;
      _s->iTypeModal[ iIndex ] = 2;
   }
   else if( hb_itemType( pFirst ) == HB_IT_STRING )
   {
      #ifdef __XHARBOUR__
      hb_dynsymLock();
      #endif
      pExecSym = hb_dynsymFindName( hb_itemGetCPtr( pFirst ) );
      #ifdef __XHARBOUR__
      hb_dynsymUnlock();
      #endif
      if ( pExecSym )
      {
         pFunc = ( PHB_ITEM ) pExecSym;
      }
      _s->pFuncModal[ iIndex ] = pFunc;
      _s->iTypeModal[ iIndex ] = 1;
   }

   switch ( iResource )
   {
      case 0:
      {
         LPTSTR lpTemplate = HB_TCHAR_CONVTO( hb_parc( 1 ) );
         iResult = DialogBoxParam( ( HINSTANCE     ) wvg_hInstance(),
                                                     lpTemplate,
                                                     hParent,
                                         ( DLGPROC ) hb_wvt_gtDlgProcModal,
                                ( LPARAM ) ( DWORD ) iIndex+1 );
         HB_TCHAR_FREE( lpTemplate );
      }
      break;

      case 1:
      {
         iResult = DialogBoxParam( ( HINSTANCE     ) wvg_hInstance(),
                           MAKEINTRESOURCE( ( WORD ) hb_parni( 1 ) ),
                                                     hParent,
                                         ( DLGPROC ) hb_wvt_gtDlgProcModal,
                                ( LPARAM ) ( DWORD ) iIndex+1 );
      }
      break;

      case 2:
      {
         /* hb_parc( 1 ) is already unicode compliant, so no conversion */
         iResult = DialogBoxIndirectParam( ( HINSTANCE     ) wvg_hInstance(),
                                           ( LPDLGTEMPLATE ) hb_parc( 1 ),
                                                             hParent,
                                                 ( DLGPROC ) hb_wvt_gtDlgProcModal,
                                        ( LPARAM ) ( DWORD ) iIndex+1 );
      }
      break;
   }

   hb_retnint( iResult );
}
wvgutils.c1083
HB_FUNCWVT__MAKEDLGTEMPLATE(void)
HB_FUNC( WVT__MAKEDLGTEMPLATE )
{
   WORD  *p, *pdlgtemplate ;
   WORD  nItems = ( WORD ) hb_parni( 1, 4 ) ;
   int   i, nchar ;
   DWORD lStyle ;

   // Parameters: 12 arrays
   // 1 for DLG template
   // 11 for item properties

   // 64k allow to build up to 255 items on the dialog
   //
   pdlgtemplate = p = ( PWORD ) LocalAlloc( LPTR, 65534 )  ;

   //---------------

    lStyle = hb_parnl(1,3) ;

    // start to fill in the dlgtemplate information.  addressing by WORDs

    *p++ = 1                        ; // version
    *p++ = 0xFFFF                   ; // signature
    *p++ = LOWORD ( hb_parnl(1,1) ) ; // Help Id
    *p++ = HIWORD ( hb_parnl(1,1) ) ;

    *p++ = LOWORD ( hb_parnl(1,2) ) ; // ext. style
    *p++ = HIWORD ( hb_parnl(1,2) ) ;

    *p++ = LOWORD (lStyle)          ;
    *p++ = HIWORD (lStyle)          ;

    *p++ = (WORD)   nItems          ;  // NumberOfItems
    *p++ = (short)  hb_parni(1,5)   ;  // x
    *p++ = (short)  hb_parni(1,6)   ;  // y
    *p++ = (short)  hb_parni(1,7)   ;  // cx
    *p++ = (short)  hb_parni(1,8)   ;  // cy
    *p++ = (short)  0               ;  // Menu (ignored for now.)
    *p++ = (short)  0x00            ;  // Class also ignored

    if ( hb_parinfa( 1,11 ) == HB_IT_STRING )
    {
       nchar = nCopyAnsiToWideChar( p, (LPSTR) hb_parc( 1,11 ) ) ;
       p += nchar   ;
    }
    else
    {
      *p++ =0 ;
    }
    // add in the wPointSize and szFontName here iff the DS_SETFONT bit on

    if ( ( lStyle & DS_SETFONT ) )
    {
      *p++ = (short) hb_parni(1,12) ;
      *p++ = (short) hb_parni(1,13) ;
      *p++ = (short) hb_parni(1,14) ;

      nchar = nCopyAnsiToWideChar( p, (LPSTR) hb_parc( 1,15 ) ) ;
      p += nchar ;
    } ;

    //---------------
    // Now, for the items

   for ( i = 1 ; i <= nItems ; i++ ) {
      // make sure each item starts on a DWORD boundary
      p = lpwAlign (p) ;

      *p++ = LOWORD ( hb_parnl(2,i) ) ;    // help id
      *p++ = HIWORD ( hb_parnl(2,i) ) ;

      *p++ = LOWORD ( hb_parnl(3,i) ) ; // ext. style
      *p++ = HIWORD ( hb_parnl(3,i) ) ;

      *p++ = LOWORD ( hb_parnl(4,i) ) ; // style
      *p++ = HIWORD ( hb_parnl(4,i) ) ;

      *p++ = (short)  hb_parni(5,i)   ;  // x
      *p++ = (short)  hb_parni(6,i)   ;  // y
      *p++ = (short)  hb_parni(7,i)   ;  // cx
      *p++ = (short)  hb_parni(8,i)   ;  // cy

      *p++ = LOWORD ( hb_parnl(9,i) ) ;  // id
      *p++ = HIWORD ( hb_parnl(9,i) ) ;  // id   // 0;

      if ( hb_parinfa( 10,i ) == HB_IT_STRING )
      {
         nchar = nCopyAnsiToWideChar( p, (LPSTR) hb_parc( 10,i ) ) ; // class
         p += nchar ;
         }
      else
         {
         *p++ = 0xFFFF ;
         *p++ = (WORD) hb_parni(10,i) ;
         }

      if ( hb_parinfa( 11,i ) == HB_IT_STRING )
         {
         nchar = nCopyAnsiToWideChar( p, (LPSTR) hb_parc( 11,i ) ) ;  // text
         p += nchar ;
         }
      else
         {
         *p++ = 0xFFFF ;
         *p++ = (WORD) hb_parni(11,i) ;
         }

      *p++ = 0x00 ;  // extras ( in array 12 )
    };

    p = lpwAlign( p );

    hb_retclen( ( LPSTR ) pdlgtemplate, ( ( HB_PTRDIFF ) p - ( HB_PTRDIFF ) pdlgtemplate ) ) ;

    LocalFree( LocalHandle( pdlgtemplate ) );
}
wvgutils.c1179
HB_EXPORT LPWORDlpwAlign( LPWORD lpIn )
HB_EXPORT LPWORD lpwAlign( LPWORD lpIn )
{
   HB_PTRDIFF ul = ( HB_PTRDIFF ) lpIn;

   ul += 3;
   ul >>=2;
   ul <<=2;
   return ( LPWORD ) ul;
}
wvgutils.c1296
HB_EXPORT INTnCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn )
HB_EXPORT int nCopyAnsiToWideChar( LPWORD lpWCStr, LPSTR lpAnsiIn )
{
   int nChar = 0;

   do
   {
      *lpWCStr++ = ( WORD ) *lpAnsiIn;
      nChar++;
   }
   while ( *lpAnsiIn++ );

   return nChar;
}
wvgutils.c1313
HB_FUNCWVT_LBADDSTRING(void)
HB_FUNC( WVT_LBADDSTRING )
{
   LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) );
   SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), LB_ADDSTRING, 0, ( LPARAM )( LPSTR ) text );
   HB_TCHAR_FREE( text );
}
wvgutils.c1329
HB_FUNCWVT_LBGETCOUNT(void)
HB_FUNC( WVT_LBGETCOUNT )
{
   hb_retnl( ( long ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), LB_GETCOUNT, 0, 0 ) );
}
wvgutils.c1338
HB_FUNCWVT_LBDELETESTRING(void)
HB_FUNC( WVT_LBDELETESTRING )
{
   SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), LB_DELETESTRING, hb_parni( 3 ), 0 );
}
wvgutils.c1345
HB_FUNCWVT_LBSETCURSEL(void)
HB_FUNC( WVT_LBSETCURSEL )
{
   SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), LB_SETCURSEL, hb_parni( 3 ), 0 );
}
wvgutils.c1352
HB_FUNCWVT_CBADDSTRING(void)
HB_FUNC( WVT_CBADDSTRING )
{
   LPTSTR text = HB_TCHAR_CONVTO( hb_parc( 3 ) );
   SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), CB_ADDSTRING, 0, ( LPARAM )( LPSTR ) text );
   HB_TCHAR_FREE( text );
}
wvgutils.c1359
HB_FUNCWVT_CBSETCURSEL(void)
HB_FUNC( WVT_CBSETCURSEL )
{
   SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), CB_SETCURSEL, hb_parni( 3 ), 0 );
}
wvgutils.c1368
HB_FUNCWVT_DLGSETICON(void)
HB_FUNC( WVT_DLGSETICON )
{
   HICON hIcon;

   if ( ISNUM( 2 ) )
   {
      hIcon = LoadIcon( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 2 ) ) );
   }
   else
   {
      LPTSTR icon = HB_TCHAR_CONVTO( hb_parc( 2 ) );
      hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, icon, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
      HB_TCHAR_FREE( icon );
   }

   if ( hIcon )
   {
      SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), WM_SETICON, ICON_SMALL, ( LPARAM ) hIcon ); // Set Title Bar ICON
      SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), WM_SETICON, ICON_BIG,   ( LPARAM ) hIcon ); // Set Task List Icon
   }

   if ( hIcon )
   {
      hb_retnint( ( HB_PTRDIFF ) hIcon );
   }
}
wvgutils.c1373
HB_FUNCWIN_SENDMESSAGE(void)
HB_FUNC( WIN_SENDMESSAGE )
{
   LPTSTR cText = NULL;

   if( ISBYREF( 4 ) )
   {
      cText = HB_TCHAR_CONVTO( hb_parc( 4 ) );
   }

   hb_retnl( ( ULONG ) SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ),
                                    ( UINT ) hb_parni( 2 ),
                                    ( ISNIL( 3 ) ? 0 : ( WPARAM ) hb_parnint( 3 ) ),
                                    ( ISNIL( 4 ) ? 0 : ( cText ? ( LPARAM ) ( LPSTR ) cText :
                                       ( ISCHAR( 4 ) ? ( LPARAM )( LPSTR ) hb_parc( 4 ) :
                                           ( LPARAM ) hb_parnint( 4 ) ) ) ) )
           );

   if( cText )
   {
      char * szText = HB_TCHAR_CONVFROM( cText );
      hb_storc( szText, 4 );
      HB_TCHAR_FREE( szText );
      HB_TCHAR_FREE( cText );
   }
}
wvgutils.c1414
HB_FUNCWIN_SENDDLGITEMMESSAGE(void)
HB_FUNC( WIN_SENDDLGITEMMESSAGE )
{
   PHB_ITEM pText = hb_param( 5, HB_IT_STRING );
   char     *cText = NULL;
   int      iLen = 0;

   if( pText )
   {
      iLen  = hb_itemGetCLen( pText );
      cText = (char*) hb_xgrab( iLen+1 );
      hb_xmemcpy( cText, hb_itemGetCPtr( pText ), iLen+1 );
   }

   hb_retnl( (LONG) SendDlgItemMessage( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ,
                                        (int)  hb_parni( 2 ) ,
                                        (UINT) hb_parni( 3 ) ,
                                        (ISNIL(4) ? 0 : (WPARAM) hb_parnint( 4 ))   ,
                                        (cText ? (LPARAM) cText : (LPARAM) hb_parnint( 5 ))
                                      ) );

   if( cText )
   {
      if( ISBYREF( 5 ) )
      {
         hb_storclen( cText, iLen, 5 ) ;
      }
      hb_xfree( cText );
   }
}
wvgutils.c1442
HB_FUNCWIN_SETTIMER(void)
HB_FUNC( WIN_SETTIMER )
{
   hb_retl( SetTimer( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), NULL ) != 0 );
}
wvgutils.c1472
HB_FUNCWIN_SETFOCUS(void)
HB_FUNC( WIN_SETFOCUS )
{
   SetFocus( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) );
}
wvgutils.c1483
HB_FUNCWIN_SETTEXTCOLOR(void)
HB_FUNC( WIN_SETTEXTCOLOR )
{
   hb_retnl( ( ULONG ) SetTextColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) );
}
wvgutils.c1490
HB_FUNCWIN_SETBKCOLOR(void)
HB_FUNC( WIN_SETBKCOLOR )
{
   hb_retnl( ( ULONG ) SetBkColor( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( COLORREF ) hb_parnl( 2 ) ) );
}
wvgutils.c1497
HB_FUNCWIN_SETBKMODE(void)
HB_FUNC( WIN_SETBKMODE )
{
   hb_retni( ( int ) SetBkMode( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) );
}
wvgutils.c1504
HB_FUNCWIN_GETSTOCKOBJECT(void)
HB_FUNC( WIN_GETSTOCKOBJECT )
{
   hb_retnint( ( HB_PTRDIFF ) GetStockObject( hb_parni( 1 ) ) );
}
wvgutils.c1511
HB_FUNCWIN_DELETEOBJECT(void)
HB_FUNC( WIN_DELETEOBJECT )
{
   hb_retl( DeleteObject( ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
wvgutils.c1518
HB_FUNCWIN_SELECTOBJECT(void)
HB_FUNC( WIN_SELECTOBJECT )
{
   hb_retnint( ( HB_PTRDIFF ) SelectObject( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HGDIOBJ ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) );
}
wvgutils.c1525
HB_FUNCWIN_LOWORD(void)
HB_FUNC( WIN_LOWORD )
{
   hb_retnl( LOWORD( hb_parnl( 1 ) ) );
}
wvgutils.c1532
HB_FUNCWIN_HIWORD(void)
HB_FUNC( WIN_HIWORD )
{
   hb_retnl( HIWORD( hb_parnl( 1 ) ) );
}
wvgutils.c1539
HB_FUNCWIN_MULDIV(void)
HB_FUNC( WIN_MULDIV )
{
   hb_retni( MulDiv( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ) ) );
}
wvgutils.c1546
HB_FUNCWIN_GETDIALOGBASEUNITS(void)
HB_FUNC( WIN_GETDIALOGBASEUNITS )
{
   hb_retnl( ( LONG ) GetDialogBaseUnits() ) ;
}
wvgutils.c1553
HB_FUNCWIN_SETMENU(void)
HB_FUNC( WIN_SETMENU )
{
   SetMenu( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) ;
}
wvgutils.c1560
HB_FUNCWIN_SETDLGITEMTEXT(void)
HB_FUNC( WIN_SETDLGITEMTEXT )
{
   LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 3 ) );
   SetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), lpBuffer );
   HB_TCHAR_FREE( lpBuffer );
}
wvgutils.c1567
HB_FUNCWIN_GETDLGITEMTEXT(void)
HB_FUNC( WIN_GETDLGITEMTEXT )
{
   USHORT iLen = ( USHORT ) SendMessage( GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ), WM_GETTEXTLENGTH, 0, 0 ) + 1 ;
   LPTSTR cText = ( LPTSTR ) hb_xgrab( iLen * sizeof( TCHAR ) );
   char * szText;
   UINT iResult;

   iResult = GetDlgItemText( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box
                             hb_parni( 2 ),            // identifier of control
                             cText,                    // address of buffer for text
                             iLen                      // maximum size of string
                            );

   cText[ iResult ] = '\0';
   szText = HB_TCHAR_CONVFROM( cText );
   hb_retc( szText );
   HB_TCHAR_FREE( szText );
   hb_xfree( cText );
}
wvgutils.c1576
HB_FUNCWIN_CHECKDLGBUTTON(void)
HB_FUNC( WIN_CHECKDLGBUTTON )
{
   hb_retl( CheckDlgButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ),
                            ( UINT )( ISNUM( 3 ) ? hb_parni( 3 ) : hb_parl( 3 ) ) ) );
}
wvgutils.c1598
HB_FUNCWIN_ISDLGBUTTONCHECKED(void)
HB_FUNC( WIN_ISDLGBUTTONCHECKED )
{
   hb_retni( IsDlgButtonChecked( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) ) ;
}
wvgutils.c1606
HB_FUNCWIN_CHECKRADIOBUTTON(void)
HB_FUNC( WIN_CHECKRADIOBUTTON )
{
    hb_retl( CheckRadioButton( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), // handle of dialog box
                                        hb_parni( 2 ),   // identifier of first radio button in group
                                        hb_parni( 3 ),   // identifier of last radio button in group
                                        hb_parni( 4 )    // identifier of radio button to select
                              ) );
}
wvgutils.c1613
HB_FUNCWIN_GETDLGITEM(void)
HB_FUNC( WIN_GETDLGITEM )
{
   hb_retnint( ( HB_PTRDIFF ) GetDlgItem( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ) ) );
}
wvgutils.c1624
HB_FUNCWIN_MESSAGEBOX(void)
HB_FUNC( WIN_MESSAGEBOX )
{
   LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) );
   LPTSTR lpBuffer2 = HB_TCHAR_CONVTO( hb_parc( 3 ) );

   hb_retni( MessageBox( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lpBuffer2, ISNIL( 4 ) ? MB_OK : hb_parni( 4 ) ) ) ;

   HB_TCHAR_FREE( lpBuffer );
   HB_TCHAR_FREE( lpBuffer2 );
}
wvgutils.c1631
HB_FUNCWIN_INVALIDATERECT(void)
HB_FUNC( WIN_INVALIDATERECT )
{
   InvalidateRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), NULL, TRUE );
}
wvgutils.c1644
HB_FUNCWIN_LOADICON(void)
HB_FUNC( WIN_LOADICON )
{
   HICON hIcon;

   if ( ISNUM( 1 ) )
   {
      hIcon = LoadIcon( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) );
   }
   else
   {
      LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) );
      hIcon = ( HICON ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_ICON, 0, 0, LR_LOADFROMFILE );
      HB_TCHAR_FREE( lpBuffer );
   }

   hb_retnint( ( HB_PTRDIFF ) hIcon );
}
wvgutils.c1649
HB_FUNCWIN_LOADIMAGE(void)
HB_FUNC( WIN_LOADIMAGE )
{
   HBITMAP hImage = 0;
   LPTSTR  lpBuffer = HB_TCHAR_CONVTO( hb_parc( 1 ) );
   int     iSource = hb_parni( 2 );

   switch ( iSource )
   {
      case 0:
         hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), MAKEINTRESOURCE( hb_parni( 1 ) ) );
         break;

      case 1:
         hImage = LoadBitmap( ( HINSTANCE ) wvg_hInstance(), lpBuffer );
         break;

      case 2:
         hImage = ( HBITMAP ) LoadImage( ( HINSTANCE ) NULL, lpBuffer, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE );
         break;
   }

   HB_TCHAR_FREE( lpBuffer );
   hb_retnint( ( HB_PTRDIFF ) hImage );
}
wvgutils.c1671
HB_FUNCWIN_GETCLIENTRECT(void)
HB_FUNC( WIN_GETCLIENTRECT )
{
   RECT     rc = { 0,0,0,0 };
   PHB_ITEM info = hb_itemArrayNew( 4 );

   GetClientRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc );

   hb_arraySetNI( info, 1, rc.left   );
   hb_arraySetNI( info, 2, rc.top    );
   hb_arraySetNI( info, 3, rc.right  );
   hb_arraySetNI( info, 4, rc.bottom );

   hb_itemReturnRelease( info );
}
wvgutils.c1705
HB_FUNCWIN_DRAWIMAGE(void)
HB_FUNC( WIN_DRAWIMAGE )
{
   hb_retl( hb_wvt_DrawImage( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ),
                                   hb_parni( 4 ), hb_parni( 5 ), hb_parc( 6 ) ) );
}
wvgutils.c1720
HB_FUNCWIN_GETDC(void)
HB_FUNC( WIN_GETDC )
{
   hb_retnint( ( HB_PTRDIFF ) GetDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
wvgutils.c1732
HB_FUNCWIN_RELEASEDC(void)
HB_FUNC( WIN_RELEASEDC )
{
   hb_retl( ReleaseDC( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( HDC ) ( HB_PTRDIFF ) hb_parnint( 2 ) ) );
}
wvgutils.c1739
HB_FUNCWIN_RECTANGLE(void)
HB_FUNC( WIN_RECTANGLE )
{
   Rectangle( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) );
}
wvgutils.c1746
HB_FUNCWIN_CREATEBRUSH(void)
HB_FUNC( WIN_CREATEBRUSH )
{
   LOGBRUSH lb = { 0,0,0 };

   lb.lbStyle = hb_parni( 1 );
   lb.lbColor = ISNIL( 2 ) ? RGB( 0, 0, 0 ) : ( COLORREF ) hb_parnl( 2 ) ;
   lb.lbHatch = ISNIL( 3 ) ? 0 : hb_parni( 3 );

   hb_retnint( ( HB_PTRDIFF ) CreateBrushIndirect( &lb ) );
}
wvgutils.c1753
HB_FUNCWIN_DRAWTEXT(void)
HB_FUNC( WIN_DRAWTEXT )
{
   RECT rc = { 0,0,0,0 };
   LPTSTR lpBuffer = HB_TCHAR_CONVTO( hb_parc( 2 ) );

   rc.left   = hb_parni( 3,1 );
   rc.top    = hb_parni( 3,2 );
   rc.right  = hb_parni( 3,3 );
   rc.bottom = hb_parni( 3,4 );

   hb_retl( DrawText( ( HDC ) ( HB_PTRDIFF ) hb_parnint( 1 ), lpBuffer, lstrlen( lpBuffer ), &rc, hb_parni( 4 ) ) );
   HB_TCHAR_FREE( lpBuffer );
}
wvgutils.c1764
HB_FUNCWIN_GETWINDOWRECT(void)
HB_FUNC( WIN_GETWINDOWRECT )
{
   RECT rc;
   PHB_ITEM info = hb_itemArrayNew( 4 );

   GetWindowRect( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), &rc );

   hb_arraySetNI( info, 1, rc.left   );
   hb_arraySetNI( info, 2, rc.top    );
   hb_arraySetNI( info, 3, rc.right  );
   hb_arraySetNI( info, 4, rc.bottom );

   hb_itemReturnRelease( info );
}
wvgutils.c1784
HB_FUNCWIN_MOVEWINDOW(void)
HB_FUNC( WIN_MOVEWINDOW )
{
   MoveWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parnl( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ), hb_parl( 6 ) );
}
wvgutils.c1801
HB_FUNCWIN_SETPARENT(void)
HB_FUNC( WIN_SETPARENT )
{
   hb_retnint( ( HB_PTRDIFF ) SetParent( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), (HWND) ( HB_PTRDIFF ) hb_parnint( 2 ) ) );
}
wvgutils.c1808
HB_FUNCWIN_SETWINDOWLONG(void)
HB_FUNC( WIN_SETWINDOWLONG )
{
   hb_retnl( SetWindowLong( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), hb_parni( 2 ), hb_parnl( 3 ) ) );
}
wvgutils.c1815
HB_FUNCWIN_ISWINDOW(void)
HB_FUNC( WIN_ISWINDOW )
{
   hb_retl( IsWindow( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ) );
}
wvgutils.c1822
HB_FUNCWVT_GETFONTHANDLE(void)
HB_FUNC( WVT_GETFONTHANDLE )
{
   PHB_GTWVT _s = hb_wvt_gtGetWVT();

   HFONT hFont = 0;
   int   iSlot = hb_parni( 1 ) - 1;

   if ( iSlot >= 0 && iSlot < WVT_PICTURES_MAX )
      hFont = _s->hUserFonts[ iSlot ];

   hb_retnint( ( HB_PTRDIFF ) hFont );
}
wvgutils.c1829
HB_FUNCWIN_CLIENTTOSCREEN(void)
HB_FUNC( WIN_CLIENTTOSCREEN )
{
   POINT    Point ;
   PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY );

   if ( wvt_Array2Point( pArray ,&Point ) )
   {
      if ( ClientToScreen( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) )
      {
          wvt_Point2ArrayEx( &Point, pArray );
          hb_retl( TRUE ) ;
      }
      else
      {
         hb_retl( FALSE ) ;
      }
   }
   else
   {
      hb_retl( FALSE ) ;
   }
}
wvgutils.c1844
HB_FUNCWIN_SCREENTOCLIENT(void)
HB_FUNC( WIN_SCREENTOCLIENT )
{
   POINT    Point ;
   PHB_ITEM pArray = hb_param( 2 , HB_IT_ARRAY );

   if ( wvt_Array2Point( pArray, &Point ) )
   {
      if( ScreenToClient( (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ), &Point ) > 0 )
      {
          wvt_Point2ArrayEx( &Point, pArray );
          hb_retl( TRUE ) ;
      }
      else
      {
         hb_retl( FALSE ) ;
      }
   }
   else
   {
      hb_retl( FALSE ) ;
   }
}
wvgutils.c1869
BOOLwvt_Array2Rect(PHB_ITEM aRect, RECT *rc )
BOOL wvt_Array2Rect(PHB_ITEM aRect, RECT *rc )
{
   if (HB_IS_ARRAY(aRect) && hb_arrayLen(aRect) == 4) {
      rc->left   = hb_arrayGetNL(aRect,1);
      rc->top    = hb_arrayGetNL(aRect,2);
      rc->right  = hb_arrayGetNL(aRect,3);
      rc->bottom = hb_arrayGetNL(aRect,4);
      return TRUE ;
   }
   return FALSE;
}
wvgutils.c1902
PHB_ITEMwvt_Rect2Array( RECT *rc )
PHB_ITEM wvt_Rect2Array( RECT *rc  )
{
   PHB_ITEM aRect = hb_itemArrayNew( 4 );

   hb_arraySetNL(aRect, 1, rc->left   );
   hb_arraySetNL(aRect, 2, rc->top    );
   hb_arraySetNL(aRect, 3, rc->right  );
   hb_arraySetNL(aRect, 4, rc->bottom );

   return aRect;
}
wvgutils.c1916
BOOLwvt_Array2Point(PHB_ITEM aPoint, POINT *pt )
BOOL wvt_Array2Point(PHB_ITEM aPoint, POINT *pt )
{
   if (HB_IS_ARRAY(aPoint) && hb_arrayLen(aPoint) == 2) {
      pt->x = hb_arrayGetNL(aPoint,1);
      pt->y = hb_arrayGetNL(aPoint,2);
      return TRUE ;
   }
   return FALSE;
}
wvgutils.c1930
PHB_ITEMwvt_Point2Array( POINT *pt )
PHB_ITEM wvt_Point2Array( POINT *pt  )
{
   PHB_ITEM aPoint = hb_itemArrayNew(2);

   hb_arraySetNL(aPoint, 1, pt->x );
   hb_arraySetNL(aPoint, 2, pt->y );

   return aPoint;
}
wvgutils.c1942
BOOLwvt_Array2Size(PHB_ITEM aSize, SIZE *siz )
BOOL wvt_Array2Size(PHB_ITEM aSize, SIZE *siz )
{
   if (HB_IS_ARRAY(aSize) && hb_arrayLen(aSize) == 2) {
      siz->cx = hb_arrayGetNL(aSize,1);
      siz->cy = hb_arrayGetNL(aSize,2);
      return TRUE ;
   }
   return FALSE;
}
wvgutils.c1954
PHB_ITEMwvt_Size2Array( SIZE *siz )
PHB_ITEM wvt_Size2Array( SIZE *siz  )
{
   PHB_ITEM aSize   = hb_itemArrayNew(2);

   hb_arraySetNL(aSize, 1, siz->cx);
   hb_arraySetNL(aSize, 2, siz->cy);

   return aSize;
}
wvgutils.c1966
VOIDwvt_Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect )
void  wvt_Rect2ArrayEx( RECT *rc ,PHB_ITEM aRect )
{
   hb_arraySetNL(aRect, 1, rc->left);
   hb_arraySetNL(aRect, 2, rc->top);
   hb_arraySetNL(aRect, 3, rc->right);
   hb_arraySetNL(aRect, 4, rc->bottom);
}
wvgutils.c1978
VOIDwvt_Point2ArrayEx( POINT *pt, PHB_ITEM aPoint)
void wvt_Point2ArrayEx( POINT *pt, PHB_ITEM aPoint)
{
   hb_arraySetNL(aPoint, 1, pt->x);
   hb_arraySetNL(aPoint, 2, pt->y);
}
wvgutils.c1988
VOIDwvt_Size2ArrayEx( SIZE *siz, PHB_ITEM aSize )
void wvt_Size2ArrayEx( SIZE *siz, PHB_ITEM aSize )
{
   hb_arraySetNL(aSize, 1, siz->cx);
   hb_arraySetNL(aSize, 2, siz->cy);
}
wvgutils.c1996
HB_FUNCWVT__GETOPENFILENAME(void)
HB_FUNC( WVT__GETOPENFILENAME )
{
   OPENFILENAME ofn;
   LPTSTR lpFileName, lpstrTitle, lpstrFilter, lpstrInitialDir, lpstrDefExt;
   int size = hb_parclen( 2 );

   size += size ? 1 : 1024;
   lpFileName = ( LPTSTR ) hb_xgrab( size * sizeof( TCHAR ) );
   HB_TCHAR_CPTO( lpFileName, hb_parcx( 2 ), size - 1 );
   lpstrTitle      = HB_PARTSTR( 3 );
   lpstrFilter     = HB_PARTSTR( 4 );
   lpstrInitialDir = HB_PARTSTR( 6 );
   lpstrDefExt     = HB_PARTSTR( 7 );

   ZeroMemory( &ofn, sizeof( ofn ) );

   ofn.hInstance        = GetModuleHandle( NULL )  ;
   ofn.lStructSize      = sizeof( ofn );
   ofn.hwndOwner        = ISNIL(1) ? GetActiveWindow() : (HWND) ( HB_PTRDIFF ) hb_parnint( 1 ) ;
   ofn.lpstrTitle       = lpstrTitle;
   ofn.lpstrFilter      = lpstrFilter;
   ofn.Flags            = ISNIL(5) ? OFN_SHOWHELP|OFN_NOCHANGEDIR : hb_parnl( 5 ) ;
   ofn.lpstrInitialDir  = lpstrInitialDir;
   ofn.lpstrDefExt      = lpstrDefExt;
   ofn.nFilterIndex     = ISNIL(8) ? 0 : (int) hb_parni( 8 );
   ofn.lpstrFile        = lpFileName;
   ofn.nMaxFile         = size;

   if( GetOpenFileName( &ofn ) )
   {
      char * szFileName = HB_TCHAR_CONVFROM( lpFileName );
      hb_stornl( ofn.nFilterIndex, 8 );
      hb_storclen( szFileName, size, 2 ) ;
      hb_retc( szFileName );
      HB_TCHAR_FREE( szFileName );
   }
   else
   {
      hb_retc( NULL );
   }
   hb_xfree( lpFileName );
   HB_PARTFREE( lpstrTitle );
   HB_PARTFREE( lpstrFilter );
   HB_PARTFREE( lpstrInitialDir );
   HB_PARTFREE( lpstrDefExt );
}
wvgutils.c2007
HB_FUNCWVT__GETSAVEFILENAME(void)
HB_FUNC( WVT__GETSAVEFILENAME )
{
   OPENFILENAME ofn;
   LPTSTR lpstrTitle, lpstrFilter, lpstrInitialDir, lpstrDefExt;
   TCHAR lpFileName[MAX_PATH + 1];

   HB_TCHAR_CPTO( lpFileName, hb_parcx( 2 ), MAX_PATH );
   lpstrTitle      = HB_PARTSTR( 3 );
   lpstrFilter     = HB_PARTSTR( 4 );
   lpstrInitialDir = HB_PARTSTR( 6 );
   lpstrDefExt     = HB_PARTSTR( 7 );

   ZeroMemory( &ofn, sizeof( ofn ) );

   ofn.hInstance       = GetModuleHandle( NULL );
   ofn.lStructSize     = sizeof( ofn );
   ofn.hwndOwner       = ISNIL   (1) ? GetActiveWindow() : (HWND) ( HB_PTRDIFF ) hb_parnint( 1 );
   ofn.lpstrTitle      = lpstrTitle;
   ofn.lpstrFilter     = lpstrFilter;
   ofn.Flags           = (ISNIL  (5) ? OFN_FILEMUSTEXIST|OFN_EXPLORER|OFN_NOCHANGEDIR : hb_parnl( 5 ) );
   ofn.lpstrInitialDir = lpstrInitialDir;
   ofn.lpstrDefExt     = lpstrDefExt;
   ofn.nFilterIndex    = hb_parni(8);
   ofn.lpstrFile       = lpFileName;
   ofn.nMaxFile        = MAX_PATH;

   if( GetSaveFileName( &ofn ) )
   {
      char * szFileName = HB_TCHAR_CONVFROM( lpFileName );
      hb_stornl( ofn.nFilterIndex, 8 );
      hb_retc( szFileName );
      HB_TCHAR_FREE( szFileName );
   }
   else
   {
      hb_retc( NULL );
   }

   HB_PARTFREE( lpstrTitle );
   HB_PARTFREE( lpstrFilter );
   HB_PARTFREE( lpstrInitialDir );
   HB_PARTFREE( lpstrDefExt );
}
wvgutils.c2056
HB_FUNCWIN_AND(void)
HB_FUNC( WIN_AND )
{
   hb_retnl( hb_parnl(1) & hb_parnl(2) ) ;
}
wvgutils.c2101
HB_FUNCWIN_OR(void)
HB_FUNC( WIN_OR )
{
   hb_retnl( hb_parnl(1) | hb_parnl(2) ) ;
}
wvgutils.c2108
HB_FUNCWIN_NOT(void)
HB_FUNC( WIN_NOT )
{
   hb_retnl( ~( hb_parnl(1) ) ) ;
}
wvgutils.c2115
HB_FUNCWIN_TRACKPOPUPMENU(void)
HB_FUNC( WIN_TRACKPOPUPMENU )
{
   HMENU hMenu  = ( HMENU ) ( HB_PTRDIFF ) hb_parnint( 1 );
   UINT  uFlags = ISNIL( 2 ) ? TPM_CENTERALIGN | TPM_RETURNCMD : hb_parnl( 2 );
   HWND  hWnd   = ISNIL( 3 ) ? GetActiveWindow() : ( HWND ) ( HB_PTRDIFF ) hb_parnint( 3 );

   POINT xy = { 0,0 };

   GetCursorPos( &xy );

   hb_retnl( TrackPopupMenu( hMenu, uFlags, xy.x, xy.y, 0, hWnd, NULL ) );
}
wvgutils.c2122
HB_FUNCWIN_CHOOSECOLOR(void)
HB_FUNC( WIN_CHOOSECOLOR )
{
   CHOOSECOLOR cc ;
   COLORREF    crCustClr[ 16 ] ;
   int         i ;

   for( i = 0 ; i < 16 ; i++ )
   {
     crCustClr[ i ] = ( ISARRAY( 2 ) ? ( COLORREF ) hb_parnl( 2, i+1 ) : GetSysColor( COLOR_BTNFACE ) ) ;
   }

   cc.lStructSize   = sizeof( CHOOSECOLOR ) ;
   cc.hwndOwner     = ISNIL( 4 ) ? NULL : (HWND) ( HB_PTRDIFF ) hb_parnint( 4 );
   cc.rgbResult     = ISNIL( 1 ) ?  0 : ( COLORREF ) hb_parnl( 1 ) ;
   cc.lpCustColors  = crCustClr ;
   cc.Flags         = ( WORD ) ( ISNIL( 3 ) ? CC_ANYCOLOR | CC_RGBINIT | CC_FULLOPEN : hb_parnl( 3 ) );

   if ( ChooseColor( &cc ) )
   {
      hb_retnl( cc.rgbResult ) ;
   }
   else
   {
      hb_retnl( -1 );
   }
}
wvgutils.c2137
HB_FUNCWIN_FINDWINDOW(void)
HB_FUNC( WIN_FINDWINDOW )
{
   HWND hwnd;
   LPTSTR lpStr;

   lpStr = HB_TCHAR_CONVTO( hb_parc( 1 ) );
   hwnd = FindWindow( NULL, lpStr );
   HB_TCHAR_FREE( lpStr );

   if ( hwnd )
   {
      hb_retnint( ( HB_PTRDIFF ) hwnd );
   }
   else
   {
      hb_retnint( -1 );
   }
}
wvgutils.c2166
wvgclass.prg
TypeFunctionSourceLine
CLASSwvtDialog
CLASS wvtDialog

   //  To hold previous settings
   //
   DATA   nOldRows
   DATA   nOldCols
   DATA   aOldFont
   DATA   cOldTitle
   DATA   cOldColor
   DATA   nOldCursor
   DATA   aPalette
   DATA   cScreen
   DATA   aWvtScreen
   DATA   aOldPnt
   DATA   oldTooltipActive
   DATA   oldTooltipWidth
   DATA   oldTooltipBkColor
   DATA   oldTooltipTextColor
   DATA   oldMenuHandle
   DATA   oldMenuBlock
   DATA   lGui

   //  Dialog Parameters
   //
   DATA   nRows
   DATA   nCols
   DATA   cFont
   DATA   nFontHeight
   DATA   nFontWidth
   DATA   nFontBold
   DATA   nFontQuality
   DATA   cTitle
   DATA   cColor

   //  Objects handelling
   //
   DATA   aObjects              INIT {}
   DATA   oCurObj
   DATA   oLastObj
   DATA   oObjOver
   DATA   oLastOver
   DATA   nCurObj               INIT 1
   DATA   nLastObj              INIT 0
   DATA   nObjOver              INIT 0
   DATA   nLastOver             INIT -1
   DATA   nUseObj
   DATA   oMenu
   DATA   aDialogKeys           INIT {}
   DATA   cDialogID             INIT ''

   //  Tooltip Management
   //
   DATA   nTooltipWidth
   DATA   nTooltipBkColor
   DATA   nTooltipTextColor

   //  Miscellaneous
   //
   DATA   ClassName             INIT 'WVTDIALOG'
   DATA   cPaintBlockID
   DATA   nPaintID              INIT 1
   DATA   nObjID                INIT 5000
   DATA   nKey
   DATA   hFonts                INIT {}
   DATA   lEventHandled
   DATA   lTabStops             INIT .f.

   ACCESS nObjects              INLINE len( ::aObjects )

   DATA   bOnCreate

   METHOD New()
   METHOD Create()
   METHOD Destroy()
wvgclass.prg109
WVTDIALOG:METHODAddObject( oObject )
   METHOD AddObject( oObject )  INLINE aadd( ::aObjects, oObject )
   METHOD Execute()
   METHOD MouseOver()
   METHOD CreateObjects()
wvgclass.prg183
WVTDIALOG:METHODMaxRow()
   METHOD MaxRow()              INLINE ::nRows - 1
wvgclass.prg187
WVTDIALOG:METHODMaxCol()
   METHOD MaxCol()              INLINE ::nCols - 1
   METHOD Eval()
   METHOD Update()
wvgclass.prg188
WVTDIALOG:METHODOnTimer()
   METHOD OnTimer()             INLINE aeval( ::aObjects, {|o| o:OnTimer() } )
   METHOD Event()
   METHOD Inkey()
   METHOD ActivateMenu()

ENDCLASS
wvgclass.prg191
WVTDIALOG:METHODNew( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFontBold,nFontQuality ) CLASS wvtDialog
METHOD New( nRows, nCols, cTitle, cFont, nFontHeight, nFontWidth,nFontBold,nFontQuality ) CLASS wvtDialog
   LOCAL fnt_:= Wvt_GetFontInfo()

   DEFAULT nRows         TO 25
   DEFAULT nCols         TO 80
   DEFAULT cTitle        TO Wvt_GetTitle()
   DEFAULT cFont         TO fnt_[ 1 ]
   DEFAULT nFontHeight   TO fnt_[ 2 ]
   DEFAULT nFontWidth    TO fnt_[ 3 ]
   DEFAULT nFontBold     TO fnt_[ 4 ]
   DEFAULT nFontQuality  TO fnt_[ 5 ]

   if empty( cFont )
      cFont := fnt_[ 1 ]
   endif
   if empty( nFontHeight )
      nFontHeight := fnt_[ 2 ]
   endif
   if empty( nFontWidth )
      nFontWidth := fnt_[ 3 ]
   endif

   ::nOldRows            := MaxRow()+1
   ::nOldCols            := MaxCol()+1
   ::aOldFont            := Wvt_GetFontInfo()
   ::cOldTitle           := Wvt_GetTitle()
   ::cOldColor           := SetColor()
   ::nOldCursor          := SetCursor()
   ::aPalette            := Wvt_GetPalette()

   ::oldMenuHandle       := Wvt_GetMenu()
   ::oldMenuBlock        := SetKey( Wvt_SetMenuKeyEvent() )

   ::oldTooltipWidth     := Wvt_GetTooltipWidth()
   ::oldTooltipBkColor   := Wvt_GetTooltipBkColor()
   ::oldTooltipTextColor := Wvt_GetTooltipTextColor()

   ::nRows               := nRows
   ::nCols               := nCols
   ::cTitle              := cTitle
   ::cFont               := cFont
   ::nFontHeight         := nFontHeight
   ::nFontWidth          := nFontWidth
   ::nFontBold           := nFontBold
   ::nFontQuality        := nFontQuality

   ::cPaintBlockID       := strzero( Hb_Random( 99999998 ),8 )
   ::nObjOver            := 0
   ::nKey                := 0
   ::cColor              := 'N/W'
   ::nUseObj             := 0
   ::lGui                := Wvt_SetGui( .f. )

   RETURN Self
wvgclass.prg200
WVTDIALOG:METHODCreate() CLASS wvtDialog
METHOD Create() CLASS wvtDialog
   LOCAL aPalette, n, i, j  // , cScr, cQry

   ::oldToolTipActive := Wvt_SetToolTipActive( .t. )
   if ::nTooltipWidth <> nil
      Wvt_setTooltipWidth( ::nTooltipWidth )
   endif
   if ::nTooltipBkColor <> nil
      Wvt_SetTooltipBkColor( ::nTooltipBkColor )
   endif
   if ::nTooltipTextColor <> nil
      Wvt_SetTooltipTextColor( ::nTooltipTextColor )
   endif

   aPalette      := Wvt_GetPalette()
   aPalette[ 9 ] := RGB( 175,175,175 )
   Wvt_SetPalette( aPalette )

   ::cScreen     := SaveScreen( 0, 0, maxrow(), maxcol() )
   ::aWvtScreen  := Wvt_SaveScreen( 0, 0, maxrow(), maxcol() )
   ::aOldPnt     := WvtSetPaint( {} )

   SetMode( ::nRows, ::nCols )
   do while .t.
      if Wvt_SetFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontBold, ::nFontQuality )
         exit
      endif
      ::nFontHeight--
   enddo
   //Wvt_SetFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontBold, ::nFontQuality )
   SetMode( ::nRows, ::nCols )

   Wvt_SetTitle( ::cTitle )

   SetColor( ::cColor )
   CLS
   ::Eval( ::bOnCreate )

   // Actually Create the Objects
   ::CreateObjects()

   if len( ::aObjects ) > 0
      ::oCurObj := ::aObjects[ 1 ]
   endif

   for i := 1 to len( ::aObjects )
      if !empty( ::aObjects[ i ]:aPaint )
         for j := 1 to len( ::aObjects[ i ]:aPaint )
            SetPaint( ::cPaintBlockID, ::nPaintID++, ;
                ::aObjects[ i ]:aPaint[ j,1 ], ::aObjects[ i ]:aPaint[ j,2 ] )
         next
      endif
   next
   WvtSetPaint( GetPaint( ::cPaintBlockID ) )

   if ( n := ascan( ::aObjects, {|o| o:lTabStop } ) ) > 0
      ::lTabStops := .t.
   endif

   ::Update()

   if HB_ISOBJECT( ::oMenu )
      Wvt_SetMenu( ::oMenu:hMenu )
      Wvt_DrawMenuBar()
      SetKey( Wvt_SetMenuKeyEvent(), {|| ::ActivateMenu( ::oMenu ) } )
   endif

   RETURN Self
wvgclass.prg257
WVTDIALOG:METHODDestroy() CLASS wvtDialog
METHOD Destroy() CLASS wvtDialog

   if HB_ISOBJECT( ::oMenu )
      ::oMenu:Destroy()
   endif

   aeval( ::aObjects, {|o| o:destroy() } )

   Wvt_SetTooltip( 0,0,0,0,'' )
   Wvt_SetTooltipActive( ::oldToolTipActive )
   Wvt_setTooltipWidth( ::oldTooltipWidth )
   Wvt_SetTooltipBkColor( ::oldTooltipBkColor )
   Wvt_SetTooltipTextColor( ::oldTooltipTextColor )

   //  Here set mode is before setting the font
   //
   SetMode( ::nOldRows, ::nOldCols )
   Wvt_SetFont( ::aOldFont[ 1 ], ::aOldFont[ 2 ], ::aOldFont[ 3 ], ::aOldFont[ 4 ], ::aOldFont[ 5 ] )
   Wvt_SetTitle( ::cOldTitle )
   Wvt_SetPalette( ::aPalette )
   Wvt_SetPointer( WVT_IDC_ARROW )
   Wvt_SetMousePos( MRow(), MCol() )

   SetColor( ::cOldColor )
   SetCursor( ::nOldCursor )

   if ::oldMenuHandle <> nil .and. ::oldMenuHandle <> 0
      Wvt_SetMenu( ::oldMenuHandle )
   endif
   SetKey( Wvt_SetMenuKeyEvent(), ::oldMenuBlock )
   RestScreen( 0, 0, maxrow(), maxcol(), ::cScreen )
   Wvt_RestScreen( 0, 0 ,maxrow(), maxcol(), ::aWvtScreen )
   PurgePaint( ::cPaintBlockID )
   WvtSetPaint( ::aOldPnt )
   Wvt_SetGui( ::lGui )


   RETURN nil
wvgclass.prg328
WVTDIALOG:METHODEvent() CLASS wvtDialog
METHOD Event() CLASS wvtDialog
   LOCAL  nKey

   if ( nKey := inkey( 0.1, INKEY_ALL ) ) == 0
      if Wvt_IsLButtonPressed()

         nKey := K_LBUTTONPRESSED

      endif
   endif

   RETURN ( nKey )
wvgclass.prg369
WVTDIALOG:METHODExecute() CLASS wvtDialog
METHOD Execute() CLASS wvtDialog

   if ::nObjects == 0
      do while .t.
         if inkey( 0.1 ) == K_ESC
            exit
         endif
      enddo
   else
      do while ( ::Inkey() <> K_ESC )
      enddo
   endif

   RETURN ::nKey
wvgclass.prg384
WVTDIALOG:METHODInkey() CLASS wvtDialog
METHOD Inkey() CLASS wvtDialog
   LOCAL  n, oObj, nID, i

   ::lEventHandled := .f.
   ::nUseObj       := 0

   ::nKey := ::Event()
   ::OnTimer()

   if ::nKey <> 0
      if ::nKey == K_ESC .or. ::nKey == K_CTRL_ENTER
         return K_ESC
      endif

      do case

      case ::nKey == K_TAB
         if ::lTabStops
            do while .t.
               ::nCurObj++
               if ::nCurObj > ::nObjects
                  ::nCurObj := 1
               endif
               if ::aObjects[ ::nCurObj ]:lTabStop
                  exit
               endif
            enddo
         endif

         ::lEventHandled := .t.

      case ::nKey == K_SH_TAB
         if ::lTabStops
            do while .t.
               ::nCurObj--
               if ::nCurObj < 1
                  ::nCurObj := ::nObjects
               endif
               if ::aObjects[ ::nCurObj ]:lTabStop
                  exit
               endif
            enddo
         endif

         ::lEventHandled := .t.

      case ::nKey == K_MOUSEMOVE .or. ::nKey == K_MMLEFTDOWN
         ::MouseOver()
         if ::nObjOver == 0
            Wvt_SetPointer( WVT_IDC_ARROW )
         elseif ::oObjOver:nPointer <> nil .and. ::oObjOver:lActive
            Wvt_SetPointer( ::oObjOver:nPointer )
         else
            Wvt_SetPointer( WVT_IDC_ARROW )
         endif
         ::lEventHandled := .t.

      endcase

      if    ::nKey == K_LBUTTONDOWN     .or. ;
            ::nKey == K_LBUTTONUP       .or. ;
            ::nKey == K_LDBLCLK         .or. ;
            ::nKey == K_MMLEFTDOWN      .or. ;
            ::nKey == K_LBUTTONPRESSED  .or. ;
            ::nKey == K_RBUTTONDOWN

         ::MouseOver()

         if ::nObjOver > 0
            if    ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_BUTTON     .or. ;
                  ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_TOOLBAR    .or. ;
                  ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_PUSHBUTTON .or. ;
                  ::aObjects[ ::nObjOver ]:nType == DLG_OBJ_SCROLLBAR

               oObj := ::aObjects[ ::nObjOver ]
               if oObj:oParent:ClassName == 'WVTBROWSE'
                  nID := oObj:oParent:nID
                  if ( n := ascan( ::aObjects, {|o| o:nID == nID } ) ) > 0
                     ::nCurObj := n
                  endif
               endif
            else
               ::nCurObj := ::nObjOver
            endif
            ::nUseObj := ::nObjOver

         else
            ::lEventHandled := .t.

         endif
      endif

      if ::nLastOver <> ::nObjOver
         if ::nLastOver > 0
            ::aObjects[ ::nLastOver ]:HoverOff()
         endif

         ::nLastOver := ::nObjOver

         if ::nObjOver > 0
            ::oObjOver:HoverOn()
         endif

         if ::nObjOver == 0
            Wvt_SetTooltip( 0,0,0,0,'' )

         elseif ::oObjOver:lActive
            ::oObjOver:SetTooltip()

         else
            Wvt_SetTooltip( 0,0,0,0,'' )

         endif
      endif

      if ::nCurObj <> ::nLastObj
         if ::nLastObj == 0
            ::aObjects[ ::nCurObj  ]:Hilite()

         else
            ::aObjects[ ::nLastObj ]:DeHilite()
            ::aObjects[ ::nCurObj  ]:Hilite()

         endif

         ::nLastObj := ::nCurObj
         ::oCurObj  := ::aObjects[ ::nCurObj ]
         ::oLastObj := ::aObjects[ ::nCurObj ]

         if ::oCurObj:nType == DLG_OBJ_BROWSE
            Select( ::oCurObj:cAlias )

         endif

         ::Eval( ::oCurObj:bOnFocus, ::oCurObj )
      endif

      if ::nKey == K_LBUTTONDOWN
         if ::nUseObj > 0
            if !( ::lEventHandled := ::aObjects[ ::nUseObj ]:LeftDown() )
               ::lEventHandled := ::Eval( ::aObjects[ ::nUseObj ]:bOnLeftDown )

            endif
         endif
      endif

      if ::nKey == K_LBUTTONUP
         if ::nUseObj > 0
            if !( ::lEventHandled := ::aObjects[ ::nUseObj ]:LeftUp() )
               ::lEventHandled := ::Eval( ::aObjects[ ::nUseObj ]:bOnLeftUp )

            endif
         endif
      endif

      if ::nKey == K_MMLEFTDOWN
         if ::nUseObj > 0
            if !( ::lEventHandled := ::aObjects[ ::nUseObj ]:MMLeftDown() )
               ::lEventHandled := ::Eval( ::aObjects[ ::nUseObj ]:bOnMMLeftDown )

            endif
         endif
      endif

      if ::nKey == K_LBUTTONPRESSED
         if ::nUseObj > 0
            if !( ::lEventHandled := ::aObjects[ ::nUseObj ]:LeftPressed() )
               ::lEventHandled := ::Eval( ::aObjects[ ::nUseObj ]:bOnLeftPressed )

            endif
         endif
      endif

      if ::nKey == K_LDBLCLK
         if ::nUseObj > 0
            ::lEventHandled := ::Eval( ::aObjects[ ::nUseObj ]:bOnSelect )

         endif
      endif

      if ::nKey == K_RBUTTONDOWN .and. ::nUseObj > 0
         ::lEventHandled := ::aObjects[ ::nUseObj ]:ShowPopup()
      endif

      if !( ::lEventHandled )
         if ::nCurObj > 0
            if !empty( ::aDialogKeys )
               if ( n := ascan( ::aDialogKeys, {|e_| e_[ 1 ] == ::nKey } ) ) > 0
                  Eval( ::aDialogKeys[ n, 2 ], self, ::oCurObj )
               endif
            endif

            ::lEventHandled := ::oCurObj:HandleEvent( ::nKey )

            if ( ::lEventHandled )
               if ::oCurObj:nChildren > 0
                  for i := 1 to ::oCurObj:nChildren
                     //if ( ::nKey IN ::oCurObj:aChildren[ i, OBJ_CHILD_EVENTS ] )
                     if ascan( ::oCurObj:aChildren[ i, OBJ_CHILD_EVENTS ],::nKey ) > 0
                        ::oCurObj:NotifyChild( i, ::nKey, ::oCurObj )
                     endif
                  next
               endif
            endif
         endif
      endif

      if !( ::lEventHandled )
         if ISBLOCK( SetKey( ::nKey ) )
            Eval( SetKey( ::nKey ) )
         endif
      endif
   endif

   RETURN ( ::nKey )
wvgclass.prg401
WVTDIALOG:METHODMouseOver() CLASS wvtDialog
METHOD MouseOver()  CLASS wvtDialog
   LOCAL mRow := MRow()
   LOCAL mCol := MCol()
   LOCAL nObj

   nObj := ascan( ::aObjects, ;
                    {|o| o:nType <> DLG_OBJ_STATIC               .and. ;
                         o:nType <> DLG_OBJ_TOOLBAR              .and. ;
                         mRow >= o:nTop  .and. mRow <= o:nBottom .and. ;
                         mCol >= o:nLeft .and. mCol <= o:nRight      } )

   ::nObjOver := nObj
   ::oObjOver := iif( nObj > 0, ::aObjects[ nObj ], nil )
   if nObj > 0
      ::aObjects[ nObj ]:nmRow := mRow
      ::aObjects[ nObj ]:nmCol := mCol

   endif

   RETURN Self
wvgclass.prg619
WVTDIALOG:METHODUpdate() CLASS wvtDialog
METHOD Update() CLASS wvtDialog

   Wvt_InvalidateRect( 0, 0, ::maxrow(), ::maxcol() )

   RETURN Self
wvgclass.prg642
WVTDIALOG:METHODCreateObjects() CLASS wvtDialog
METHOD CreateObjects() CLASS wvtDialog
   LOCAL i, nObjs

   nObjs := len( ::aObjects )

   for i := 1 to nObjs
      switch ::aObjects[ i ]:nType

      case DLG_OBJ_BROWSE
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_STATUSBAR
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_LABEL
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_TOOLBAR
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_BUTTON
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_PUSHBUTTON
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_IMAGE
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_STATIC
         ::aObjects[ i ]:Create()
         exit
   /*
      case DLG_OBJ_SCROLLBAR
         ::aObjects[ i ]:Create()
         exit
   */
      case DLG_OBJ_GETS
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_BANNER
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_TEXTBOX
         ::aObjects[ i ]:Create()
         exit
      case DLG_OBJ_PROGRESSBAR
         ::aObjects[ i ]:Create()
         exit
      end
   next

   RETURN self
wvgclass.prg650
WVTDIALOG:METHODEval( bBlock, p1,p2,p3,p4,p5 ) CLASS wvtDialog
METHOD Eval( bBlock, p1,p2,p3,p4,p5 ) CLASS wvtDialog
   LOCAL lRet

   if ( lRet := ISBLOCK( bBlock ) )
      eval( bBlock, p1,p2,p3,p4,p5 )
   endif

   RETURN lRet
wvgclass.prg706
WVTDIALOG:METHODActivateMenu() CLASS WvtDialog
METHOD ActivateMenu() CLASS WvtDialog
   LOCAL nMenu:= Wvt_GetLastMenuEvent()
   LOCAL aMenuItem

   IF !EMPTY( nMenu )
      IF HB_ISOBJECT( ::oMenu )
         IF !EMPTY( aMenuItem := ::oMenu:FindMenuItemById( nMenu ) )
            IF HB_ISBLOCK( aMenuItem[ WVT_MENU_ACTION ] )
               EVAL( aMenuItem[ WVT_MENU_ACTION ] )
            ENDIF
         ENDIF
      ENDIF
   ENDIF

   RETURN Self
wvgclass.prg717
CLASSWvtObject
CLASS WvtObject

   DATA   oParent
   DATA   nType
   DATA   nId

   DATA   nTop
   DATA   nLeft
   DATA   nBottom
   DATA   nRight
   DATA   aPxlTLBR              INIT {}

   DATA   aObjects              INIT {}
   DATA   aParent               INIT {}
   DATA   aChildren             INIT {}
   DATA   aPaint                INIT {}
   DATA   bPaint
   DATA   ClassName             INIT ''

   DATA   nObjID                INIT 900000
   DATA   nPointer
   DATA   cargo
   DATA   xSettings
   DATA   cText
   DATA   cToolTip
   DATA   lActive               INIT .t.
   DATA   lAnimate              INIT .f.
   DATA   lTabStop              INIT .t.
   DATA   hFont

   DATA   aPopup                INIT {}
   DATA   hPopup                INIT nil
   DATA   nPopupItemID          INIT 700000

   DATA   nMRow                 INIT 0
   DATA   nMCol                 INIT 0
   DATA   cColorHilite          INIT 'W+/B*'
   DATA   cColorDehilite        INIT 'W/N*'

   DATA   nTextColor
   DATA   nBackColor
   DATA   nBackMode             INIT 0 // OPAQUE 1-TRANSPARENT
   DATA   nTextColorHoverOn
   DATA   nTextColorHoverOff
   DATA   nBackColorHoverOn
   DATA   nBackColorHoverOff
   DATA   cFont
   DATA   nFontHeight
   DATA   nFontWidth
   DATA   nFontWeight
   DATA   nFontQuality
   DATA   nCharSet
   DATA   lItalic
   DATA   lUnderline
   DATA   lStrikeOut
   DATA   nAlignHorz
   DATA   nAlignVert
   DATA   nAngle

   ACCESS ToolTip               INLINE iif( ::cTooltip == nil, '', ::cTooltip )
   ASSIGN ToolTip( cTip )       INLINE ::cToolTip := cTip

   DATA   bHandleEvent
   DATA   bOnCreate
   DATA   bOnSelect
   DATA   bOnFocus
   DATA   bOnRefresh
   DATA   bOnLeftUp
   DATA   bOnLeftDown
   DATA   bOnMMLeftDown
   DATA   bOnLeftPressed
   DATA   bTooltip
   DATA   bSaveSettings
   DATA   bRestSettings
   DATA   bOnHilite
   DATA   bOnDeHilite

   ACCESS nChildren             INLINE len( ::aChildren )
   DATA   nIndexOrder

   METHOD New()
   METHOD Create()
   METHOD Destroy()
wvgclass.prg745
WVTOBJECT:METHODPaintBlock()
   METHOD PaintBlock()          INLINE nil
wvgclass.prg832
WVTOBJECT:METHODHilite()
   METHOD Hilite()              INLINE nil
wvgclass.prg833
WVTOBJECT:METHODDeHilite()
   METHOD DeHilite()            INLINE nil
wvgclass.prg834
WVTOBJECT:METHODHandleEvent()
   METHOD HandleEvent()         INLINE .f.
wvgclass.prg835
WVTOBJECT:METHODLeftDown()
   METHOD LeftDown()            INLINE .f.
wvgclass.prg837
WVTOBJECT:METHODLeftUp()
   METHOD LeftUp()              INLINE .f.
wvgclass.prg838
WVTOBJECT:METHODMMLeftDown
   METHOD MMLeftDown            INLINE .f.
wvgclass.prg839
WVTOBJECT:METHODLeftPressed
   METHOD LeftPressed           INLINE .f.
wvgclass.prg840
WVTOBJECT:METHODHoverOn()
   METHOD HoverOn()             INLINE nil
wvgclass.prg842
WVTOBJECT:METHODHoverOff()
   METHOD HoverOff()            INLINE nil
wvgclass.prg843
WVTOBJECT:METHODOnTimer()
   METHOD OnTimer()             INLINE nil
wvgclass.prg845
WVTOBJECT:METHODSaveSettings()
   METHOD SaveSettings()        INLINE nil
wvgclass.prg847
WVTOBJECT:METHODRestSettings()
   METHOD RestSettings()        INLINE nil
wvgclass.prg848
WVTOBJECT:METHODSetToolTip()
   METHOD SetToolTip()          INLINE ;
            Wvt_SetToolTip( ::nTop, ::nLeft, ::nBottom, ::nRight, ::Tooltip )
wvgclass.prg850
WVTOBJECT:METHODRefresh()
   METHOD Refresh()             INLINE ;
            Wvt_InvalidateRect( ::nTop, ::nLeft, ::nTop, ::nLeft )
wvgclass.prg853
WVTOBJECT:METHODEval( bBlock )
   METHOD Eval( bBlock )        INLINE ;
            iif( ISBLOCK( bBlock ), Eval( bBlock, self ), nil )

   METHOD CreatePopup()
   METHOD ShowPopup()
wvgclass.prg856
WVTOBJECT:METHODActivate()
   METHOD Activate()            INLINE nil
wvgclass.prg861
WVTOBJECT:METHODDeActivate()
   METHOD DeActivate()          INLINE nil
wvgclass.prg862
WVTOBJECT:METHODAddChild( aChild )
   METHOD AddChild( aChild )    INLINE aadd( ::aChildren, aChild )
wvgclass.prg864
WVTOBJECT:METHODAddParent( aParent )
   METHOD AddParent( aParent )  INLINE aadd( ::aParent, aParent )
wvgclass.prg865
WVTOBJECT:METHODNotifyChild( )
   METHOD NotifyChild( /*nChild*/ ) INLINE nil

   ENDCLASS
wvgclass.prg867
WVTOBJECT:METHODNew( oParent, nType, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtObject
METHOD New( oParent, nType, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtObject

   DEFAULT nID TO ++::nObjID

   ::oParent   :=  oParent
   ::nType     :=  nType
   ::nId       :=  nID
   ::nTop      :=  nTop
   ::nLeft     :=  nLeft
   ::nBottom   :=  nBottom
   ::nRight    :=  nRight

   switch nType

   case DLG_OBJ_BROWSE
      ::ClassName := 'WVTBROWSE'
      exit

   case DLG_OBJ_STATIC
      ::ClassName := 'WVTSTATIC'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_GETS
      ::ClassName := 'WVTGETS'
      exit

   case DLG_OBJ_IMAGE
      ::ClassName := 'WVTIMAGE'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_PUSHBUTTON
      ::ClassName := 'WVTPUSHBUTTON'
      exit

   case DLG_OBJ_BUTTON
      ::ClassName := 'WVTBUTTON'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_TOOLBAR
      ::ClassName := 'WVTTOOLBAR'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_LABEL
      ::ClassName := 'WVTLABEL'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_SCROLLBAR
      ::ClassName := 'WVTSCROLLBAR'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_STATUSBAR
      ::ClassName := 'WVTSTATUSBAR'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_BANNER
      ::ClassName := 'WVTBANNER'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_TEXTBOX
      ::ClassName := 'WVTTEXTBOX'
      ::lTabStop  := .f.
      exit

   case DLG_OBJ_PROGRESSBAR
      ::ClassName := 'WVTPROGRESSBAR'
      ::lTabStop  := .f.
      exit

   end

   RETURN Self
wvgclass.prg873
WVTOBJECT:METHODCreate() CLASS WvtObject
METHOD Create() CLASS WvtObject

   ::Eval( ::bOnCreate )
   ::CreatePopup()

   RETURN Self
wvgclass.prg955
WVTOBJECT:METHODDestroy() CLASS WvtObject
METHOD Destroy() CLASS WvtObject

   if ::hFont <> nil
      Win_DeleteObject( ::hFont )
      ::hFont := nil
   endif

   if ::hPopup <> nil
      Wvt_DestroyMenu( ::hPopup )
      ::hPopup := nil
   endif

   RETURN Nil
wvgclass.prg964
WVTOBJECT:METHODCreatePopup() CLASS WvtObject
METHOD CreatePopup() CLASS WvtObject
   LOCAL i, nID

   if !empty( ::aPopup ) .and. ::hPopup == nil
      ::hPopup := Wvt_CreatePopupMenu()

      for i := 1 to len( ::aPopup )

         aSize( ::aPopup[ i ],3 )
         nID := ::nPopupItemID++
         ::aPopup[ i,3 ] := nID

         Wvt_AppendMenu( ::hPopup, MF_ENABLED + MF_STRING, nID, ::aPopup[ i,1 ] )
      next
   endif

   RETURN Self
wvgclass.prg980
WVTOBJECT:METHODShowPopup() CLASS WvtObject
METHOD ShowPopup() CLASS WvtObject
   LOCAL lRet := .f., nRet, n, aPos

   if ::hPopup <> nil
      aPos := Wvt_GetCursorPos()

      nRet := Wvt_TrackPopupMenu( ::hPopup, TPM_CENTERALIGN +TPM_RETURNCMD, ;
                             aPos[ 1 ], aPos[ 2 ], 0, Wvt_GetWindowHandle() )
      if nRet > 0
         if ( n := ascan( ::aPopup, {|e_| e_[ 3 ] == nRet } ) ) > 0
            lRet := .t.

            if ISBLOCK( ::aPopup[ n,2 ] )
               Eval( ::aPopup[ n,2 ] )
            endif
         endif
      endif
   endif

   RETURN lRet
wvgclass.prg1000
CLASSWvtBrowse FROM WvtObject
CLASS WvtBrowse FROM WvtObject

   DATA   cAlias
   DATA   oBrw
   DATA   lHSBar                INIT .t.
   DATA   lVSBar                INIT .t.
   DATA   oHBar
   DATA   oVBar
   DATA   bTotalRecords
   DATA   bCurrentRecord
   DATA   bTotalColumns
   DATA   bCurrentColumn

   ACCESS cDesc                 INLINE iif( ::cText == nil, '', ::cText )
   ASSIGN cDesc( cText )        INLINE ::cText := cText

   METHOD New()
   METHOD Create()
   METHOD PaintBlock()
   METHOD Hilite()
   METHOD DeHilite()
   METHOD HandleEvent()
   METHOD Refresh()
   METHOD SetVBar()
   METHOD SetHBar()
   METHOD SetTooltip()
   METHOD SaveSettings()
   METHOD RestSettings()
   METHOD NotifyChild()

ENDCLASS
wvgclass.prg1031
WVTBROWSE:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtBrowse
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtBrowse

   ::Super:New( oParent, DLG_OBJ_BROWSE, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg1065
WVTBROWSE:METHODCreate() CLASS WvtBrowse
METHOD Create() CLASS WvtBrowse

   Select( ::cAlias )

   ::nTop    := ::oBrw:nTop-2
   ::nLeft   := ::oBrw:nLeft-2
   ::nBottom := iif( ::lHSBar, ::oBrw:nBottom, ::oBrw:nBottom+1 )
   ::nRight  := iif( ::lVSBar, ::oBrw:nRight , ::oBrw:nRight+2  )

   ::PaintBlock( 1 )
   ::PaintBlock( 2 )
   ::PaintBlock( 3 )
   ::PaintBlock( 4 )

   ::Super:Create()

   DEFAULT ::bTotalRecords  TO {|| ( ::cAlias )->( OrdKeyCount() ) }
   DEFAULT ::bCurrentRecord TO {|| ( ::cAlias )->( OrdKeyNo()    ) }
   ::SetVBar()

   DEFAULT ::bTotalColumns  TO {|| ::oBrw:ColCount }
   DEFAULT ::bCurrentColumn TO {|| ::oBrw:ColPos   }
   ::SetHBar()

   ::oBrw:ForceStable()
   ::DeHilite()

   RETURN Self
wvgclass.prg1073
WVTBROWSE:METHODSetVBar() CLASS WvtBrowse
METHOD SetVBar() CLASS WvtBrowse

   if ::lVSBar
      ::oVBar := WvtScrollBar():New( self, 999991, ;
                 ::oBrw:nTop, ::oBrw:nRight+1, ::oBrw:nBottom, ::oBrw:nRight+2 )
      ::oVBar:nBarType   := WVT_SCROLLBAR_VERT
      ::oVBar:bTotal     := ::bTotalRecords
      ::oVBar:bCurrent   := ::bCurrentRecord
      ::oVBar:aPxlBtnTop := { -2,2,0,0 }
      ::oVBar:aPxlBtnBtm := {  0,2,2,0 }
      ::oVBar:aPxlScroll := {  0,2,0,0 }
      ::oVBar:Create()

      aadd( ::aPaint, { ::oVBar:bBtnLeftTop, ;
          { WVT_BLOCK_BUTTON, ::oVBar:nBtn1Top, ::oVBar:nBtn1Left, ;
                ::oVBar:nBtn1Bottom, ::oVBar:nBtn1Right } } )

      aadd( ::aPaint, { ::oVBar:bBtnRightBottom, ;
          { WVT_BLOCK_BUTTON, ::oVBar:nBtn2Top, ::oVBar:nBtn2Left, ;
                ::oVBar:nBtn2Bottom, ::oVBar:nBtn2Right } } )

      aadd( ::aPaint, { ::oVBar:bBtnScroll, ;
          { WVT_BLOCK_BUTTON, ::oVBar:nSTop, ::oVBar:nSLeft, ;
                ::oVBar:nSBottom, ::oVBar:nSRight } } )

      ::oParent:AddObject( ::oVBar )
   endif

   RETURN Self
wvgclass.prg1104
WVTBROWSE:METHODSetHBar() CLASS WvtBrowse
METHOD SetHBar() CLASS WvtBrowse

   if ::lHSBar
      ::oHBar := WvtScrollBar():New( self, 999990, ;
                 ::oBrw:nBottom+1, ::oBrw:nLeft, ::oBrw:nBottom+1, ::oBrw:nRight )
      ::oHBar:nBarType   := 2
      ::oHBar:bTotal     := ::bTotalColumns
      ::oHBar:bCurrent   := ::bCurrentColumn
      ::oHBar:aPxlBtnLft := { 2,-2,0,0 }
      ::oHBar:aPxlBtnRgt := { 2, 0,0,2 }
      ::oHBar:aPxlScroll := { 2, 0,0,0 }
      ::oHBar:Create()

      aadd( ::aPaint, { ::oHBar:bBtnLeftTop, ;
          { WVT_BLOCK_BUTTON, ::oHBar:nBtn1Top, ::oHBar:nBtn1Left, ;
                       ::oHBar:nBtn1Bottom, ::oHBar:nBtn1Right } } )
      aadd( ::aPaint, { ::oHBar:bBtnRightBottom, ;
          { WVT_BLOCK_BUTTON, ::oHBar:nBtn2Top, ::oHBar:nBtn2Left, ;
                       ::oHBar:nBtn2Bottom, ::oHBar:nBtn2Right } } )
      aadd( ::aPaint, { ::oHBar:bBtnScroll, ;
          { WVT_BLOCK_BUTTON, ::oHBar:nSTop, ::oHBar:nSLeft, ;
                       ::oHBar:nSBottom, ::oHBar:nSRight } } )

      ::oParent:AddObject( ::oHBar )
   endif

   RETURN Self
wvgclass.prg1136
WVTBROWSE:METHODRefresh() CLASS WvtBrowse
METHOD Refresh() CLASS WvtBrowse
   LOCAL nWorkArea := Select()

   if ISBLOCK( ::bOnRefresh )
      eval( ::bOnRefresh, self )
   else
      Select( ::cAlias )

      ::oBrw:RefreshAll()
      ::oBrw:ForceStable()

      Select( nWorkArea )
   endif

   RETURN Self
wvgclass.prg1166
WVTBROWSE:METHODHandleEvent( nKey ) CLASS WvtBrowse
METHOD HandleEvent( nKey ) CLASS WvtBrowse
   Local lRet := .f.

   if valtype( ::bHandleEvent ) == 'B'
      lRet := eval( ::bHandleEvent, self, ::oParent:cPaintBlockID, ::oBrw, nKey )
   endif

   RETURN lRet
wvgclass.prg1184
WVTBROWSE:METHODNotifyChild( nIndex, nKey, oCurObj ) CLASS WvtBrowse
METHOD NotifyChild( nIndex, nKey, oCurObj ) CLASS WvtBrowse
   Local xData, i

   if nIndex > 0 .and. nIndex <= len( ::aChildren )
      if valtype( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] ) == 'B'
         xData := eval( ::aChildren[ nIndex, OBJ_CHILD_DATABLOCK ] )
      endif

      eval( ::aChildren[ nIndex, OBJ_CHILD_REFRESHBLOCK ], ;
            ::aChildren[ nIndex, OBJ_CHILD_OBJ ],;
            ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oParent:cPaintBlockID, ;
            ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:oBrw, ;
            nKey, ;
            xData )

      if ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren > 0
         // Pretend if focus is current on this object
         //
         Eval( ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:bOnFocus, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] )

         for i := 1 to ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:nChildren
            ::aChildren[ nIndex, OBJ_CHILD_OBJ ]:NotifyChild( i, nKey, ::aChildren[ nIndex, OBJ_CHILD_OBJ ] )
         next

         // Restore previous environments
         Eval( oCurObj:bOnFocus, oCurObj )
      endif
   endif

   RETURN Self
wvgclass.prg1195
WVTBROWSE:METHODHilite() CLASS WvtBrowse
METHOD Hilite() CLASS WvtBrowse
   LOCAL b := ::oBrw

   DispOutAt( b:nTop-2, b:nLeft-2, pad( ' '+::cDesc, b:nRight-b:nLeft+5 ), ::cColorHilite )

   RETURN Self
wvgclass.prg1228
WVTBROWSE:METHODDeHilite() CLASS WvtBrowse
METHOD DeHilite() CLASS WvtBrowse
   LOCAL b := ::oBrw

   DispOutAt( b:nTop-2, b:nLeft-2, pad( ' '+::cDesc, b:nRight-b:nLeft+5 ), ::cColorDeHilite )

   RETURN Self
wvgclass.prg1237
WVTBROWSE:METHODSetTooltip() CLASS WvtBrowse
METHOD SetTooltip() CLASS WvtBrowse
   LOCAL cTip, nArea

   if ISBLOCK( ::bTooltip )
      ::SaveSettings()
      nArea := Select( ::cAlias )

      Select( ::cAlias )

      cTip := Eval( ::bTooltip )

      Select( nArea )

      ::RestSettings()
   endif

   if cTip <> nil
      ::Tooltip := cTip
   endif

   Wvt_SetTooltip( ::nTop, ::nLeft, ::nBottom, ::nRight, ::Tooltip )

   RETURN Self
wvgclass.prg1246
WVTBROWSE:METHODSaveSettings CLASS WvtBrowse
METHOD SaveSettings CLASS WvtBrowse

   if ISBLOCK( ::bSaveSettings )
      ::xSettings := Eval( ::bSaveSettings, self )
   endif

   RETURN Self
wvgclass.prg1272
WVTBROWSE:METHODRestSettings() CLASS WvtBrowse
METHOD RestSettings() CLASS WvtBrowse

   if ::xSettings <> nil .and. ISBLOCK( ::bRestSettings )
      Eval( ::bRestSettings, self )
   endif

   RETURN Self
wvgclass.prg1282
WVTBROWSE:METHODPaintBlock( nPaintObj ) CLASS WvtBrowse
METHOD PaintBlock( nPaintObj ) CLASS WvtBrowse
   LOCAL bBlock, b := ::oBrw

   switch nPaintObj

   case 1
      bBlock := {|| Wvt_DrawBoxRaised( b:nTop-2,b:nLeft-2,b:nBottom+1,b:nRight+2 ) }
      aadd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop-3,b:nLeft-3,b:nBottom+2,b:nRight+3 } } )
      exit

   case 2
      bBlock := {|| Wvt_DrawBoxRecessed( b:nTop,b:nLeft,b:nBottom,b:nRight ) }
      aadd( ::aPaint, { bBlock, { WVT_BLOCK_BOX, b:nTop-1,b:nLeft-1,b:nBottom+1,b:nRight+1 } } )
      exit

   case 3
      bBlock := {|| Wvt_DrawGridHorz( b:nTop+3, b:nLeft, b:nRight, b:nBottom - b:nTop - 2 ) }
      aadd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_H, b:nTop+4, b:nLeft+1, b:nBottom-1, b:nRight-1 } } )
      exit

   case 4
      bBlock := {|| Wvt_DrawGridVert( b:nTop, b:nBottom, b:aColumnsSep, len( b:aColumnsSep ) ) }
      aadd( ::aPaint, { bBlock, { WVT_BLOCK_GRID_V, b:nTop+1, b:nLeft+1, b:nBottom-1, b:nRight-1, b } } )
      exit

   end

   RETURN Self
wvgclass.prg1292
CLASSWvtStatusBar FROM WvtObject
CLASS WvtStatusBar FROM WvtObject

   DATA aPanels
   DATA cColor

   METHOD New()
   METHOD Create()
   METHOD SetPanels()
   METHOD SetText()
   METHOD SetIcon()
   METHOD Refresh()
   METHOD Update( nPanel, cText )
   METHOD PaintBlock()

ENDCLASS
wvgclass.prg1331
WVTSTATUSBAR:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtStatusBar
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtStatusBar

   DEFAULT nTop    TO oParent:MaxRow()
   DEFAULT nLeft   TO 0
   DEFAULT nBottom TO oParent:MaxRow()
   DEFAULT nRight  TO oParent:MaxCol()

   ::Super:New( oParent, DLG_OBJ_STATUSBAR, nID, nTop, nLeft, nBottom, nRight )

   ::cColor  := 'N/W'

   RETURN Self
wvgclass.prg1349
WVTSTATUSBAR:METHODCreate() CLASS WvtStatusBar
METHOD Create() CLASS WvtStatusBar

   ::Refresh()
   ::PaintBlock( DLG_OBJ_STATUSBAR, self )

   ::Super:Create()

   RETURN Self
wvgclass.prg1364
WVTSTATUSBAR:METHODPaintBlock() CLASS WvtStatusBar
METHOD PaintBlock() CLASS WvtStatusBar
   LOCAL a_:= {}, nPanels

   aeval( ::aPanels, {|o| aadd( a_,o:nTop )   , aadd( a_,o:nLeft ), ;
                          aadd( a_,o:nBottom ), aadd( a_,o:nRight ) } )

   a_[ len( a_ ) ]++
   nPanels := len( ::aPanels )

   ::bPaint  := {|| Wvt_DrawStatusBar( nPanels, a_ ) }
   aadd( ::aPaint, { ::bPaint,;
            { WVT_BLOCK_STATUSBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } )

   RETURN Self
wvgclass.prg1375
WVTSTATUSBAR:METHODSetPanels( aPanels ) CLASS WvtStatusBar
METHOD SetPanels( aPanels )  CLASS WvtStatusBar
   LOCAL i, oPanel, nID
   LOCAL nLastCol := ::oParent:MaxCol()

   nID := 200000

   ::aPanels := {}

   oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, 0 )

   aadd( ::aPanels, oPanel )

   if aPanels <> nil
      for i := 1 to len( aPanels )
         if ::oParent:MaxCol() > aPanels[ i ]
            oPanel := WvtPanel():New( ::oParent, ++nID, ::nTop, aPanels[ i ] )
            aadd( ::aPanels, oPanel )
         endif
      next
   endif

   atail( ::aPanels ):nRight := nLastCol

   for i := len( ::aPanels ) - 1 TO 1 STEP -1
      oPanel        := ::aPanels[ i ]
      oPanel:nRight := ::aPanels[ i+1 ]:nLeft
      oPanel:cColor := ::cColor
   next

   RETURN self
wvgclass.prg1392
WVTSTATUSBAR:METHODUpdate( nPanel, cText, cColor )
METHOD Update( nPanel, cText, cColor )
   LOCAL oPanel

   if nPanel > 0 .and. nPanel <= len( ::aPanels )
      oPanel        := ::aPanels[ nPanel ]
      oPanel:Text   := cText
      oPanel:cColor := iif( cColor == nil, 'N/W', cColor )
      oPanel:Refresh()
   endif

   RETURN Self
wvgclass.prg1425
WVTSTATUSBAR:METHODSetText( nPanel, cText, cColor ) CLASS WvtStatusBar
METHOD SetText( nPanel, cText, cColor )  CLASS WvtStatusBar
   LOCAL oPanel

   DEFAULT cColor TO ::cColor

   if nPanel > 0 .and. nPanel <= len( ::aPanels )
      oPanel        := ::aPanels[ nPanel ]
      oPanel:Text   := cText
      oPanel:cColor := cColor
   endif

   RETURN Self
wvgclass.prg1439
WVTSTATUSBAR:METHODSetIcon( nPanel, cIconFile ) CLASS WvtStatusBar
METHOD SetIcon( nPanel, cIconFile ) CLASS WvtStatusBar

   if nPanel > 0 .and. nPanel <= len( ::aPanels )
      ::aPanels[ nPanel ]:cIconFile := cIconFile
   endif

   RETURN Self
wvgclass.prg1454
WVTSTATUSBAR:METHODRefresh() CLASS WvtStatusBar
METHOD Refresh() CLASS WvtStatusBar
   LOCAL i

   for i := 1 to len( ::aPanels )
      ::aPanels[ i ]:Refresh()
   next

   RETURN nil
wvgclass.prg1464
CLASSWvtPanel FROM WvtObject
CLASS WvtPanel FROM WvtObject

   DATA cColor
   DATA cTxt
   DATA cIconFile

   ACCESS Text                  INLINE ::cTxt
   ASSIGN Text( cText )         INLINE ::cTxt := pad( cText, ::nRight - ::nLeft-2 )

   METHOD New()
   METHOD Refresh()

ENDCLASS
wvgclass.prg1483
WVTPANEL:METHODNew( oParent, nId, nTop, nLeft ) CLASS WvtPanel
METHOD New( oParent, nId, nTop, nLeft ) CLASS WvtPanel

   ::Super:New( oParent, DLG_OBJ_PANEL, nId, nTop, nLeft, nTop )

   RETURN Self
wvgclass.prg1499
WVTPANEL:METHODRefresh() CLASS WvtPanel
METHOD Refresh() CLASS WvtPanel

   if ::Text <> nil
      DispOutAt( ::nTop, ::nLeft+1, ::Text, ::cColor )
   endif

   RETURN Self
wvgclass.prg1507
CLASSWvtLabel FROM WvtObject
CLASS WvtLabel FROM WvtObject

   ACCESS Text                  INLINE iif( ::cText == nil, '', ::cText )
   ASSIGN Text( cTxt )          INLINE ::cText := iif( cTxt == nil, '', cTxt )

   METHOD New()
   METHOD Create()
   METHOD Configure()
   METHOD Refresh()
   METHOD HoverOn()
   METHOD HoverOff()
   METHOD SetText()
   METHOD SetTextColor()
   METHOD SetBackColor()

ENDCLASS
wvgclass.prg1525
WVTLABEL:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtLabel
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtLabel

   ::Super:New( oParent, DLG_OBJ_LABEL, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg1544
WVTLABEL:METHODCreate( lConfg ) CLASS WvtLabel
METHOD Create( lConfg ) CLASS WvtLabel

   DEFAULT lConfg       TO .f.

   DEFAULT ::nBottom    TO ::nTop
   DEFAULT ::nRight     TO ::nLeft + len( ::Text )
   DEFAULT ::nTextColor TO RGB( 0,0,0 )

   ::nTextColorHoverOff := ::nTextColor
   ::nBackColorHoverOff := ::nBackColor

   ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic,;
                              ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle )
   if ::hFont <> 0
      if !( lConfg )
         ::bPaint := {|| Wvt_DrawLabelObj( ::nTop, ::nLeft, ::nBottom, ::nRight,;
                       ::Text, ::nAlignHorz, ::nAlignVert, ::nTextColor, ::nBackColor, ::hFont ) }
         aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } )
      endif
   endif

   ::Super:Create()

   RETURN Self
wvgclass.prg1552
WVTLABEL:METHODRefresh() CLASS WvtLabel
METHOD Refresh() CLASS WvtLabel

Eval( ::bPaint )

RETURN Self
wvgclass.prg1579
WVTLABEL:METHODSetText( cTxt ) CLASS WvtLabel
METHOD SetText( cTxt ) CLASS WvtLabel

   if valtype( cTxt ) == 'C'
      ::Text := cTxt
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg1587
WVTLABEL:METHODSetTextColor( nRGB ) CLASS WvtLabel
METHOD SetTextColor( nRGB ) CLASS WvtLabel

   if valtype( nRGB ) == 'N'
      ::nTextColor := nRGB
      ::nTextColorHoverOff := nRGB
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg1598
WVTLABEL:METHODSetBackColor( nRGB ) CLASS WvtLabel
METHOD SetBackColor( nRGB ) CLASS WvtLabel

   if valtype( nRGB ) == 'N'
      ::nBackColor := nRGB
      ::nBackColorHoverOff := nRGB
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg1610
WVTLABEL:METHODConfigure() CLASS WvtLabel
METHOD Configure() CLASS WvtLabel

   ::nTextColorHoverOff := ::nTextColor
   ::nBackColorHoverOff := ::nBackColor

   if ::hFont <> 0
      Win_DeleteObject( ::hFont )
   endif

   ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ::nFontWeight, ::lItalic,;
                              ::lUnderline, ::lStrikeout, ::nCharSet, ::nFontQuality, ::nAngle )

   RETURN Self
wvgclass.prg1622
WVTLABEL:METHODHoverOn() CLASS WvtLabel
METHOD HoverOn() CLASS WvtLabel
   LOCAL lOn := .f.

   if ::nTextColorHoverOn <> nil
      lOn := .t.
      ::nTextColor := ::nTextColorHoverOn
   endif
   if ::nBackColorHoverOn <> nil
      lOn := .t.
      ::nBackColor := ::nBackColorHoverOn
   endif

   if lOn
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg1638
WVTLABEL:METHODHoverOff() CLASS WvtLabel
METHOD HoverOff() CLASS WvtLabel
   LOCAL lOn := .f.

   if ::nTextColorHoverOn <> nil
      lOn := .t.
      ::nTextColor := ::nTextColorHoverOff
   endif
   if ::nBackColorHoverOn <> nil
      lOn := .t.
      ::nBackColor := ::nBackColorHoverOff
   endif

   if lOn
      ::Refresh()
   endif

   Return Self
wvgclass.prg1658
CLASSWvtToolBar FROM WvtObject
CLASS WvtToolBar FROM WvtObject

   DATA   nPaintID
   DATA   aObjects              INIT {}
   DATA   lHidden               INIT .f.
   DATA   nCurButton            INIT 0
   DATA   lActive
   DATA   lFloating
   DATA   wScreen
   DATA   cScreen
   DATA   nBtnLeft              INIT 0
   DATA   nRGBSep               INIT RGB( 150,150,150 )

   ACCESS nButtons              INLINE len( ::aButtons )

   METHOD New()
   METHOD Create()
   METHOD Refresh()
   METHOD AddButton()
   METHOD PaintToolBar()
   METHOD HoverOn()
   METHOD HoverOff()

ENDCLASS
wvgclass.prg1686
WVTTOOLBAR:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtToolBar
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtToolBar

   nTop    := 0
   nLeft   := 0
   DEFAULT nBottom TO 1
   nRight  := oParent:MaxCol()

   ::Super:New( oParent, DLG_OBJ_TOOLBAR, nID, nTop, nLeft, nBottom, nRight )

   ::lActive   := .t.
   ::lFloating := .F.
   ::nPaintID  := ::oParent:nPaintID++

   RETURN Self
wvgclass.prg1713
WVTTOOLBAR:METHODCreate() CLASS WvtToolBar
METHOD Create() CLASS WvtToolBar

   if ::lFloating
      ::lActive := .f.
      ::lHidden := .t.
   endif

   aeval( ::aObjects, {|o| o:lActive := ::lActive } )

   ::bPaint := {|| ::PaintToolBar() }
   aadd( ::aPaint, { ::bPaint,;
            { WVT_BLOCK_TOOLBAR, ::nTop, ::nLeft, ::nBottom, ::nRight } } )

   ::Super:Create()

   RETURN Self
wvgclass.prg1730
WVTTOOLBAR:METHODRefresh() CLASS WvtToolBar
METHOD Refresh() CLASS WvtToolBar

   if ::lFloating
      DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, '         ', 'n/w' )
   else
      Wvt_InvalidateRect( ::nTop, ::nLeft, ::nTop, ::nLeft )
   endif

   RETURN Self
wvgclass.prg1749
WVTTOOLBAR:METHODPaintToolBar() CLASS WvtToolBar
METHOD PaintToolBar() CLASS WvtToolBar

   if ( ::lActive )
      Wvt_DrawLine( ::nTop, ::nLeft, ::nBottom, ::nRight, 0, 1, 2, , , ::nRGBSep )
   endif

   RETURN Self
wvgclass.prg1761
WVTTOOLBAR:METHODAddButton( cFileImage, bBlock, cTooltip ) CLASS WvtToolBar
METHOD AddButton( cFileImage, bBlock, cTooltip ) CLASS WvtToolBar
   LOCAL oObj, nCol

   nCol := ( ::nBottom-::nTop+1 ) * 2

   oObj := WvtToolButton():New( self )

   oObj:lActive    := ::lActive
   oObj:nTop       := ::nTop
   oObj:nLeft      := ::nBtnLeft + 1
   oObj:nBottom    := ::nBottom

   if valtype( cFileImage ) == 'C'
      oObj:nBtnType   := TLB_BUTTON_TYPE_IMAGE
      oObj:nRight     := oObj:nLeft + nCol - 1
      oObj:cFileImage := cFileImage
      oObj:bOnLeftUp  := bBlock
      oObj:Tooltip    := cTooltip
   else
      oObj:nBtnType   := TLB_BUTTON_TYPE_SEPARATOR
      oObj:nRight     := oObj:nLeft
   endif

   aadd( ::aObjects, oObj )

   ::nBtnLeft         := oObj:nRight + 1
   ::nCurButton++

   ::oParent:AddObject( oObj )

   RETURN Self
wvgclass.prg1771
WVTTOOLBAR:METHODHoverOn()
METHOD HoverOn()

   if ::lFloating .and. ::lHidden
      ::lHidden   := .f.
      ::lActive   := .t.
      // ::cScreen   := SaveScreen( ::nTop, ::nLeft, ::nBottom, ::nRight )
      // ::wScreen   := Wvt_SaveScreen( ::nTop, ::nLeft, ::nBottom, ::nRight )

      aeval( ::aObjects, {|o| o:lActive := ::lActive } )

      ::Refresh()
   endif

   RETURN self
wvgclass.prg1805
WVTTOOLBAR:METHODHoverOff()
METHOD HoverOff()

   if ::lFloating .and. !( ::lHidden )
      ::lHidden := .t.
      ::lActive := .f.
      aeval( ::aObjects, {|o| o:lActive := ::lActive } )
      // RestScreen( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cScreen )
      // Wvt_RestScreen( ::nTop, ::nLeft, ::nBottom, ::nRight, ::wScreen, .f. )
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg1822
CLASSWvtToolButton FROM WvtObject
CLASS WvtToolButton FROM WvtObject

   DATA   cFileImage
   DATA   nCurState             INIT 0
   DATA   nBtnType              INIT TLB_BUTTON_TYPE_IMAGE
   DATA   aPxlOffSet            INIT { 0, -1, -3, 1 }

   METHOD New()
   METHOD Create()
   METHOD Refresh()
   METHOD LeftDown()
   METHOD LeftUp()
   METHOD HoverOn()
   METHOD HoverOff()
   METHOD PaintButton()

   ENDCLASS
wvgclass.prg1845
WVTTOOLBUTTON:METHODNew( oParent ) CLASS WvtToolButton
METHOD New( oParent ) CLASS WvtToolButton

   ::Super:New( oParent, DLG_OBJ_BUTTON )

   RETURN Self
wvgclass.prg1865
WVTTOOLBUTTON:METHODCreate() CLASS WvtToolButton
METHOD Create() CLASS WvtToolButton

   ::bPaint := {|| ::PaintButton() }
   aadd( ::aPaint, { ::bPaint,;
               { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight }} )

   ::Super:Create()

   RETURN Self
wvgclass.prg1873
WVTTOOLBUTTON:METHODRefresh() CLASS WvtToolButton
METHOD Refresh() CLASS WvtToolButton

   if ::lActive
      Eval( ::bPaint )
   endif

   RETURN Self
wvgclass.prg1885
WVTTOOLBUTTON:METHODPaintButton() CLASS WvtToolButton
METHOD PaintButton() CLASS WvtToolButton

   if ::lActive
      if ::nBtnType == TLB_BUTTON_TYPE_IMAGE
         Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, {4,4,-6,-4} )
      else
         Wvt_DrawLine( ::nTop, ::nLeft, ::nBottom, ::nRight, 1, 1, , , , ::oParent:nRGBSep )
      endif
   endif

   RETURN Self
wvgclass.prg1895
WVTTOOLBUTTON:METHODLeftDown() CLASS WvtToolButton
METHOD LeftDown() CLASS WvtToolButton
   LOCAL lRet := .f.

   if ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE
      Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 2 )
      lRet := .t.
   endif

   RETURN lRet
wvgclass.prg1909
WVTTOOLBUTTON:METHODLeftUp() CLASS WvtToolButton
METHOD LeftUp() CLASS WvtToolButton
   LOCAL lRet := .f.

   if ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE
      Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 1 )
      Eval( ::bOnLeftUp )
      lRet := .t.
   endif

   RETURN lRet
wvgclass.prg1921
WVTTOOLBUTTON:METHODHoverOn() CLASS WvtToolButton
METHOD HoverOn() CLASS WvtToolButton

   ::oParent:HoverOn()

   if ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE
      Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet, 1 )
   endif

   RETURN Self
wvgclass.prg1934
WVTTOOLBUTTON:METHODHoverOff() CLASS WvtToolButton
METHOD HoverOff() CLASS WvtToolButton

   ::oParent:HoverOff()

   if ::lActive .and. ::nBtnType == TLB_BUTTON_TYPE_IMAGE
      Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight,::aPxlOffSet, 0 )
   endif

   RETURN Self
wvgclass.prg1946
CLASSWvtImage FROM WvtObject
CLASS WvtImage FROM WvtObject

   DATA   cImageFile

   ACCESS cImage                INLINE ::cImageFile
   ASSIGN cImage( cImg )        INLINE ::cImageFile := cImg

   METHOD New()
   METHOD Create()
   METHOD SetImage()

   ENDCLASS
wvgclass.prg1966
WVTIMAGE:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtImage
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtImage

   ::Super:New( oParent, DLG_OBJ_IMAGE, nId, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg1981
WVTIMAGE:METHODCreate() CLASS WvtImage
METHOD Create() CLASS WvtImage

   ::bPaint := {|| iif( file( ::cImage ), ;
        Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cImage ),'' ) }

   aadd( ::aPaint, { ::bPaint,;
               { WVT_BLOCK_IMAGE, ::nTop, ::nLeft, ::nBottom, ::nRight } } )

   ::Super:Create()

   RETURN Self
wvgclass.prg1989
WVTIMAGE:METHODSetImage( cImage ) CLASS WvtImage
METHOD SetImage( cImage ) CLASS WvtImage

   if cImage <> nil .and. file( cImage )
      ::cImageFile := cImage
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg2003
CLASSWvtStatic FROM WvtObject
CLASS WvtStatic FROM WvtObject

   DATA   nStatic
   DATA   nOrient
   DATA   nFormat
   DATA   nAlign
   DATA   nStyle
   DATA   nThick
   DATA   nColor

   DATA   nfTop
   DATA   nfLeft
   DATA   nfBottom
   DATA   nfRight

   DATA   nHorzVert             INIT 0
   DATA   aRGBb
   DATA   aRGBe

   DATA   aPxlOffSet            INIT {}

   METHOD New()
   METHOD Create()
   METHOD Refresh()
   METHOD HoverOn()
   METHOD HoverOff()

   ENDCLASS
wvgclass.prg2022
WVTSTATIC:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtStatic
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtStatic

   ::Super:New( oParent, DLG_OBJ_STATIC, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg2053
WVTSTATIC:METHODCreate() CLASS WvtStatic
METHOD Create() CLASS WvtStatic
   LOCAL lInside := .f.

   switch ::nStatic

   case WVT_STATIC_LINE
      lInside := .t.
      ::bPaint  := {|| Wvt_DrawLine( ::nTop, ::nLeft, ::nBottom, ::nRight, ;
               ::nOrient, ::nFormat, ::nAlign, ::nStyle, ::nThick, ::nColor ) }
      exit

   case WVT_STATIC_BOXRAISED
      ::bPaint := {|| Wvt_DrawBoxRaised( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_BOXRECESSED
      ::bPaint := {|| Wvt_DrawBoxRecessed( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_BOXGROUP
      ::bPaint := {|| Wvt_DrawBoxGroup( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_BOXGROUPRAISED
      ::bPaint := {|| Wvt_DrawBoxGroupRaised( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_OUTLINE
      ::bPaint := {|| Wvt_DrawOutline( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_RECTANGLE
      lInside := .t.
      ::bPaint := {|| Wvt_DrawRectangle( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_ROUNDRECT
      lInside := .t.
      ::bPaint := {|| Wvt_DrawRoundRect( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_FOCUSRECT
      lInside := .t.
      ::bPaint := {|| Wvt_DrawFocusRect( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_ELLIPSE
      lInside := .t.
      ::bPaint := {|| Wvt_DrawEllipse( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlOffSet ) }
      exit

   case WVT_STATIC_SHADEDRECT
      lInside := .t.
      ::bPaint := {|| Wvt_DrawShadedRect( ::nTop, ::nLeft, ::nBottom, ::nRight, ;
                                ::aPxlOffSet, ::nHorzVert, ::aRGBb, ::aRGBe ) }
      exit

   end

   if lInside
      ::nfTop    := ::nTop
      ::nfLeft   := ::nLeft
      ::nfBottom := ::nBottom
      ::nfRight  := ::nRight
   else
      ::nfTop    := ::nTop    - 1
      ::nfLeft   := ::nLeft   - 1
      ::nfBottom := ::nBottom + 1
      ::nfRight  := ::nRight  + 1
   endif

   aadd( ::aPaint, { ::bPaint,;
             { WVT_BLOCK_STATIC, ::nfTop, ::nfLeft, ::nfBottom, ::nfRight }} )

   ::Super:Create()

   RETURN Self
wvgclass.prg2061
WVTSTATIC:METHODHoverOn()
METHOD HoverOn()

   RETURN Self
wvgclass.prg2141
WVTSTATIC:METHODHoverOff()
METHOD HoverOff()

   RETURN Self
wvgclass.prg2147
WVTSTATIC:METHODRefresh() CLASS WvtStatic
METHOD Refresh() CLASS WvtStatic

   Eval( ::bPaint )

   RETURN Self
wvgclass.prg2153
CLASSWvtPushButton FROM WvtObject
CLASS WvtPushButton FROM WvtObject

   DATA   cCaption
   DATA   cFileImage

   ACCESS block                 INLINE ::bOnLeftUp
   ASSIGN block( bBlock )       INLINE ::bOnLeftUp := bBlock

   METHOD New()
   METHOD Create()
   METHOD LeftDown()
   METHOD LeftUp()
   METHOD PaintButton()

ENDCLASS
wvgclass.prg2169
WVTPUSHBUTTON:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtPushButton
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtPushButton

   ::Super:New( oParent, DLG_OBJ_PUSHBUTTON, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg2187
WVTPUSHBUTTON:METHODCreate() CLASS WvtPushButton
METHOD Create() CLASS WvtPushButton

   ::bPaint := {|| ::PaintButton() }

   aadd( ::aPaint, { ::bPaint,;
               { WVT_BLOCK_BUTTON, ::nTop, ::nLeft, ::nBottom, ::nRight } } )

   ::Super:Create()

   RETURN Self
wvgclass.prg2195
WVTPUSHBUTTON:METHODPaintButton() CLASS WvtPushButton
METHOD PaintButton() CLASS WvtPushButton

   if ::cCaption == nil
      Wvt_DrawImage( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cFileImage, { 4, 4,-4, -4 } )
   else
      Wvt_DrawButton( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cCaption, , 4 )
   endif
   Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, {0,0,0,0}, 1 )

   RETURN Self
wvgclass.prg2208
WVTPUSHBUTTON:METHODLeftDown() CLASS WvtPushButton
METHOD LeftDown() CLASS WvtPushButton

   Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight,{0,0,0,0} , 2 )

   RETURN .t.
wvgclass.prg2221
WVTPUSHBUTTON:METHODLeftUp() CLASS WvtPushButton
METHOD LeftUp() CLASS WvtPushButton

   Wvt_DrawToolButtonState( ::nTop, ::nLeft, ::nBottom, ::nRight, {0,0,0,0}, 1 )
   ::Eval( ::bOnLeftUp )

   RETURN .t.
wvgclass.prg2229
CLASSWvtGets FROM WvtObject
CLASS WvtGets FROM WvtObject

   DATA   aGetList              INIT  {}
   DATA   nLastGet              INIT  1
   DATA   nCurGet               INIT  1
   DATA   GetList               INIT  {}
   DATA   cDesc                 INIT  ''

   METHOD New()
   METHOD Create()
   METHOD KillFocus()
   METHOD SetFocus()
   METHOD HandleEvent()
   METHOD AddGets()
   METHOD PaintBlock()
   METHOD Read()
   METHOD Hilite()
   METHOD DeHilite()
   METHOD GetData()
   METHOD SetData()

ENDCLASS
wvgclass.prg2246
WVTGETS:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtGets
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtGets

   ::Super:New( oParent, DLG_OBJ_GETS, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg2271
WVTGETS:METHODCreate() CLASS WvtGets
METHOD Create() CLASS WvtGets
   LOCAL i, GetList
   LOCAL nCurRow := row()
   LOCAL nCurCol := Col()

   for i := 1 to len( ::aGetList )
      GetList := {}

      DEFAULT ::aGetList[ i,7 ] TO 'N/W*,N/W*,,,N/GR*'
      DEFAULT ::aGetList[ i,5 ] TO {|| .T. }
      DEFAULT ::aGetList[ i,6 ] TO {|| .T. }

      @ ::aGetList[ i,1 ], ::aGetList[ i,2 ] GET ::aGetList[ i,3 ] PICTURE ::aGetList[ i,4 ] COLOR ::aGetList[ i,7 ]

      aadd( ::GetList, GetList[ 1 ] )

      ::GetList[ i ]:Display()
      ::PaintBlock( i )
   next
   SetPos( nCurRow, nCurCol )

   ::Super:Create()
   ::Dehilite()

   RETURN Self
wvgclass.prg2279
WVTGETS:METHODPaintBlock( nIndex ) CLASS WvtGets
METHOD PaintBlock( nIndex ) CLASS WvtGets
   LOCAL nLen, bPaint

   nLen   := len( Transform( ::aGetList[ nIndex,3 ], ::aGetList[ nIndex,4 ] ) )

   bPaint := {|| Wvt_DrawBoxGet( ::aGetList[ nIndex,1 ], ::aGetList[ nIndex,2 ], nLen ) }

   aadd( ::aPaint, { bPaint,;
               { WVT_BLOCK_GETS, ::aGetList[ nIndex,1 ]-1, ::aGetList[ nIndex,2 ]-1, ;
                     ::aGetList[ nIndex,1 ]-1,  ::aGetList[ nIndex,2 ]+nLen } } )

   RETURN Self
wvgclass.prg2307
WVTGETS:METHODSetFocus() CLASS WvtGets
METHOD SetFocus() CLASS WvtGets

   RETURN Self
wvgclass.prg2322
WVTGETS:METHODKillFocus() CLASS WvtGets
METHOD KillFocus() CLASS WvtGets

   RETURN Self
wvgclass.prg2328
WVTGETS:METHODAddGets( nRow, nCol, xVar, cPic, cColor, bValid, bWhen ) CLASS WvtGets
METHOD AddGets( nRow, nCol, xVar, cPic, cColor, bValid, bWhen ) CLASS WvtGets

   aadd( ::aGetList, { nRow, nCol, xVar, cPic, bValid, bWhen, cColor } )

   RETURN Self
wvgclass.prg2334
WVTGETS:METHODHandleEvent( nKey ) CLASS WvtGets
METHOD HandleEvent( nKey ) CLASS WvtGets
   Local lRet := .f.

   do case
   case nKey == K_LDBLCLK
      ::Read()
      lRet := .t.
   endcase

   RETURN lRet
wvgclass.prg2342
WVTGETS:METHODRead() CLASS WvtGets
METHOD Read() CLASS WvtGets

   ReadModal( ::GetList, ::nCurGet )

   RETURN Self
wvgclass.prg2355
WVTGETS:METHODGetData() CLASS WvtGets
METHOD GetData() CLASS WvtGets
   LOCAL aData

   RETURN aData
wvgclass.prg2363
WVTGETS:METHODSetData( )
METHOD SetData( /*aData*/ )

   RETURN Self
wvgclass.prg2370
WVTGETS:METHODHilite() CLASS WvtGets
METHOD Hilite() CLASS WvtGets

   DispOutAt( ::nTop, ::nLeft, pad( ' '+::cDesc, ::nRight-::nLeft+1 ), ::cColorHilite )

   RETURN Self
wvgclass.prg2376
WVTGETS:METHODDeHilite() CLASS WvtGets
METHOD DeHilite() CLASS WvtGets

   DispOutAt( ::nTop, ::nLeft, pad( ' '+::cDesc, ::nRight-::nLeft+1 ), ::cColorDeHilite )

   RETURN Self
wvgclass.prg2384
CLASSWvtScrollBar FROM WvtObject
CLASS WvtScrollBar FROM WvtObject

   DATA   nBarType              INIT WVT_SCROLLBAR_VERT

   DATA   nTotal                INIT 100
   DATA   nCurrent              INIT 1
   DATA   nThumbPos             INIT 0
   DATA   nBlockNo              INIT 1

   DATA   nSTop
   DATA   nSLeft
   DATA   nSBottom
   DATA   nSRight

   DATA   nBtn1Top
   DATA   nBtn1Left
   DATA   nBtn1Bottom
   DATA   nBtn1Right

   DATA   nBtn2Top
   DATA   nBtn2Left
   DATA   nBtn2Bottom
   DATA   nBtn2Right

   DATA   bBtnLeftTop
   DATA   bBtnLeftTopDep
   DATA   bBtnRightBottom
   DATA   bBtnRightBottomDep

   DATA   bBtnScroll

   DATA   bTotal
   DATA   bCurrent

   DATA   lHidden               INIT .t.

   DATA   aPxlBtnTop            INIT {0,0,0,0}
   DATA   aPxlBtnLft            INIT {0,0,0,0}
   DATA   aPxlBtnBtm            INIT {0,0,0,0}
   DATA   aPxlBtnRgt            INIT {0,0,0,0}
   DATA   aPxlScroll            INIT {0,0,0,0}

   DATA   lLeftDown             INIT .f.
   DATA   lOnThumb              INIT .f.
   DATA   lAnchored             INIT .f.
   DATA   lOnLeftDown           INIT .f.

   DATA   nScrollUnits          INIT 0

   METHOD New()
   METHOD Create()
   METHOD Configure()
   METHOD Refresh()
   METHOD HandleEvent()
   METHOD SetPos()
   METHOD GetPos()
   METHOD ThumbPos()
   METHOD SetTooltip()

ENDCLASS
wvgclass.prg2400
WVTSCROLLBAR:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtScrollBar
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtScrollBar

   ::Super:New( oParent, DLG_OBJ_SCROLLBAR, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg2463
WVTSCROLLBAR:METHODCreate() CLASS WvtScrollBar
METHOD Create() CLASS WvtScrollBar

   if ::nTop == nil .or. ::nLeft == nil
      return nil
   endif

   if ::nBarType == WVT_SCROLLBAR_VERT
      DEFAULT ::nBottom TO ::nTop + 5
      DEFAULT ::nRight  TO ::nLeft + 1

      ::nRight       := ::nLeft + 1
      ::nBottom      := max( 7, ::nBottom )

      ::nBtn1Top     := ::nTop
      ::nBtn1Left    := ::nLeft
      ::nBtn1Bottom  := ::nTop
      ::nBtn1Right   := ::nRight

      ::nBtn2Top     := ::nBottom
      ::nBtn2Left    := ::nLeft
      ::nBtn2Bottom  := ::nBottom
      ::nBtn2Right   := ::nRight

      ::nSTop        := ::nTop + 1
      ::nSLeft       := ::nLeft
      ::nSBottom     := ::nBottom - 1
      ::nSRight      := ::nRight

      ::nScrollUnits := ::nSBottom - ::nSTop + 1

      ::nTotal       := Eval( ::bTotal   )
      ::nCurrent     := Eval( ::bCurrent )
      ::ThumbPos()

      ::bBtnLeftTop := ;
           {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnTop,1 ) }
      ::bBtnRightBottom := ;
           {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnBtm,3 ) }
      ::bBtnScroll := ;
           {|| Wvt_DrawScrollThumbVert( ::nSTop ,::nSLeft  ,::nSBottom,::nSRight,::aPxlScroll,;
                                                  ::nThumbPos ) }
      ::bBtnLeftTopDep := ;
           {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnTop,1,.t. ) }
      ::bBtnRightBottomDep := ;
           {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnBtm,3,.t. ) }

   else
      DEFAULT ::nBottom TO ::nTop
      DEFAULT ::nRight  TO ::nLeft + 11

      ::nBottom      := ::nTop
      ::nRight       := max( 11, ::nRight )

      ::nBtn1Top     := ::nTop
      ::nBtn1Left    := ::nLeft
      ::nBtn1Bottom  := ::nBottom
      ::nBtn1Right   := ::nLeft + 1

      ::nBtn2Top     := ::nTop
      ::nBtn2Left    := ::nRight - 1
      ::nBtn2Bottom  := ::nBottom
      ::nBtn2Right   := ::nRight

      ::nSTop        := ::nTop
      ::nSLeft       := ::nLeft + 2
      ::nSBottom     := ::nBottom
      ::nSRight      := ::nRight - 2

      ::nScrollUnits := ::nSRight - ::nSLeft + 1

      ::nTotal       := Eval( ::bTotal   )
      ::nCurrent     := Eval( ::bCurrent )

      ::ThumbPos()

      ::bBtnLeftTop := ;
           {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnLft,2 ) }
      ::bBtnRightBottom := ;
           {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnRgt,4 ) }
      ::bBtnScroll := ;
           {|| Wvt_DrawScrollThumbHorz( ::nSTop,::nSLeft,::nSBottom,::nSRight,;
                                            ::aPxlScroll,::nThumbPos ) }
      ::bBtnLeftTopDep := ;
           {|| Wvt_DrawScrollButton( ::nBtn1Top,::nBtn1Left,::nBtn1Bottom,::nBtn1Right,::aPxlBtnLft,2,.t. ) }
      ::bBtnRightBottomDep := ;
           {|| Wvt_DrawScrollButton( ::nBtn2Top,::nBtn2Left,::nBtn2Bottom,::nBtn2Right,::aPxlBtnRgt,4,.t. ) }

   endif

   ::bOnLeftUp      := {|| ::HandleEvent( K_LBUTTONUP      ) }
   ::bOnLeftDown    := {|| ::HandleEvent( K_LBUTTONDOWN    ) }
   ::bOnMMLeftDown  := {|| ::HandleEvent( K_MMLEFTDOWN     ) }
   ::bOnLeftPressed := {|| ::HandleEvent( K_LBUTTONPRESSED ) }

   Eval( ::bBtnLeftTop     )
   Eval( ::bBtnRightBottom )

   ::Super:Create()

   RETURN Self
wvgclass.prg2471
WVTSCROLLBAR:METHODConfigure( nTop, nLeft, nBottom, nRight ) CLASS WvtScrollBar
METHOD Configure( nTop, nLeft, nBottom, nRight ) CLASS WvtScrollBar

   ::nTop     := nTop
   ::nLeft    := nLeft
   ::nBottom  := nBottom
   ::nRight   := nRight

   ::Create()
   ::Refresh()

   RETURN Self
wvgclass.prg2574
WVTSCROLLBAR:METHODRefresh() CLASS WvtScrollBar
METHOD Refresh() CLASS WvtScrollBar

   Eval( ::bBtnScroll )

   RETURN Self
wvgclass.prg2588
WVTSCROLLBAR:METHODSetPos( nTotal, nCurrent ) CLASS WvtScrollBar
METHOD SetPos( nTotal, nCurrent ) CLASS WvtScrollBar

   DEFAULT nTotal   TO Eval( ::bTotal   )
   DEFAULT nCurrent TO Eval( ::bCurrent )

   ::nTotal   := nTotal
   ::nCurrent := nCurrent

   ::ThumbPos()
   ::Refresh()

   RETURN Self
wvgclass.prg2596
WVTSCROLLBAR:METHODThumbPos() CLASS WvtScrollBar
METHOD ThumbPos() CLASS WvtScrollBar
   LOCAL  nNewPos     := ::nThumbPos
   LOCAL  nRecPerUnit, nCurUnit

   if ::nBarType == WVT_SCROLLBAR_VERT
      nRecPerUnit := ::nTotal / ::nScrollUnits
      nCurUnit    := int( ::nCurrent / nRecPerUnit )

      if ::nCurrent == 1
         nCurUnit := 0
      elseif ::nCurrent == ::nTotal
         nCurUnit := ::nScrollUnits
      endif
      nNewPos     := ::nSTop + nCurUnit

      if nNewPos < ::nSTop
         nNewPos := ::nSTop
      elseif nNewPos > ::nSBottom
         nNewPos := ::nSBottom
      endif

   else
      if ::nTotal < ::nScrollUnits
         nCurUnit := ::nCurrent * int( ::nScrollUnits / ::nTotal )
      else
         nRecPerUnit := ::nTotal / ::nScrollUnits
         nCurUnit    := int( ::nCurrent / nRecPerUnit )
      endif

      if ::nCurrent == 1
         nCurUnit := 0
      elseif ::nCurrent == ::nTotal
         nCurUnit := ::nScrollUnits
      endif

        nNewPos := ::nSLeft + nCurUnit

        if nNewPos < ::nSLeft
           nNewPos := ::nSLeft
      elseif nNewPos > ::nSRight - 1
           nNewPos := ::nSRight-1
      endif

   endif

   ::nThumbPos := nNewPos

   RETURN Self
wvgclass.prg2611
WVTSCROLLBAR:METHODGetPos() CLASS WvtScrollBar
METHOD GetPos() CLASS WvtScrollBar

   RETURN ::nCurrent
wvgclass.prg2662
WVTSCROLLBAR:METHODSetTooltip() CLASS WvtScrollBar
METHOD SetTooltip() CLASS WvtScrollBar

   ::Tooltip := ltrim( str( ::nCurrent,12,0 ) ) + ' / ' + ;
                ltrim( str( ::nTotal  ,12,0 ) )

   Wvt_SetToolTip( ::nTop, ::nLeft, ::nBottom, ::nRight, ::Tooltip )

   RETURN Self
wvgclass.prg2668
WVTSCROLLBAR:METHODHandleEvent( nKey ) CLASS WvtScrollBar
METHOD HandleEvent( nKey ) CLASS WvtScrollBar
   LOCAL nmRow, nmCol, nOff
   LOCAL lHit  := .F.
   LOCAL mKeys_:={ K_LBUTTONDOWN, K_LBUTTONUP, K_MMLEFTDOWN, K_LBUTTONPRESSED }

   if ascan( mKeys_, nKey ) == 0
      return .f.
   endif

   nmRow := MRow()
   nmCol := MCol()

   do case
   case ::nBarType == WVT_SCROLLBAR_VERT
      lHit := .t.

      do case
      case ::lAnchored .and. nKey == K_MMLEFTDOWN
         if nmRow <> ::nThumbPos
            nOff := ::nThumbPos - nmRow
            if nOff > 0
               ::nThumbPos := max( ::nTop+1, nmRow )
            else
               ::nThumbPos := min( ::nBottom-1, nmRow )
            endif
            ::nCurrent := ( ::nTotal * ( ::nThumbPos - ::nTop ) / ::nScrollUnits )

            if ::nCurrent > ::nTotal
               ::nCurrent := ::nTotal
            endif
            if ::nCurrent < 1
               ::nCurrent := 1
            endif

            ::SetPos( ::nTotal, ::nCurrent )

            ::SetTooltip()
            Wvt_Keyboard( K_SBTHUMBTRACKVERT )
         else
            lHit := .f.
         endif

      case ::lAnchored .and. nKey == K_LBUTTONUP
         ::lAnchored := .f.

      otherwise
         lHit := .f.

         if nmCol >= ::nLeft .and. nmCol <= ::nRight
            lHit := .t.

            do case
            case nmRow == ::nThumbPos .and. nKey == K_LBUTTONDOWN
               ::lAnchored := .t.

            case nKey == K_LBUTTONUP
               if ( lHit := ::lOnLeftDown )
                  do case
                  case nmRow == ::nTop
                     Eval( ::bBtnLeftTop )
                  case nmRow == ::nBottom
                     Eval( ::bBtnRightBottom )
                  case nmRow < ::nThumbPos .and. nmRow > ::nTop
                  case nmRow > ::nThumbPos .and. nmRow < ::nBottom
                  otherwise
                     lHit := .f.
                  endcase
                  if lHit
                     ::lOnLeftDown := .f.
                  endif
               endif

            case nKey == K_LBUTTONPRESSED
               if ( lHit := ::lOnLeftDown )
                  do case
                  case nmRow == ::nTop
                     Wvt_Keyboard( K_SBLINEUP   )
                  case nmRow == ::nBottom
                     Wvt_Keyboard( K_SBLINEDOWN )
                  case nmRow < ::nThumbPos .and. nmRow > ::nTop
                     Wvt_Keyboard( K_SBPAGEUP )
                  case nmRow > ::nThumbPos .and. nmRow < ::nBottom
                     Wvt_Keyboard( K_SBPAGEDOWN )
                  otherwise
                     lHit := .f.
                  endcase
               endif

            case nKey == K_LBUTTONDOWN
               do case
               case nmRow == ::nTop
                  Eval( ::bBtnLeftTopDep )
                  Wvt_Keyboard( K_SBLINEUP )
               case nmRow == ::nBottom
                  Eval( ::bBtnRightBottomDep )
                  Wvt_Keyboard( K_SBLINEDOWN )
               case nmRow < ::nThumbPos .and. nmRow > ::nTop
                  Wvt_Keyboard( K_SBPAGEUP   )
               case nmRow > ::nThumbPos .and. nmRow < ::nBottom
                  Wvt_Keyboard( K_SBPAGEDOWN )
               otherwise
                  lHit := .f.
               endcase
               if lHit
                  ::lOnLeftDown := .t.
               endif
            endcase
         endif

      endcase

   case ::nBarType == WVT_SCROLLBAR_HORZ
      do case
      case ::lAnchored .and. nKey == K_MMLEFTDOWN
         if ( lHit := ( nmCol < ::nThumbPos .or. nmCol > ::nThumbPos+1 ) )

            nOff := ::nThumbPos - nmCol
            if nOff > 0
               ::nThumbPos := max( ::nLeft+2, nmCol )
            else
               ::nThumbPos := min( ::nRight-2, nmCol )
            endif

            ::nCurrent := ( ::nTotal * ( ::nThumbPos - ::nLeft+1 ) / ::nScrollUnits )

            if ::nCurrent > ::nTotal
               ::nCurrent := ::nTotal
            endif
            if ::nCurrent < 1
               ::nCurrent := 1
            endif

            ::SetPos( ::nTotal, ::nCurrent )

            Wvt_Keyboard( K_SBTHUMBTRACKHORZ )
         endif

      case ::lAnchored .and. nKey == K_LBUTTONUP
         ::lAnchored := .f.
         lHit := .t.

      otherwise

         if ( lHit := nmRow == ::nTop .and. nmCol >= ::nLeft .and. nmCol <= ::nRight )

            do case
            case nKey == K_LBUTTONDOWN .and. nmCol >= ::nThumbPos .and. nmCol <= ::nThumbPos+1
               ::lAnchored := .t.

            case nKey == K_LBUTTONUP

               if ( lHit := ::lOnLeftDown )
                  do case
                  case nmCol >= ::nLeft    .and. nmCol <= ::nLeft+1
                     Eval( ::bBtnLeftTop )
                  case nmCol >= ::nRight-1 .and. nmCol <= ::nRight
                     Eval( ::bBtnRightBottom )
                  case nmCol <  ::nThumbPos
                  case nmCol >  ::nThumbPos+1
                  otherwise
                     lHit := .f.
                  endcase
                  if lHit
                     ::lOnLeftDown := .f.
                  endif
               endif

            case nKey == K_LBUTTONPRESSED
               if ( lHit := ::lOnLeftDown )
                  do case
                  case nmCol == ::nLeft  .or. nmCol == ::nLeft+1
                     Wvt_Keyboard( K_SBLINELEFT )
                  case nmCol == ::nRight .or. nmCol == ::nRight-1
                     Wvt_Keyboard( K_SBLINERIGHT )
                  case nmCol < ::nThumbPos
                     Wvt_Keyboard( K_SBPAGELEFT )
                  case nmCol > ::nThumbPos+1
                     Wvt_Keyboard( K_SBPAGERIGHT )
                  otherwise
                     lHit := .f.
                  endcase
               endif

            case nKey == K_LBUTTONDOWN
               do case
               case nmCol == ::nLeft  .or. nmCol == ::nLeft+1
                  Eval( ::bBtnLeftTopDep )
                  Wvt_Keyboard( K_SBLINELEFT )
               case nmCol == ::nRight .or. nmCol == ::nRight-1
                  Eval( ::bBtnRightBottomDep )
                  Wvt_Keyboard( K_SBLINERIGHT )
               case nmCol < ::nThumbPos
                  Wvt_Keyboard( K_SBPAGELEFT )
               case nmCol > ::nThumbPos+1
                  Wvt_Keyboard( K_SBPAGERIGHT )
               otherwise
                  lHit := .f.
               endcase
               if lHit
                  ::lOnLeftDown := .t.
               endif
            endcase
         endif
      endcase
   endcase

   RETURN lHit
wvgclass.prg2679
CLASSWvtBanner FROM WvtObject
CLASS WvtBanner FROM WvtObject

   DATA   nTimeDelay            INIT 0.5    // One-half Second
   DATA   nDirection            INIT 0      // LEFT 1-RIGHT
   DATA   nCharToSkip           INIT 1
   DATA   cText                 INIT ''
   DATA   cDispText             INIT ''
   DATA   nTextLen              INIT 0
   DATA   nTextIndex            INIT 0

   DATA   oLabel

   DATA   nAlignVert            INIT 2     // Center

   DATA   nCurSeconds           INIT 0
   DATA   nCurAlign

   METHOD New()
   METHOD Create()
   METHOD Configure()
   METHOD Refresh()
   METHOD HoverOn()
   METHOD HoverOff()
   METHOD OnTimer()
   METHOD SetText()
   METHOD Destroy()

ENDCLASS
wvgclass.prg2897
WVTBANNER:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtBanner
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtBanner

   ::Super:New( oParent, DLG_OBJ_BANNER, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg2928
WVTBANNER:METHODCreate() CLASS WvtBanner
METHOD Create() CLASS WvtBanner

   ::cDispText := ::cText

   ::oLabel := WvtLabel():New( ::oParent, , ::nTop, ::nLeft, ::nBottom, ::nRight )
   ::oLabel:Text              := ::cDispText
   ::oLabel:cFont             := ::cFont
   ::oLabel:nFontHeight       := ::nFontHeight
   ::oLabel:nFontWidth        := ::nFontWidth
   ::oLabel:nFontWeight       := ::nFontWeight
   ::oLabel:nFontQuality      := ::nFontQuality
   ::oLabel:lItalic           := ::lItalic
   ::oLabel:lStrikeout        := ::lStrikeout
   ::oLabel:lUnderline        := ::lUnderline
   ::oLabel:nAlignVert        := ::nAlignVert
   ::oLabel:nAlignHorz        := iif( ::nDirection == 0, 0, 1 )
   ::oLabel:nTextColor        := ::nTextColor
   ::oLabel:nBackColor        := ::nBackColor
   ::oLabel:nTextColorHoverOn := ::nTextColorHoverOn
   ::oLabel:nBackColorHoverOn := ::nBackColorHoverOn

   ::oLabel:Create()

   ::nCurSeconds := Seconds()
   ::nTextLen    := len( ::cText )
   ::nTextIndex  := iif( ::nDirection == 0, 1, ::nTextLen )
   ::nCurAlign   := ::nDirection

   ::Super:Create()

   RETURN Self
wvgclass.prg2936
WVTBANNER:METHODDestroy() CLASS WvtBanner
METHOD Destroy() CLASS WvtBanner

   Win_DeleteObject( ::oLabel:hFont )

   RETURN nil
wvgclass.prg2970
WVTBANNER:METHODConfigure() CLASS WvtBanner
METHOD Configure() CLASS WvtBanner

   RETURN Self
wvgclass.prg2978
WVTBANNER:METHODOnTimer() CLASS WvtBanner
METHOD OnTimer() CLASS WvtBanner

   ::Refresh()

   RETURN Self
wvgclass.prg2984
WVTBANNER:METHODSetText( cText ) CLASS WvtBanner
METHOD SetText( cText ) CLASS WvtBanner

   if cText <> nil
      ::cText := cText
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg2992
WVTBANNER:METHODRefresh() CLASS WvtBanner
METHOD Refresh() CLASS WvtBanner
   LOCAL nNewTime

   if abs( ( nNewTime := Seconds() ) - ::nCurSeconds ) >= ::nTimeDelay
      ::nCurSeconds := nNewTime

      if ::nDirection == 0
         ::nTextIndex++
         if ::nTextIndex > ::nTextLen
            ::nTextIndex := 1
            ::nCurAlign  := iif( ::nCurAlign == 0, 1, 0 )
         endif

         if ::nCurAlign == 0   // Left
            ::cDispText := substr( ::cText,::nTextIndex )
         else                  // Right
            ::cDispText := substr( ::cText, 1, ::nTextIndex )
         endif
      else
         ::nTextIndex--
         if ::nTextIndex < 0
            ::nTextIndex := ::nTextLen
            ::nCurAlign := iif( ::nCurAlign == 0, 1, 0 )
         endif

         if ::nCurAlign == 0   // Left
            ::cDispText := substr( ::cText,::nTextIndex )
         else                  // Right
            ::cDispText := substr( ::cText, 1, ::nTextIndex )
         endif
      endif

      ::oLabel:nAlignHorz := ::nCurAlign
      ::oLabel:SetText( ::cDispText )
      ::oLabel:Refresh()
   endif

   RETURN Self
wvgclass.prg3003
WVTBANNER:METHODHoverOn() CLASS WvtBanner
METHOD HoverOn() CLASS WvtBanner

   ::oLabel:HoverOn()

   RETURN Self
wvgclass.prg3044
WVTBANNER:METHODHoverOff() CLASS WvtBanner
METHOD HoverOff() CLASS WvtBanner

   ::oLabel:HoverOff()

   RETURN Self
wvgclass.prg3052
CLASSWvtTextBox FROM WvtObject
CLASS WvtTextBox FROM WvtObject

   DATA   cText                 INIT ''

   METHOD New()
   METHOD Create()
   METHOD Configure()
   METHOD Refresh()
   METHOD SetText()
   METHOD HoverOn()
   METHOD HoverOff()

ENDCLASS
wvgclass.prg3068
WVTTEXTBOX:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtTextBox
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtTextBox

   ::Super:New( oParent, DLG_OBJ_TEXTBOX, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg3084
WVTTEXTBOX:METHODCreate() CLASS WvtTextBox
METHOD Create() CLASS WvtTextBox

   ::nTextColorHoverOff := ::nTextColor

   ::hFont := Wvt_CreateFont( ::cFont, ::nFontHeight, ::nFontWidth, ;
                  ::nFontWeight, ::lItalic, ::lUnderline, ::lStrikeout, ;
                  ::nCharSet, ::nFontQuality, 0 )

   if ::hFont <> 0
      ::bPaint := {|| Wvt_DrawTextBox( ::nTop, ::nLeft, ::nBottom, ::nRight, ;
            ::aPxlTLBR, ::cText, ::nAlignHorz, ::nAlignVert, ;
            ::nTextColor, ::nBackColor, ::nBackMode, ::hFont ) }

      aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } )
   endif

   ::Super:Create()

   RETURN Self
wvgclass.prg3092
WVTTEXTBOX:METHODRefresh() CLASS WvtTextBox
METHOD Refresh() CLASS WvtTextBox

   Eval( ::bPaint )

   RETURN Self
wvgclass.prg3114
WVTTEXTBOX:METHODConfigure() CLASS WvtTextBox
METHOD Configure() CLASS WvtTextBox

   RETURN Self
wvgclass.prg3122
WVTTEXTBOX:METHODSetText( cText ) CLASS WvtTextBox
METHOD SetText( cText ) CLASS WvtTextBox

   if cText <> nil
      ::cText := cText
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg3128
WVTTEXTBOX:METHODHoverOn( ) CLASS WvtTextBox
METHOD HoverOn( /*cText*/ ) CLASS WvtTextBox

   if ::nTextColorHoverOn <> nil
      ::nTextColor := ::nTextColorHoverOn
      ::Refresh()
   endif

   RETURN Self
wvgclass.prg3139
WVTTEXTBOX:METHODHoverOff( ) CLASS WvtTextBox
METHOD HoverOff( /*cText*/ ) CLASS WvtTextBox

   if ::nTextColorHoverOn <> nil
      ::nTextColor := ::nTextColorHoverOff
      ::Refresh()
   endif

RETURN Self
wvgclass.prg3150
CLASSWvtProgressBar FROM WvtObject
CLASS WvtProgressBar FROM WvtObject

   DATA   cImage
   DATA   nDirection            INIT 0      // 0-Left-Right,Top-Bottom  1-Right-Left,Bottom-Top
   DATA   nStyle                INIT 0
   DATA   lVertical             INIT .f.
   DATA   lActive               INIT .f.

   DATA   nBarColor             INIT RGB( 0,0,128 )
   DATA   nCurrent              INIT 0
   DATA   nTotal                INIT 1
   DATA   nPercent              INIT 0
   DATA   cBackColor            INIT 'W/W'

   DATA   cScreen

   METHOD New()
   METHOD Create()
   METHOD Display()
   METHOD Activate()
   METHOD DeActivate()

ENDCLASS
wvgclass.prg3169
WVTPROGRESSBAR:METHODNew( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtProgressBar
METHOD New( oParent, nID, nTop, nLeft, nBottom, nRight ) CLASS WvtProgressBar

   ::Super:New( oParent, DLG_OBJ_PROGRESSBAR, nID, nTop, nLeft, nBottom, nRight )

   RETURN Self
wvgclass.prg3195
WVTPROGRESSBAR:METHODCreate() CLASS WvtProgressBar
METHOD Create() CLASS WvtProgressBar

   DEFAULT ::nTop       TO 0
   DEFAULT ::nLeft      TO 0
   DEFAULT ::nBottom    TO iif( ::lVertical, ::nTop + 9, ::nTop )
   DEFAULT ::nRight     TO iif( ::lVertical, ::nLeft + 1, ::nLeft + 19 )
   DEFAULT ::nTextColor TO RGB( 255,255,255 )
   DEFAULT ::nBackColor TO RGB( 198,198,198 )

   ::bPaint := {|| ::Display() }
   aadd( ::aPaint, { ::bPaint, { WVT_BLOCK_LABEL, ::nTop, ::nLeft, ::nBottom, ::nRight } } )

   ::Super:Create()

   RETURN Self
wvgclass.prg3203
WVTPROGRESSBAR:METHODDisplay( nCurrent, nTotal ) CLASS WvtProgressBar
METHOD Display( nCurrent, nTotal ) CLASS WvtProgressBar

   if !( ::lActive )
      return Self
   endif

   DEFAULT nCurrent TO ::nCurrent
   DEFAULT nTotal   TO ::nTotal

   ::nCurrent := nCurrent
   ::nTotal   := nTotal

   if ::nCurrent > ::nTotal
      ::nCurrent := ::nTotal
   endif

   ::nPercent := int( ::nCurrent / ::nTotal * 100 )

   Wvt_DrawProgressBar( ::nTop, ::nLeft, ::nBottom, ::nRight, ::aPxlTLBR, ::nPercent, ;
                        ::nBackColor, ::nBarColor, ::cImage, ::lVertical, ::nDirection )
   RETURN Self
wvgclass.prg3221
WVTPROGRESSBAR:METHODActivate() CLASS WvtProgressBar
METHOD Activate() CLASS WvtProgressBar

   ::cScreen := SaveScreen( ::nTop, ::nLeft, ::nBottom, ::nRight )
   DispBox( ::nTop, ::nLeft, ::nBottom, ::nRight, '         ', ::cBackColor )
   ::lActive := .t.

   RETURN Self
wvgclass.prg3245
WVTPROGRESSBAR:METHODDeActivate() CLASS WvtProgressBar
METHOD DeActivate() CLASS WvtProgressBar

   ::lActive  := .f.
   ::nCurrent := 0
   ::nTotal   := 1
   RestScreen( ::nTop, ::nLeft, ::nBottom, ::nRight, ::cScreen )
   ::cScreen := nil

   RETURN Self
wvgclass.prg3255
CLASSwvtMenu
CLASS wvtMenu

   METHOD Create( cCaption )
   METHOD AddItem( cCaption, bAction )
   METHOD DelAllItems()
   METHOD DelItem( nItem )
   METHOD EnableItem( nItemNum )
   METHOD DisableItem( nItemNum )
   METHOD NumItems()
   METHOD Destroy()
   METHOD GetItem( nItemNum )
   METHOD FindMenuItemById( nId )
   METHOD DrawMenuBar()

   CLASSVAR MenuItemId          INIT 1

   VAR    aItems
   VAR    hMenu
   VAR    Caption
   VAR    IdNumber

ENDCLASS
wvgclass.prg3276
WVTMENU:METHODCreate( cCaption ) CLASS wvtMenu
METHOD Create( cCaption ) CLASS wvtMenu
   ::aItems := {}

   IF EMPTY( ::hMenu:= Wvt_CreateMenu() )
      //Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Init()", "Create Menu Error", { cCaption, cCaption },"wvt.prg" ) )
   ENDIF
   ::Caption:= IIF( cCaption == NIL, "", cCaption )

   RETURN(Self)
wvgclass.prg3301
WVTMENU:METHODDestroy() CLASS wvtMenu
METHOD Destroy() CLASS wvtMenu

   IF !EMPTY( ::hMenu )
      ::DelAllItems()

      IF !Wvt_DestroyMenu( ::hMenu )
         //Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:Destroy()", "Destroy menu FAILED", {},"wvt.prg" ) )
      ENDIF
      ::hMenu:= 0
   ENDIF

   RETURN( .T. )
wvgclass.prg3313
WVTMENU:METHODAddItem(cCaption, bAction) CLASS wvtMenu
METHOD AddItem(cCaption, bAction) CLASS wvtMenu
   LOCAL lResult:= .F., aItem

   IF !EMPTY( ::hMenu ) .AND. ( !EMPTY( cCaption ) .OR. !EMPTY( bAction ) )
      IF HB_ISOBJECT( bAction )
         cCaption:= IIF(!EMPTY(cCaption),cCaption,bAction:Caption)
         aItem:= {MF_POPUP,bAction:hMenu,cCaption,bAction} // bAction is a wvtMenu object reference
      ELSEIF HB_ISBLOCK(bAction)
         aItem:= {MF_STRING,::MenuItemId++,cCaption,bAction} // bAction is a code block to execute
      ELSEIF left( cCaption, 1 )=="-"
         aItem:= {MF_SEPARATOR,0,0,NIL}
      ELSE
         //Throw( ErrorNew( "wvtMenu", 3101, "wvtMenu:AddItem()", "Argument Error", { cCaption, bAction },"wvt.prg" ) )
      ENDIF

      IF !Wvt_AppendMenu(::hMenu, aItem[WVT_MENU_TYPE],aItem[WVT_MENU_IDENTIFIER],aItem[WVT_MENU_CAPTION])
         //Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:AddItem()", "Add menu item", { cCaption, bAction },"wvt.prg" ) )
      ENDIF

      AADD(::aItems, aItem)
      lResult:= .T.
   ENDIF

   RETURN( lResult )
wvgclass.prg3328
WVTMENU:METHODDelAllItems() CLASS wvtMenu
METHOD DelAllItems() CLASS wvtMenu
   LOCAL lResult:= .T.,  nItems

   nItems := ::NumItems()
   DO WHILE nItems>0 .AND. lResult
      lResult := ::DelItem( nItems )
      nItems--
   ENDDO

   RETURN ( lResult )
wvgclass.prg3355
WVTMENU:METHODDelItem( nItemNum ) CLASS wvtMenu
METHOD DelItem( nItemNum ) CLASS wvtMenu
   LOCAL lResult:= .F.

   IF nItemNum > 0 .AND. nItemNum <= ::NumItems()
      IF ::aItems[ nItemNum,WVT_MENU_TYPE ]== MF_POPUP
         ::aItems[ nItemNum,WVT_MENU_MENUOBJ ]:Destroy()
      ENDIF

      IF ( lResult:= Wvt_DeleteMenu(::hMenu, nItemNum-1,MF_BYPOSITION)) // Remember ZERO base
         ADEL( ::aItems, nItemNum )
         ASIZE( ::aItems, LEN( ::aItems ) - 1 )
      ELSE
         //Throw( ErrorNew( "wvtMenu", 1000, "wvtMenu:DelItem()", "Delete menu item FAILED", { nItemNum },"wvt.prg" ) )
      ENDIF
   ENDIF

   RETURN(lResult)
wvgclass.prg3368
WVTMENU:METHODEnableItem( nItemNum ) CLASS wvtMenu
METHOD EnableItem( nItemNum ) CLASS wvtMenu
   LOCAL nPrevious:= -1

   IF !EMPTY( ::hMenu ) && !EMPTY( nItemNum )
      nPrevious:= Wvt_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_ENABLED )
   ENDIF

   RETURN ( nPrevious )
wvgclass.prg3388
WVTMENU:METHODDisableItem( nItemNum ) CLASS wvtMenu
METHOD DisableItem( nItemNum ) CLASS wvtMenu
   LOCAL nPrevious:= -1

   IF !EMPTY( ::hMenu ) && !EMPTY( nItemNum )
      nPrevious:= Wvt_EnableMenuItem( ::hMenu, nItemNum-1, MF_BYPOSITION + MF_GRAYED )
   ENDIF

   RETURN ( nPrevious )
wvgclass.prg3399
WVTMENU:METHODNumItems() CLASS wvtMenu
METHOD NumItems() CLASS wvtMenu

   RETURN ( LEN( ::aItems ) )
wvgclass.prg3410
WVTMENU:METHODGetItem( nItemNum ) CLASS wvtMenu
METHOD GetItem( nItemNum ) CLASS wvtMenu
   LOCAL nItems := ::NumItems(), aResult:= NIL

   IF nItemNum > 0 .AND. nItemNum <= nItems
      aResult:= ::aItems[ nItemNum ]
   ENDIF

   RETURN ( aResult )
wvgclass.prg3416
WVTMENU:METHODFindMenuItemById( nId ) CLASS wvtMenu
METHOD FindMenuItemById( nId ) CLASS wvtMenu
   LOCAL x, aResult:= {}

   IF !EMPTY( nId )
      x:= ::NumItems()
      DO WHILE x > 0 .AND. EMPTY( aResult )
         IF ::aItems[ x,WVT_MENU_TYPE ] == MF_POPUP
            aResult:= ::aItems[ x,WVT_MENU_MENUOBJ ]:FindMenuItemById( nId )
         ELSEIF ::aItems[ x,WVT_MENU_IDENTIFIER ] == nId
            aResult := ::aItems[ x ]
         ENDIF
         x--
      ENDDO
   ENDIF

   RETURN ( aResult )
wvgclass.prg3427
WVTMENU:METHODDrawMenuBar() CLASS wvtMenu
METHOD DrawMenuBar() CLASS wvtMenu

   Wvt_DrawMenuBar()

   RETURN ( NIL )
wvgclass.prg3446
CLASSWvtConsole FROM WvtObject
CLASS WvtConsole FROM WvtObject

   METHOD New()
   METHOD Say()
   METHOD Box()

ENDCLASS
wvgclass.prg3462
WVTCONSOLE:METHODNew( oParent ) CLASS WvtConsole
METHOD New( oParent ) CLASS WvtConsole

   ::Super:New( oParent, DLG_OBJ_CONSOLE, , -1, -1, -1, -1 )

   RETURN Self
wvgclass.prg3472
WVTCONSOLE:METHODSay( nRow, nCol, xExp, cColor ) CLASS WvtConsole
METHOD Say( nRow, nCol, xExp, cColor ) CLASS WvtConsole
   LOCAL nCRow, nCCol, nCursor

   if nRow >=0 .and. nCol >= 0 .and. xExp <> nil
      nCursor := SetCursor( SC_NONE )
      nCRow   := Row()
      nCCol   := Col()
      DispOutAt( nRow, nCol, xExp, cColor )
      SetPos( nCRow, nCCol )
      SetCursor( nCursor )
   endif

RETURN Self
wvgclass.prg3480
WVTCONSOLE:METHODBox( nRow, nCol, n2Row, n2Col, cBoxChars, cColor ) CLASS WvtConsole
METHOD Box( nRow, nCol, n2Row, n2Col, cBoxChars, cColor ) CLASS WvtConsole

   LOCAL nCRow, nCCol, nCursor

   if nRow >=0 .and. nCol >= 0
      nCursor := SetCursor( SC_NONE )
      nCRow   := Row()
      nCCol   := Col()
      DispBox( nRow, nCol, n2Row, n2Col, cBoxChars, cColor )
      SetPos( nCRow, nCCol )
      SetCursor( nCursor )
   endif

   RETURN Self
wvgclass.prg3496
CLASSTBrowseWVG FROM TBrowse
CLASS TBrowseWVG FROM TBrowse

   DATA   aColumnsSep               INIT {}

   METHOD SetVisible()

   ENDCLASS
wvgclass.prg3539
TBROWSEWVG:METHODSetVisible() CLASS TBrowseWVG
METHOD SetVisible() CLASS TBrowseWVG
   Local lFirst, aCol, nColPos

   ::Super:SetVisible()
   ::aColumnsSep := {}

   lFirst := .T.
   FOR EACH aCol IN ::aColData
      IF aCol[ _TBCI_COLPOS ] != NIL
         IF lFirst
            lFirst := .F.

         ELSE
            nColPos := aCol[ _TBCI_COLPOS ]

            IF aCol[ _TBCI_SEPWIDTH ] > 0
               nColPos += Int( aCol[ _TBCI_SEPWIDTH ]/2 )
            ENDIF

            aadd( ::aColumnsSep, nColPos )
         ENDIF
      ENDIF
   NEXT

   Return Self
wvgclass.prg3549
wvgpaint.prg
TypeFunctionSourceLine
FUNCTIONWvtPaintObjects()
function WvtPaintObjects()
   LOCAL i, lExe, nLeft, nRight, b, tlbr_, aBlocks, nBlocks

   aBlocks := WvtSetPaint()

   if ( nBlocks := len( aBlocks ) ) > 0
      tlbr_:= Wvt_GetPaintRect()

      for i := 1 to nBlocks
         lExe := .t.

         if aBlocks[ i,3 ] <> nil .and. !empty( aBlocks[ i,3 ] )
            //  Check parameters against tlbr_ depending upon the
            //  type of object and attributes contained in aAttr
            //
            do case
            case aBlocks[ i,3,1 ] == WVT_BLOCK_GRID_V
               b := aBlocks[ i,3,6 ]
               if len( b:aColumnsSep ) == 0
                  lExe := .f.
               else
                  nLeft  := b:aColumnsSep[ 1 ]
                  nRight := b:aColumnsSep[ len( b:aColumnsSep ) ]
                  if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top   < bottom
                        tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm > top
                        tlbr_[ 2 ] <= nRight + 1       .and. ; // left  < right
                        tlbr_[ 4 ] >= nLeft  - 2             ) // right > left
                     lExe := .f.
                  endif
               endif

            case aBlocks[ i,3,1 ] == WVT_BLOCK_GETS
               if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top   < bott
                     tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm > top
                     tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left  < righ
                     tlbr_[ 4 ] >= aBlocks[ i,3,3 ]       ) // right > left
                  lExe := .f.
               endif

            otherwise
               // If refreshing rectangle's top is less than objects' bottom
               // and left is less than objects' right
               //
               if !( tlbr_[ 1 ] <= aBlocks[ i,3,4 ] .and. ; // top   <= bottom
                     tlbr_[ 3 ] >= aBlocks[ i,3,2 ] .and. ; // bootm >= top
                     tlbr_[ 2 ] <= aBlocks[ i,3,5 ] .and. ; // left  < right
                     tlbr_[ 4 ] >= aBlocks[ i,3,3 ]       ) // right > left
                  lExe := .f.
               endif
            endcase
         endif

         if lExe
            eval( aBlocks[ i,2 ] )
         endif
      next
   endif

   return ( 0 )
wvgpaint.prg83
FUNCTIONWvtSetPaint( a_ )
function WvtSetPaint( a_ )
   local o
   static s := {}

   o := s

   if a_ <> nil
      s := a_
   endif

   return o
wvgpaint.prg145
FUNCTIONSetPaint( cID, nAction, xData, aAttr )
function SetPaint( cID, nAction, xData, aAttr )
   local n, n1, oldData

   if xData <> nil
      if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0
         if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0
            oldData := paint_[ n,2,n1,2 ]
            paint_[ n,2,n1,2 ] := xData
            paint_[ n,2,n1,3 ] := aAttr
         else
            aadd( paint_[ n,2 ], { nAction,xData,aAttr } )
         endif
      else
         aadd( paint_, { cID, {} } )
         n := len( paint_ )
         aadd( paint_[ n,2 ], { nAction, xData, aAttr } )
      endif
   endif

   return oldData
wvgpaint.prg159
FUNCTIONGetPaint( cID )
function GetPaint( cID )
   local n

   if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0
      return paint_[ n,2 ]
   endif

   return {}
wvgpaint.prg182
FUNCTIONDelPaint( cID, nAction )
function DelPaint( cID, nAction )
   local xData, n1, n

   if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0
      if ( n1 := ascan( paint_[ n,2 ], {|e_| e_[ 1 ] == nAction } ) ) > 0
         xData := paint_[ n,2,n1,2 ]
         paint_[ n,2,n1,2 ] := {|| .t. }
      endif
   endif

   return xData
wvgpaint.prg193
FUNCTIONPurgePaint( cID,lDummy )
function PurgePaint( cID,lDummy )
   local n, aPaint

   DEFAULT lDummy TO .f.

   if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0
      aPaint := paint_[ n ]
      ADel( paint_, n )
      aSize( paint_, len( paint_ ) - 1 )
   endif

   if lDummy
      WvtSetPaint( {} )
   endif

   return ( aPaint )
wvgpaint.prg207
FUNCTIONInsertPaint( cID, aPaint, lSet )
function InsertPaint( cID, aPaint, lSet )
   local n

   DEFAULT lSet TO .f.

   if ( n := ascan( paint_, { |e_| e_[ 1 ] == cID } ) ) > 0
      paint_[ n ] := aPaint
   else
      aadd( paint_, aPaint )
   endif

   if lSet
      WvtSetPaint( aPaint )
   endif

   return nil
wvgpaint.prg226
FUNCTIONWvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle, cFaceName, nPointSize, nWeight, lItalic, nHelpId, nExStyle )
FUNCTION Wvt_MakeDlgTemplate( nTop, nLeft, nRows, nCols, aOffSet, cTitle, nStyle, ;
                              cFaceName, nPointSize, nWeight, lItalic, nHelpId, nExStyle )

   LOCAL aDlg := { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} }
   LOCAL aXY, nX, nY, nW, nH, nXM, nYM
   LOCAL nBaseUnits, nBaseUnitsX, nBaseUnitsY
   LOCAL aFont

   aFont := Wvt_GetFontInfo()

   DEFAULT aOffSet TO {}

   aSize( aOffSet,4 )

   DEFAULT aOffSet[ 1 ] TO 0
   DEFAULT aOffSet[ 2 ] TO 0
   DEFAULT aOffSet[ 3 ] TO 0
   DEFAULT aOffSet[ 4 ] TO 0

   nBaseUnits  := Win_GetDialogBaseUnits()
   nBaseUnitsX := Win_LoWord( nBaseUnits )
   nBaseUnitsY := Win_HiWord( nBaseUnits )

   nW := aFont[ 7 ] * nCols + aOffSet[ 4 ]
   nH := aFont[ 6 ] * nRows + aOffSet[ 3 ]

   // Position it exactly where user has requested
   //
   aXY := Wvt_ClientToScreen( nTop,nLeft )
   nX  := aXY[ 1 ] + aOffSet[ 2 ]
   nY  := aXY[ 2 ] + aOffSet[ 1 ]

   // MSDN says DlgBaseUnits and Screen Coordinates has multiplier of 4,8 for x & Y.
   // But in my practice, the values below are 99% accurate.
   // I have tested it on many fonts but on 1280/800 resolution.
   // Please feel free to experiment if you find thses values inappropriate.
   //
   nXM :=  5.25
   nYM := 10.25

   nX  := ( nX * nXM / nBaseUnitsX )
   nY  := ( nY * nYM / nBaseUnitsY )
   nW  := ( nW * nXM / nBaseUnitsX )
   nH  := ( nH * nYM / nBaseUnitsY )

   If !ISNUMBER( nStyle )
      nStyle := + WS_CAPTION    + WS_SYSMENU              ;
                + WS_GROUP      + WS_TABSTOP + DS_SETFONT ;
                + WS_THICKFRAME + WS_VISIBLE + WS_POPUP   ;
                + DS_3DLOOK
   EndIf

   aAdd( aDlg[ 1 ] , iif( Empty( nHelpId  ), 0, nHelpId  ) )
   aAdd( aDlg[ 1 ] , iif( Empty( nExStyle ), 0, nExStyle ) )
   aAdd( aDlg[ 1 ] , nStyle  )
   aAdd( aDlg[ 1 ] , 0       )
   aAdd( aDlg[ 1 ] , nX      )
   aAdd( aDlg[ 1 ] , nY      )
   aAdd( aDlg[ 1 ] , nW      )
   aAdd( aDlg[ 1 ] , nH      )
   aAdd( aDlg[ 1 ] , 0       )
   aAdd( aDlg[ 1 ] , 0       )
   aAdd( aDlg[ 1 ] , iif( ValType( cTitle ) == "C", cTitle, "" ) )

   //IF ( nStyle & DS_SETFONT ) == DS_SETFONT
   if hb_bitAnd( nStyle, DS_SETFONT ) == DS_SETFONT
      aAdd( aDlg[ 1 ], iif( ValType( nPointSize ) == "N", nPointSize, 8               ) )
      aAdd( aDlg[ 1 ], iif( ValType( nWeight    ) == "N", nWeight   , 400             ) )
      aAdd( aDlg[ 1 ], iif( ValType( lItalic    ) == "L", lItalic   , .F.             ) )
      aAdd( aDlg[ 1 ], iif( ValType( cFaceName  ) == "C", cFaceName , "MS Sans Serif" ) )
   EndIf

   Return( aDlg )
wvgpaint.prg255
FUNCTIONWvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet, cnId, cnDlgClass, nStyle, cText, nHelpId, nExStyle )
Function Wvt_AddDlgItem( aDlg, nTop, nLeft, nRows, nCols, aOffSet,;
                         cnId, cnDlgClass, nStyle, cText, nHelpId, nExStyle )
   LOCAL aXY, nX, nY, nW, nH, nXM, nYM
   LOCAL nBaseUnits, nBaseUnitsX, nBaseUnitsY
   LOCAL nBottom, nRight

   nBottom := nTop  + nRows - 1
   nRight  := nLeft + nCols - 1

   DEFAULT aOffSet TO {}

   aSize( aOffSet,4 )

   DEFAULT aOffSet[ 1 ] TO 0
   DEFAULT aOffSet[ 2 ] TO 0
   DEFAULT aOffSet[ 3 ] TO 0
   DEFAULT aOffSet[ 4 ] TO 0

   nBaseUnits  := Win_GetDialogBaseUnits()
   nBaseUnitsX := Win_LoWord( nBaseUnits )
   nBaseUnitsY := Win_HiWord( nBaseUnits )

   aXY := Wvt_GetXYFromRowCol( nTop, nLeft )
   nX  := aXY[ 1 ] + aOffSet[ 2 ]
   nY  := aXY[ 2 ] + aOffSet[ 1 ]

   aXY := Wvt_GetXYFromRowCol( nBottom+1, nRight+1 )
   nW  := aXY[ 1 ] + aOffSet[ 4 ] - nX
   nH  := aXY[ 2 ] + aOffSet[ 3 ] - nY

   nXM :=  5.25
   nYM := 10.25

   nX  := ( nX * nXM / nBaseUnitsX )
   nY  := ( nY * nYM / nBaseUnitsY )
   nW  := ( nW * nXM / nBaseUnitsX )
   nH  := ( nH * nYM / nBaseUnitsY )

   aDlg[ 1,4 ]++      // item count

   aAdd( aDlg[  2 ] , iif( ValType( nHelpId  ) == "N", nHelpId , 0                     ) )
   aAdd( aDlg[  3 ] , iif( ValType( nExStyle ) == "N", nExStyle, 0                     ) )
   aAdd( aDlg[  4 ] , iif( ValType( nStyle   ) == "N", nStyle  , WS_CHILD + WS_VISIBLE ) )
   aAdd( aDlg[  5 ] , nX         )
   aAdd( aDlg[  6 ] , nY         )
   aAdd( aDlg[  7 ] , nW         )
   aAdd( aDlg[  8 ] , nH         )
   aAdd( aDlg[  9 ] , cnId       )
   aAdd( aDlg[ 10 ] , cnDlgClass )
   aAdd( aDlg[ 11 ] , iif( ISCHARACTER( cText ), cText, iif( ISNUMBER( cText ), cText, "" ) ) )
   aAdd( aDlg[ 12 ] , 0 )

   Return aDlg
wvgpaint.prg331
FUNCTIONWvt_CreateDialog( acnDlg, lOnTop, cbDlgProc, ncIcon, nTimerTicks, hMenu )
Function Wvt_CreateDialog( acnDlg, lOnTop, cbDlgProc, ncIcon, nTimerTicks, hMenu )
   LOCAL hDlg, cType, xTemplate, nDlgMode

   if valtype( cbDlgProc ) == 'C'
      cbDlgProc := upper( cbDlgProc )
   endif

   hDlg     := 0
   cType    := Valtype( acnDlg )
   nDlgMode := iif( cType == 'C', 0, iif( cType == 'N', 1, 2 ) )

   if cType == 'A'
      xTemplate := Wvt__MakeDlgTemplate( acnDlg[ 1 ] , acnDlg[  2 ] , acnDlg[  3 ] , acnDlg[  4 ] , ;
                                         acnDlg[ 5 ] , acnDlg[  6 ] , acnDlg[  7 ] , acnDlg[  8 ] , ;
                                         acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] )
   else
      xTemplate := acnDlg
   endif

   hDlg := Wvt_CreateDialogDynamic( xTemplate, lOnTop, cbDlgProc, nDlgMode )

   if hDlg <> 0
      if ncIcon <> nil
         Wvt_DlgSetIcon( hDlg, ncIcon )

      endif

      if valtype( nTimerTicks ) == 'N'
         Win_SetTimer( hDlg, 1001, nTimerTicks )

      endif

      if hMenu <> nil
         Win_SetMenu( hDlg, hMenu )

      endif

   endif

   Return hDlg
wvgpaint.prg387
FUNCTIONWvt_DialogBox( acnDlg, cbDlgProc, hWndParent )
Function Wvt_DialogBox( acnDlg, cbDlgProc, hWndParent )
   LOCAL nResult, cType, xTemplate, nDlgMode

   if valtype( cbDlgProc ) == 'C'
      cbDlgProc := upper( cbDlgProc )
   endif

   cType    := Valtype( acnDlg )
   nDlgMode := iif( cType == 'C', 0, iif( cType == 'N', 1, 2 ) )

   if cType == 'A'
      xTemplate := Wvt__MakeDlgTemplate( acnDlg[ 1 ] , acnDlg[  2 ] , acnDlg[  3 ] , acnDlg[  4 ] , ;
                                         acnDlg[ 5 ] , acnDlg[  6 ] , acnDlg[  7 ] , acnDlg[  8 ] , ;
                                         acnDlg[ 9 ] , acnDlg[ 10 ] , acnDlg[ 11 ] , acnDlg[ 12 ] )
   else
      xTemplate := acnDlg
   endif

   nResult := Wvt_CreateDialogModal( xTemplate, .f., cbDlgProc, nDlgMode, hWndParent )

   Return nResult
wvgpaint.prg430
FUNCTIONWVT_GetOpenFileName( hWnd, cPath, cTitle, aFilter, nFlags, cIniDir, cDefExt, nIndex )
FUNCTION WVT_GetOpenFileName( hWnd, cPath, cTitle, aFilter, nFlags, cIniDir, cDefExt, nIndex )
   local aFiles, cRet, cFile, n, x, c := ''

   IF aFilter == nil
      aFilter := {}
   END
   IF ValType( aFilter ) == "A"
      FOR n := 1 TO LEN( aFilter )
          c += aFilter[n][1] + chr(0) + aFilter[n][2] + chr(0)
      NEXT
   ENDIF
   if WIN_AND( nFlags,OFN_ALLOWMULTISELECT ) > 0
      cFile := space( 32000 )
     ELSE
      cFile := padr( trim( cPath ), 255, chr( 0 ) )
   END

   cRet := WVT__GetOpenFileName( hWnd, @cFile, cTitle, c, nFlags, cIniDir, cDefExt, @nIndex )

   if WIN_AND( nFlags,OFN_ALLOWMULTISELECT ) > 0
      n := AT( CHR(0)+ CHR(0), cFile )
      cFile  := LEFT( cFile,n )
      aFiles := {}
      IF n == 0 // no double chr(0) user must have pressed cancel
         RETURN( aFiles )
      END
      x := AT( CHR( 0 ),cFile ) // fist null
      cPath := LEFT( cFile,x )

      cFile := STRTRAN( cFile,cPath )
      IF !EMPTY( cFile ) // user selected more than 1 file
         c := ''
         FOR n := 1 TO LEN( cFile )
             IF SUBSTR( cFile,n,1 ) == CHR( 0 )
                AADD( aFiles,STRTRAN( cPath, CHR( 0 ) ) +'\'+ c )
                c:=''
                LOOP
             END
             c += SUBSTR( cFile,n,1 )
         NEXT
        ELSE
         /*
         cFile:=cPath
         x:=RAT('\',cFile)
         cPath:=LEFT(cFile,x-1)
         */
         aFiles := { STRTRAN( cPath, CHR( 0 ) ) } //STRTRAN(STRTRAN(cFile,cPath),'\')}
      END
      Return( aFiles )
   else
      //cRet := left( cRet, at( chr( 0 ), cRet ) -1 )

   end

   Return ( cRet )
wvgpaint.prg472
FUNCTIONWVT_GetSaveFileName( hWnd, cFile, cTitle, aFilter, nFlags, cIniDir, cDefExt, nIndex )
FUNCTION WVT_GetSaveFileName( hWnd, cFile, cTitle, aFilter, nFlags, cIniDir, cDefExt, nIndex )
   local n,c:=''

   IF aFilter == nil
      aFilter := {}
   END

   FOR n := 1 TO LEN( aFilter )
       c += aFilter[ n ][ 1 ]+chr( 0 )+aFilter[ n ][ 2 ]+chr( 0 )
   NEXT
   cFile := WVT__GetSaveFileName( hWnd, cFile, cTitle, c, nFlags, cIniDir, cDefExt, @nIndex )

   Return ( cFile )
wvgpaint.prg544
FUNCTIONWvt_SetTitle( cTitle )
FUNCTION Wvt_SetTitle( cTitle )

   RETURN Hb_GtInfo( HB_GTI_WINTITLE, cTitle )
wvgpaint.prg573
FUNCTIONWvt_GetTitle()
FUNCTION Wvt_GetTitle()

   RETURN Hb_GtInfo( HB_GTI_WINTITLE )
wvgpaint.prg579
FUNCTIONWvt_SetIcon( ncIconRes, cIconName )
FUNCTION Wvt_SetIcon( ncIconRes, cIconName )

   if     valtype( ncIconRes ) == 'N'
      Hb_GtInfo( HB_GTI_ICONRES, ncIconRes )

   elseif valtype( cIconName ) == 'C'
      Hb_GtInfo( HB_GTI_ICONRES, cIconName )

   elseif valtype( ncIconRes ) == 'C'
      Hb_GtInfo( HB_GTI_ICONFILE, ncIconRes )

   endif

   RETURN NIL
wvgpaint.prg585
FUNCTIONWvt_SetFont( cFontName, nSize, nWidth, nWeight, nQuality )
FUNCTION Wvt_SetFont( cFontName, nSize, nWidth, nWeight, nQuality )

   DEFAULT cFontName TO Hb_GtInfo( HB_GTI_FONTNAME    )
   DEFAULT nWidth    TO Hb_GtInfo( HB_GTI_FONTWIDTH   )
   DEFAULT nWeight   TO Hb_GtInfo( HB_GTI_FONTWEIGHT  )
   DEFAULT nQuality  TO Hb_GtInfo( HB_GTI_FONTQUALITY )
   DEFAULT nSize     TO Hb_GtInfo( HB_GTI_FONTSIZE    )

   RETURN Hb_GtInfo( HB_GTI_SETFONT, { cFontName, nSize, nWidth, nWeight, nQuality } )
wvgpaint.prg602
FUNCTIONWvt_SetCodePage( nCodePage )
FUNCTION Wvt_SetCodePage( nCodePage )

   RETURN Hb_GtInfo( HB_GTI_CODEPAGE, nCodePage )
wvgpaint.prg614
FUNCTIONWvt_GetPalette()
FUNCTION Wvt_GetPalette()

   RETURN Hb_GtInfo( HB_GTI_PALETTE )
wvgpaint.prg620
FUNCTIONWvt_SetPalette( aRGB )
FUNCTION Wvt_SetPalette( aRGB )

   RETURN Hb_GtInfo( HB_GTI_PALETTE, aRGB )
wvgpaint.prg626
FUNCTIONWvt_GetRGBColor( nIndex )
FUNCTION Wvt_GetRGBColor( nIndex )

   RETURN Hb_GtInfo( HB_GTI_PALETTE, nIndex )
wvgpaint.prg632
FUNCTIONWvt_SetAltF4Close( lSetClose )
FUNCTION Wvt_SetAltF4Close( lSetClose )

   RETURN Hb_GtInfo( HB_GTI_CLOSABLE, lSetClose )
wvgpaint.prg638
FUNCTIONWvt_GetScreenWidth()
FUNCTION Wvt_GetScreenWidth()

   RETURN Hb_GtInfo( HB_GTI_DESKTOPWIDTH )
wvgpaint.prg644
FUNCTIONWvt_GetScreenHeight()
FUNCTION Wvt_GetScreenHeight()

   RETURN Hb_GtInfo( HB_GTI_DESKTOPHEIGHT )
wvgpaint.prg650
FUNCTIONWvt_GetWindowHandle()
FUNCTION Wvt_GetWindowHandle()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WINDOWHANDLE )
wvgpaint.prg656
FUNCTIONWvt_CenterWindow( lCenter, lRePaint )
FUNCTION Wvt_CenterWindow( lCenter, lRePaint )

   DEFAULT lCenter  TO .t.
   DEFAULT lRePaint TO .f.

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } )
wvgpaint.prg662
FUNCTIONWvt_WindowCentre( lCenter, lRePaint )
FUNCTION Wvt_WindowCentre( lCenter, lRePaint )

   DEFAULT lCenter  TO .t.
   DEFAULT lRePaint TO .f.

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_CENTERWINDOW, { lCenter, lRePaint } )
wvgpaint.prg671
FUNCTIONWvt_ProcessMessages()
FUNCTION Wvt_ProcessMessages()

   Hb_GtInfo( HB_GTI_SPEC, HB_GTS_PROCESSMESSAGES )

   RETURN .t.
wvgpaint.prg680
FUNCTIONWvt_KeyBoard( nKey )
FUNCTION Wvt_KeyBoard( nKey )

   Hb_GtInfo( HB_GTI_SPEC, HB_GTS_KEYBOARD, nKey )

   RETURN NIL
wvgpaint.prg688
FUNCTIONWvt_GetClipboard()
FUNCTION Wvt_GetClipboard()

   RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA )
wvgpaint.prg696
FUNCTIONWvt_SetClipboard( cText )
FUNCTION Wvt_SetClipboard( cText )

   RETURN Hb_GtInfo( HB_GTI_CLIPBOARDDATA, cText )
wvgpaint.prg702
FUNCTIONWvt_PasteFromClipboard()
FUNCTION Wvt_PasteFromClipboard()
   Local cText, nLen, i

   cText := Hb_GtInfo( HB_GTI_CLIPBOARDDATA )
   if ( nLen := Len( cText ) ) > 0
      for i := 1 to nLen
         Wvt_KeyBoard( asc( substr( cText, i, 1 ) ) )
      next
   endif

   RETURN NIL
wvgpaint.prg708
FUNCTIONWvt_ResetWindow()
FUNCTION Wvt_ResetWindow()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_RESETWINDOW )
wvgpaint.prg722
FUNCTIONWvt_SetTimer( nTimerID, nMiliSeconds )
FUNCTION Wvt_SetTimer( nTimerID, nMiliSeconds )

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SETTIMER, { nTimerID, nMiliSeconds } )
wvgpaint.prg728
FUNCTIONWvt_KillTimer( nTimerID )
FUNCTION Wvt_KillTimer( nTimerID )

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_KILLTIMER, nTimerID )
wvgpaint.prg734
FUNCTIONWvt_SetOnTop()
FUNCTION Wvt_SetOnTop()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_SETONTOP )
wvgpaint.prg740
FUNCTIONWvt_SetAsNormal()
FUNCTION Wvt_SetAsNormal()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_SETASNORMAL )
wvgpaint.prg746
FUNCTIONWvt_Minimize()
FUNCTION Wvt_Minimize()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_MINIMIZED )
wvgpaint.prg752
FUNCTIONWvt_Maximize()
FUNCTION Wvt_Maximize()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_MAXIMIZED )
wvgpaint.prg758
FUNCTIONWvt_Hide()
FUNCTION Wvt_Hide()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_HIDDEN )
wvgpaint.prg764
FUNCTIONWvt_Show()
FUNCTION Wvt_Show()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_WNDSTATE, WNDS_NORMAL )
wvgpaint.prg770
FUNCTIONWvt_SetWindowPos( nX, nY )
FUNCTION Wvt_SetWindowPos( nX, nY )

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SETPOSITION, { nX, nY } )
wvgpaint.prg776
FUNCTIONWvt_ShowWindow( nState )
FUNCTION Wvt_ShowWindow( nState )

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_SHOWWINDOW, nState )
wvgpaint.prg782
FUNCTIONWvt_Update()
FUNCTION Wvt_Update()

   RETURN Hb_GtInfo( HB_GTI_SPEC, HB_GTS_UPDATEWINDOW )
wvgpaint.prg788

Page url: http://www.yourdomain.com/help/index.html?gtwvg.htm