-void wxWindowOS2::OS2Layout(
- int nWidth
-, int nHeight
-)
-{
- //
- // Frames laying out canvas windows need the held.
- // Dialogs or Frames laying out child controls do not.
- //
- if (IsKindOf(CLASSINFO(wxFrame)))
- {
- RECTL vRectFrame;
- RECTL vRectClient;
- RECTL vRectChild;
- RECTL vRectHorz;
- RECTL vRectVert;
- SWP vSwpFrame;
- SWP vSwpClient;
- SWP vSwpChild;
- SWP vSwpHorz;
- SWP vSwpVert;
- wxFrame* pFrame = wxDynamicCast(this, wxFrame);
- bool bNewYSize = FALSE;
- bool bNewXSize = FALSE;
-
- ::WinQueryWindowPos(pFrame->GetFrame(), &vSwpFrame);
- ::WinQueryWindowPos(GetHwnd(), &vSwpClient);
-
- if (vSwpClient.cy != pFrame->GetSwpClient()->cy)
- bNewYSize = TRUE;
- if (vSwpClient.cx != pFrame->GetSwpClient()->cx)
- bNewXSize = TRUE;
-
- for (wxWindowList::Node* pNode = GetChildren().GetFirst();
- pNode;
- pNode = pNode->GetNext())
- {
- wxWindow* pChild = pNode->GetData();
- int nWidthAdjust = 0;
- int nHeightAdjust = 0;
-
- if ( pChild->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
- pChild->IsKindOf(CLASSINFO(wxScrolledWindow))
- )
- {
- if(bNewYSize)
- {
- //
- // This is needed SetSize will mess up the OS/2 child window
- // positioning because we position in wxWindows coordinates,
- // not OS/2 coordinates.
- //
- pChild->MoveChildren(pFrame->GetSwpClient()->cy - vSwpClient.cy);
- pChild->Refresh();
- }
- ::WinQueryWindowPos(pChild->GetHWND(), &vSwpChild);
-
- //
- // Reset the child window size to account for scrollbars
- //
- if (pChild->GetScrollBarHorz() != NULLHANDLE)
- nHeightAdjust = 20;
- if (pChild->GetScrollBarVert() != NULLHANDLE)
- nWidthAdjust = 20;
- ::WinSetWindowPos( pChild->GetHWND()
- ,HWND_TOP
- ,vSwpChild.x
- ,vSwpChild.y + nHeightAdjust
- ,vSwpChild.cx - nWidthAdjust
- ,vSwpChild.cy - nHeightAdjust
- ,SWP_MOVE | SWP_SIZE
- );
-
- //
- // Reset the scrollbar sizes...they will be all messed up after
- // auto layouts
- //
- if (pChild->GetScrollBarHorz() != NULLHANDLE)
- {
- ::WinSetWindowPos( pChild->GetScrollBarHorz()
- ,HWND_TOP
- ,vSwpClient.x + vSwpChild.x
- ,vSwpClient.y + vSwpChild.y
- ,vSwpChild.cx - 20
- ,20
- ,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
- );
- }
- if (pChild->GetScrollBarVert() != NULLHANDLE)
- {
- ::WinSetWindowPos( pChild->GetScrollBarVert()
- ,HWND_TOP
- ,vSwpClient.x + vSwpChild.x + vSwpChild.cx - 20
- ,vSwpClient.y + vSwpChild.y + 20
- ,20
- ,vSwpChild.cy - 20
- ,SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER
- );
- }
- }
- }
- ::WinQueryWindowPos(GetHwnd(), pFrame->GetSwpClient());
- }
-} // end of wxWindowOS2::OS2Layout
-