00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <KDGanttViewItemDrag.h>
00034 #include <KDGanttViewItem.h>
00035 #include <tqpixmap.h>
00036 #include <KDGanttView.h>
00037
00057 KDGanttViewItemDrag::KDGanttViewItemDrag( KDGanttViewItem* item , TQWidget *source, const char * name ) : TQStoredDrag("x-application/x-KDGanttViewItemDrag", source, name )
00058 {
00059 myItem = item;
00060
00061 TQPixmap pix;
00062 if (item->pixmap() )
00063 pix = *(item->pixmap()) ;
00064 else {
00065 KDGanttViewItem::Shape start, middle, end;
00066 item->shapes( start, middle, end );
00067 TQColor st, mi, en;
00068 item->colors( st, mi, en );
00069 pix =item->myGanttView->getPixmap( start, st, item->myGanttView->lvBackgroundColor(), 11 );
00070 }
00071 setPixmap( pix , TQPoint( -10,-10 ));
00072 TQDomDocument doc( "GanttView" );
00073 TQString docstart = "<GanttView/>";
00074 doc.setContent( docstart );
00075 TQDomElement itemsElement = doc.createElement( "Items" );
00076 doc.documentElement().appendChild( itemsElement );
00077 item->createNode( doc, itemsElement );
00078 TQDataStream s( array, IO_WriteOnly );
00079 s << doc.toString();
00080 }
00081
00082
00089 TQByteArray KDGanttViewItemDrag::encodedData( const char * c) const
00090 {
00091 TQString s ( c );
00092 if ( s == "x-application/x-KDGanttViewItemDrag" ) {
00093 return array;
00094 }
00095 return TQByteArray();
00096 }
00097
00103 KDGanttViewItem* KDGanttViewItemDrag::getItem()
00104 {
00105 return myItem;
00106 }
00107
00108
00115 bool KDGanttViewItemDrag::canDecode ( const TQMimeSource * e )
00116 {
00117 if ( TQString( e->format() ) == "x-application/x-KDGanttViewItemDrag" )
00118 return true;
00119
00120 return false;
00121 }
00122
00123
00132 bool KDGanttViewItemDrag::decode ( const TQMimeSource * e , TQString & string)
00133 {
00134 TQByteArray arr;
00135 arr = e->encodedData( "x-application/x-KDGanttViewItemDrag");
00136 TQDataStream s( arr, IO_ReadOnly );
00137 s >> string;
00138 return true;
00139 }
00140