From 5e48c4944c493b0a24e14ae5fe79c8a4cda99f1a Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 22 Jun 2010 16:02:20 +0000 Subject: [PATCH] 2010-06-22 08:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/generator/qt45.qtp * contrib/hbqt/hbqt.h * contrib/hbqt/hbqt_garbage.h * contrib/hbqt/qtgui/filelist.mk + contrib/hbqt/qtgui/QItemDelegate.cpp + contrib/hbqt/qtgui/QItemEditorCreator.cpp + contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp + contrib/hbqt/qtgui/QItemEditorFactory.cpp + contrib/hbqt/qtgui/TQItemDelegate.prg + contrib/hbqt/qtgui/TQItemEditorCreator.prg + contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg + contrib/hbqt/qtgui/TQItemEditorFactory.prg + contrib/hbqt/qth/QItemDelegate.qth + contrib/hbqt/qth/QItemEditorCreator.qth + contrib/hbqt/qth/QItemEditorCreatorBase.qth + contrib/hbqt/qth/QItemEditorFactory.qth + Added: more classes to implement GET validation - in progress. --- harbour/ChangeLog | 21 ++ harbour/contrib/hbqt/generator/qt45.qtp | 4 + harbour/contrib/hbqt/hbqt.h | 3 + harbour/contrib/hbqt/hbqt_garbage.h | 6 + harbour/contrib/hbqt/qtgui/QItemDelegate.cpp | 304 ++++++++++++++++++ .../contrib/hbqt/qtgui/QItemEditorCreator.cpp | 151 +++++++++ .../hbqt/qtgui/QItemEditorCreatorBase.cpp | 151 +++++++++ .../contrib/hbqt/qtgui/QItemEditorFactory.cpp | 206 ++++++++++++ harbour/contrib/hbqt/qtgui/TQItemDelegate.prg | 131 ++++++++ .../hbqt/qtgui/TQItemEditorCreator.prg | 91 ++++++ .../hbqt/qtgui/TQItemEditorCreatorBase.prg | 91 ++++++ .../hbqt/qtgui/TQItemEditorFactory.prg | 101 ++++++ harbour/contrib/hbqt/qtgui/filelist.mk | 6 + harbour/contrib/hbqt/qth/QItemDelegate.qth | 116 +++++++ .../contrib/hbqt/qth/QItemEditorCreator.qth | 96 ++++++ .../hbqt/qth/QItemEditorCreatorBase.qth | 96 ++++++ .../contrib/hbqt/qth/QItemEditorFactory.qth | 108 +++++++ 17 files changed, 1682 insertions(+) create mode 100644 harbour/contrib/hbqt/qtgui/QItemDelegate.cpp create mode 100644 harbour/contrib/hbqt/qtgui/QItemEditorCreator.cpp create mode 100644 harbour/contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp create mode 100644 harbour/contrib/hbqt/qtgui/QItemEditorFactory.cpp create mode 100644 harbour/contrib/hbqt/qtgui/TQItemDelegate.prg create mode 100644 harbour/contrib/hbqt/qtgui/TQItemEditorCreator.prg create mode 100644 harbour/contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg create mode 100644 harbour/contrib/hbqt/qtgui/TQItemEditorFactory.prg create mode 100644 harbour/contrib/hbqt/qth/QItemDelegate.qth create mode 100644 harbour/contrib/hbqt/qth/QItemEditorCreator.qth create mode 100644 harbour/contrib/hbqt/qth/QItemEditorCreatorBase.qth create mode 100644 harbour/contrib/hbqt/qth/QItemEditorFactory.qth diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c792468c50..888f8fa2b2 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,27 @@ The license applies to all entries newer than 2009-04-28. */ +2010-06-22 08:54 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/generator/qt45.qtp + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_garbage.h + * contrib/hbqt/qtgui/filelist.mk + + + contrib/hbqt/qtgui/QItemDelegate.cpp + + contrib/hbqt/qtgui/QItemEditorCreator.cpp + + contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp + + contrib/hbqt/qtgui/QItemEditorFactory.cpp + + contrib/hbqt/qtgui/TQItemDelegate.prg + + contrib/hbqt/qtgui/TQItemEditorCreator.prg + + contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg + + contrib/hbqt/qtgui/TQItemEditorFactory.prg + + contrib/hbqt/qth/QItemDelegate.qth + + contrib/hbqt/qth/QItemEditorCreator.qth + + contrib/hbqt/qth/QItemEditorCreatorBase.qth + + contrib/hbqt/qth/QItemEditorFactory.qth + + + Added: more classes to implement GET validation - in progress. + 2010-06-22 17:59 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * src/rtl/hbsha2.c * src/rtl/hbsha2hm.c diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 83ece9ed90..18658317d0 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -115,6 +115,10 @@ QImageWriter.qth QInputDialog.qth QInputEvent.qth QIODevice.qth +QItemDelegate.qth +; QItemEditorCreator.qth +QItemEditorCreatorBase.qth +QItemEditorFactory.qth QItemSelection.qth QItemSelectionModel.qth QKeyEvent.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index fb9e563236..d2290553bb 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -193,6 +193,9 @@ extern void * hbqt_pPtrFromItem( PHB_ITEM pObj ); #define hbqt_par_QInputEvent( n ) ( ( QInputEvent * ) hbqt_gcpointer( n ) ) #define hbqt_par_QInputMethodEvent( n ) ( ( QInputMethodEvent * ) hbqt_gcpointer( n ) ) #define hbqt_par_QIODevice( n ) ( ( QIODevice * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QItemDelegate( n ) ( ( QItemDelegate * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QItemEditorCreator( n ) ( ( QItemEditorCreator * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QItemEditorCreatorBase( n ) ( ( QItemEditorCreatorBase * ) hbqt_gcpointer( n ) ) #define hbqt_par_QItemEditorFactory( n ) ( ( QItemEditorFactory * ) hbqt_gcpointer( n ) ) #define hbqt_par_QItemSelection( n ) ( ( QItemSelection * ) hbqt_gcpointer( n ) ) #define hbqt_par_QItemSelectionModel( n ) ( ( QItemSelectionModel * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_garbage.h b/harbour/contrib/hbqt/hbqt_garbage.h index c68c933acb..d4a713f021 100644 --- a/harbour/contrib/hbqt/hbqt_garbage.h +++ b/harbour/contrib/hbqt/hbqt_garbage.h @@ -107,6 +107,9 @@ extern QT_G_FUNC( hbqt_gcRelease_QImageWriter ); extern QT_G_FUNC( hbqt_gcRelease_QInputDialog ); extern QT_G_FUNC( hbqt_gcRelease_QInputEvent ); extern QT_G_FUNC( hbqt_gcRelease_QIODevice ); +extern QT_G_FUNC( hbqt_gcRelease_QItemDelegate ); +extern QT_G_FUNC( hbqt_gcRelease_QItemEditorCreatorBase ); +extern QT_G_FUNC( hbqt_gcRelease_QItemEditorFactory ); extern QT_G_FUNC( hbqt_gcRelease_QItemSelection ); extern QT_G_FUNC( hbqt_gcRelease_QItemSelectionModel ); extern QT_G_FUNC( hbqt_gcRelease_QKeyEvent ); @@ -396,6 +399,9 @@ extern void * hbqt_gcAllocate_QImageWriter( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QInputDialog( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QInputEvent( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QIODevice( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QItemDelegate( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QItemEditorCreatorBase( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QItemEditorFactory( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QItemSelection( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QItemSelectionModel( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QKeyEvent( void * pObj, bool bNew ); diff --git a/harbour/contrib/hbqt/qtgui/QItemDelegate.cpp b/harbour/contrib/hbqt/qtgui/QItemDelegate.cpp new file mode 100644 index 0000000000..c2f437145d --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QItemDelegate.cpp @@ -0,0 +1,304 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +/* + * enum EndEditHint { NoHint, EditNextItem, EditPreviousItem, SubmitModelCache, RevertModelCache } + */ + +#include + +#include + + +/* QItemDelegate ( QObject * parent = 0 ) + * ~QItemDelegate () + * + */ + +typedef struct +{ + QPointer< QItemDelegate > ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QItemDelegate; + +QT_G_FUNC( hbqt_gcRelease_QItemDelegate ) +{ + QItemDelegate * ph = NULL ; + QGC_POINTER_QItemDelegate * p = ( QGC_POINTER_QItemDelegate * ) Cargo; + + if( p && p->bNew && p->ph ) + { + ph = p->ph; + if( ph ) + { + const QMetaObject * m = ( ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p %p YES_rel_QItemDelegate /.\\ ", (void*) ph, (void*) p->ph ) ); + delete ( p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "ph=%p %p YES_rel_QItemDelegate \\./ ", (void*) ph, (void*) p->ph ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p NO__rel_QItemDelegate ", ph ) ); + p->ph = NULL; + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p DEL_rel_QItemDelegate : Object already deleted!", ph ) ); + p->ph = NULL; + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p PTR_rel_QItemDelegate : Object not created with new=true", ph ) ); + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_QItemDelegate( void * pObj, bool bNew ) +{ + QGC_POINTER_QItemDelegate * p = ( QGC_POINTER_QItemDelegate * ) hb_gcAllocate( sizeof( QGC_POINTER_QItemDelegate ), hbqt_gcFuncs() ); + + new( & p->ph ) QPointer< QItemDelegate >( ( QItemDelegate * ) pObj ); + p->bNew = bNew; + p->func = hbqt_gcRelease_QItemDelegate; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p _new_QItemDelegate under p->pq", pObj ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p NOT_new_QItemDelegate", pObj ) ); + } + return p; +} + +HB_FUNC( QT_QITEMDELEGATE ) +{ + QItemDelegate * pObj = NULL; + + if( HB_ISPOINTER( 1 ) ) + { + pObj = new QItemDelegate( hbqt_par_QObject( 1 ) ) ; + } + else + { + pObj = new QItemDelegate() ; + } + + hb_retptrGC( hbqt_gcAllocate_QItemDelegate( ( void * ) pObj, true ) ); +} + +/* + * bool hasClipping () const + */ +HB_FUNC( QT_QITEMDELEGATE_HASCLIPPING ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + hb_retl( ( p )->hasClipping() ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_HASCLIPPING FP=hb_retl( ( p )->hasClipping() ); p is NULL" ) ); + } +} + +/* + * QItemEditorFactory * itemEditorFactory () const + */ +HB_FUNC( QT_QITEMDELEGATE_ITEMEDITORFACTORY ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QItemEditorFactory( ( p )->itemEditorFactory(), false ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_ITEMEDITORFACTORY FP=hb_retptrGC( hbqt_gcAllocate_QItemEditorFactory( ( p )->itemEditorFactory(), false ) ); p is NULL" ) ); + } +} + +/* + * void setClipping ( bool clip ) + */ +HB_FUNC( QT_QITEMDELEGATE_SETCLIPPING ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->setClipping( hb_parl( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_SETCLIPPING FP=( p )->setClipping( hb_parl( 2 ) ); p is NULL" ) ); + } +} + +/* + * void setItemEditorFactory ( QItemEditorFactory * factory ) + */ +HB_FUNC( QT_QITEMDELEGATE_SETITEMEDITORFACTORY ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->setItemEditorFactory( hbqt_par_QItemEditorFactory( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_SETITEMEDITORFACTORY FP=( p )->setItemEditorFactory( hbqt_par_QItemEditorFactory( 2 ) ); p is NULL" ) ); + } +} + +/* + * virtual QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_CREATEEDITOR ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ), false ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_CREATEEDITOR FP=hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ), false ) ); p is NULL" ) ); + } +} + +/* + * virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_PAINT ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->paint( hbqt_par_QPainter( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_PAINT FP=( p )->paint( hbqt_par_QPainter( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ); p is NULL" ) ); + } +} + +/* + * virtual void setEditorData ( QWidget * editor, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_SETEDITORDATA ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->setEditorData( hbqt_par_QWidget( 2 ), *hbqt_par_QModelIndex( 3 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_SETEDITORDATA FP=( p )->setEditorData( hbqt_par_QWidget( 2 ), *hbqt_par_QModelIndex( 3 ) ); p is NULL" ) ); + } +} + +/* + * virtual void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_SETMODELDATA ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->setModelData( hbqt_par_QWidget( 2 ), hbqt_par_QAbstractItemModel( 3 ), *hbqt_par_QModelIndex( 4 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_SETMODELDATA FP=( p )->setModelData( hbqt_par_QWidget( 2 ), hbqt_par_QAbstractItemModel( 3 ), *hbqt_par_QModelIndex( 4 ) ); p is NULL" ) ); + } +} + +/* + * virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_SIZEHINT ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( ( p )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), true ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_SIZEHINT FP=hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( ( p )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), true ) ); p is NULL" ) ); + } +} + +/* + * virtual void updateEditorGeometry ( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index ) const + */ +HB_FUNC( QT_QITEMDELEGATE_UPDATEEDITORGEOMETRY ) +{ + QItemDelegate * p = hbqt_par_QItemDelegate( 1 ); + if( p ) + ( p )->updateEditorGeometry( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMDELEGATE_UPDATEEDITORGEOMETRY FP=( p )->updateEditorGeometry( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ); p is NULL" ) ); + } +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QItemEditorCreator.cpp b/harbour/contrib/hbqt/qtgui/QItemEditorCreator.cpp new file mode 100644 index 0000000000..cd40e73cc0 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QItemEditorCreator.cpp @@ -0,0 +1,151 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include + + +/* + * QItemEditorCreator ( const QByteArray & valuePropertyName ) + * + */ + +typedef struct +{ + QPointer< QItemEditorCreator > ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QItemEditorCreator; + +QT_G_FUNC( hbqt_gcRelease_QItemEditorCreator ) +{ + HB_SYMBOL_UNUSED( Cargo ); + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + if( p && p->bNew ) + { + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_QItemEditorCreator( void * pObj, bool bNew ) +{ + QGC_POINTER_QItemEditorCreator * p = ( QGC_POINTER_QItemEditorCreator * ) hb_gcAllocate( sizeof( QGC_POINTER_QItemEditorCreator ), hbqt_gcFuncs() ); + + new( & p->ph ) QPointer< QItemEditorCreator >( ( QItemEditorCreator * ) pObj ); + p->bNew = bNew; + p->func = hbqt_gcRelease_QItemEditorCreator; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p _new_QItemEditorCreator under p->pq", pObj ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p NOT_new_QItemEditorCreator", pObj ) ); + } + return p; +} + +HB_FUNC( QT_QITEMEDITORCREATOR ) +{ +// hb_retptr( new QItemEditorCreator( hbqt_par_QByteArray( 1 ) ) ); +} + +/* + * virtual QWidget * createWidget ( QWidget * parent ) const + */ +HB_FUNC( QT_QITEMEDITORCREATOR_CREATEWIDGET ) +{ + QItemEditorCreator * p = hbqt_par_QItemEditorCreator( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createWidget( hbqt_par_QWidget( 2 ) ), false ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORCREATOR_CREATEWIDGET FP=hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createWidget( hbqt_par_QWidget( 2 ) ), false ) ); p is NULL" ) ); + } +} + +/* + * virtual QByteArray valuePropertyName () const + */ +HB_FUNC( QT_QITEMEDITORCREATOR_VALUEPROPERTYNAME ) +{ + QItemEditorCreator * p = hbqt_par_QItemEditorCreator( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName() ), true ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORCREATOR_VALUEPROPERTYNAME FP=hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName() ), true ) ); p is NULL" ) ); + } +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp b/harbour/contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp new file mode 100644 index 0000000000..9e5ce234ad --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QItemEditorCreatorBase.cpp @@ -0,0 +1,151 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include + + +/* + * virtual ~QItemEditorCreatorBase () + * + */ + +typedef struct +{ + QItemEditorCreatorBase * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QItemEditorCreatorBase; + +QT_G_FUNC( hbqt_gcRelease_QItemEditorCreatorBase ) +{ + HB_SYMBOL_UNUSED( Cargo ); + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + if( p && p->bNew ) + { + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_QItemEditorCreatorBase( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = ( QItemEditorCreatorBase * ) pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QItemEditorCreatorBase; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p _new_QItemEditorCreatorBase", pObj ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p NOT_new_QItemEditorCreatorBase", pObj ) ); + } + return p; +} + +HB_FUNC( QT_QITEMEDITORCREATORBASE ) +{ + +} + +/* + * virtual QWidget * createWidget ( QWidget * parent ) const = 0 + */ +HB_FUNC( QT_QITEMEDITORCREATORBASE_CREATEWIDGET ) +{ + QItemEditorCreatorBase * p = hbqt_par_QItemEditorCreatorBase( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createWidget( hbqt_par_QWidget( 2 ) ), false ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORCREATORBASE_CREATEWIDGET FP=hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createWidget( hbqt_par_QWidget( 2 ) ), false ) ); p is NULL" ) ); + } +} + +/* + * virtual QByteArray valuePropertyName () const = 0 + */ +HB_FUNC( QT_QITEMEDITORCREATORBASE_VALUEPROPERTYNAME ) +{ + QItemEditorCreatorBase * p = hbqt_par_QItemEditorCreatorBase( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName() ), true ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORCREATORBASE_VALUEPROPERTYNAME FP=hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName() ), true ) ); p is NULL" ) ); + } +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QItemEditorFactory.cpp b/harbour/contrib/hbqt/qtgui/QItemEditorFactory.cpp new file mode 100644 index 0000000000..2457f9264e --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QItemEditorFactory.cpp @@ -0,0 +1,206 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include + + +/* + * QItemEditorFactory () + * virtual ~QItemEditorFactory () + * + */ + +typedef struct +{ + QItemEditorFactory * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QItemEditorFactory; + +QT_G_FUNC( hbqt_gcRelease_QItemEditorFactory ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + if( p && p->bNew ) + { + if( p->ph ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p _rel_QItemEditorFactory /.\\", p->ph ) ); + delete ( ( QItemEditorFactory * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "ph=%p YES_rel_QItemEditorFactory \\./", p->ph ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p DEL_rel_QItemEditorFactory : Object already deleted!", p->ph ) ); + p->ph = NULL; + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p PTR_rel_QItemEditorFactory : Object not created with new=true", p->ph ) ); + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_QItemEditorFactory( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = ( QItemEditorFactory * ) pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QItemEditorFactory; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p _new_QItemEditorFactory", pObj ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "ph=%p NOT_new_QItemEditorFactory", pObj ) ); + } + return p; +} + +HB_FUNC( QT_QITEMEDITORFACTORY ) +{ + QItemEditorFactory * pObj = NULL; + + if( HB_ISPOINTER( 1 ) ) + { + pObj = new QItemEditorFactory() ; + } + else + { + pObj = new QItemEditorFactory( *hbqt_par_QItemEditorFactory( 1 ) ) ; + } + + hb_retptrGC( hbqt_gcAllocate_QItemEditorFactory( ( void * ) pObj, true ) ); +} + +/* + * virtual QWidget * createEditor ( QVariant::Type type, QWidget * parent ) const + */ +HB_FUNC( QT_QITEMEDITORFACTORY_CREATEEDITOR ) +{ + QItemEditorFactory * p = hbqt_par_QItemEditorFactory( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createEditor( ( QVariant::Type ) hb_parni( 2 ), hbqt_par_QWidget( 3 ) ), false ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORFACTORY_CREATEEDITOR FP=hb_retptrGC( hbqt_gcAllocate_QWidget( ( p )->createEditor( ( QVariant::Type ) hb_parni( 2 ), hbqt_par_QWidget( 3 ) ), false ) ); p is NULL" ) ); + } +} + +/* + * void registerEditor ( QVariant::Type type, QItemEditorCreatorBase * creator ) + */ +HB_FUNC( QT_QITEMEDITORFACTORY_REGISTEREDITOR ) +{ + QItemEditorFactory * p = hbqt_par_QItemEditorFactory( 1 ); + if( p ) + ( p )->registerEditor( ( QVariant::Type ) hb_parni( 2 ), hbqt_par_QItemEditorCreatorBase( 3 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORFACTORY_REGISTEREDITOR FP=( p )->registerEditor( ( QVariant::Type ) hb_parni( 2 ), hbqt_par_QItemEditorCreatorBase( 3 ) ); p is NULL" ) ); + } +} + +/* + * virtual QByteArray valuePropertyName ( QVariant::Type type ) const + */ +HB_FUNC( QT_QITEMEDITORFACTORY_VALUEPROPERTYNAME ) +{ + QItemEditorFactory * p = hbqt_par_QItemEditorFactory( 1 ); + if( p ) + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName( ( QVariant::Type ) hb_parni( 2 ) ) ), true ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORFACTORY_VALUEPROPERTYNAME FP=hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( ( p )->valuePropertyName( ( QVariant::Type ) hb_parni( 2 ) ) ), true ) ); p is NULL" ) ); + } +} + +/* + * void setDefaultFactory ( QItemEditorFactory * factory ) + */ +HB_FUNC( QT_QITEMEDITORFACTORY_SETDEFAULTFACTORY ) +{ + QItemEditorFactory * p = hbqt_par_QItemEditorFactory( 1 ); + if( p ) + ( p )->setDefaultFactory( hbqt_par_QItemEditorFactory( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_QITEMEDITORFACTORY_SETDEFAULTFACTORY FP=( p )->setDefaultFactory( hbqt_par_QItemEditorFactory( 2 ) ); p is NULL" ) ); + } +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/TQItemDelegate.prg b/harbour/contrib/hbqt/qtgui/TQItemDelegate.prg new file mode 100644 index 0000000000..def73dbcd3 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQItemDelegate.prg @@ -0,0 +1,131 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 QItemDelegate INHERIT HbQtObjectHandler, QAbstractItemDelegate + + METHOD new( ... ) + + METHOD hasClipping() + METHOD itemEditorFactory() + METHOD setClipping( lClip ) + METHOD setItemEditorFactory( pFactory ) + METHOD createEditor( pParent, pOption, pIndex ) + METHOD paint( pPainter, pOption, pIndex ) + METHOD setEditorData( pEditor, pIndex ) + METHOD setModelData( pEditor, pModel, pIndex ) + METHOD sizeHint( pOption, pIndex ) + METHOD updateEditorGeometry( pEditor, pOption, pIndex ) + + ENDCLASS + + +METHOD QItemDelegate:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QItemDelegate( ... ) + RETURN Self + + +METHOD QItemDelegate:hasClipping() + RETURN Qt_QItemDelegate_hasClipping( ::pPtr ) + + +METHOD QItemDelegate:itemEditorFactory() + RETURN Qt_QItemDelegate_itemEditorFactory( ::pPtr ) + + +METHOD QItemDelegate:setClipping( lClip ) + RETURN Qt_QItemDelegate_setClipping( ::pPtr, lClip ) + + +METHOD QItemDelegate:setItemEditorFactory( pFactory ) + RETURN Qt_QItemDelegate_setItemEditorFactory( ::pPtr, hbqt_ptr( pFactory ) ) + + +METHOD QItemDelegate:createEditor( pParent, pOption, pIndex ) + RETURN Qt_QItemDelegate_createEditor( ::pPtr, hbqt_ptr( pParent ), hbqt_ptr( pOption ), hbqt_ptr( pIndex ) ) + + +METHOD QItemDelegate:paint( pPainter, pOption, pIndex ) + RETURN Qt_QItemDelegate_paint( ::pPtr, hbqt_ptr( pPainter ), hbqt_ptr( pOption ), hbqt_ptr( pIndex ) ) + + +METHOD QItemDelegate:setEditorData( pEditor, pIndex ) + RETURN Qt_QItemDelegate_setEditorData( ::pPtr, hbqt_ptr( pEditor ), hbqt_ptr( pIndex ) ) + + +METHOD QItemDelegate:setModelData( pEditor, pModel, pIndex ) + RETURN Qt_QItemDelegate_setModelData( ::pPtr, hbqt_ptr( pEditor ), hbqt_ptr( pModel ), hbqt_ptr( pIndex ) ) + + +METHOD QItemDelegate:sizeHint( pOption, pIndex ) + RETURN Qt_QItemDelegate_sizeHint( ::pPtr, hbqt_ptr( pOption ), hbqt_ptr( pIndex ) ) + + +METHOD QItemDelegate:updateEditorGeometry( pEditor, pOption, pIndex ) + RETURN Qt_QItemDelegate_updateEditorGeometry( ::pPtr, hbqt_ptr( pEditor ), hbqt_ptr( pOption ), hbqt_ptr( pIndex ) ) + diff --git a/harbour/contrib/hbqt/qtgui/TQItemEditorCreator.prg b/harbour/contrib/hbqt/qtgui/TQItemEditorCreator.prg new file mode 100644 index 0000000000..781d5f8d01 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQItemEditorCreator.prg @@ -0,0 +1,91 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 QItemEditorCreator INHERIT HbQtObjectHandler, QItemEditorCreatorBase + + METHOD new( ... ) + + METHOD createWidget( pParent ) + METHOD valuePropertyName() + + ENDCLASS + + +METHOD QItemEditorCreator:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QItemEditorCreator( ... ) + RETURN Self + + +METHOD QItemEditorCreator:createWidget( pParent ) + RETURN Qt_QItemEditorCreator_createWidget( ::pPtr, hbqt_ptr( pParent ) ) + + +METHOD QItemEditorCreator:valuePropertyName() + RETURN Qt_QItemEditorCreator_valuePropertyName( ::pPtr ) + diff --git a/harbour/contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg b/harbour/contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg new file mode 100644 index 0000000000..289c77b47e --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQItemEditorCreatorBase.prg @@ -0,0 +1,91 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 QItemEditorCreatorBase INHERIT HbQtObjectHandler + + METHOD new( ... ) + + METHOD createWidget( pParent ) + METHOD valuePropertyName() + + ENDCLASS + + +METHOD QItemEditorCreatorBase:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QItemEditorCreatorBase( ... ) + RETURN Self + + +METHOD QItemEditorCreatorBase:createWidget( pParent ) + RETURN Qt_QItemEditorCreatorBase_createWidget( ::pPtr, hbqt_ptr( pParent ) ) + + +METHOD QItemEditorCreatorBase:valuePropertyName() + RETURN Qt_QItemEditorCreatorBase_valuePropertyName( ::pPtr ) + diff --git a/harbour/contrib/hbqt/qtgui/TQItemEditorFactory.prg b/harbour/contrib/hbqt/qtgui/TQItemEditorFactory.prg new file mode 100644 index 0000000000..910d32d75c --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQItemEditorFactory.prg @@ -0,0 +1,101 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://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 QItemEditorFactory INHERIT HbQtObjectHandler + + METHOD new( ... ) + + METHOD createEditor( nType, pParent ) + METHOD registerEditor( nType, pCreator ) + METHOD valuePropertyName( nType ) + METHOD setDefaultFactory( pFactory ) + + ENDCLASS + + +METHOD QItemEditorFactory:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QItemEditorFactory( ... ) + RETURN Self + + +METHOD QItemEditorFactory:createEditor( nType, pParent ) + RETURN Qt_QItemEditorFactory_createEditor( ::pPtr, nType, hbqt_ptr( pParent ) ) + + +METHOD QItemEditorFactory:registerEditor( nType, pCreator ) + RETURN Qt_QItemEditorFactory_registerEditor( ::pPtr, nType, hbqt_ptr( pCreator ) ) + + +METHOD QItemEditorFactory:valuePropertyName( nType ) + RETURN Qt_QItemEditorFactory_valuePropertyName( ::pPtr, nType ) + + +METHOD QItemEditorFactory:setDefaultFactory( pFactory ) + RETURN Qt_QItemEditorFactory_setDefaultFactory( ::pPtr, hbqt_ptr( pFactory ) ) + diff --git a/harbour/contrib/hbqt/qtgui/filelist.mk b/harbour/contrib/hbqt/qtgui/filelist.mk index e014213052..1e4e2d7593 100644 --- a/harbour/contrib/hbqt/qtgui/filelist.mk +++ b/harbour/contrib/hbqt/qtgui/filelist.mk @@ -83,6 +83,9 @@ CPP_SOURCES := \ QImageWriter.cpp \ QInputDialog.cpp \ QInputEvent.cpp \ + QItemDelegate.cpp \ + QItemEditorCreatorBase.cpp \ + QItemEditorFactory.cpp \ QItemSelection.cpp \ QItemSelectionModel.cpp \ QKeyEvent.cpp \ @@ -306,6 +309,9 @@ PRG_SOURCES := \ TQImageWriter.prg \ TQInputDialog.prg \ TQInputEvent.prg \ + TQItemDelegate.prg \ + TQItemEditorCreatorBase.prg \ + TQItemEditorFactory.prg \ TQItemSelection.prg \ TQItemSelectionModel.prg \ TQKeyEvent.prg \ diff --git a/harbour/contrib/hbqt/qth/QItemDelegate.qth b/harbour/contrib/hbqt/qth/QItemDelegate.qth new file mode 100644 index 0000000000..9ca226bd0d --- /dev/null +++ b/harbour/contrib/hbqt/qth/QItemDelegate.qth @@ -0,0 +1,116 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * 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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = +Inherits = QAbstractItemDelegate +Type = +New = + + + + + + + + + +#include + + +/* QItemDelegate ( QObject * parent = 0 ) + * ~QItemDelegate () + * + */ +HB_FUNC( QT_QITEMDELEGATE ) +{ + if( HB_ISPOINTER( 1 ) ) + { + hb_retptr( new QItemDelegate( hbqt_par_QObject( 1 ) ) ); + } + else + { + hb_retptr( new QItemDelegate() ); + } +} + + + +enum EndEditHint { NoHint, EditNextItem, EditPreviousItem, SubmitModelCache, RevertModelCache } + + + +bool hasClipping () const +QItemEditorFactory * itemEditorFactory () const +void setClipping ( bool clip ) +void setItemEditorFactory ( QItemEditorFactory * factory ) + +virtual QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const +virtual void paint ( QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index ) const +virtual void setEditorData ( QWidget * editor, const QModelIndex & index ) const +virtual void setModelData ( QWidget * editor, QAbstractItemModel * model, const QModelIndex & index ) const +virtual QSize sizeHint ( const QStyleOptionViewItem & option, const QModelIndex & index ) const +virtual void updateEditorGeometry ( QWidget * editor, const QStyleOptionViewItem & option, const QModelIndex & index ) const + + + + + + +void closeEditor ( QWidget * editor, QAbstractItemDelegate::EndEditHint hint = NoHint ) +void commitData ( QWidget * editor ) +void sizeHintChanged ( const QModelIndex & index ) + diff --git a/harbour/contrib/hbqt/qth/QItemEditorCreator.qth b/harbour/contrib/hbqt/qth/QItemEditorCreator.qth new file mode 100644 index 0000000000..077fc52d0f --- /dev/null +++ b/harbour/contrib/hbqt/qth/QItemEditorCreator.qth @@ -0,0 +1,96 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * 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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = +Inherits = QItemEditorCreatorBase +Type = +New = + + + + + + + + + +#include + + +/* + * QItemEditorCreator ( const QByteArray & valuePropertyName ) + * + */ +HB_FUNC( QT_QITEMEDITORCREATOR ) +{ +// hb_retptr( new QItemEditorCreator( hbqt_par_QByteArray( 1 ) ) ); +} + + + + + + +virtual QWidget * createWidget ( QWidget * parent ) const +virtual QByteArray valuePropertyName () const + + + + + + + diff --git a/harbour/contrib/hbqt/qth/QItemEditorCreatorBase.qth b/harbour/contrib/hbqt/qth/QItemEditorCreatorBase.qth new file mode 100644 index 0000000000..59acd43e55 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QItemEditorCreatorBase.qth @@ -0,0 +1,96 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * 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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = no +Inherits = +Type = +New = + + + + + + + + + +#include + + +/* + * virtual ~QItemEditorCreatorBase () + * + */ +HB_FUNC( QT_QITEMEDITORCREATORBASE ) +{ + +} + + + + + + +virtual QWidget * createWidget ( QWidget * parent ) const = 0 +virtual QByteArray valuePropertyName () const = 0 + + + + + + + diff --git a/harbour/contrib/hbqt/qth/QItemEditorFactory.qth b/harbour/contrib/hbqt/qth/QItemEditorFactory.qth new file mode 100644 index 0000000000..7f863ba210 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QItemEditorFactory.qth @@ -0,0 +1,108 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * 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. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = no +Inherits = +Type = +New = + + + + + + + + + +#include + + +/* + * QItemEditorFactory () + * virtual ~QItemEditorFactory () + * + */ +HB_FUNC( QT_QITEMEDITORFACTORY ) +{ + if( HB_ISPOINTER( 1 ) ) + { + hb_retptr( new QItemEditorFactory() ); + } + else + { + hb_retptr( new QItemEditorFactory( *hbqt_par_QItemEditorFactory( 1 ) ) ); + } +} + + + + + + +virtual QWidget * createEditor ( QVariant::Type type, QWidget * parent ) const +void registerEditor ( QVariant::Type type, QItemEditorCreatorBase * creator ) +virtual QByteArray valuePropertyName ( QVariant::Type type ) const + +//const QItemEditorFactory * defaultFactory () +void setDefaultFactory ( QItemEditorFactory * factory ) + + + + + + +