Exemple #1
0
/*
 * redrawViewWnd - process the WM_PAINT message for the view windows
 */
static void redrawViewWnd( HWND hwnd )
{
    WPI_PRES    pres;
    WPI_PRES    hps;
    WPI_PRES    mempres;
    HDC         memdc;
    HBITMAP     bitmap;
    HBITMAP     oldbitmap;
    img_node    *node;
    PAINTSTRUCT ps;

    node = SelectFromViewHwnd( hwnd );
    if( node == NULL ) {
        return;
    }

    hps = _wpi_beginpaint( hwnd, NULL, &ps );

    drawBorder( node );
    pres = _wpi_getpres( hwnd );

    bitmap = CreateViewBitmap( node );
    mempres = _wpi_createcompatiblepres( pres, Instance, &memdc );
    oldbitmap = _wpi_selectbitmap( mempres, bitmap );

    _wpi_bitblt( pres, BORDER_WIDTH, BORDER_WIDTH, node->width, node->height,
                 mempres, 0, 0, SRCCOPY );
    _wpi_getoldbitmap( mempres, oldbitmap );
    _wpi_deletebitmap( bitmap );
    _wpi_deletecompatiblepres( mempres, memdc );

    _wpi_releasepres( hwnd, pres );
    _wpi_endpaint( hwnd, hps, &ps );

} /* redrawViewWnd */
Exemple #2
0
/*
 * paintColors - paint the available colors on the color palette
 */
static void paintColors( HWND hwnd )
{
    WPI_PRES    pres;
    WPI_PRES    mempres;
    HDC         hdc;
    PAINTSTRUCT ps;
    HBITMAP     bitmap;
    HBITMAP     oldbitmap;

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

    _wpi_torgbmode( pres );
    if( numberOfColors == 2 ) {
        bitmap = hMonoBitmap;
    } else {
        bitmap = hColorBitmap;
    }

    mempres = _wpi_createcompatiblepres( pres, Instance, &hdc );
    _wpi_torgbmode( mempres );
    oldbitmap = _wpi_selectbitmap( mempres, bitmap );

    _wpi_bitblt( pres, 0, 0, CUR_BMP_WIDTH, CUR_BMP_HEIGHT, mempres, 0, 0, SRCCOPY );
    _wpi_getoldbitmap( mempres, oldbitmap );
    _wpi_deletecompatiblepres( mempres, hdc );

    _wpi_endpaint( hwnd, pres, &ps );

} /* paintColors */
Exemple #3
0
/*
 * paintPalette - repaint the color palette
 */
static void paintPalette( HWND hwnd )
{
    WPI_PRES            hdc;
    WPI_POINT           pt;
    HPEN                holdpen;
    HPEN                hgraypen;
    HPEN                hwhitepen;
    PAINTSTRUCT         rect;
    WPI_RECT            client;
    int                 height;

    hdc = _wpi_beginpaint( hwnd, NULL, &rect );
#ifdef __OS2_PM__
    WinFillRect( hdc, &rect, CLR_PALEGRAY );
#endif
    _wpi_torgbmode( hdc );
    GetClientRect( hwnd, &client );
    height = _wpi_getheightrect( client );
#if defined( __NT__ )
    FillRect( (HDC)hdc, (CONST RECT*)&client, hbrush );
#endif

#if defined( __NT__ )
    hgraypen = _wpi_createpen( PS_SOLID, 0, GetSysColor( COLOR_BTNSHADOW ) );
#else
    hgraypen = _wpi_createpen( PS_SOLID, 0, DKGRAY );
#endif
    holdpen = _wpi_selectobject( hdc, hgraypen );
    pt.x = 2;
    pt.y = 50;
    _wpi_cvth_pt( &pt, height );
    _wpi_movetoex( hdc, &pt, NULL );

    pt.y = 6;
    _wpi_cvth_pt( &pt, height );
    _wpi_lineto( hdc, &pt );
    pt.x = 90;
    _wpi_lineto( hdc, &pt );

    _wpi_selectobject( hdc, holdpen );
    _wpi_deleteobject( hgraypen );

#if defined( __NT__ )
    hwhitepen = _wpi_createpen( PS_SOLID, 0, GetSysColor( COLOR_BTNHIGHLIGHT ) );
#else
    hwhitepen = _wpi_createpen( PS_SOLID, 0, WHITE );
#endif
    holdpen = _wpi_selectobject( hdc, hwhitepen );
    pt.y = 50;
    _wpi_cvth_pt( &pt, height );
    _wpi_lineto( hdc, &pt );
    pt.x = 2;
    _wpi_lineto( hdc, &pt );

    _wpi_selectobject( hdc, holdpen );
    _wpi_deleteobject( hwhitepen );
    _wpi_endpaint( hwnd, hdc, &rect );

} /* paintPalette */
Exemple #4
0
/*
 * RepaintDrawArea - handles the WM_PAINT message.
 */
void RepaintDrawArea( HWND hwnd )
{
    WPI_PRES            pres;
    PAINTSTRUCT         ps;

    if (hwnd) {
        pres = _wpi_beginpaint( hwnd, NULL, &ps );
        BlowupImage( hwnd, pres );
        _wpi_endpaint( hwnd, pres, &ps );
    }
} /* RepaintDrawArea */
Exemple #5
0
/*
 * paintScreen - paint the screen and inverse window
  */
static void paintScreen( HWND hwnd )
{
    WPI_PRES    pres;
    PAINTSTRUCT ps;

    pres = _wpi_beginpaint( hwnd, NULL, &ps );
#ifdef __OS2_PM__
   WinFillRect( pres, &ps, CLR_PALEGRAY );
#endif
    _wpi_torgbmode( pres );
    if( fShowScreenClr ) {
        DisplayColorBox( pres, &screenColor );
        DisplayColorBox( pres, &inverseColor );
    }
    _wpi_endpaint( hwnd, pres, &ps );

} /* paintScreen */
Exemple #6
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 */
Exemple #7
0
/*
 * SelColorDlgProc - select the color to represent the background
 */
WPI_DLGRESULT CALLBACK SelColorDlgProc( HWND hwnd, WPI_MSG msg, WPI_PARAM1 wparam, WPI_PARAM2 lparam )
{
    PAINTSTRUCT         ps;
    WPI_POINT           pt;
    WPI_PRES            pres;
    bool                ret;

    ret = false;

    if( _wpi_dlg_command( hwnd, &msg, &wparam, &lparam ) ) {
        switch( LOWORD( wparam ) ) {
        case IDOK:
            _wpi_enddialog( hwnd, IDOK );
            break;

        case IDCANCEL:
            _wpi_enddialog( hwnd, IDCANCEL );
            break;

        case IDB_HELP:
            IEHelpRoutine();
            break;
        }
    } else {
        switch( msg ) {
        case WM_INITDIALOG:
            showColors( hwnd );
            ret = true;
            break;

#ifndef __OS2_PM__
        case WM_SYSCOLORCHANGE:
            IECtl3dColorChange();
            break;
#endif

        case WM_LBUTTONDOWN:
            WPI_MAKEPOINT( wparam, lparam, pt );
            selectColor( &pt, hwnd );
            break;

        case WM_PAINT:
            pres = _wpi_beginpaint( hwnd, NULL, &ps );
#ifdef __OS2_PM__
            WinFillRect( pres, &ps, CLR_PALEGRAY );
#endif
            displayColors( hwnd );
            _wpi_endpaint( hwnd, pres, &ps );
            _wpi_setfocus( hwnd );
            break;

        case WM_CLOSE:
            _wpi_enddialog( hwnd, IDCANCEL );
            break;
        default:
            return( _wpi_defdlgproc( hwnd, msg, wparam, lparam ) );
        }
    }
    _wpi_dlgreturn( ret );

} /* SelColorDlgProc */
Exemple #8
0
void GUIPaint( gui_window *wnd, HWND hwnd, bool isdlg )
{
    HDC         prev_hdc;
    PAINTSTRUCT *prev_ps;
    gui_row_num row_num;
    PAINTSTRUCT ps;
    WPI_RECT    fill_area;
#ifdef __OS2_PM__
    ULONG       flags;
    RECTL       client;
#endif

    isdlg=isdlg;
    /* save old state */
    prev_hdc = wnd->hdc;
    prev_ps = wnd->ps;

    /* Setup Paint */
    wnd->ps = &ps;
    wnd->hdc = _wpi_beginpaint( hwnd, NULLHANDLE, wnd->ps );
    _wpi_torgbmode( wnd->hdc );
    _wpi_getpaintrect( wnd->ps, &fill_area );
#ifdef __OS2_PM__
    fill_area = *(wnd->ps);
    if( isdlg ) {
        _wpi_inflaterect( GUIMainHInst, &fill_area, 10, 10);
    }
    WinFillRect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ) );
#endif
#if defined( __NT__ )
    if( isdlg ) {
        _wpi_fillrect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ),
                       wnd->bk_brush );
    }
#endif
    if( wnd->font != NULL ) {
        wnd->prev_font = _wpi_selectfont( wnd->hdc, wnd->font );
    } else {
        wnd->prev_font = NULL;
    }

    /* send paint to app */
    GUIGetUpdateRows( wnd, hwnd, &row_num.start, &row_num.num );
    if( row_num.num > 0 ) {
        GUIEVENTWND( wnd, GUI_PAINT, &row_num );
    }

    /* finish painting */
    if( wnd->prev_font != NULL ) {
        _wpi_getoldfont( wnd->hdc, wnd->prev_font );
        wnd->prev_font = NULL;
    }

#ifdef __OS2_PM__
    if( isdlg ) {
        flags = DB_AREAATTRS | DB_DLGBORDER;
  #ifdef _M_I86
        if( WinQueryActiveWindow( HWND_DESKTOP, FALSE ) != hwnd ) {
  #else
        if( WinQueryActiveWindow( HWND_DESKTOP ) != hwnd ) {
  #endif
        //if( _wpi_getfocus() != hwnd ) {
            flags |= DB_PATINVERT;
        }
        WinQueryWindowRect( hwnd, &client );
        WinDrawBorder( wnd->hdc, &client, 1, 1, 0, 0, flags );
    }
#endif

    _wpi_endpaint( hwnd, wnd->hdc, wnd->ps );

    /* restore old state */
    wnd->hdc = prev_hdc;
    wnd->ps = prev_ps;
}

#else

// this is some experimental PM stuff
void GUIPaint( gui_window *wnd, HWND hwnd, bool isdlg )
{
    HDC         prev_hdc;
    PAINTSTRUCT *prev_ps;
    gui_row_num row_num;
    PAINTSTRUCT ps;
    PAINTSTRUCT fill_area;

    // experimenal stuff
    HPS                 hps;
    RECTL               client;
    LONG                width, height;
    ULONG               flags;
    int                 compat_created;
    gui_paint_info      *pinfo;

    // figure out which paint info to use
    if( !isdlg && wnd->root == hwnd ) {
        pinfo = &wnd->root_pinfo;
    } else {
        pinfo = &wnd->hwnd_pinfo;
    }
    pinfo->in_use++;
    compat_created = FALSE;

    /* save old state */
    prev_hdc = wnd->hdc;
    prev_ps = wnd->ps;
    if( isdlg ) {
        _wpi_getclientrect( hwnd, &client );
    } else {
        WinQueryWindowRect( hwnd, &client );
    }
    width = client.xRight - client.xLeft;
    height = client.yTop - client.yBottom;

    wnd->ps = &ps;
    //hps = _wpi_beginpaint( hwnd, pinfo->normal_pres, wnd->ps );
    hps = _wpi_beginpaint( hwnd, NULL, wnd->ps );
    if( pinfo->compatible_pres == (WPI_PRES)NULL ) {
        compat_created = TRUE;
        pinfo->compatible_pres = _wpi_createcompatiblepres( hps, GUIMainHInst, &pinfo->compatible_hdc );
        pinfo->draw_bmp = _wpi_createcompatiblebitmap( hps, width, height );
        pinfo->old_bmp = _wpi_selectbitmap( pinfo->compatible_pres, pinfo->draw_bmp );
    }

    // the condition is here VERY conservative!!
    // its gains have to analyzed
    if( compat_created || pinfo->force_count ) {
        wnd->hdc = pinfo->compatible_pres;
        //wnd->hdc = hps;
        _wpi_torgbmode( wnd->hdc );
        fill_area = *(wnd->ps);
        if( isdlg ) {
            _wpi_inflaterect( GUIMainHInst, &fill_area, 10, 10);
        }
        WinFillRect( wnd->hdc, &fill_area, GUIGetBack( wnd, GUI_BACKGROUND ) );
        wnd->prev_font = NULL;
        if( wnd->font != NULL ) {
            wnd->prev_font = _wpi_selectfont( wnd->hdc, wnd->font );
        }

        /* send paint to app */
        GUIGetUpdateRows( wnd, hwnd, &row_num.start, &row_num.num );
        if( row_num.num > 0 ) {
            GUIEVENTWND( wnd, GUI_PAINT, &row_num );
        }

        /* finish painting */
        if( wnd->prev_font != NULL ) {
            _wpi_getoldfont( wnd->hdc, wnd->prev_font );
            wnd->prev_font = NULL;
        }

        if( pinfo->force_count ) {
            //pinfo->force_count--;
        }
    }

    //_wpi_bitblt( hps, client.xLeft, client.yBottom, width, height,
    //       wnd->hdc, 0, 0, SRCCOPY );

    if( pinfo->in_use == 1 ) {
        //_wpi_bitblt( hps, client.xLeft, client.yBottom, width, height,
        //               wnd->hdc, 0, 0, SRCCOPY );
        _wpi_bitblt( hps, ps.xLeft, ps.yBottom,
                     ps.xRight - ps.xLeft,
                     ps.yTop - ps.yBottom,
                     wnd->hdc,
                     ps.xLeft, ps.yBottom,
                     SRCCOPY );
        if( pinfo->delete_when_done ) {
            GUIFreePaintHandles( pinfo, TRUE );
        }
    }

    if( isdlg ) {
        flags = DB_AREAATTRS | DB_DLGBORDER;
  #ifdef _M_I86
        if( WinQueryActiveWindow( HWND_DESKTOP, FALSE ) != hwnd ) {
  #else
        if( WinQueryActiveWindow( HWND_DESKTOP ) != hwnd ) {
  #endif
        //if( _wpi_getfocus() != hwnd ) {
            flags |= DB_PATINVERT;
        }
        WinQueryWindowRect( hwnd, &client );
        WinDrawBorder( hps, &client, 1, 1, 0, 0, flags );
    }

    _wpi_endpaint( hwnd, hps, wnd->ps );

    /* restore old state */
    wnd->hdc = prev_hdc;
    wnd->ps = prev_ps;

    if( pinfo->in_use ) {
        pinfo->in_use--;
    }
}

#endif

void GUIInvalidatePaintHandles( gui_window *wnd )
{
    GUIFreeWndPaintHandles( wnd, FALSE );
}
Exemple #9
0
WPI_MRESULT CALLBACK GraphWndProc( HWND         Wnd,
                                   WPI_MSG      message,
                                   WPI_PARAM1   wParam,
                                   WPI_PARAM2   lParam )
//=============================================================

{
    WPI_PRES            Win_dc;
    PAINTSTRUCT         ps;
    int                 width, height;
    int                 x, y, t;
    int                 h_minpos, h_maxpos, h_currpos;
    int                 v_minpos, v_maxpos, v_currpos;
    WPI_RECTDIM         left, top, right, bottom;
    WPI_RECT            rect;
    struct ScrollStruct scroll_info;
    LPWDATA             w;
    HWND                frame;
#if defined( __OS2__ )
    int                 wheight;
    WPI_RECT            wrect;
#endif

    w = _GetWindowData( Wnd );
    if( w == NULL ) {
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );
    }
#if defined( __OS2__ )
    frame = w->frame;
#else
    frame = Wnd;
#endif

    switch( message ) {
#if defined( __WINDOWS__ )
    case WM_SETFOCUS:
        SetFocus( _MainWindow );
    case WM_SYSCOMMAND:
    case WM_MOUSEACTIVATE:
        _MakeWindowActive( w );
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );

    case WM_KILLFOCUS:
        if( ( wParam != NULL) && ( wParam != _MainWindow ) ) {
            _ShowWindowActive( NULL, w );
        }
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );
#else
    case WM_FOCUSCHANGE:
    case WM_SYSCOMMAND:
        _MakeWindowActive( w );
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );
#endif

    case WM_PAINT:
        // Setup
        Win_dc = _wpi_beginpaint( Wnd, NULLHANDLE, &ps );
        _wpi_torgbmode( Win_dc );
        _wpi_getpaintrect( &ps, &rect );
        _wpi_getwrectvalues( rect, &left, &top, &right, &bottom );
        width = _wpi_getwidthrect( rect );
        height = _wpi_getheightrect( rect );

        // Copy from the memory dc to the screen
#if defined( __OS2__ )
        GetClientRect( Wnd, &wrect );
        wheight = _wpi_getheightrect( wrect );
        y = _GetPresHeight() - wheight - _BitBlt_Coord.ycoord + top;
#else
        y = _BitBlt_Coord.ycoord + top;
#endif
        _wpi_bitblt( Win_dc,
                left,
                top,
                width, height,
                _Mem_dc,
                _BitBlt_Coord.xcoord + left,
                y,
                SRCCOPY );

        //Cleanup
        _wpi_endpaint( Wnd, Win_dc, &ps );
        break;
#if defined( __OS2__ )
    case WM_CLOSE:
        WinDestroyWindow( w->frame );
        return( 0 );
#endif
    case WM_DESTROY:
        // free the system resources allocated

        if( _Mem_dc ){
            _wpi_deletecliprgn( _Mem_dc, _ClipRgn );
            _wpi_deletecompatiblepres( _Mem_dc, _Hdc );
            if( _Mem_bmp ){
                _wpi_deletebitmap( _Mem_bmp );
                if( !_IsStockFont() ){
                    _wpi_f_deletefont( _CurFnt );
                }
            }
#if defined( __OS2__ )
            WinSendMsg( _GetWinMenuHandle(), ( ULONG )MM_DELETEITEM,
                MPFROM2SHORT( ( w->handles[0] + DID_WIND_STDIO ), FALSE ), 0 );
#endif
            _DestroyAWindow( w );
        }
        break;

    case WM_VSCROLL:
        scroll_info = getscrolldata( frame, SB_VERT );
        CalPos( &scroll_info, wParam, lParam, &v_currpos, &y );

        // Make sure we have to refresh first
        if( _BitBlt_Coord.ycoord != y ) {
            _BitBlt_Coord.ycoord = y;
            _wpi_setscrollpos( frame,
                          SB_VERT,
                          v_currpos,
                          TRUE );
            _wpi_invalidaterect( Wnd, NULL, 0 );
            _wpi_updatewindow( Wnd );
        }
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );

    case WM_HSCROLL:
        scroll_info = getscrolldata( frame, SB_HORZ );
        CalPos( &scroll_info, wParam, lParam, &h_currpos, &x );

        // make sure we need to refresh first
        if( _BitBlt_Coord.xcoord != x ) {
            _BitBlt_Coord.xcoord = x;
            _wpi_setscrollpos(  frame,
                                SB_HORZ,
                                h_currpos,
                                TRUE );
            _wpi_invalidaterect( Wnd, NULL, 0 );
            _wpi_updatewindow( Wnd );
        }
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );

    case WM_SIZE:
        x = _wpi_getsystemmetrics( SM_CXSCREEN );
        y = _wpi_getsystemmetrics( SM_CYSCREEN );

        _wpi_getscrollrange( frame, SB_VERT, &v_minpos, &v_maxpos );
        _wpi_getscrollrange( frame, SB_HORZ, &h_minpos, &h_maxpos );
        _wpi_getclientrect( Wnd, &rect );
        _wpi_getrectvalues( rect, &left, &top, &right, &bottom );
        height = bottom - top + 1;
        width = right - left + 1;

        if( width >= x ) {
            // hide the scroll bar
#if defined( __OS2__ )
            WinShowWindow( WinWindowFromID( frame, FID_HORZSCROLL ),
                           FALSE );
#else
            ShowScrollBar( Wnd, SB_HORZ, FALSE );
#endif
            _BitBlt_Coord.xcoord = 0;
            h_currpos = 0;
        } else {
            // if the window isn't as big as the device context
            // show the scroll bar
            t = x - width + 1;
            if( x - _BitBlt_Coord.xcoord + 1 < width ) {
                _BitBlt_Coord.xcoord = x - width + 1;
            }
            if( _BitBlt_Coord.xcoord == t ) {
                h_currpos = h_maxpos;
            } else {
            h_currpos = CalScrollAmt( h_maxpos, h_minpos,
                                      _BitBlt_Coord.xcoord,
                                      x, width );
            }
#if defined( __OS2__ )
            WinShowWindow( WinWindowFromID( frame, FID_HORZSCROLL ),
                           TRUE );
#else
            ShowScrollBar( Wnd, SB_HORZ, 1 );
#endif
        }

        if( height >= y ) {
            // hide the scroll bar
#if defined( __OS2__ )
            WinShowWindow( WinWindowFromID( frame, FID_VERTSCROLL ),
                           FALSE );
#else
            ShowScrollBar( Wnd, SB_VERT, 0 );
#endif
            _BitBlt_Coord.ycoord = 0;
            v_currpos = 0;
        } else {
            // if the the window isn't as big as the device context
            // then show the scroll bar
            t = y - height + 1;
            if( y - _BitBlt_Coord.ycoord + 1 < height ) {
                _BitBlt_Coord.ycoord = t;
            }
            if( _BitBlt_Coord.ycoord == t ) {
                v_currpos = v_maxpos;
            } else {
                v_currpos = CalScrollAmt( v_maxpos, v_minpos,
                                          _BitBlt_Coord.ycoord,
                                          y, height );
            }
#if defined( __OS2__ )
            WinShowWindow( WinWindowFromID( frame, FID_VERTSCROLL ),
                           TRUE );
#else
            ShowScrollBar( Wnd, SB_VERT, 1 );
#endif
        }


        // Adjust the scroll bar thumbs' positions
        _wpi_setscrollpos( frame, SB_HORZ, h_currpos, TRUE );
        _wpi_setscrollpos( frame, SB_VERT, v_currpos, TRUE );
#if defined( __OS2__ )
        Win_dc = WinBeginPaint( Wnd, NULL, &rect );
        WinFillRect( Win_dc, &rect, CLR_BLACK );
        WinEndPaint( Win_dc );
#endif
        _wpi_invalidaterect( Wnd, NULL, 0 );
        break;
    default:
        return( _wpi_defwindowproc( Wnd, message, wParam, lParam ) );
    }
   return( NULL );
}
Exemple #10
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 */