75
76
void doFlash(bool on);
76
77
void posChanging(int *x, int *y, int *width, int *height);
78
void moveEvent(QMoveEvent *e);
79
81
QTimer *flashTimer;
83
86
void flashAnimate();
87
void updateGeometry();
86
90
int GAdvancedWidget::Private::stickAt = 5;
117
121
bool resizing = p->frameSize() != QSize(*width, *height);
120
123
QDesktopWidget *desktop = qApp->desktop();
123
126
if ( stickToWindows )
124
127
list = QApplication::topLevelWidgets();
126
list = new QWidgetList();
127
list->append( desktop );
129
QWidgetListIt it( *list );
130
for ( ; (w = it.current()); ++it ) {
129
foreach(QWidget *w, list) {
132
131
bool dockWidget = false;
134
if ( w->isDesktop() )
133
if ( w->windowType() == Qt::Desktop )
135
134
rect = ((QDesktopWidget *)w)->availableGeometry((QWidget *)parent());
236
233
bool GAdvancedWidget::Private::flashing()
235
return flashTimer && flashCount & 1;
238
void GAdvancedWidget::Private::moveEvent(QMoveEvent *)
240
if (!parentWidget->isTopLevel())
243
QRect r = qApp->desktop()->availableGeometry(parentWidget);
244
QRect g = parentWidget->frameGeometry();
248
if (g.top() < r.top())
249
g.moveTo(g.x(), r.top());
251
if (g.right() < r.left() + margin)
252
g.moveTo(r.left() + margin - g.width(), g.y());
254
if (g.left() > r.right() - margin)
255
g.moveTo(r.right() - margin, g.y());
257
if (g.top() > r.bottom() - margin)
258
g.moveTo(g.x(), r.bottom() - margin);
261
QTimer::singleShot(0, this, SLOT(updateGeometry()));
265
void GAdvancedWidget::Private::updateGeometry()
267
QWidget *w = (QWidget *)parent();
268
w->move(newGeometry.topLeft());
245
271
//----------------------------------------------------------------------------
246
272
// GAdvancedWidget
247
273
//----------------------------------------------------------------------------
249
GAdvancedWidget::GAdvancedWidget(QWidget *parent, const char *name)
250
: QObject(parent, name)
275
GAdvancedWidget::GAdvancedWidget(QWidget *parent)
252
278
d = new Private(parent);
255
GAdvancedWidget::~GAdvancedWidget()
261
282
bool GAdvancedWidget::winEvent(MSG *msg)
312
void GAdvancedWidget::restoreSavedGeometry(QRect savedGeometry)
314
QRect geom = savedGeometry;
315
QDesktopWidget *pdesktop = QApplication::desktop();
316
int nscreen = pdesktop->screenNumber(geom.topLeft());
317
QRect r = pdesktop->screenGeometry(nscreen);
319
// if the coordinates are out of the desktop bounds, reset to the top left
321
if((geom.width() + pad * 2) > r.width())
322
geom.setWidth(r.width() - pad * 2);
323
if((geom.height() + pad * 2) > r.height())
324
geom.setHeight(r.height() - pad * 2);
325
if(geom.left() < r.left())
326
geom.moveLeft(r.left());
327
if(geom.right() >= r.right())
328
geom.moveRight(r.right() - 1);
329
if(geom.top() < r.top())
330
geom.moveTop(r.top());
331
if(geom.bottom() >= r.bottom())
332
geom.moveBottom(r.bottom() - 1);
334
d->parentWidget->move(geom.topLeft());
335
d->parentWidget->resize(geom.size());
291
338
void GAdvancedWidget::doFlash(bool on)
293
340
d->doFlash( on );