+/* static */
+wxSize wxTopLevelWindowBase::GetDefaultSize()
+{
+ wxSize size = wxGetClientDisplayRect().GetSize();
+
+ // create proportionally bigger windows on small screens
+ if ( size.x >= 1024 )
+ size.x = 400;
+ else if ( size.x >= 800 )
+ size.x = 300;
+ else if ( size.x >= 320 )
+ size.x = 240;
+
+ if ( size.y >= 768 )
+ size.y = 250;
+ else if ( size.y > 200 )
+ {
+ size.y *= 2;
+ size.y /= 3;
+ }
+
+ return size;
+}
+
+void wxTopLevelWindowBase::DoCentre(int dir)
+{
+ wxRect rectCentre;
+ if ( !(dir & wxCENTRE_ON_SCREEN) && GetParent() )
+ {
+ // centre on parent window
+ rectCentre = GetParent()->GetRect();
+ }
+ else
+ {
+ // we were explicitely asked to centre this window on the entire screen
+ // or if we have no parent anyhow and so can't centre on it
+#if wxUSE_DISPLAY
+ const int nDisplay = wxDisplay::GetFromWindow(this);
+ if ( nDisplay != wxNOT_FOUND )
+ {
+ rectCentre = wxDisplay(nDisplay).GetGeometry();
+ }
+ else
+#endif // wxUSE_DISPLAY
+ {
+ wxDisplaySize(&rectCentre.width, &rectCentre.height);
+ }
+ }
+
+ // window may be at -1 if it's centered on a secondary display, for example
+ SetSize(GetRect().CentreIn(rectCentre, dir), wxSIZE_ALLOW_MINUS_ONE);
+}
+