- // Can't iconize a dialog in Motif, apparently
- // TODO: try using the parent of m_mainShell.
-// XtVaSetValues((Widget) m_mainWidget, XmNiconic, iconize, NULL);
+ // Can't iconize a dialog in Motif, apparently
+ // TODO: try using the parent of m_mainShell.
+ // XtVaSetValues((Widget) m_mainWidget, XmNiconic, iconize, NULL);
+}
+
+// Default resizing behaviour - if only ONE subwindow,
+// resize to client rectangle size
+void wxDialog::OnSize(wxSizeEvent& event)
+{
+ // if we're using constraints - do use them
+#if wxUSE_CONSTRAINTS
+ if ( GetAutoLayout() ) {
+ Layout();
+ return;
+ }
+#endif
+
+ // do we have _exactly_ one child?
+ wxWindow *child = NULL;
+ for ( wxNode *node = GetChildren().First(); node; node = node->Next() )
+ {
+ wxWindow *win = (wxWindow *)node->Data();
+ if ( !win->IsKindOf(CLASSINFO(wxFrame)) &&
+ !win->IsKindOf(CLASSINFO(wxDialog)) )
+ {
+ if ( child )
+ return; // it's our second subwindow - nothing to do
+ child = win;
+ }
+ }
+
+ if ( child ) {
+ // we have exactly one child - set it's size to fill the whole frame
+ int clientW, clientH;
+ GetClientSize(&clientW, &clientH);
+
+ int x = 0;
+ int y = 0;
+
+ child->SetSize(x, y, clientW, clientH);
+ }