Exemple #1
0
POINT * hbwapi_par_POINT( POINT * p, int iParam, HB_BOOL bMandatory )
{
   PHB_ITEM pStru = hb_param( iParam, HB_IT_ANY );

   memset( p, 0, sizeof( POINT ) );

   if( pStru && HB_IS_HASH( pStru ) )
   {
      p->x = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "x" ) );
      p->y = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "y" ) );

      return p;
   }
   else if( pStru && HB_IS_ARRAY( pStru ) && hb_arrayLen( pStru ) >= 2 )
   {
      p->x = ( LONG ) hb_arrayGetNL( pStru, 1 );
      p->y = ( LONG ) hb_arrayGetNL( pStru, 2 );

      return p;
   }
   else if( bMandatory )
      return p;

   return NULL;
}
Exemple #2
0
RECT * hbwapi_par_RECT( RECT * p, int iParam, HB_BOOL bMandatory )
{
   PHB_ITEM pStru = hb_param( iParam, HB_IT_ANY );

   memset( p, 0, sizeof( RECT ) );

   if( pStru && HB_IS_HASH( pStru ) )
   {
      p->left   = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "left"   ) );
      p->top    = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "top"    ) );
      p->right  = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "right"  ) );
      p->bottom = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "bottom" ) );

      return p;
   }
   else if( pStru && HB_IS_ARRAY( pStru ) && hb_arrayLen( pStru ) >= 4 )
   {
      p->left   = ( LONG ) hb_arrayGetNL( pStru, 1 );
      p->top    = ( LONG ) hb_arrayGetNL( pStru, 2 );
      p->right  = ( LONG ) hb_arrayGetNL( pStru, 3 );
      p->bottom = ( LONG ) hb_arrayGetNL( pStru, 4 );

      return p;
   }
   else if( bMandatory )
      return p;

   return NULL;
}
Exemple #3
0
HB_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 HB_TRUE;
   }
   return HB_FALSE;
}
Exemple #4
0
HB_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 HB_TRUE;
   }
   return HB_FALSE;
}
Exemple #5
0
HB_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 HB_TRUE;
   }
   return HB_FALSE;
}
Exemple #6
0
LOGFONT * hbwapi_par_LOGFONT( LOGFONT * p, int iParam, HB_BOOL bMandatory )
{
   PHB_ITEM pStru = hb_param( iParam, HB_IT_ANY );

   void * hfFaceName;
   LPCTSTR pfFaceName;
   HB_SIZE nLen;

   memset( p, 0, sizeof( LOGFONT ) );

   if( pStru && HB_IS_HASH( pStru ) )
   {
      p->lfHeight         = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "lfHeight"         ) );
      p->lfWidth          = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "lfWidth"          ) );
      p->lfEscapement     = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "lfEscapement"     ) );
      p->lfOrientation    = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "lfOrientation"    ) );
      p->lfWeight         = ( LONG ) hb_itemGetNL( hb_hashGetCItemPtr( pStru, "lfWeight"         ) );
      p->lfItalic         = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfItalic"         ) );
      p->lfUnderline      = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfUnderline"      ) );
      p->lfStrikeOut      = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfStrikeOut"      ) );
      p->lfCharSet        = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfCharSet"        ) );
      p->lfOutPrecision   = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfOutPrecision"   ) );
      p->lfClipPrecision  = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfClipPrecision"  ) );
      p->lfQuality        = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfQuality"        ) );
      p->lfPitchAndFamily = ( BYTE ) hb_itemGetNI( hb_hashGetCItemPtr( pStru, "lfPitchAndFamily" ) );

      pfFaceName = HB_ITEMGETSTR( hb_hashGetCItemPtr( pStru, "lfFaceName" ), &hfFaceName, &nLen );

      if( nLen > ( LF_FACESIZE - 1 ) )
         nLen = LF_FACESIZE - 1;

      memcpy( p->lfFaceName, pfFaceName, nLen * sizeof( TCHAR ) );
      p->lfFaceName[ nLen ] = TEXT( '\0' );

      hb_strfree( hfFaceName );

      return p;
   }
   else if( pStru && HB_IS_ARRAY( pStru ) && hb_arrayLen( pStru ) >= 14 )
   {
      p->lfHeight         = ( LONG ) hb_arrayGetNL( pStru, 1 );
      p->lfWidth          = ( LONG ) hb_arrayGetNL( pStru, 2 );
      p->lfEscapement     = ( LONG ) hb_arrayGetNL( pStru, 3 );
      p->lfOrientation    = ( LONG ) hb_arrayGetNL( pStru, 4 );
      p->lfWeight         = ( LONG ) hb_arrayGetNL( pStru, 5 );
      p->lfItalic         = ( BYTE ) hb_arrayGetNI( pStru, 6 );
      p->lfUnderline      = ( BYTE ) hb_arrayGetNI( pStru, 7 );
      p->lfStrikeOut      = ( BYTE ) hb_arrayGetNI( pStru, 8 );
      p->lfCharSet        = ( BYTE ) hb_arrayGetNI( pStru, 9 );
      p->lfOutPrecision   = ( BYTE ) hb_arrayGetNI( pStru, 10 );
      p->lfClipPrecision  = ( BYTE ) hb_arrayGetNI( pStru, 11 );
      p->lfQuality        = ( BYTE ) hb_arrayGetNI( pStru, 12 );
      p->lfPitchAndFamily = ( BYTE ) hb_arrayGetNI( pStru, 13 );

      pfFaceName = HB_ARRAYGETSTR( pStru, 14, &hfFaceName, &nLen );

      if( nLen > ( LF_FACESIZE - 1 ) )
         nLen = LF_FACESIZE - 1;

      memcpy( p->lfFaceName, pfFaceName, nLen * sizeof( TCHAR ) );
      p->lfFaceName[ nLen ] = TEXT( '\0' );

      hb_strfree( hfFaceName );

      return p;
   }
   else if( bMandatory )
      return p;

   return NULL;
}
Exemple #7
0
static void hb_gaugeUpdate( PHB_ITEM pArray, float fPercent )
{
   int iCenter = ( ( hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) ) / 2 ) + 1;
   int iRatio = hb_arrayGetNL( pArray, B_RIGHT ) - hb_arrayGetNL( pArray, B_LEFT ) - 1;
   int iRow;
   int iCols;
   int iMax;
   char szOldColor[ CLR_STRLEN ];
   char * szStr = "        ";
   char szPct[ 5 ];

   hb_gtGetColorStr( szOldColor );
   hb_gtSetColorStr( hb_arrayGetCPtr( pArray, B_BARCOLOR ) );

   fPercent = ( fPercent < 0 ? 0 : ( fPercent > 1 ? 1 : fPercent ) );
   iCols    = (int) (fPercent * iRatio);

   if( hb_arrayGetL( pArray, B_DISPLAYNUM ) )
   {
//    hb_snprintf( szPct, sizeof( szPct ), "%3.0f\%", fPercent * 100 );
      hb_snprintf( szPct, sizeof( szPct ), "%3.0f%%", fPercent * 100 );
      hb_gtWriteAt( (USHORT) hb_arrayGetNL( pArray, B_TOP ),
                    (USHORT) iCenter + 2, (BYTE *) szPct, 4 );
   }

   hb_gtBox( (SHORT) hb_arrayGetNL( pArray, B_TOP ) + 1, (SHORT) hb_arrayGetNL( pArray, B_LEFT ) + 1,
             (SHORT) hb_arrayGetNL( pArray, B_BOTTOM ) - 1, (SHORT) hb_arrayGetNL( pArray, B_RIGHT ) - 1,
             ( BYTE * ) szStr );

   iMax = hb_arrayGetNL( pArray, B_BOTTOM ) - hb_arrayGetNL( pArray, B_TOP ) - 1;
   for( iRow = 1; iRow <= iMax; iRow++ )
   {
      hb_gtRepChar( ( USHORT ) (iRow + hb_arrayGetNL( pArray, B_TOP )),
                    ( USHORT ) (hb_arrayGetNL( pArray, B_LEFT ) + 1),
                    ( BYTE ) * hb_arrayGetCPtr( pArray, B_BARCHAR ), ( USHORT ) iCols );
   }

   hb_gtSetColorStr( szOldColor );
}
Exemple #8
0
static long GetInt( void * Array, WORD wIndex )
{
   return hb_arrayGetNL( ( PHB_ITEM ) Array, wIndex );
}