示例#1
0
文件: maxrow.c 项目: xharbour/core
int hb_MaxCol( BOOL bVisible )
{
   /* See the note about MaxRow(.t.) above */
   if( bVisible )
   {
      PHB_GT      pGT = hb_gt_Base();
      HB_GT_INFO  gtInfo;

      gtInfo.pNewVal = gtInfo.pResult = NULL;

      assert( pGT );

      HB_GTSELF_INFO( pGT, HB_GTI_VIEWPORTWIDTH, &gtInfo );

      if( gtInfo.pResult )
      {
         int iMaxCol = hb_itemGetNI( gtInfo.pResult );

         hb_itemRelease( gtInfo.pResult );
         return iMaxCol;
      }
      else
      {
         return hb_gtMaxCol();
      }
   }
   else
   {
      return hb_gtMaxCol();
   }
}
示例#2
0
static HB_BOOL hb_ctGetWinCord( int * piTop, int * piLeft,
                                int * piBottom, int * piRight )
{
   int iMaxRow = hb_gtMaxRow();
   int iMaxCol = hb_gtMaxCol();

   hb_gtGetPosEx( piTop, piLeft );

   if( HB_ISNUM( 1 ) )
      *piTop = hb_parni( 1 );
   if( HB_ISNUM( 2 ) )
      *piLeft   = hb_parni( 2 );
   if( HB_ISNUM( 3 ) )
   {
      *piBottom = hb_parni( 3 );
      if( *piBottom > iMaxRow )
         *piBottom = iMaxRow;
   }
   else
      *piBottom = iMaxRow;
   if( HB_ISNUM( 4 ) )
   {
      *piRight = hb_parni( 4 );
      if( *piRight > iMaxCol )
         *piRight = iMaxCol;
   }
   else
      *piRight = iMaxCol;

   return *piTop >= 0 && *piLeft >= 0 &&
          *piTop <= *piBottom && *piLeft <= *piRight;
}
示例#3
0
static void hb_getScreenRange( int * piMin, int * piMax,
                               HB_BOOL fNoCheck, HB_BOOL fVertical )
{
   int iFrom, iTo, iMax;

   if( fVertical )
   {
      iMax  = hb_gtMaxRow();
      iFrom = hb_parni( 1 );
      iTo   = hb_parnidef( 3, iMax );
   }
   else
   {
      iMax  = hb_gtMaxCol();
      iFrom = hb_parni( 2 );
      iTo   = hb_parnidef( 4, iMax );
   }

   if( iFrom < 0 )
      iFrom = 0;
   else if( iFrom > iMax && ! fNoCheck )
      iFrom = iMax;

   if( iTo < 0 )
      iTo = 0;
   else if( iTo > iMax && ! fNoCheck )
      iTo = iMax;

   if( iFrom > iTo )
   {
      *piMin = iTo;
      *piMax = iFrom;
   }
   else
   {
      *piMin = iFrom;
      *piMax = iTo;
   }
}
示例#4
0
int main( void )
{
   const char * test = "Testing GT API Functions";
   const char * test2 = "This message wraps!";

   void * scr;
   HB_SIZE size;

   /* NOTE: always have to initialze video subsystem */
   hb_gtInit( 0, 0, 0 );

   /* save screen */

   hb_gtRectSize( 1, 1, hb_gtMaxRow(), hb_gtMaxCol(), &size );
   scr = hb_xgrab( size );
   hb_gtSave( 1, 1, hb_gtMaxRow() - 1, hb_gtMaxCol() - 1, scr );

   /* writing text */
   hb_gtSetPos( 3, 3 );
   hb_gtWrite( test, strlen( test ) );
   hb_gtSetPos( 12, 42 );
   hb_gtWrite( test, strlen( test ) );

   /* wrapping text */
   hb_gtSetPos( 7, 70 );
   hb_gtWrite( test2, strlen( test2 ) );

   /* writing color text */
   hb_gtSetColorStr( "W+/B, B/W" );
   hb_gtColorSelect( HB_CLR_STANDARD );
   hb_gtWrite( "Enhanced color (B/W)", 20 );
   hb_gtSetPos( 22, 62 );
   hb_gtColorSelect( HB_CLR_ENHANCED );
   hb_gtWrite( "Standard Color (W+/B)", 21 );

   /* boxes */
   hb_gtBoxS( 10, 10, 20, 20 );
   hb_gtBoxD( 10, 40, 15, 45 );

   /* cursor functions */
   hb_gtSetPos( 12, 1 );

   /* none */
   hb_gtSetCursor( SC_NONE );
   hb_inkey( HB_TRUE, 0.0, INKEY_ALL );

   /* underline */
   hb_gtSetCursor( SC_NORMAL );
   hb_inkey( HB_TRUE, 0.0, INKEY_ALL );

   /* lower half block */
   hb_gtSetCursor( SC_INSERT );
   hb_inkey( HB_TRUE, 0.0, INKEY_ALL );

   /* full block */
   hb_gtSetCursor( SC_SPECIAL1 );
   hb_inkey( HB_TRUE, 0.0, INKEY_ALL );

   /* upper half block */
   hb_gtSetCursor( SC_SPECIAL2 );
   hb_inkey( HB_TRUE, 0.0, INKEY_ALL );

   /* restore screen */
   hb_gtRest( 1, 1, hb_gtMaxRow() - 1, hb_gtMaxCol() - 1, scr );
   hb_xfree( scr );

   return 0;
}