wxFrame::OnSize() calls Layout() if GetAutoLayout()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-07-10 17:45:38 +00:00
parent 2049ba38ad
commit ed7a557b53
2 changed files with 126 additions and 122 deletions

View File

@@ -252,32 +252,34 @@ void wxFrame::GtkOnSize( int width, int height )
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
if ( GetAutoLayout() )
Layout();
else {
// do we have exactly one child?
wxWindow *child = NULL; wxWindow *child = NULL;
int noChildren = 0;
for(wxNode *node = GetChildren()->First(); node; node = node->Next()) for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) && if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) !win->IsKindOf(CLASSINFO(wxDialog))
/* && (win != m_frameMenuBar) && #if 0 // not in m_children anyway
(win != m_frameStatusBar) not in m_children anyway */ && (win != m_frameMenuBar) &&
(win != m_frameStatusBar)
#endif
) )
{ {
if ( child ) // it's the second one: do nothing
return;
child = win; child = win;
noChildren ++;
}; };
} };
;
if ((child) && (noChildren == 1)) // yes: set it's size to fill all the frame
{
int client_x, client_y; int client_x, client_y;
GetClientSize(&client_x, &client_y); GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y); child->SetSize( 1, 1, client_x-2, client_y);
} }
;
}; };
void SetInvokingWindow( wxMenu *menu, wxWindow *win ) void SetInvokingWindow( wxMenu *menu, wxWindow *win )

View File

@@ -252,32 +252,34 @@ void wxFrame::GtkOnSize( int width, int height )
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{ {
if ( GetAutoLayout() )
Layout();
else {
// do we have exactly one child?
wxWindow *child = NULL; wxWindow *child = NULL;
int noChildren = 0;
for(wxNode *node = GetChildren()->First(); node; node = node->Next()) for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{ {
wxWindow *win = (wxWindow *)node->Data(); wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) && if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog)) !win->IsKindOf(CLASSINFO(wxDialog))
/* && (win != m_frameMenuBar) && #if 0 // not in m_children anyway
(win != m_frameStatusBar) not in m_children anyway */ && (win != m_frameMenuBar) &&
(win != m_frameStatusBar)
#endif
) )
{ {
if ( child ) // it's the second one: do nothing
return;
child = win; child = win;
noChildren ++;
}; };
} };
;
if ((child) && (noChildren == 1)) // yes: set it's size to fill all the frame
{
int client_x, client_y; int client_x, client_y;
GetClientSize(&client_x, &client_y); GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y); child->SetSize( 1, 1, client_x-2, client_y);
} }
;
}; };
void SetInvokingWindow( wxMenu *menu, wxWindow *win ) void SetInvokingWindow( wxMenu *menu, wxWindow *win )