Updates for Y positioning

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14121 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Webster 2002-02-11 04:33:03 +00:00
parent 4222829b44
commit 4a46a5df87
6 changed files with 36 additions and 100 deletions

View File

@ -198,8 +198,8 @@ private:
#if !USE_SHARED_LIBRARIES #if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler) IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxGDIImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxGDIImageHandler) IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxObject)
#endif #endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@ -29,7 +29,7 @@
#include "wx/icon.h" #include "wx/icon.h"
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxIconBase) IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxGDIObject)
// ============================================================================ // ============================================================================
// implementation // implementation

View File

@ -96,11 +96,7 @@ static wxString TextToLabel(const wxString& rTitle)
// dynamic classes implementation // dynamic classes implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#if wxUSE_OWNER_DRAWN IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS2(wxMenuItem, wxMenuItemBase, wxOwnerDrawn)
#else //!USE_OWNER_DRAWN
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxMenuItemBase)
#endif //USE_OWNER_DRAWN
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxMenuItem // wxMenuItem

View File

@ -414,7 +414,7 @@ void wxRegion::GetBox(
,&vRect ,&vRect
); );
x = vRect.xLeft; x = vRect.xLeft;
y = vRect.yTop; y = vRect.yBottom;
vWidth = vRect.xRight - vRect.xLeft; vWidth = vRect.xRight - vRect.xLeft;
vHeight = vRect.yTop - vRect.yBottom; vHeight = vRect.yTop - vRect.yBottom;
} }

View File

@ -593,35 +593,13 @@ bool wxTopLevelWindowOS2::Show(
m_bIconized = vSwp.fl & SWP_MINIMIZE; m_bIconized = vSwp.fl & SWP_MINIMIZE;
::WinQueryWindowPos(m_hWnd, &m_vSwpClient); ::WinQueryWindowPos(m_hWnd, &m_vSwpClient);
::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0); ::WinSendMsg(m_hFrame, WM_UPDATEFRAME, (MPARAM)~0, 0);
::WinQueryWindowPos(m_hWnd, &vSwp);
::WinEnableWindow(m_hFrame, TRUE); ::WinEnableWindow(m_hFrame, TRUE);
// //
// Deal with children // Deal with children
// //
MoveChildren(m_vSwpClient.cy - vSwp.cy); MoveChildren(m_vSwpClient.cy - vSwp.cy);
//
// Need to handle the case of a single child that not a control
// as this is probably a panel with its own children
//
if (GetChildren().GetCount() > 0)
{
for (wxWindowList::Node* pNode = GetChildren().GetFirst();
pNode;
pNode = pNode->GetNext())
{
wxWindow* pChild = pNode->GetData();
if ( GetChildren().GetCount() == 1 &&
!pChild->IsKindOf(CLASSINFO(wxControl))
)
pChild->MoveChildren(m_vSwpClient.cy - vSwp.cy);
pChild->Refresh();
pChild = NULL;
}
}
vEvent.SetEventObject(this); vEvent.SetEventObject(this);
GetEventHandler()->ProcessEvent(vEvent); GetEventHandler()->ProcessEvent(vEvent);
} }

View File

@ -303,8 +303,11 @@ void wxWindowOS2::Init()
m_hWndScrollBarHorz = 0L; m_hWndScrollBarHorz = 0L;
m_hWndScrollBarVert = 0L; m_hWndScrollBarVert = 0L;
memset(&m_vWinSwp, '\0', sizeof (SWP));
// //
// Pass WM_GETDLGCODE to DefWindowProc() // Pass WM_GETDLGCODE to DefWindowProc()
//
m_lDlgCode = 0; m_lDlgCode = 0;
m_nXThumbSize = 0; m_nXThumbSize = 0;
@ -902,7 +905,6 @@ void wxWindowOS2::SetScrollbar(
} }
else else
{ {
::WinQueryWindowPos(hWnd, &vSwpOwner);
// //
// The owner (the scrolled window) is a child of the Frame's // The owner (the scrolled window) is a child of the Frame's
// client window, usually. The scrollbars are children of the // client window, usually. The scrollbars are children of the
@ -975,6 +977,7 @@ void wxWindowOS2::ScrollWindow(
,NULL ,NULL
,SW_SCROLLCHILDREN | SW_INVALIDATERGN ,SW_SCROLLCHILDREN | SW_INVALIDATERGN
); );
Refresh();
} // end of wxWindowOS2::ScrollWindow } // end of wxWindowOS2::ScrollWindow
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -1598,8 +1601,8 @@ void wxWindowOS2::DoMoveWindow(
// which will cause the scrollbars to be displayed via the SetScrollbar // which will cause the scrollbars to be displayed via the SetScrollbar
// call in CWindow. // call in CWindow.
// //
if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) || if ( IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
pParent->IsKindOf(CLASSINFO(wxScrolledWindow)) IsKindOf(CLASSINFO(wxScrolledWindow))
) )
{ {
int nAdjustWidth = 0; int nAdjustWidth = 0;
@ -3045,37 +3048,6 @@ bool wxWindowOS2::OS2Create(
{ {
sClassName += wxT("NR"); sClassName += wxT("NR");
} }
//
// If the window being created is a Frame's Statusbar we need to use
// the actual Frame's size, not its client
//
if (pParent)
{
if ( pParent->IsKindOf(CLASSINFO(wxGenericScrolledWindow)) ||
pParent->IsKindOf(CLASSINFO(wxScrolledWindow))
)
{
if (IsKindOf(CLASSINFO(wxStatusBar)) &&
pParent->IsKindOf(CLASSINFO(wxFrame)))
{
RECTL vRect;
wxFrame* pFrame = wxDynamicCast(pParent, wxFrame);
::WinQueryWindowRect((HWND)pFrame->GetFrame(), &vRect);
nY = vRect.yTop - (nY + nHeight);
}
else
nY = pParent->GetSize().y - (nY + nHeight);
}
}
else
{
RECTL vRect;
::WinQueryWindowRect(HWND_DESKTOP, &vRect);
nY = vRect.yTop - (nY + nHeight);
}
m_hWnd = (WXHWND)::WinCreateWindow( (HWND)hParent m_hWnd = (WXHWND)::WinCreateWindow( (HWND)hParent
,(PSZ)sClassName.c_str() ,(PSZ)sClassName.c_str()
,(PSZ)zTitle ? zTitle : "" ,(PSZ)zTitle ? zTitle : ""
@ -3098,6 +3070,22 @@ bool wxWindowOS2::OS2Create(
} }
SubclassWin(m_hWnd); SubclassWin(m_hWnd);
SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT)); SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
m_backgroundColour.Set(wxString("GREY"));
LONG lColor = (LONG)m_backgroundColour.GetPixel();
if (!::WinSetPresParam( m_hWnd
,PP_BACKGROUNDCOLOR
,sizeof(LONG)
,(PVOID)&lColor
))
{
vError = ::WinGetLastError(vHabmain);
sError = wxPMErrorToStr(vError);
wxLogError("Error creating frame. Error: %s\n", sError);
return FALSE;
}
SetSize( nX SetSize( nX
,nY ,nY
,nWidth ,nWidth
@ -4112,12 +4100,12 @@ void wxWindowOS2::MoveChildren(
vSwp.x -= pCtrl->GetXComp(); vSwp.x -= pCtrl->GetXComp();
} }
::WinSetWindowPos( GetHwndOf(pWin) ::WinSetWindowPos( GetHwndOf(pWin)
,HWND_BOTTOM ,HWND_TOP
,vSwp.x ,vSwp.x
,vSwp.y - nDiff ,vSwp.y - nDiff
,vSwp.cx ,vSwp.cx
,vSwp.cy ,vSwp.cy
,SWP_MOVE | SWP_ZORDER ,SWP_MOVE | SWP_SHOW | SWP_ZORDER
); );
::WinQueryWindowPos(GetHwndOf(pWin), pWin->GetSwp()); ::WinQueryWindowPos(GetHwndOf(pWin), pWin->GetSwp());
if (pWin->IsKindOf(CLASSINFO(wxRadioBox))) if (pWin->IsKindOf(CLASSINFO(wxRadioBox)))
@ -4145,6 +4133,7 @@ void wxWindowOS2::MoveChildren(
); );
} }
} }
Refresh();
} // end of wxWindowOS2::MoveChildren } // end of wxWindowOS2::MoveChildren
// //
@ -4207,41 +4196,14 @@ int wxWindowOS2::GetOS2ParentHeight(
return(pParent->GetClientSize().y); return(pParent->GetClientSize().y);
} }
// //
// Case 3a -- One of many Frame children. Will be positioned normally // Case -- this is for any window that is the sole child of a Frame.
// // The grandparent must exist and it must be of type CFrame
else if (pParent->GetChildren().GetCount() > 1) // and it's height must be different. Otherwise the standard
return(pParent->GetClientSize().y); // applies.
//
// Case 3b -- this is for any window that is the sole child of a Frame.
// The grandparent must exist and it must be of type CFrame
// and it's height must be different. Otherwise the standard
// applies.
// //
else else
{ {
pGrandParent = pParent->GetParent(); return(pParent->GetClientSize().y);
if (pGrandParent &&
pGrandParent->IsKindOf(CLASSINFO(wxFrame)) &&
pGrandParent->GetClientSize().y != pParent->GetSize().y
)
{
int nParentHeight = 0L;
int nStatusBarHeight = 0L;
wxFrame* pFrame = wxDynamicCast(pGrandParent, wxFrame);
wxStatusBar* pStatbar = pFrame->GetStatusBar();
nParentHeight = pGrandParent->GetClientSize().y;
if (pStatbar)
nStatusBarHeight = pStatbar->GetSize().y;
nParentHeight -= nStatusBarHeight;
return(nParentHeight);
}
else
//
// Panel is a child of some other kind of window so we'll
// just use it's original size
//
return(pParent->GetClientSize().y);
} }
return(0L); return(0L);
} // end of wxWindowOS2::GetOS2ParentHeight } // end of wxWindowOS2::GetOS2ParentHeight