void GUIResizeToolBar( gui_window *wnd ) { WPI_RECT rect; GUI_RECTDIM left, top, right, bottom; GUI_RECTDIM height; GUI_RECTDIM t, h; toolbarinfo *tbar; tbar = wnd->tbinfo; if( tbar != NULL ) { rect = wnd->root_client_rect; if( wnd->root == NULLHANDLE ) { rect = wnd->hwnd_client_rect; } _wpi_rationalize_rect( &rect ); if( tbar->info.is_fixed ) { height = _wpi_getheightrect( tbar->fixedrect ); h = _wpi_getheightrect( rect ); _wpi_getrectvalues( rect, &left, &top, &right, &bottom ); t = _wpi_cvth_y_plus1( top, h ); bottom = _wpi_cvth_y_plus1( height, h ); _wpi_setwrectvalues( &tbar->fixedrect, left, t, right, bottom ); t = _wpi_cvth_y_size_plus1( top, h, height ); _wpi_movewindow( ToolBarWindow( tbar->hdl ), left, t, right - left, height, TRUE ); } } }
void GUIResizeBackground( gui_window *wnd, bool force_msg ) { WPI_RECT status; int t_height, s_height; GUI_RECTDIM left, top, right, bottom; gui_coord size; if( wnd->root == NULLHANDLE ) { if( wnd->hwnd != NULLHANDLE ) { _wpi_getclientrect( wnd->hwnd, &wnd->hwnd_client ); } return; } t_height = 0; s_height = 0; if( ( wnd->toolbar != NULL ) && ( wnd->toolbar->info.is_fixed ) ) { t_height = _wpi_getheightrect( wnd->toolbar->fixedrect ); } if( wnd->status != NULLHANDLE ) { _wpi_getwindowrect( wnd->status, &status ); s_height = _wpi_getheightrect( status ); } _wpi_getclientrect( wnd->root_frame, &wnd->root_client ); _wpi_getrectvalues( wnd->root_client, &left, &top, &right, &bottom ); bottom -= top; right -= left; top = left = 0; #ifdef __OS2_PM__ top += s_height; bottom -= t_height; #else top += t_height; bottom -= s_height; #endif /* if the root client is a separate window resize it too */ _wpi_movewindow( wnd->hwnd, left, top, right - left, bottom - top, TRUE ); _wpi_getclientrect( wnd->hwnd, &wnd->hwnd_client ); if( force_msg && ( wnd->flags & SENT_INIT ) ) { size.x = right - left; size.y = bottom - top; GUIScreenToScaleR( &size ); GUIEVENTWND( wnd, GUI_RESIZE, &size ); } }
bool GUIResizeStatusWindow( gui_window *wnd, gui_ord x, gui_ord height ) { WPI_RECT status; GUI_RECTDIM left, top, right, bottom; if( !GUIHasStatus( wnd ) ) { return( false ); } CalcStatusRect( wnd, x, height, &status ); _wpi_getrectvalues( status, &left, &top, &right, &bottom ); _wpi_movewindow( wnd->status, left, top, right - left, bottom - top, TRUE ); GUIResizeBackground( wnd, true ); return( true ); }
static void ResizeStatus( gui_window *wnd ) { WPI_RECT status; GUI_RECTDIM left, top, right, bottom; if( GUIHasStatus( wnd ) ) { _wpi_getwindowrect( wnd->status, &status ); _wpi_mapwindowpoints( HWND_DESKTOP, wnd->root, (WPI_LPPOINT)&status, 2 ); _wpi_getrectvalues( status, &left, &top, &right, &bottom ); /* maintain height and left position of status window -- tie the rest to the client are of the parent */ SetStatusRect( wnd->root, &status, left, bottom - top ); _wpi_getrectvalues( status, &left, &top, &right, &bottom ); _wpi_movewindow( wnd->status, left, top, right - left, bottom - top, TRUE ); } }
bool GUIResizeWindow( gui_window *wnd, gui_rect *rect ) { gui_coord pos; gui_coord size; gui_window *parent; HWND frame; HWND phwnd; HWND rphwnd; WPI_POINT pt; GUIInvalidatePaintHandles( wnd ); if( wnd->hwnd != NULLHANDLE ) { frame = GUIGetParentFrameHWND( wnd ); parent = wnd->parent; phwnd = HWND_DESKTOP; if( parent ) { phwnd = parent->hwnd; } GUICalcLocation( rect, &pos, &size, phwnd ); if( wnd->flags & IS_DIALOG ) { // dialogs are owned by, but not children of, phwnd // so lets map pos to its real parent pt.x = pos.x; pt.y = pos.y; rphwnd = _wpi_getparent( frame ); _wpi_mapwindowpoints( phwnd, rphwnd, &pt, 1 ); _wpi_movewindow( frame, pt.x, pt.y, size.x, size.y, TRUE ); // The following is a bandaid 'till I find out why WM_SIZE's aren't // generated for PM GUI dialogs by this fuction #ifdef __OS2_PM__ _wpi_getclientrect( frame, &wnd->hwnd_client ); wnd->root_client = wnd->hwnd_client; GUISetRowCol( wnd, NULL ); GUIScreenToScaleR( &size ); GUIEVENTWND( wnd, GUI_RESIZE, &size ); #endif } else { _wpi_setwindowpos( frame, NULLHANDLE, pos.x, pos.y, size.x, size.y, SWP_NOACTIVATE | SWP_NOZORDER | SWP_SIZE | SWP_MOVE ); //SWP_NOREDRAW | SWP_NOACTIVATE | SWP_NOZORDER | SWP_SIZE | SWP_MOVE ); } } return( true ); }
/* * 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 */
bool GUIChangeToolBar( gui_window *wnd ) { gui_event gui_ev; toolbarinfo *tbar; HWND toolhwnd; int t; GUI_RECTDIM left, top, right, bottom; tbar = wnd->tbinfo; if( !tbar->info.is_fixed ) { tbar->info.is_fixed = true; tbar->info.style = TOOLBAR_FIXED_STYLE; tbar->info.area = tbar->fixedrect; gui_ev = GUI_TOOLBAR_FIXED; } else { tbar->info.is_fixed = false; tbar->info.style = TOOLBAR_FLOAT_STYLE; tbar->info.area = tbar->floatrect; _wpi_cvtc_rect_plus1( wnd->root, &tbar->info.area ); gui_ev = GUI_TOOLBAR_FLOATING; } ToolBarDisplay( tbar->hdl, &tbar->info ); if( tbar->info.style != TOOLBAR_FLOAT_STYLE ) { ToolBarRedrawButtons( tbar->hdl ); } toolhwnd = ToolBarWindow( tbar->hdl ); if( tbar->info.style == TOOLBAR_FLOAT_STYLE ) { _wpi_getrectvalues( tbar->floatrect, &left, &top, &right, &bottom ); t = top; //t = _wpi_cvtc_y_size( wnd->hwnd, t, bottom - top ); t = _wpi_cvtc_y_plus1( wnd->root, t ); _wpi_movewindow( toolhwnd, left, t, right-left, bottom-top, TRUE ); } GUIResizeBackground( wnd, true ); _wpi_showwindow( toolhwnd, SW_SHOWNORMAL ); _wpi_updatewindow( toolhwnd ); GUIEVENTWND( wnd, gui_ev, NULL ); return( true ); }
/* * MDIContainerResized - resize MDI windows when container resized, if we're * maximized */ void MDIContainerResized( void ) { mdi_data *md; WPI_RECT r; WPI_RECTDIM left; WPI_RECTDIM top; WPI_RECTDIM right; WPI_RECTDIM bottom; if( MDIIsMaximized() ) { _wpi_getwindowrect( mdiInfo.container, &r ); _wpi_getrectvalues( r, &left, &top, &right, &bottom ); md = mdiHead; while( md != NULL ) { if( _wpi_isiconic( md->hwnd ) ) { _wpi_movewindow( md->hwnd, 0, 0, right - left + 1, bottom - top + 1, TRUE ); } md = md->next; } } } /* MDIContainerResized */
/* * 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 */