From 29a8684c43d10dd1ebdcf6b8e1bb1d2e9fe91739 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 17 Apr 2009 15:13:38 +0000 Subject: [PATCH] 2009-04-17 08:07 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * harbour/contrib/hbqt/generator/hbqtgen.prg * harbour/contrib/hbqt/generator/qt45.qtp * harbour/contrib/hbqt/Makefile_gen * harbour/contrib/hbqt/hbqt.h + harbour/contrib/hbqt/hbqt_qclipboard.cpp + harbour/contrib/hbqt/TQClipboard.prg + Added QClipboard class. ! Fixed hbqt.h generation not to include #define version... --- harbour/ChangeLog | 10 ++ harbour/contrib/hbqt/Makefile_gen | 2 + harbour/contrib/hbqt/TQClipboard.prg | 94 ++++++++++ harbour/contrib/hbqt/generator/hbqtgen.prg | 4 +- harbour/contrib/hbqt/generator/qt45.qtp | 1 + harbour/contrib/hbqt/hbqt.h | 5 +- harbour/contrib/hbqt/hbqt_qclipboard.cpp | 191 +++++++++++++++++++++ 7 files changed, 303 insertions(+), 4 deletions(-) create mode 100644 harbour/contrib/hbqt/TQClipboard.prg create mode 100644 harbour/contrib/hbqt/hbqt_qclipboard.cpp diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4d59866d8f..946cfbbab3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,16 @@ 2009-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org) */ +2009-04-17 08:07 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbqt/generator/hbqtgen.prg + * harbour/contrib/hbqt/generator/qt45.qtp + * harbour/contrib/hbqt/Makefile_gen + * harbour/contrib/hbqt/hbqt.h + + harbour/contrib/hbqt/hbqt_qclipboard.cpp + + harbour/contrib/hbqt/TQClipboard.prg + + Added QClipboard class. + ! Fixed hbqt.h generation not to include #define version... + 2009-04-17 16:26 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/vm/fm.c ! fixed typo in recent modification which broke compilation diff --git a/harbour/contrib/hbqt/Makefile_gen b/harbour/contrib/hbqt/Makefile_gen index ba07206c89..7a981c5798 100644 --- a/harbour/contrib/hbqt/Makefile_gen +++ b/harbour/contrib/hbqt/Makefile_gen @@ -17,6 +17,7 @@ CPP_SOURCES=\ hbqt_qbrush.cpp \ hbqt_qcalendarwidget.cpp \ hbqt_qcheckbox.cpp \ + hbqt_qclipboard.cpp \ hbqt_qcolor.cpp \ hbqt_qcolordialog.cpp \ hbqt_qcombobox.cpp \ @@ -142,6 +143,7 @@ PRG_SOURCES=\ TQBoxLayout.prg \ TQCalendarWidget.prg \ TQCheckBox.prg \ + TQClipboard.prg \ TQColorDialog.prg \ TQComboBox.prg \ TQCommandLinkButton.prg \ diff --git a/harbour/contrib/hbqt/TQClipboard.prg b/harbour/contrib/hbqt/TQClipboard.prg new file mode 100644 index 0000000000..a6b385f6ef --- /dev/null +++ b/harbour/contrib/hbqt/TQClipboard.prg @@ -0,0 +1,94 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * 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 "hbclass.ch" + + +CREATE CLASS QClipboard INHERIT QObject + + VAR pParent + VAR pPtr + + METHOD New() + + METHOD clear( nMode ) INLINE Qt_QClipboard_clear( ::pPtr, nMode ) + METHOD image( nMode ) INLINE Qt_QClipboard_image( ::pPtr, nMode ) + METHOD mimeData( nMode ) INLINE Qt_QClipboard_mimeData( ::pPtr, nMode ) + METHOD ownsClipboard() INLINE Qt_QClipboard_ownsClipboard( ::pPtr ) + METHOD ownsFindBuffer() INLINE Qt_QClipboard_ownsFindBuffer( ::pPtr ) + METHOD ownsSelection() INLINE Qt_QClipboard_ownsSelection( ::pPtr ) + METHOD pixmap( nMode ) INLINE Qt_QClipboard_pixmap( ::pPtr, nMode ) + METHOD setImage( pImage, nMode ) INLINE Qt_QClipboard_setImage( ::pPtr, pImage, nMode ) + METHOD setMimeData( pSrc, nMode ) INLINE Qt_QClipboard_setMimeData( ::pPtr, pSrc, nMode ) + METHOD setPixmap( pPixmap, nMode ) INLINE Qt_QClipboard_setPixmap( ::pPtr, pPixmap, nMode ) + METHOD setText( cText, nMode ) INLINE Qt_QClipboard_setText( ::pPtr, cText, nMode ) + METHOD supportsFindBuffer() INLINE Qt_QClipboard_supportsFindBuffer( ::pPtr ) + METHOD supportsSelection() INLINE Qt_QClipboard_supportsSelection( ::pPtr ) + METHOD text( nMode ) INLINE Qt_QClipboard_text( ::pPtr, nMode ) + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD New( pParent ) CLASS QClipboard + + ::pParent := pParent + + ::pPtr := Qt_QClipboard( pParent ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index fc3459af60..a25b76d76a 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -1227,8 +1227,6 @@ STATIC FUNCTION Build_HBQT_H( cPathOut ) aadd( txt_, "#define __HBQT_H " ) aadd( txt_, " " ) aadd( txt_, " " ) - aadd( txt_, "#define QT_VERSION 0x040500 " ) - aadd( txt_, " " ) aadd( txt_, "#include " ) aadd( txt_, " " ) aadd( txt_, "#if QT_VERSION >= 0x040500 " ) @@ -1403,6 +1401,8 @@ STATIC FUNCTION Build_HBQT_H( cPathOut ) aadd( txt_, "#define hbqt_par_QStyleOptionComplex( n ) ( ( QStyleOptionComplex* ) hb_parptr( n ) ) " ) aadd( txt_, "#define hbqt_par_QFontMetrics( n ) ( ( QFontMetrics* ) hb_parptr( n ) ) " ) aadd( txt_, "#define hbqt_par_QStyleHintReturn( n ) ( ( QStyleHintReturn* ) hb_parptr( n ) ) " ) + aadd( txt_, "#define hbqt_par_QClipboard( n ) ( ( QClipboard* ) hb_parptr( n ) ) " ) + aadd( txt_, "#define hbqt_par_QMimeData( n ) ( ( QMimeData* ) hb_parptr( n ) ) " ) aadd( txt_, " " ) aadd( txt_, "#define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) ) " ) aadd( txt_, "#define hbqt_par_QRgb( n ) ( hb_parnint( n ) ) " ) diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 090e70be29..b219f92bc8 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -24,6 +24,7 @@ QBoxLayout.qth QBrush.qth QCalendarWidget.qth QCheckBox.qth +QClipboard.qth QColor.qth QColorDialog.qth QComboBox.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 1767eba199..b3191fd920 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -57,8 +57,6 @@ #define __HBQT_H -/* #define QT_VERSION 0x040500 */ - #include #if QT_VERSION >= 0x040500 @@ -233,6 +231,8 @@ #define hbqt_par_QStyleOptionComplex( n ) ( ( QStyleOptionComplex* ) hb_parptr( n ) ) #define hbqt_par_QFontMetrics( n ) ( ( QFontMetrics* ) hb_parptr( n ) ) #define hbqt_par_QStyleHintReturn( n ) ( ( QStyleHintReturn* ) hb_parptr( n ) ) +#define hbqt_par_QClipboard( n ) ( ( QClipboard* ) hb_parptr( n ) ) +#define hbqt_par_QMimeData( n ) ( ( QMimeData* ) hb_parptr( n ) ) #define hbqt_par_QString( n ) ( ( QString ) hb_parc( n ) ) #define hbqt_par_QRgb( n ) ( hb_parnint( n ) ) @@ -265,3 +265,4 @@ QPointF hbqt_const_QPointF( int ); #endif #endif /* __HBQT_H */ + diff --git a/harbour/contrib/hbqt/hbqt_qclipboard.cpp b/harbour/contrib/hbqt/hbqt_qclipboard.cpp new file mode 100644 index 0000000000..5859b69f31 --- /dev/null +++ b/harbour/contrib/hbqt/hbqt_qclipboard.cpp @@ -0,0 +1,191 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * 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 +#include + +/* + * + * + */ +HB_FUNC( QT_QCLIPBOARD ) +{ + hb_retptr( ( QClipboard* ) QApplication::clipboard() ); +} + +/* + * void clear ( Mode mode = Clipboard ) + */ +HB_FUNC( QT_QCLIPBOARD_CLEAR ) +{ + hbqt_par_QClipboard( 1 )->clear( ( HB_ISNIL( 2 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 2 ) ) ); +} + +/* + * QImage image ( Mode mode = Clipboard ) const + */ +HB_FUNC( QT_QCLIPBOARD_IMAGE ) +{ + hb_retptr( new QImage( hbqt_par_QClipboard( 1 )->image( ( HB_ISNIL( 2 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 2 ) ) ) ) ); +} + +/* + * const QMimeData * mimeData ( Mode mode = Clipboard ) const + */ +HB_FUNC( QT_QCLIPBOARD_MIMEDATA ) +{ + hb_retptr( ( QMimeData* ) hbqt_par_QClipboard( 1 )->mimeData( ( HB_ISNIL( 2 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 2 ) ) ) ); +} + +/* + * bool ownsClipboard () const + */ +HB_FUNC( QT_QCLIPBOARD_OWNSCLIPBOARD ) +{ + hb_retl( hbqt_par_QClipboard( 1 )->ownsClipboard() ); +} + +/* + * bool ownsFindBuffer () const + */ +HB_FUNC( QT_QCLIPBOARD_OWNSFINDBUFFER ) +{ + hb_retl( hbqt_par_QClipboard( 1 )->ownsFindBuffer() ); +} + +/* + * bool ownsSelection () const + */ +HB_FUNC( QT_QCLIPBOARD_OWNSSELECTION ) +{ + hb_retl( hbqt_par_QClipboard( 1 )->ownsSelection() ); +} + +/* + * QPixmap pixmap ( Mode mode = Clipboard ) const + */ +HB_FUNC( QT_QCLIPBOARD_PIXMAP ) +{ + hb_retptr( new QPixmap( hbqt_par_QClipboard( 1 )->pixmap( ( HB_ISNIL( 2 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 2 ) ) ) ) ); +} + +/* + * void setImage ( const QImage & image, Mode mode = Clipboard ) + */ +HB_FUNC( QT_QCLIPBOARD_SETIMAGE ) +{ + hbqt_par_QClipboard( 1 )->setImage( *hbqt_par_QImage( 2 ), ( HB_ISNIL( 3 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 3 ) ) ); +} + +/* + * void setMimeData ( QMimeData * src, Mode mode = Clipboard ) + */ +HB_FUNC( QT_QCLIPBOARD_SETMIMEDATA ) +{ + hbqt_par_QClipboard( 1 )->setMimeData( hbqt_par_QMimeData( 2 ), ( HB_ISNIL( 3 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 3 ) ) ); +} + +/* + * void setPixmap ( const QPixmap & pixmap, Mode mode = Clipboard ) + */ +HB_FUNC( QT_QCLIPBOARD_SETPIXMAP ) +{ + hbqt_par_QClipboard( 1 )->setPixmap( *hbqt_par_QPixmap( 2 ), ( HB_ISNIL( 3 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 3 ) ) ); +} + +/* + * void setText ( const QString & text, Mode mode = Clipboard ) + */ +HB_FUNC( QT_QCLIPBOARD_SETTEXT ) +{ + hbqt_par_QClipboard( 1 )->setText( hbqt_par_QString( 2 ), ( HB_ISNIL( 3 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 3 ) ) ); +} + +/* + * bool supportsFindBuffer () const + */ +HB_FUNC( QT_QCLIPBOARD_SUPPORTSFINDBUFFER ) +{ + hb_retl( hbqt_par_QClipboard( 1 )->supportsFindBuffer() ); +} + +/* + * bool supportsSelection () const + */ +HB_FUNC( QT_QCLIPBOARD_SUPPORTSSELECTION ) +{ + hb_retl( hbqt_par_QClipboard( 1 )->supportsSelection() ); +} + +/* + * QString text ( Mode mode = Clipboard ) const + */ +HB_FUNC( QT_QCLIPBOARD_TEXT ) +{ + hb_retc( hbqt_par_QClipboard( 1 )->text( ( HB_ISNIL( 2 ) ? ( QClipboard::Mode ) QClipboard::Clipboard : ( QClipboard::Mode ) hb_parni( 2 ) ) ).toLatin1().data() ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ +