Changeset 1015 for tests


Ignore:
Timestamp:
Aug 20, 2011, 9:59:19 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

tests: embedded: Use case qt_WinProcessWindowObstacles().

And also added direct painting code for Windows.

Location:
tests/embedded
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • tests/embedded/embedded.cpp

    r1010 r1015  
    1 #ifdef __OS2__
    2 #include <os2.h>
    3 #endif
    4 
    51#include <QDebug>
    62#include <QtGui>
     3
     4#ifdef Q_WS_PM
     5#include <qt_os2.h>
     6#endif
     7
     8#ifdef Q_WS_WIN
     9#include <qt_windows.h>
     10#endif
    711
    812class VideoWidget : public QFrame
     
    3135
    3236        WId id = stable->winId();
     37#ifdef Q_WS_PM
    3338        qDebug() << "stable id" << qDebugHWND (id);
     39#else
     40        qDebug() << "stable id" << id;
     41#endif
    3442        return id;
    3543    }
     
    9098
    9199        bgWidget = new QLabel ("Background");
     100        bgWidget->setAutoFillBackground (true);
    92101        stackCentralW->addWidget (bgWidget);
    93102
     
    107116        if (tickCount == 5)
    108117            resize (800, 600);
    109 #ifdef __OS2__
     118
     119#ifdef Q_WS_PM
    110120        if (id)
    111121        {
    112122            qDebug() << "window handle" << qDebugFmtHex (id);
    113123            HWND hwnd = id;
     124            RECTL rcl;
     125            WinQueryWindowRect (hwnd, &rcl);
    114126            HPS hps = WinGetPS (hwnd);
    115127            if (hps)
    116128            {
    117                 RECTL rcl;
    118 //                WinQueryWindowRect (hwnd, &rcl);
     129                HRGN hrgn = GpiCreateRegion(hps, 1L, &rcl);
     130                ULONG rc = qt_WinProcessWindowObstacles (hwnd, NULL, hrgn, CRGN_DIFF, PWO_Default);
     131
     132                HRGN hrgnOld;
     133                GpiSetClipRegion (hps, hrgn, &hrgnOld);
    119134
    120135                rcl.xLeft = 0;
     
    127142                WinDrawBorder (hps, &rcl, 3, 3, CLR_RED, CLR_DARKGREEN, DB_INTERIOR);
    128143
     144                GpiDestroyRegion (hps, hrgnOld);
     145
    129146                WinReleasePS (hps);
    130147            }
     148        }
     149#endif
     150#ifdef Q_WS_WIN
     151        if (id)
     152        {
     153            qDebug() << "window handle" << id;
     154            HDC hdc = GetDC (id);
     155            RECT rect;
     156            rect.left = 0;
     157            rect.top = 0;
     158            rect.right = videoWidget->size().width();
     159            rect.bottom = videoWidget->size().height();
     160            SetDCBrushColor (hdc, RGB (0x00, 0x80, 0x00));
     161            FillRect (hdc, &rect, (HBRUSH) GetStockObject (DC_BRUSH));
     162            SetDCBrushColor (hdc, RGB (0xFF, 0x00, 0x00));
     163            FrameRect (hdc, &rect, (HBRUSH) GetStockObject (DC_BRUSH));
     164            ReleaseDC (id, hdc);
    131165        }
    132166#endif
  • tests/embedded/embedded.pro

    r1003 r1015  
    88
    99RUN_ARGS = -style windows
     10
     11win32:LIBS += user32.lib gdi32.lib
Note: See TracChangeset for help on using the changeset viewer.