- const wxChar *dlgTemplate;
- if ( style & wxRESIZE_BORDER )
- dlgTemplate = wxT("wxResizeableDialog");
- else if ( style & wxCAPTION )
- dlgTemplate = wxT("wxCaptionDialog");
- else
- dlgTemplate = wxT("wxNoCaptionDialog");
-
- return CreateDialog(dlgTemplate, title, pos, size);
+
+ // we need 3 additional WORDs for dialog menu, class and title (as we
+ // don't use DS_SETFONT we don't need the fourth WORD for the font)
+ static const int dlgsize = sizeof(DLGTEMPLATE) + (sizeof(WORD) * 3);
+ DLGTEMPLATE *dlgTemplate = (DLGTEMPLATE *)malloc(dlgsize);
+ memset(dlgTemplate, 0, dlgsize);
+
+ // these values are arbitrary, they won't be used normally anyhow
+ dlgTemplate->x = 34;
+ dlgTemplate->y = 22;
+ dlgTemplate->cx = 144;
+ dlgTemplate->cy = 75;
+
+ // reuse the code in MSWGetStyle() but correct the results slightly for
+ // the dialog
+ dlgTemplate->style = MSWGetStyle(style, NULL);
+
+ // all dialogs are popups
+ dlgTemplate->style |= WS_POPUP;
+
+ // force 3D-look if necessary, it looks impossibly ugly otherwise
+ if ( style & (wxRESIZE_BORDER | wxCAPTION) )
+ dlgTemplate->style |= DS_MODALFRAME;
+
+ bool ret = CreateDialog(dlgTemplate, title, pos, size);
+ free(dlgTemplate);
+
+ return ret;