Example #1
0
/*
 * doRestore - handle restoring an edit window
 */
static void doRestore( HWND hwnd )
{
    DWORD       style;
    mdi_data    *md;
    WPI_RECTDIM left;
    WPI_RECTDIM top;
    WPI_RECTDIM right;
    WPI_RECTDIM bottom;

    md = MDI_DATA_FROM_HWND( hwnd );

    if( md->curr_state == STATE_NORMAL ) {
        return;
    }

    if( mdiInfo.start_max_restore != NULL ) {
        mdiInfo.start_max_restore( hwnd );
    }

    md->curr_state = md->orig_state = STATE_NORMAL;

    if( mdiInfo.set_style != NULL ) {
        (mdiInfo.set_style)( hwnd, FALSE );
    } else {
        style = _wpi_getwindowlong( hwnd, GWL_STYLE );
        style &= ~mdiInfo.max_style;
        style |= mdiInfo.reg_style;
        _wpi_setwindowlong( hwnd, GWL_STYLE, style );
    }

    _wpi_setscrollrange( hwnd, SB_VERT, 1, 1, TRUE );
    _wpi_setscrollrange( hwnd, SB_HORZ, 1, 1, TRUE );
    _wpi_updatewindow( hwnd );
    _wpi_getrectvalues( md->orig_size, &left, &top, &right, &bottom );
    _wpi_movewindow( hwnd, left, top, right - left, bottom - top, TRUE );
    if( mdiInfo.end_max_restore != NULL ) {
        mdiInfo.end_max_restore( hwnd );
    }

} /* doRestore */
Example #2
0
/*
 * MDINewWindow - a new MDI window has been created
 */
int MDINewWindow( HWND hwnd )
{
    mdi_data    *md;

    md = (mdi_data *)MemAlloc( sizeof( mdi_data ) );
    if( md == NULL ) {
        return( FALSE );
    }
    md->hwnd = hwnd;
    _wpi_setwindowlong( hwnd, mdiInfo.data_off, (LONG)md );
    if( mdiHead == NULL ) {
        mdiHead = mdiTail = md;
    } else {
        mdiTail->next = md;
        mdiTail = md;
    }

    if( childrenMaximized ) {
        doMaximize( hwnd );
        mdiInfo.set_window_title( hwnd );
    }
    return( TRUE );

} /* MDINewWindow */
Example #3
0
void GUIFreeWindowMemory( gui_window *wnd, bool from_parent, bool dialog )
{
    gui_window  *root;
    HWND        capture;

    from_parent = from_parent;
    if( ( wnd->hwnd != NULLHANDLE ) && ( GUICurrWnd == wnd ) ) {
        capture = _wpi_getcapture();
        if( capture == wnd->hwnd ) {
            _wpi_releasecapture();
        }
    }
    if( wnd->font != NULL ) {
        _wpi_deletefont( wnd->font );
        wnd->font = NULL;
    }
    if( wnd->icon != (WPI_HICON)NULL ) {
        _wpi_destroyicon( wnd->icon );
    }
    GUIFreeColours( wnd );
    GUIFreeBKBrush( wnd );
    GUIControlDeleteAll( wnd );
    //GUICloseToolBar( wnd );
    GUIFreeHint( wnd );
    _wpi_setwindowlong( wnd->hwnd, GUI_EXTRA_WORD * EXTRA_SIZE, 0 );
    if( wnd->root != NULLHANDLE ) {
        _wpi_setwindowlong( wnd->root, GUI_EXTRA_WORD * EXTRA_SIZE, 0 );
    }
    if( !dialog ) {
        GUIMDIDelete( wnd );
        if( GUICurrWnd == wnd ) {
            GUICurrWnd = NULL;
        }
        GUIFreePopupList( wnd );
    }
    GUIDeleteFromList( wnd );
    /* If the window being deleted was the current window, choose a new
     * window to bring to front.  Don't do this if the window that's being
     * destroyed is being destroyed because it's parent is being destroyed
     * (ie never got WM_CLOSE so DOING_CLOSE isn't set).
     */
    if( !dialog && ( wnd->flags & DOING_CLOSE ) && ( GUICurrWnd == NULL ) &&
        !GUIIsParentADialog( wnd ) ) {
        // if the root window has received a WM_DESTROY then just run away
        root = GUIGetRootWindow();
        if( root && !( root->flags & DOING_DESTROY ) ) {
            GUIBringNewToFront( wnd );
        }
    }
    if( wnd->hdc != (WPI_PRES)NULL ) {
        _wpi_releasepres( wnd->hwnd, wnd->hdc );
        wnd->hdc = NULLHANDLE;
    }
#ifdef __OS2_PM__
    GUIFreeWndPaintHandles( wnd, TRUE );
    if( wnd->root_pinfo.normal_pres != (WPI_PRES)NULL ) {
        _wpi_deleteos2normpres( wnd->root_pinfo.normal_pres );
        wnd->root_pinfo.normal_pres = (WPI_PRES)NULL;
    }
    if( wnd->hwnd_pinfo.normal_pres != (WPI_PRES)NULL ) {
        _wpi_deleteos2normpres( wnd->hwnd_pinfo.normal_pres );
        wnd->hwnd_pinfo.normal_pres = (WPI_PRES)NULL;
    }
#endif
    GUIMemFree( wnd );
}
Example #4
0
/*
 * doMaximize - handle maximizing an edit window
 */
static void doMaximize( HWND hwnd )
{
    DWORD               style;
    mdi_data            *md;
    WPI_RECT            r;
    bool                iconic;
    WPI_RECTDIM         left;
    WPI_RECTDIM         top;
    WPI_RECTDIM         right;
    WPI_RECTDIM         bottom;

    setMaximizedMenuConfig( hwnd );

    md = MDI_DATA_FROM_HWND( hwnd );

    if( mdiInfo.start_max_restore != NULL ) {
        mdiInfo.start_max_restore( hwnd );
    }

    iconic = _wpi_isiconic( hwnd );
    if( iconic ) {
        _wpi_getrestoredrect( hwnd, &md->orig_size );
    } else {
        _wpi_getwindowrect( hwnd, &md->orig_size );
    }
    md->orig_state = md->curr_state;
    md->curr_state = STATE_MAX;

    if( mdiInfo.set_style != NULL ) {
        (mdiInfo.set_style)( hwnd, TRUE );
    } else {
        style = _wpi_getwindowlong( hwnd, GWL_STYLE );
        style &= ~mdiInfo.reg_style;
        style |= mdiInfo.max_style;
        _wpi_setwindowlong( hwnd, GWL_STYLE, style );
    }
    _wpi_setscrollrange( hwnd, SB_VERT, 1, 1, TRUE );
    _wpi_setscrollrange( hwnd, SB_HORZ, 1, 1, TRUE );
    _wpi_getwindowrect( mdiInfo.container, &r );

    _wpi_getrectvalues( r, &left, &top, &right, &bottom );

    if( !iconic ) {
        _wpi_offsetrect( mdiInfo.hinstance, &md->orig_size, -left, -top );
    }

    _wpi_setrectvalues( &r, 0, 0, right-left+1, bottom-top+1 );

    if( iconic ) {
        _wpi_setrestoredrect( hwnd, &r );
    } else {
        _wpi_getrectvalues( r, &left, &top, &right, &bottom );
        _wpi_movewindow( hwnd, left, top, right, bottom, TRUE );
    }

    if( mdiInfo.end_max_restore != NULL ) {
        mdiInfo.end_max_restore( hwnd );
    }

    _wpi_invalidaterect( hwnd, NULL, FALSE );

} /* doMaximize */
Example #5
0
static void DoSetWindowLong( HWND hwnd, gui_window *wnd )
{
    _wpi_setwindowlong( hwnd, GUI_CONTAINER_WORD1 * EXTRA_SIZE, 0L );
    _wpi_setwindowlong( hwnd, GUI_CONTAINER_WORD2 * EXTRA_SIZE, 0L );
    _wpi_setwindowlong( hwnd, GUI_EXTRA_WORD * EXTRA_SIZE, (LONG)wnd );
}