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 ); } } } }
gui_window *FindNextMDIMenuWindowNotInArray( gui_window *wnd, gui_window *avoid ) { gui_window *start, *next, *parent; bool done; done = false; start = next = wnd; parent = GUIGetParentWindow( wnd ); while( !done ) { next = GUIGetNextWindow( next ); if( next == NULL ) { next = GUIGetFirstSibling( start ); } if( parent != GUIGetParentWindow( next ) ) { continue; } if( next == start ) { break; } if( ( next != avoid ) && GetIndex( next ) == -1 ) { done = true; } } if( done ) { return( next ); } else { return( NULL ); } }
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; } } }
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 ); }
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 ); }
gui_window *GUIXGetRootWindow( void ) { gui_window *curr; for( curr = GUIGetFront(); curr != NULL; curr = GUIGetNextWindow( curr ) ) { if( curr->flags & IS_ROOT ) { return( curr ); } } return( NULL ); }
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 ); }
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 ); }
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 ); }
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 ); } }