21#include <tqobjectlist.h>
27#include "kexireportform.h"
29KexiReportForm::KexiReportForm(TQWidget *parent, const char *name)
30 : TQWidget(parent, name)
33 kexipluginsdbg << "KexiReportForm::KexiReportForm(): " << endl;
34 setCursor(TQCursor(TQt::ArrowCursor));
35 setBackgroundColor(white);
38KexiReportForm::~KexiReportForm()
40 kexipluginsdbg << "KexiReportForm::~KexiReportForm(): close" << endl;
44static void repaintAll(TQWidget *w)
46 TQObjectList *list = w->queryList( "TQWidget");
47 TQObjectListIt it(*list);
48 for (TQObject *obj; (obj=it.current()); ++it ) {
49 static_cast<TQWidget* >(obj)->repaint();
55KexiReportForm::drawRect( const TQRect& r, int type)
57 TQValueList<TQRect> l;
67 bool unclipped = testWFlags( WPaintUnclipped );
68 setWFlags( WPaintUnclipped );
70 if (prev_rect.isValid()) {
72 p.drawPixmap( TQPoint(prev_rect.x()-2, prev_rect.y()-2), buffer, TQRect(prev_rect.x()-2, prev_rect.y()-2, prev_rect.width()+4, prev_rect.height()+4));
74 p.setBrush(TQBrush::NoBrush);
76 p.setPen(TQPen(white, 1, TQt::DotLine));
78 p.setPen(TQPen(white, 2));
79 p.setRasterOp(XorROP);
82 TQValueList<TQRect>::ConstIterator endIt = list.constEnd();
83 for(TQValueList<TQRect>::ConstIterator it = list.constBegin(); it != endIt; ++it) {
85 prev_rect = prev_rect.unite(*it);
89 clearWFlags( WPaintUnclipped );
97 buffer.resize( width(), height() );
98 buffer = TQPixmap::grabWindow( winId() );
107 bool unclipped = testWFlags( WPaintUnclipped );
108 setWFlags( WPaintUnclipped );
111 p.drawPixmap( TQPoint(0,0), buffer, TQRect(0,0,buffer.width(), buffer.height()) );
114 clearWFlags( WPaintUnclipped );
123 TQPoint fromPoint, toPoint;
124 if(from && from->parentWidget() && (from != this))
125 fromPoint = from->parentWidget()->mapTo( this, from->pos());
126 if(to && to->parentWidget() && (to != this))
127 toPoint = to->parentWidget()->mapTo( this, to->pos());
131 bool unclipped = testWFlags( WPaintUnclipped );
132 setWFlags( WPaintUnclipped );
134 if (prev_rect.isValid()) {
136 p.drawPixmap( TQPoint(prev_rect.x(), prev_rect.y()), buffer, TQRect(prev_rect.x(), prev_rect.y(), prev_rect.width(), prev_rect.height()));
139 p.setPen( TQPen(TQt::red, 2) );
143 TQPixmap pix1 = TQPixmap::grabWidget(from);
144 TQPixmap pix2 = TQPixmap::grabWidget(to);
146 if((from != this) && (to != this))
147 p.drawLine( from->parentWidget()->mapTo( this, from->geometry().center()), to->parentWidget()->mapTo( this, to->geometry().center()) );
149 p.drawPixmap(fromPoint.x(), fromPoint.y(), pix1);
150 p.drawPixmap(toPoint.x(), toPoint.y(), pix2);
153 p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4);
155 p.drawRoundRect(toPoint.x(), toPoint.y(), to->width(), to->height(), 5, 5);
159 p.drawRoundRect(2, 2, width()-4, height()-4, 4, 4);
161 p.drawRoundRect(fromPoint.x(), fromPoint.y(), from->width(), from->height(), 5, 5);
163 if((to == this) || (from == this))
164 prev_rect = TQRect(0, 0, buffer.width(), buffer.height());
167 prev_rect.setX( (fromPoint.x() < toPoint.x()) ? (fromPoint.x() - 5) : (toPoint.x() - 5) );
168 prev_rect.setY( (fromPoint.y() < toPoint.y()) ? (fromPoint.y() - 5) : (toPoint.y() - 5) );
169 prev_rect.setRight( (fromPoint.x() < toPoint.x()) ? (toPoint.x() + to->width() + 10) : (fromPoint.x() + from->width() + 10) );
170 prev_rect.setBottom( (fromPoint.y() < toPoint.y()) ? (toPoint.y() + to->height() + 10) : (fromPoint.y() + from->height() + 10) ) ;
173 prev_rect = TQRect(fromPoint.x()- 5, fromPoint.y() -5, from->width() + 10, from->height() + 10);
176 clearWFlags( WPaintUnclipped );
181KexiReportForm::sizeHint() const
184 return TQSize(400,300);
187#include "kexireportform.moc"
|