Changeset 186 for trunk/src


Ignore:
Timestamp:
Sep 16, 2009, 11:12:02 PM (16 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: Enabled actual enforcing min/max Qt widget constraints for top-level windows.

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

Legend:

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

    r185 r186  
    126126    QWidgetData *dataPtr() { return data; }
    127127    QWidgetPrivate *dptr() { return d_func(); }
    128 //  QRect frameStrut() const { return d_func()->frameStrut(); }
     128    QRect frameStrut() const { return d_func()->frameStrut(); }
    129129    bool        pmEvent(QMSG *m, MRESULT *r) { return QWidget::pmEvent(m, r); }
    130130//  void        markFrameStrutDirty() { data->fstrut_dirty = 1; }
     
    917917#endif
    918918
     919        MRESULT rc = (MRESULT) FALSE;
     920
    919921        HWND hwndC = WinWindowFromID(hwnd, FID_CLIENT);
    920922        QETWidget *widget = (QETWidget*)QWidget::find(hwndC);
     
    947949            if (widget->translateConfigEvent(qmsg))
    948950                return (MRESULT)TRUE;
     951            break;
     952        }
     953
     954        case WM_QUERYTRACKINFO: {
     955            QWExtra *x = widget->xtra();
     956            if (x) {
     957                rc = QtOldFrameProc(hwnd, msg, mp1, mp2);
     958                PTRACKINFO pti = (PTRACKINFO) mp2;
     959                int minw = 0, minh = 0;
     960                int maxw = QWIDGETSIZE_MAX, maxh = QWIDGETSIZE_MAX;
     961                QRect fs = widget->frameStrut();
     962                if (x->minw > 0)
     963                    minw = x->minw + fs.left() + fs.right();
     964                if (x->minh > 0)
     965                    minh = x->minh + fs.top() + fs.bottom();
     966                if (x->maxw < QWIDGETSIZE_MAX)
     967                    maxw = x->maxw >= x->minw ? x->maxw : x->minw + fs.left() + fs.right();
     968                if (x->maxh < QWIDGETSIZE_MAX)
     969                    maxh = x->maxh >= x->minh ? x->maxh : x->minh + fs.top() + fs.bottom();
     970                // obey system recommended minimum size (to emulate Qt/Win32)
     971                pti->ptlMinTrackSize.x = qMax<LONG>(minw, pti->ptlMinTrackSize.x);
     972                pti->ptlMinTrackSize.y = qMax<LONG>(minh, pti->ptlMinTrackSize.y);
     973                // we assume that PM doesn't restrict the maximum size by default
     974                // and use it as an absolute maximum (values above it will cause
     975                // PM to disable window sizing and moving for some reason)
     976                pti->ptlMaxTrackSize.x = qMin<LONG>(maxw, pti->ptlMaxTrackSize.x);
     977                pti->ptlMaxTrackSize.y = qMin<LONG>(maxh, pti->ptlMaxTrackSize.y);
     978                return rc;
     979            }
    949980            break;
    950981        }
  • trunk/src/gui/kernel/qwidget_pm.cpp

    r184 r186  
    21962196void QWidgetPrivate::setConstraints_sys()
    21972197{
    2198     // @todo implement
     2198    // @todo is there a way to show/hide the Maximize button according to
     2199    // the shouldShowMaximizeButton() return value?
    21992200}
    22002201
Note: See TracChangeset for help on using the changeset viewer.