class QETWidget : public QWidget // event translator widget
{
public:
- QWidgetPrivate* d_func() { return QWidget::d_func(); }
+ inline QWidgetPrivate* d_func() { return QWidget::d_func(); }
bool translateMouseEvent(const XEvent *);
void translatePaintEvent(const XEvent *);
bool translateConfigEvent(const XEvent *);
** $QT_END_LICENSE$
**
****************************************************************************/
-#ifdef Q_WS_MAC
-# include <qcore_mac_p.h>
-#endif
#include <qapplication.h>
#include <qdesktopwidget.h>
#include <qbasictimer.h>
#ifndef QT_NO_TOOLTIP
-#ifdef Q_WS_MAC
-# include <qcore_mac_p.h>
-#include <qt_cocoa_helpers_mac_p.h>
-#endif
-
QT_BEGIN_NAMESPACE
/*!
#endif //QT_NO_STYLE_STYLESHEET
const QRect screen = QApplication::desktop()->screenGeometry(getTipScreen(pos, w));
-
- QPoint p = pos;
- p += QPoint(2,
-#ifdef Q_WS_WIN
- 21
-#else
- 16
-#endif
- );
+ QPoint p = pos + QPoint(2, 16);
if (p.x() + this->width() > screen.x() + screen.width())
p.rx() -= 4 + this->width();
if (p.y() + this->height() > screen.y() + screen.height())
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#if defined(Q_WS_WIN)
-#include "qt_windows.h"
-#ifndef SPI_GETDROPSHADOW
-#define SPI_GETDROPSHADOW 0x1024
-#endif
-#endif
#if defined(Q_WS_X11)
#include "qx11info_x11.h"
#include <qwidget.h>
+ Qt::TextWordWrap + Qt::TextExpandTabs,
text);
}
-#if defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
- {
- BOOL shadow;
- SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
- shadowWidth = shadow ? 0 : 6;
- }
-#endif
resize(r.width() + 2*hMargin + shadowWidth, r.height() + 2*vMargin + shadowWidth);
}
void QWhatsThat::paintEvent(QPaintEvent*)
{
- bool drawShadow = true;
-#if defined(Q_WS_WIN)
- if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP
- && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
- {
- BOOL shadow;
- SystemParametersInfo(SPI_GETDROPSHADOW, 0, &shadow, 0);
- drawShadow = !shadow;
- }
-#elif defined(Q_WS_MAC)
- drawShadow = false; // never draw it on OS X, as we get it for free
-#endif
-
QRect r = rect();
r.adjust(0, 0, -1, -1);
- if (drawShadow)
- r.adjust(0, 0, -shadowWidth, -shadowWidth);
+ r.adjust(0, 0, -shadowWidth, -shadowWidth);
QPainter p(this);
p.drawPixmap(0, 0, background);
p.setPen(QPen(palette().toolTipText(), 0));
int h = r.height();
p.setPen(palette().brush(QPalette::Dark).color());
p.drawRect(1, 1, w-2, h-2);
- if (drawShadow) {
- p.setPen(palette().shadow().color());
- p.drawPoint(w + 5, 6);
- p.drawLine(w + 3, 6, w + 5, 8);
- p.drawLine(w + 1, 6, w + 5, 10);
- int i;
- for(i=7; i < h; i += 2)
- p.drawLine(w, i, w + 5, i + 5);
- for(i = w - i + h; i > 6; i -= 2)
- p.drawLine(i, h, i + 5, h + 5);
- for(; i > 0 ; i -= 2)
- p.drawLine(6, h + 6 - i, i + 5, h + 5);
- }
+
+ // draw shadow
+ p.setPen(palette().shadow().color());
+ p.drawPoint(w + 5, 6);
+ p.drawLine(w + 3, 6, w + 5, 8);
+ p.drawLine(w + 1, 6, w + 5, 10);
+ int i;
+ for(i=7; i < h; i += 2)
+ p.drawLine(w, i, w + 5, i + 5);
+ for(i = w - i + h; i > 6; i -= 2)
+ p.drawLine(i, h, i + 5, h + 5);
+ for(; i > 0 ; i -= 2)
+ p.drawLine(6, h + 6 - i, i + 5, h + 5);
+
r.adjust(0, 0, 1, 1);
p.setPen(palette().toolTipText().color());
r.adjust(hMargin, vMargin, -hMargin, -vMargin);
d->topData()->backingStore.create(this);
}
- d->setModal_sys();
-
if (!isWindow() && parentWidget() && parentWidget()->testAttribute(Qt::WA_DropSiteRegistered))
setAttribute(Qt::WA_DropSiteRegistered, true);
ungrabGesture(type);
#endif
- // force acceptDrops false before winId is destroyed.
- d->registerDropSite(false);
-
#ifndef QT_NO_ACTION
// remove all actions from this widget
for (int i = 0; i < d->actions.size(); ++i) {
#ifndef QT_NO_CURSOR
delete extra->curs;
#endif
- deleteSysExtra();
#ifndef QT_NO_STYLE_STYLESHEET
// dereference the stylesheet style
if (QStyleSheetStyle *proxy = qobject_cast<QStyleSheetStyle *>(extra->style))
void QWidget::setWindowModality(Qt::WindowModality windowModality)
{
data->window_modality = windowModality;
- // setModal_sys() will be called by setAttribute()
setAttribute(Qt::WA_ShowModal, (data->window_modality != Qt::NonModal));
setAttribute(Qt::WA_SetWindowModality, true);
}
break;
}
case Qt::WA_DropSiteRegistered: {
- d->registerDropSite(on);
for (int i = 0; i < d->children.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(d->children.at(i));
if (w && !w->isWindow() && !w->testAttribute(Qt::WA_AcceptDrops) && w->testAttribute(Qt::WA_DropSiteRegistered) != on)
// QApplicationPrivate::enterModal(this) here. The window must be
// hidden before changing modality.
}
- if (testAttribute(Qt::WA_WState_Created)) {
- // don't call setModal_sys() before create_sys()
- d->setModal_sys();
- }
break;
case Qt::WA_MouseTracking: {
QEvent e(QEvent::MouseTrackingChange);
void createExtra();
void deleteExtra();
void createSysExtra();
- void deleteSysExtra();
void createTLSysExtra();
void deleteTLSysExtra();
void updateSystemBackground();
void _q_showIfNotHidden();
void setEnabled_helper(bool);
- void registerDropSite(bool);
static void adjustFlags(Qt::WindowFlags &flags, QWidget *w = 0);
void updateFrameStrut();
return w;
}
- void setModal_sys();
-
// This is an helper function that return the available geometry for
// a widget and takes care is this one is in QGraphicsView.
// If the widget is not embed in a scene then the geometry available is
false, (SubstructureNotifyMask | SubstructureRedirectMask), &e);
}
-struct QX11WindowAttributes {
- const XWindowAttributes *att;
-};
-
-void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const XWindowAttributes &a)
-{
- QX11WindowAttributes att;
- att.att = &a;
- qt_x11_getX11InfoForWindow(xinfo,att);
-}
-
-
static QVector<Atom> getNetWmState(QWidget *w)
{
QVector<Atom> returnValue;
else
q->setAttribute(Qt::WA_WState_Visible);
- qt_x11_getX11InfoForWindow(&xinfo,a);
+ QX11InfoData* xd = xinfo.getX11Data(true);
+ // find which screen the window is on...
+ xd->screen = QX11Info::appScreen(); // by default, use the default :)
+ int i;
+ for (i = 0; i < ScreenCount(X11->display); i++) {
+ if (RootWindow(X11->display, i) == a.root) {
+ xd->screen = i;
+ break;
+ }
+ }
+
+ xd->depth = a.depth;
+ xd->cells = DisplayCells(X11->display, xd->screen);
+ xd->visual = a.visual;
+ xd->defaultVisual = (XVisualIDFromVisual((Visual *) a.visual) ==
+ XVisualIDFromVisual((Visual *) QX11Info::appVisual(scr)));
+ xd->colormap = a.colormap;
+ xd->defaultColormap = (a.colormap == QX11Info::appColormap(scr));
+ xinfo.setX11Data(xd);
} else if (desktop) { // desktop widget
#ifdef QWIDGET_EXTRA_DEBUG
extra->xDndProxy = 0;
}
-void QWidgetPrivate::deleteSysExtra()
-{
-}
-
void QWidgetPrivate::createTLSysExtra()
{
extra->topextra->spont_unmapped = 0;
#endif
}
-void QWidgetPrivate::registerDropSite(bool on)
-{
- Q_UNUSED(on);
-}
-
void QWidgetPrivate::setMask_sys(const QRegion ®ion)
{
Q_Q(QWidget);
}
#endif
-void QWidgetPrivate::setModal_sys()
-{
-}
-
-void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &att)
-{
- QX11InfoData* xd = xinfo->getX11Data(true);
- const XWindowAttributes &a = *(att.att);
- // find which screen the window is on...
- xd->screen = QX11Info::appScreen(); // by default, use the default :)
- int i;
- for (i = 0; i < ScreenCount(X11->display); i++) {
- if (RootWindow(X11->display, i) == a.root) {
- xd->screen = i;
- break;
- }
- }
-
- xd->depth = a.depth;
- xd->cells = DisplayCells(X11->display, xd->screen);
- xd->visual = a.visual;
- xd->defaultVisual = (XVisualIDFromVisual((Visual *) a.visual) ==
- XVisualIDFromVisual((Visual *) QX11Info::appVisual(xinfo->screen())));
- xd->colormap = a.colormap;
- xd->defaultColormap = (a.colormap == QX11Info::appColormap(xinfo->screen()));
- xinfo->setX11Data(xd);
-}
-
void QWidgetPrivate::updateX11AcceptFocus()
{
Q_Q(QWidget);
#include <QtCore/qobjectdefs.h>
#include <QtCore/qnamespace.h>
+// Window system dependent definitions
+
+#if defined(Q_WS_X11)
+
+typedef struct _XDisplay Display;
+typedef union _XEvent XEvent;
+typedef struct _XGC *GC;
+typedef struct _XRegion *Region;
+typedef unsigned long WId;
+
+#endif // Q_WS_X11
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-
// Class forward definitions
class QPaintDevice;
template<typename T> class QList;
typedef QList<QWidget *> QWidgetList;
-QT_END_NAMESPACE
-QT_END_HEADER
-
-// Window system dependent definitions
-
-#if defined(Q_WS_X11)
-
-typedef struct _XDisplay Display;
-typedef union _XEvent XEvent;
-typedef struct _XGC *GC;
-typedef struct _XRegion *Region;
-typedef unsigned long WId;
-
-#endif // Q_WS_X11
-
-QT_BEGIN_HEADER
-QT_BEGIN_NAMESPACE
-
template<class K, class V> class QHash;
typedef QHash<WId, QWidget *> QWidgetMapper;
QT_END_NAMESPACE
QT_END_HEADER
-#if defined(QT_NEEDS_QMAIN)
-#define main qMain
-#endif
-
-// Global platform-independent types and functions
-
#endif // QWINDOWDEFS_H
class QPaintDevice;
class QApplicationPrivate;
class QX11InfoPrivate;
-struct QX11WindowAttributes;
-void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a);
class Q_GUI_EXPORT QX11Info
{
public:
friend void qt_init(QApplicationPrivate *priv, int, Display *display, Qt::HANDLE visual,
Qt::HANDLE colormap);
friend void qt_cleanup();
- friend void qt_x11_getX11InfoForWindow(QX11Info * xinfo, const QX11WindowAttributes &a);
};
QT_END_NAMESPACE
return;
}
QWidget::timerEvent(event);
- return;
}
/*!
void titleBarDoubleClicked();
protected:
- void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void childEvent(QChildEvent*);
void resizeEvent(QResizeEvent *);
widgetResizeHandler->doMove();
}
-void QWorkspaceChild::enterEvent(QEvent *)
-{
-}
-
void QWorkspaceChild::leaveEvent(QEvent *)
{
#ifndef QT_NO_CURSOR