Fix centering of top-level children of wxMDIParentFrame on Mac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30706 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
58b9c9badd
commit
0bba37f51d
@ -68,6 +68,8 @@ public:
|
||||
|
||||
// Get the client window
|
||||
inline wxMDIClientWindow *GetClientWindow() const { return m_clientWindow; };
|
||||
// Get rect to be used to center top-level children
|
||||
virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
|
||||
|
||||
// Create the client window class (don't Create the window,
|
||||
// just return a new class)
|
||||
|
@ -196,6 +196,9 @@ public:
|
||||
void OnCloseWindow(wxCloseEvent& event);
|
||||
void OnSize(wxSizeEvent& WXUNUSED(event)) { DoLayout(); }
|
||||
|
||||
// Get rect to be used to center top-level children
|
||||
virtual void GetRectForTopLevelChildren(int *x, int *y, int *w, int *h);
|
||||
|
||||
// this should go away, but for now it's called from docview.cpp,
|
||||
// so should be there for all platforms
|
||||
void OnActivate(wxActivateEvent &WXUNUSED(event)) { }
|
||||
|
@ -109,6 +109,12 @@ bool wxTopLevelWindowBase::IsLastBeforeExit() const
|
||||
// wxTopLevelWindow geometry
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxTopLevelWindowBase::GetRectForTopLevelChildren(int *x, int *y, int *w, int *h)
|
||||
{
|
||||
GetPosition(x,y);
|
||||
GetSize(w,h);
|
||||
}
|
||||
|
||||
wxSize wxTopLevelWindowBase::GetMaxSize() const
|
||||
{
|
||||
wxSize size( GetMaxWidth(), GetMaxHeight() );
|
||||
|
@ -388,6 +388,7 @@ void wxWindowBase::Centre(int direction)
|
||||
int widthParent, heightParent;
|
||||
|
||||
wxWindow *parent = NULL;
|
||||
wxTopLevelWindow *winTop = NULL;
|
||||
|
||||
if ( !(direction & wxCENTRE_ON_SCREEN) )
|
||||
{
|
||||
@ -409,9 +410,10 @@ void wxWindowBase::Centre(int direction)
|
||||
// Windows, for example, this places it completely off the screen
|
||||
if ( parent )
|
||||
{
|
||||
wxTopLevelWindow *winTop = wxDynamicCast(parent, wxTopLevelWindow);
|
||||
winTop = wxDynamicCast(parent, wxTopLevelWindow);
|
||||
if ( winTop && winTop->IsIconized() )
|
||||
{
|
||||
winTop = NULL;
|
||||
parent = NULL;
|
||||
}
|
||||
}
|
||||
@ -433,6 +435,10 @@ void wxWindowBase::Centre(int direction)
|
||||
else
|
||||
{
|
||||
if ( IsTopLevel() )
|
||||
{
|
||||
if(winTop)
|
||||
winTop->GetRectForTopLevelChildren(&posParent.x, &posParent.y, &widthParent, &heightParent);
|
||||
else
|
||||
{
|
||||
// centre on the parent
|
||||
parent->GetSize(&widthParent, &heightParent);
|
||||
@ -440,6 +446,7 @@ void wxWindowBase::Centre(int direction)
|
||||
// adjust to the parents position
|
||||
posParent = parent->GetPosition();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// centre inside the parents client rectangle
|
||||
|
@ -117,6 +117,15 @@ void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||
wxFrame::SetMenuBar( menu_bar ) ;
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::GetRectForTopLevelChildren(int *x, int *y, int *w, int *h)
|
||||
{
|
||||
if(x)
|
||||
*x = 0;
|
||||
if(y)
|
||||
*y = 0;
|
||||
wxDisplaySize(w,h);
|
||||
}
|
||||
|
||||
void wxMDIParentFrame::MacActivate(long timestamp, bool activating)
|
||||
{
|
||||
wxLogDebug(wxT("MDI PARENT=%p MacActivate(0x%08lx,%s)"),this,timestamp,activating?wxT("ACTIV"):wxT("deact"));
|
||||
|
Loading…
Reference in New Issue
Block a user