예제 #1
0
/*
 * paintCurrent - paint the current window (process WM_PAINT)
 */
static void paintCurrent( HWND hwnd )
{
    WPI_PRES            pres;
    WPI_PRES            mempres;
    HDC                 hdc;
    PAINTSTRUCT         ps;
    WPI_RECT            rect;
    HBITMAP             oldbitmap;
    int                 top;
    int                 bottom;

    pres = _wpi_beginpaint( hwnd, NULL, &ps );
#ifdef __OS2_PM__
    WinFillRect( pres, &ps, CLR_PALEGRAY );
#endif

    mempres = _wpi_createcompatiblepres( pres, Instance, &hdc );
    _wpi_torgbmode( pres );
    _wpi_torgbmode( mempres );
    oldbitmap = _wpi_selectobject( mempres, lButton.bitmap );

    _wpi_bitblt( pres, 0, 0, CUR_SQR_SIZE + 1, 2 * CUR_SQR_SIZE + 1, mempres,
                 0, 0, SRCCOPY );
    _wpi_selectobject( mempres, oldbitmap );
    oldbitmap = _wpi_selectobject( mempres, rButton.bitmap );

    _wpi_bitblt( pres, CUR_RCOL_X - 1, 0, CUR_SQR_SIZE + 1, 2 * CUR_SQR_SIZE + 1,
                 mempres, 0, 0, SRCCOPY );

    _wpi_selectobject( mempres, oldbitmap );
    _wpi_deletecompatiblepres( mempres, hdc );

    _wpi_setbackmode( pres, TRANSPARENT );
    _wpi_settextcolor( pres, GetInverseColor( lButton.solid ) );

    top = _wpi_cvth_y( CUR_COL_Y, currentHeight );
    bottom = _wpi_cvth_y( CUR_COL_Y + CUR_SQR_SIZE, currentHeight );
    _wpi_setintwrectvalues( &rect, CUR_LCOL_X, top, CUR_LCOL_X + CUR_SQR_SIZE, bottom );
    _wpi_drawtext( pres, "L", 1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER );
    _wpi_settextcolor( pres, GetInverseColor( rButton.solid ) );
    _wpi_setintwrectvalues( &rect, CUR_RCOL_X, top, CUR_RCOL_X + CUR_SQR_SIZE, bottom );
    _wpi_drawtext( pres, "R", 1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER );
    _wpi_endpaint( hwnd, pres, &ps );

} /* paintCurrent */
예제 #2
0
WPI_FONT _wtextinit(
/******************/
/* initial text, pass back font handle for _wtextout */

    text_def            *text
) {
    WPI_LOGFONT         font;
    WPI_FONT            font_hld;
    BOOL                is_bold;
    int                 size;
    int                 match_no;

    _wpi_getdeffm( font );
    if( text->style & TEXT_SIZEABLE ) {
        _wpi_setfontsizeable( &font, TRUE );
    }
    if( text->not_set ) {
        _wpi_setfontfacename( &font, NULL );
    } else {
        _wpi_setfontfacename( &font, text->face_name );
    }

#if 0
    size = text->size%100;
    match_no = ((text->size-(text->size%100))/100);;
#else
    size = text->size;
    match_no = 0;
#endif
    _wpi_setfontpointsize( &font, size, points_to_pixel( text->size ),
                match_no );

    _wpi_settextcolor( Win_dc, get_palette_color( text->color - 1 ) );
    is_bold = text->style & TEXT_BOLD;
    _wpi_setfontbold( &font, is_bold );

    /* due to some wierd, undocumented bug in Windows, italics will
       not print on some devices unless the style booleans below
       are set to -1 (255)! We found this out by looking at what
       commdlg.dll returned in the LOGFONT. I don't understand,
       but leave it this way */
    _wpi_setfontitalic( &font, text->style & TEXT_ITALIC );
    _wpi_setfontunderline( &font, text->style & TEXT_UNDERLINE );
    _wpi_setfontstrikeout( &font, text->style & TEXT_STRIKEOUT );
    if( text->not_set ) {
        _wpi_setfontcharset( &font, ANSI_CHARSET );
        _wpi_setfontpitch( &font, DEFAULT_PITCH | FF_ROMAN );
    } else {
        _wpi_setfontcharset( &font, text->char_set );
        _wpi_setfontpitch( &font, text->pitchfamily );
    }

    _wpi_setfontprecision( &font, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS );
    _wpi_setfontquality( &font, DRAFT_QUALITY );

    _wpi_setfontescapement( &font, 0 );
    _wpi_setfontorientation( &font, 0 );

    _wpi_createfont( font, font_hld );

    return( font_hld );
}
예제 #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 ) );
}