Changeset 134


Ignore:
Timestamp:
Aug 27, 2009, 2:02:17 AM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Implemented QDesktopWidget.

Location:
trunk/src/gui/kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/kernel/qapplication_pm.cpp

    r133 r134  
    519519
    520520        switch(msg) {
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
     539
     540
     541
     542
     543
    521544
    522545        case WM_BUTTON1DOWN:
  • trunk/src/gui/kernel/qdesktopwidget_pm.cpp

    r95 r134  
    4747#include "qwidget_p.h"
    4848
     49
     50
    4951QT_BEGIN_NAMESPACE
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
    5073
    5174class QDesktopWidgetPrivate : public QWidgetPrivate
    5275{
    5376public:
     77
    5478};
    5579
     
    7195QDesktopWidget::QDesktopWidget()
    7296    : QWidget(*new QDesktopWidgetPrivate, 0, Qt::Desktop)
    73   {
     97{
    7498    setObjectName(QLatin1String("desktop"));
    75     // @todo implement
    7699}
    77100
     
    87110int QDesktopWidget::primaryScreen() const
    88111{
    89     // @todo implement
    90112    return 0;
    91113}
     
    93115int QDesktopWidget::numScreens() const
    94116{
    95     // @todo implement
    96     return 0;
     117    return 1;
    97118}
    98119
     
    105126const QRect QDesktopWidget::availableGeometry(int screen) const
    106127{
    107     // @todo implement
    108     return QRect();
     128    Q_D(const QDesktopWidget);
     129
     130    if (!d->workArea.isValid())
     131        const_cast<QDesktopWidget *>(this)->resizeEvent(0);
     132    if (d->workArea.isValid())
     133        return d->workArea;
     134
     135    return geometry();
    109136}
    110137
    111138const QRect QDesktopWidget::screenGeometry(int screen) const
    112139{
    113     // @todo implement
    114     return QRect();
     140    return geometry();
    115141}
    116142
    117 int QDesktopWidget::screenNumber(const QWidget *widget) const
     143int QDesktopWidget::screenNumber(const QWidget *) const
    118144{
    119     // @todo implement
    120145    return 0;
    121146}
    122147
    123 int QDesktopWidget::screenNumber(const QPoint &point) const
     148int QDesktopWidget::screenNumber(const QPoint &) const
    124149{
    125     // @todo implement
    126150    return 0;
    127151}
    128152
    129 void QDesktopWidget::resizeEvent(QResizeEvent *)
     153void QDesktopWidget::resizeEvent(QResizeEvent *)
    130154{
    131     // @todo implement
     155    Q_D(QDesktopWidget);
     156
     157    if (e == 0) {
     158        // this is a Work Area Changed notification, see WM_SYSVALUECHANGED
     159        // in qapplication_pm.cpp
     160        typedef
     161        BOOL (APIENTRY *WinQueryDesktopWorkArea_T) (HWND hwndDesktop,
     162                                                    PRECTL pwrcWorkArea);
     163        static WinQueryDesktopWorkArea_T WinQueryDesktopWorkArea =
     164            (WinQueryDesktopWorkArea_T) ~0;
     165
     166        if ((ULONG) WinQueryDesktopWorkArea == (ULONG) ~0) {
     167            if (qt_DosQueryProcAddr("PMMERGE", 5469,
     168                                    (PFN *) &WinQueryDesktopWorkArea))
     169                WinQueryDesktopWorkArea = NULL;
     170        }
     171
     172        if (WinQueryDesktopWorkArea) {
     173            RECTL rcl;
     174            if (WinQueryDesktopWorkArea(HWND_DESKTOP, &rcl)) {
     175                // flip y coordinates
     176                d->workArea.setCoords(rcl.xLeft, height() - rcl.yTop,
     177                                      rcl.xRight - 1,
     178                                      height() - (rcl.yBottom + 1));
     179            }
     180        }
     181
     182        emit workAreaResized(0);
     183        return;
     184    }
     185
     186    // otherwise nothing to do, the desktop cannot be dynamically resized
     187    // on OS/2
    132188}
    133189
Note: See TracChangeset for help on using the changeset viewer.