fixed creation of the dialogs with a simple (non 3D, non resizeable) border; also fixed handling of minimize/maximize box style bits (but is this really needed for the dialogs?)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -217,10 +217,13 @@ bool wxTopLevelWindowMSW::CreateDialog(const void *dlgTemplate,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hWnd = (WXHWND)::CreateDialogIndirect(wxGetInstance(),
|
m_hWnd = (WXHWND)::CreateDialogIndirect
|
||||||
(DLGTEMPLATE*)dlgTemplate,
|
(
|
||||||
parent ? GetHwndOf(parent) : NULL,
|
wxGetInstance(),
|
||||||
(DLGPROC)wxDlgProc);
|
(DLGTEMPLATE*)dlgTemplate,
|
||||||
|
parent ? GetHwndOf(parent) : NULL,
|
||||||
|
(DLGPROC)wxDlgProc
|
||||||
|
);
|
||||||
|
|
||||||
if ( !m_hWnd )
|
if ( !m_hWnd )
|
||||||
{
|
{
|
||||||
@@ -344,36 +347,37 @@ bool wxTopLevelWindowMSW::Create(wxWindow *parent,
|
|||||||
|
|
||||||
if ( GetExtraStyle() & wxTOPLEVEL_EX_DIALOG )
|
if ( GetExtraStyle() & wxTOPLEVEL_EX_DIALOG )
|
||||||
{
|
{
|
||||||
// TODO: it would be better to construct the dialog template in memory
|
|
||||||
// during run-time than to rely on the limited number of
|
|
||||||
// templates in wx.rc because:
|
|
||||||
// a) you wouldn't have to include wx.rc in all wxWin programs
|
|
||||||
// (and the number of complaints about it would dtop)
|
|
||||||
// b) we'd be able to provide more templates simply, i.e.
|
|
||||||
// we could generate the templates for all style
|
|
||||||
// combinations
|
|
||||||
|
|
||||||
// we have different dialog templates to allows creation of dialogs
|
// we have different dialog templates to allows creation of dialogs
|
||||||
// with & without captions under MSWindows, resizeable or not (but a
|
// with & without captions under MSWindows, resizeable or not (but a
|
||||||
// resizeable dialog always has caption - otherwise it would look too
|
// resizeable dialog always has caption - otherwise it would look too
|
||||||
// strange)
|
// strange)
|
||||||
int dlgsize = sizeof(DLGTEMPLATE) + (sizeof(WORD) * 3);
|
|
||||||
DLGTEMPLATE* dlgTemplate = (DLGTEMPLATE*)malloc( dlgsize );
|
// we need 3 additional WORDs for dialog menu, class and title (as we
|
||||||
memset (dlgTemplate, 0, dlgsize );
|
// 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->x = 34;
|
||||||
dlgTemplate->y = 22;
|
dlgTemplate->y = 22;
|
||||||
dlgTemplate->cx = 144;
|
dlgTemplate->cx = 144;
|
||||||
dlgTemplate->cy = 75;
|
dlgTemplate->cy = 75;
|
||||||
|
|
||||||
if ( style & wxRESIZE_BORDER )
|
// reuse the code in MSWGetStyle() but correct the results slightly for
|
||||||
dlgTemplate->style = DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_SYSMENU | WS_THICKFRAME;
|
// the dialog
|
||||||
else if ( style & wxCAPTION )
|
dlgTemplate->style = MSWGetStyle(style, NULL);
|
||||||
dlgTemplate->style = DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_SYSMENU;
|
|
||||||
else
|
// all dialogs are popups
|
||||||
dlgTemplate->style = WS_POPUP;
|
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);
|
bool ret = CreateDialog(dlgTemplate, title, pos, size);
|
||||||
free(dlgTemplate);
|
free(dlgTemplate);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
else // !dialog
|
else // !dialog
|
||||||
|
Reference in New Issue
Block a user