示例#1
0
void GUIDestroyWnd( gui_window *wnd )
{
    HWND        hwnd;
    gui_window  *curr;

    if( wnd == NULL ) {
        curr = GUIGetFront();
        while( curr != NULL ) {
            if( curr->flags & DOING_CLOSE ) {
                curr = GUIGetNextWindow( curr );
            } else if( _wpi_getparent( GUIGetParentFrameHWND( curr ) ) == HWND_DESKTOP ) {
                GUIDestroyWnd( curr );
                curr = GUIGetFront();
            } else {
                curr = GUIGetNextWindow( curr );
            }
        }
    } else {
        if ( GUIIsOpen( wnd ) ) {
            /* this will make a new window be chosen as current if this
             * window was current */
            hwnd = GUIGetParentFrameHWND( wnd );
            wnd->flags |= DOING_CLOSE;
            if( NumWindows == 1 || ( _wpi_getparent( hwnd ) == HWND_DESKTOP ) &&
                !( wnd->style & GUI_POPUP ) ) {
                _wpi_sendmessage( hwnd, WM_CLOSE, 0, 0 );
            } else {
                DestroyWindow( hwnd );
            }
        }
    }
}
示例#2
0
void GUIRestoreWindow( gui_window *wnd )
{
    if( GUIIsMDIChildWindow( wnd ) && GUIMDIMaximized( wnd ) ) {
        GUIMDIMaximize( false, GUIGetFront() );
    } else {
        _wpi_restorewindow( GUIGetParentFrameHWND( wnd ) );
    }
}
示例#3
0
static void GUIMarkChildrenWithFlag( gui_window *parent, gui_flags flag )
{
    gui_window *wnd;

    for( wnd = GUIGetFront(); wnd != NULL; wnd = GUIGetNextWindow( wnd ) ) {
        if( wnd->parent == parent ){
            wnd->flags |= flag;
        }
    }
}
示例#4
0
extern void GUIMaximizeWindow( gui_window *wnd )
{
    if( wnd->style & GUI_MAXIMIZE ) {
        if( GUIIsMDIChildWindow( wnd ) ) {
            GUIMDIMaximize( true, GUIGetFront() );
        } else {
            _wpi_maximizewindow( GUIGetParentFrameHWND( wnd ) );
        }
    }
}
示例#5
0
gui_window *GUIFindFirstPopupWithNoParent( void )
{
    gui_window *wnd;

    for( wnd = GUIGetFront(); wnd != NULL; wnd = GUIGetNextWindow( wnd ) ) {
        if( ( wnd->style & GUI_POPUP ) && ( wnd->parent == NULL ) ) {
            return( wnd );
        }
    }

    return( NULL );
}
示例#6
0
gui_window *GUIFindFirstChild( gui_window *parent )
{
    gui_window *wnd;

    for( wnd = GUIGetFront(); wnd != NULL; wnd = GUIGetNextWindow( wnd ) ) {
        if( wnd->parent == parent && !( wnd->flags & UTILITY_BIT ) ){
            return( wnd );
        }
    }

    return( NULL );
}
示例#7
0
gui_window *GUIXGetRootWindow( void )
{
    gui_window *curr;

    for( curr = GUIGetFront(); curr != NULL; curr = GUIGetNextWindow( curr ) ) {
        if( curr->flags & IS_ROOT ) {
            return( curr );
        }
    }

    return( NULL );
}
示例#8
0
bool GUIBringNewToFront( gui_window *prev )
{
    gui_window *curr;

    for( curr = GUIGetFront(); curr != NULL; curr = GUIGetNextWindow( curr ) ) {
        if( ( curr != prev ) && !_wpi_ischild( prev->hwnd, curr->hwnd ) &&
            !(curr->flags & DOING_DESTROY) ) {
            GUIBringToFront( curr );
            return( true );
        }
    }
    return( false );
}
示例#9
0
gui_window *GUIFindWindowFromHWND( HWND hwnd )
{
    gui_window *curr;

    for( curr = GUIGetFront(); curr != NULL; curr = GUIGetNextWindow( curr ) ) {
        if( ( curr->hwnd == hwnd ) || ( curr->hwnd_frame == hwnd ) ||
            ( curr->root == hwnd ) || ( curr->root_frame == hwnd ) ) {
            return( curr );
        }
    }

    return( NULL );
}
示例#10
0
gui_window *GUIGetMenuWindow( void )
{
    gui_window *menu_window;

    menu_window = GUIGetFront();
    if( menu_window != NULL ) {
        menu_window = GUIGetTopWnd( menu_window );
        if( menu_window->vbarmenu == NULL ) {
            menu_window = NULL;
        }
    }
    return( menu_window );
}
示例#11
0
void WndShowAll( void )
{
    gui_window  *gui;
    gui_window  **list;
    gui_window  **pcurr;
    int         count;

    // this is a kludge since UI brings windows to the front on show
    count = 0;
    for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) {
        ++count;
    }
    list = WndAlloc( count * sizeof( gui ) );
    pcurr = list;
    for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) {
        if( WndMain != NULL && WndMain->gui == gui )
            continue;
        *pcurr++ = gui;
    }
    while( pcurr > list ) {
        GUIShowWindow( *--pcurr );
    }
    WndFree( list );
}
示例#12
0
void GUIWndDirty( gui_window *wnd )
{
    gui_window *curr;

    if( wnd == NULL ) {
        for( curr = GUIGetFront(); curr != NULL; curr = GUIGetNextWindow( curr ) ) {
            if( GUIGetParentFrameHWND( curr ) != NULLHANDLE ) {
                GUIWndDirty( curr );
            }
        }
    } else {
        //GUIInvalidatePaintHandles( wnd );
        _wpi_invalidaterect( wnd->hwnd, NULL, TRUE );
        wnd->flags &= ~NEEDS_RESIZE_REDRAW;
        _wpi_updatewindow( wnd->hwnd );
    }
}
示例#13
0
int GUIXMain( int argc, char *argv[] )
{
    bool        ok;
    int         ret;
    bool        register_done;
    HAB         inst;

    inst = WinInitialize( 0 );
    if( !inst ) {
        return( 0 );
    }

    GUIPMmq = WinCreateMsgQueue( inst, 0 );
    if( !GUIPMmq ) {
        return( 0 );
    }

    register_done = FALSE;

#else

int GUIXMain( int argc, char *argv[],
              WPI_INST inst, WPI_INST hPrevInstance, LPSTR lpCmdLine,
              int nShowCmd )
{
    bool        ok;
    int         ret;
    bool        register_done;

    ret = 0;
    lpCmdLine = lpCmdLine;
    nShowCmd = nShowCmd;
    register_done = ( hPrevInstance != 0 );
    FirstInstance = ( hPrevInstance == 0 );

#endif

    GUIMainTouched = TRUE;

    GUIStoreArgs( argv, argc );

    _wpi_setwpiinst( inst, 0, &GUIMainHInst );
    memcpy( &GUIResHInst, &GUIMainHInst, sizeof( WPI_INST ) ) ;

    ok = TRUE;

    GUISetWindowClassName();
    GUIMemOpen();

    ok = GUIFirstCrack();

    if( ok ) {
        if( !register_done ) {
            ok = SetupClass();
        }
    }

    if( ok ) {
        ok = GUILoadStrInit( argv[0] );
    }

    if( ok ) {
        ok = GUIInitInternalStringTable();
    }

    if( ok ) {
        GUIInitGUIMenuHint();
        GUImain();
    }

    if( GUIGetFront() == NULL && !Posted ) {  /* no windows created */
        _wpi_postquitmessage( 0 );
    }

    if( NumWindows ) {
        ret = GUIWinMessageLoop();
    }

#ifdef __OS2_PM__
    WinDestroyMsgQueue( GUIPMmq );
    WinTerminate( inst );
#endif
    GUICleanup();
    GUIDead();
    GUIMemClose();
    return( ret );
}