Exemplo n.º 1
0
/*
 * finiPRES - finished with our presentation space
 */
static void finiPRES( WPI_PRES pres )
{
    _wpi_getoldbrush( pres, oldBrush );
    _wpi_getoldfont( pres, oldFont );
    _wpi_setbackcolour( pres, oldBkColor );
#ifdef __OS2_PM__
    GpiSetBackMix( pres, BM_LEAVEALONE );
#else
    SetTextColor( pres, oldTextColor );
#endif

} /* finiPRES */
Exemplo n.º 2
0
/*
 * initPRES - initialize our presentation space for drawing text
 */
static bool initPRES( statwnd *sw, WPI_PRES pres )
{
    if( sw->sectionDataFont == NULL ) {
        return( false );
    }
#ifdef __NT__
    oldFont = _wpi_selectfont( pres, systemDataFont );
#else
    oldFont = _wpi_selectfont( pres, sw->sectionDataFont );
#endif
    oldBrush = _wpi_selectbrush( pres, brushButtonFace );
    oldBkColor = _wpi_getbackcolour( pres );
    _wpi_setbackcolour( pres, colorButtonFace );
#ifdef __OS2_PM__
    GpiSetBackMix( pres, BM_OVERPAINT );
#else
    oldTextColor = GetTextColor( pres );
    SetTextColor( pres, colorTextFace );
#endif
    return( true );

} /* initPRES */
Exemplo n.º 3
0
static void SetText( gui_window * wnd, WPI_COLOUR fore, WPI_COLOUR back )
{
    _wpi_settextcolor( wnd->hdc, _wpi_getnearestcolor( wnd->hdc, fore ) );
    _wpi_setbackcolour( wnd->hdc, _wpi_getnearestcolor( wnd->hdc , back ) );
}
Exemplo n.º 4
0
/*
 * StatusWndCallback - handle messages for the status window
 */
WPI_MRESULT CALLBACK StatusWndCallback( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    PAINTSTRUCT ps;
    WPI_RECT    r;
    int         i;
    WPI_PRES    pres;
    statwnd     *sw;

    sw = (statwnd *)_wpi_getwindowlongptr( hwnd, classWinExtra );

    if( statusWndHookFunc != NULL ) {
        if( statusWndHookFunc( hwnd, msg, wparam, lparam ) ) {
            return( 0 );
        }
    }

    if( (msg == WM_SIZE || msg == WM_PAINT) && sw == NULL ) {
        return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) );
    }

    switch( msg ) {
    case WM_CREATE:
        _wpi_setwindowlongptr( hwnd, classWinExtra, (LONG_PTR)currentStatWnd );
        return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) );
    case WM_SIZE:
        GetClientRect( hwnd, &sw->statusRect );
        sw->wndHeight = _wpi_getheightrect( sw->statusRect );
        _wpi_inflaterect( classHandle, &sw->statusRect, -HORZ_BORDER, -VERT_BORDER );
        return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) );
    case WM_PAINT:
        pres = _wpi_beginpaint( hwnd, NULLHANDLE, &ps );
#ifdef __OS2_PM__
        WinFillRect( pres, &ps, CLR_PALEGRAY );
#endif
#ifdef __NT__
        /*
         * We have to do this little trick because currently this window does not receive
         * the WM_SYSCOLORCHANGE message when it should.
         */
        if( colorButtonFace != GetSysColor( COLOR_BTNFACE ) ) {
            RECT rs;
            if( hasGDIObjects ) {
                _wpi_deleteobject( penLight );
                _wpi_deleteobject( penShade );
                _wpi_deleteobject( brushButtonFace );
            }
            colorButtonFace = GetSysColor( COLOR_BTNFACE );
            _wpi_setbackcolour( pres, colorButtonFace );
            brushButtonFace = CreateSolidBrush( colorButtonFace );
            penLight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) );
            penShade = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) );
            hasGDIObjects = true;
            GetClientRect( hwnd, &rs );
            FillRect( pres, &rs, brushButtonFace );
        }
#endif
        StatusWndDraw3DBox( sw, pres );
        if( initPRES( sw, pres ) ) {
            for( i = 0; i <= sw->numSections; i++ ) {
                if( sw->sectionData[i] != NULL ) {
                    getRect( sw, &r, i );
                    makeInsideRect( &r );
                    _wpi_drawtext( pres, sw->sectionData[i], -1, &r, sw->sectionDataFlags[i] );
                }
            }
            finiPRES( pres );
        }
        _wpi_endpaint( hwnd, pres, &ps );
        break;
#ifdef __NT__
    case WM_SYSCOLORCHANGE:
        if( hasGDIObjects ) {
            DeleteObject( penLight );
            DeleteObject( penShade );
            DeleteObject( brushButtonFace );
            hasGDIObjects = false;
        }
        colorButtonFace = GetSysColor( COLOR_BTNFACE );
        colorTextFace = GetSysColor( COLOR_BTNTEXT );
        brushButtonFace = CreateSolidBrush( colorButtonFace );
        penLight = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNHIGHLIGHT ) );
        penShade = CreatePen( PS_SOLID, 1, GetSysColor( COLOR_BTNSHADOW ) );
        hasGDIObjects = true;
        break;
#endif
    case WM_ERASEBKGND:
#ifdef __NT__
        if( colorButtonFace != GetSysColor( COLOR_BTNFACE ) ) {
            /*
             * If WM_SYSCOLORCHANGE message is not received by this window, we
             * have to fake it.
             */
            SendMessage( hwnd, WM_SYSCOLORCHANGE, 0, 0L );
        }
#endif
        GetClientRect( hwnd, &r );
        _wpi_unrealizeobject( brushButtonFace );
        _wpi_fillrect( (WPI_PRES)wparam, &r, colorButtonFace, brushButtonFace );
        break;
    default:
        return( _wpi_defwindowproc( hwnd, msg, wparam, lparam ) );
    }
    return( 0 );

} /* StatusWndCallback */