Пример #1
0
void GUIBringToFront( gui_window *wnd )
{
    bool        parent_is_dlg;
    bool        same_window;

    if( wnd == NULL ) {
        return;
    }

    same_window = ( GUICurrWnd == wnd );
    parent_is_dlg = false;
    if( wnd->parent ) {
        if( wnd->parent->flags & IS_DIALOG ) {
            parent_is_dlg = true;
        }
    }

    if( !same_window || parent_is_dlg ) {
        if( !same_window && ( GUICurrWnd != NULL ) ) {
            if( _wpi_getparent( GUICurrWnd->hwnd_frame ) != HWND_DESKTOP ) {
                ActivateNC( GUICurrWnd, false );
            }
            GUIEVENTWND( GUICurrWnd, GUI_NOT_ACTIVE, NULL );
        }
        // if the application indicates that it has processed the message
        // then do not proceed to bring the window to top
        if( !GUIEVENTWND( wnd, GUI_NOW_ACTIVE, NULL ) ) {
            GUICurrWnd = wnd;
            GUIFrontOfList( wnd );
            ActivateNC( wnd, true );
            GUIMDIBroughtToFront( wnd );
            _wpi_bringwindowtotop( wnd->hwnd_frame );
            _wpi_setfocus( wnd->hwnd_frame );
        }
    }

    if( same_window && !parent_is_dlg ) {
        ActivateNC( wnd, true );
    }

    if( parent_is_dlg ) {
        ActivateNC( wnd->parent, true );
    }
}
Пример #2
0
/*
 * ResetViewWindow - when a new MDI child is activated, reset the position
 *                   of the view window
 *                 - first check if only 1 view window is being shown, or all of them
 */
void ResetViewWindow( HWND hwnd )
{
    WPI_RECT    currentloc;
    WPI_RECT    newloc;
    WPI_RECTDIM left;
    WPI_RECTDIM top;
    WPI_RECTDIM right;
    WPI_RECTDIM bottom;
    HWND        hframe;
    HWND        currentframe;

    hframe = _wpi_getframe( hwnd );
    if( hViewWindow != NULL ) {
        currentframe = _wpi_getframe( hViewWindow );
    } else {
        currentframe = NULL;
    }

    if( fOneViewWindow ) {
        _wpi_getwindowrect( hframe, &newloc );
        if( hViewWindow != NULL ) {
            _wpi_getwindowrect( currentframe, &currentloc );
            ShowWindow( currentframe, SW_HIDE );
        } else {
            currentloc = newloc;
        }
        _wpi_getrectvalues( currentloc, &left, &top, &right, &bottom );

        SetWindowPos( hframe, NULL, left, top,
                     _wpi_getwidthrect( newloc ), _wpi_getheightrect( newloc ),
                     SWP_MOVE | SWP_SIZE | SWP_NOZORDER | SWP_HIDEWINDOW );
        hViewWindow = hwnd;
        ShowWindow( hframe, showState );
    } else {
        hViewWindow = hwnd;
        ShowWindow( hframe, showState );
        _wpi_bringwindowtotop( hframe );
    }
#ifndef __OS2_PM__
    RedrawWindow( hwnd, NULL, NULL, RDW_UPDATENOW );
#endif

} /* ResetViewWindow */