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:
@@ -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 )
|
||||||
|
@@ -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 )
|
||||||
|
Reference in New Issue
Block a user