Files
harbour-core/harbour/contrib/hbqt/QBitmap.cpp
Pritpal Bedi e612f92599 2009-07-08 16:50 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbqt/hbqt.ch

  * harbour/contrib/hbqt/QBitmap.cpp
  * harbour/contrib/hbqt/QBrush.cpp
  * harbour/contrib/hbqt/QCursor.cpp
  * harbour/contrib/hbqt/QImage.cpp
  * harbour/contrib/hbqt/QLine.cpp
  * harbour/contrib/hbqt/QLinearGradient.cpp
  * harbour/contrib/hbqt/QPicture.cpp
  * harbour/contrib/hbqt/QPixmap.cpp
  * harbour/contrib/hbqt/QPoint.cpp
  * harbour/contrib/hbqt/QPointF.cpp
  * harbour/contrib/hbqt/QRadialGradient.cpp
  * harbour/contrib/hbqt/QRect.cpp
  * harbour/contrib/hbqt/QRectF.cpp
  * harbour/contrib/hbqt/QRegion.cpp
  * harbour/contrib/hbqt/QSizeF.cpp

  * harbour/contrib/hbqt/TQBitmap.prg
  * harbour/contrib/hbqt/TQImage.prg
  * harbour/contrib/hbqt/TQLine.prg
  * harbour/contrib/hbqt/TQLinearGradient.prg
  * harbour/contrib/hbqt/TQPicture.prg
  * harbour/contrib/hbqt/TQPixmap.prg
  * harbour/contrib/hbqt/TQPoint.prg
  * harbour/contrib/hbqt/TQPointF.prg
  * harbour/contrib/hbqt/TQRadialGradient.prg
  * harbour/contrib/hbqt/TQRect.prg
  * harbour/contrib/hbqt/TQRectF.prg
  * harbour/contrib/hbqt/TQRegion.prg
  * harbour/contrib/hbqt/TQSizeF.prg

  * harbour/contrib/hbqt/qth/QBitmap.qth
  * harbour/contrib/hbqt/qth/QBrush.qth
  * harbour/contrib/hbqt/qth/QCursor.qth
  * harbour/contrib/hbqt/qth/QImage.qth
  * harbour/contrib/hbqt/qth/QLine.qth
  * harbour/contrib/hbqt/qth/QLinearGradient.qth
  * harbour/contrib/hbqt/qth/QPalette.qth
  * harbour/contrib/hbqt/qth/QPicture.qth
  * harbour/contrib/hbqt/qth/QPixmap.qth
  * harbour/contrib/hbqt/qth/QPoint.qth
  * harbour/contrib/hbqt/qth/QPointF.qth
  * harbour/contrib/hbqt/qth/QRadialGradient.qth
  * harbour/contrib/hbqt/qth/QRect.qth
  * harbour/contrib/hbqt/qth/QRectF.qth
  * harbour/contrib/hbqt/qth/QRegion.qth
  * harbour/contrib/hbqt/qth/QSizeF.qth

  ! Updated for exact constructor parameters.
    If the constructor accepts parameters with identical .prg supplied values,
    a new parameter is inserted as a first argument and then resolved in .cpp.
        
      oBrush := QBrush():new( "QPixmap"  , pQPixmap )
      oBrush := QBrush():new( "QImage"   , pQImage )
      oBrush := QBrush():new( "QGradient", pQGradient )
           
          Note that constructor fetches only one argument, a pointer to relevant
          object, which at prg to cpp level can never be differed so this 
          mechanism was necessary. The first parameter will be matched exact
          and hence it is case sensitive. If this parameter is of the same type
          object is being created then it call will only supply pointer:
  
      oBrush := QBrush():new( pQBrush_other )
2009-07-08 23:57:56 +00:00

150 lines
4.9 KiB
C++

/*
* $Id$
*/
/*
* Harbour Project source code:
* QT wrapper main header
*
* Copyright 2009 Marcos Antonio Gambeta <marcosgambeta at gmail dot com>
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
/*----------------------------------------------------------------------*/
#include "hbapi.h"
#include "hbqt.h"
/*----------------------------------------------------------------------*/
#if QT_VERSION >= 0x040500
/*----------------------------------------------------------------------*/
#include <QtGui/QBitmap>
/*
* QBitmap ()
* QBitmap ( const QPixmap & pixmap )
* QBitmap ( int width, int height )
* QBitmap ( const QSize & size )
* QBitmap ( const QString & fileName, const char * format = 0 )
* ~QBitmap ()
*/
HB_FUNC( QT_QBITMAP )
{
if( hb_pcount() == 1 && HB_ISPOINTER( 1 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( *hbqt_par_QBitmap( 1 ) ) );
}
else if( hb_pcount() == 1 && HB_ISCHAR( 1 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( hbqt_par_QString( 1 ), ( const char * ) 0 ) );
}
else if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISCHAR( 2 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( hbqt_par_QString( 1 ), hb_parc( 2 ) ) );
}
else if( hb_pcount() == 2 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( hb_parni( 1 ), hb_parni( 2 ) ) );
}
else if( hb_pcount() == 2 && HB_ISCHAR( 1 ) && HB_ISPOINTER( 2 ) )
{
if( ( QString ) "QPixmap" == hbqt_par_QString( 1 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( *hbqt_par_QPixmap( 1 ) ) );
}
else if( ( QString ) "QSize" == hbqt_par_QString( 1 ) )
{
hb_retptr( ( QBitmap* ) new QBitmap( *hbqt_par_QSize( 1 ) ) );
}
else
{
hb_retptr( ( QBitmap* ) new QBitmap() );
}
}
else
{
hb_retptr( ( QBitmap* ) new QBitmap() );
}
}
/*
* void clear ()
*/
HB_FUNC( QT_QBITMAP_CLEAR )
{
hbqt_par_QBitmap( 1 )->clear();
}
/*
* QBitmap transformed ( const QTransform & matrix ) const
*/
HB_FUNC( QT_QBITMAP_TRANSFORMED )
{
hb_retptr( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QTransform( 2 ) ) ) );
}
/*
* QBitmap transformed ( const QMatrix & matrix ) const
*/
HB_FUNC( QT_QBITMAP_TRANSFORMED_1 )
{
hb_retptr( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ) ) ) );
}
/*
* QBitmap fromImage ( const QImage & image, Qt::ImageConversionFlags flags = Qt::AutoColor )
*/
HB_FUNC( QT_QBITMAP_FROMIMAGE )
{
hb_retptr( new QBitmap( hbqt_par_QBitmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) );
}
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */
/*----------------------------------------------------------------------*/