X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/82c9f85ce5aceaa3aedac7e690070d5eff904e5b..458ee9e4522e412228827b5799c324cc57c1ea01:/src/msw/dialog.cpp?ds=inline diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index d612844e9c..620a3de16a 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -113,86 +113,16 @@ bool wxDialog::Create(wxWindow *parent, SetExtraStyle(GetExtraStyle() | wxTOPLEVEL_EX_DIALOG); - if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) - return FALSE; - + // save focus before doing anything which can potentially change it m_oldFocus = FindFocus(); - int x = pos.x; - int y = pos.y; - int width = size.x; - int height = size.y; - - if (x < 0) - x = wxDIALOG_DEFAULT_X; - if (y < 0) - y = wxDIALOG_DEFAULT_Y; - - if (width < 0) - width = wxDIALOG_DEFAULT_WIDTH; - if (height < 0) - height = wxDIALOG_DEFAULT_HEIGHT; - // All dialogs should really have this style - m_windowStyle |= wxTAB_TRAVERSAL; - - WXDWORD extendedStyle = MakeExtendedStyle(m_windowStyle); - if (m_windowStyle & wxSTAY_ON_TOP) - extendedStyle |= WS_EX_TOPMOST; - -#ifndef __WIN16__ - if (m_exStyle & wxDIALOG_EX_CONTEXTHELP) - extendedStyle |= WS_EX_CONTEXTHELP; -#endif - - // Allows creation of dialogs with & without captions under MSWindows, - // resizeable or not (but a resizeable dialog always has caption - - // otherwise it would look too strange) - const wxChar *dlg; - if ( style & wxRESIZE_BORDER ) - dlg = wxT("wxResizeableDialog"); - else if ( style & wxCAPTION ) - dlg = wxT("wxCaptionDialog"); - else - dlg = wxT("wxNoCaptionDialog"); - -#ifdef __WXMICROWIN__ - extern const wxChar *wxFrameClassName; - - int msflags = WS_OVERLAPPED|WS_POPUP; - if (style & wxCAPTION) - msflags |= WS_CAPTION; - if (style & wxCLIP_CHILDREN) - msflags |= WS_CLIPCHILDREN; - if ((style & wxTHICK_FRAME) == 0) - msflags |= WS_BORDER; - MSWCreate(m_windowId, parent, wxFrameClassName, this, NULL, - x, y, width, height, - msflags, - NULL, - extendedStyle); - -#else - MSWCreate(m_windowId, parent, NULL, this, NULL, - x, y, width, height, - 0, // style is not used if we have dlg template - dlg, - extendedStyle); -#endif - HWND hwnd = (HWND)GetHWND(); - - if ( !hwnd ) - { - wxFAIL_MSG(_("Failed to create dialog. You probably forgot to include wx/msw/wx.rc in your resources.")); + style |= wxTAB_TRAVERSAL; + if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) ) return FALSE; - } -#ifndef __WXMICROWIN__ - SubclassWin(GetHWND()); -#endif - - SetWindowText(hwnd, title); + SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT)); return TRUE; } @@ -392,18 +322,6 @@ bool wxDialog::Show(bool show) { // use it m_parent = parent; - - // VZ: to make dialog behave properly we should reparent - // the dialog for Windows as well - unfortunately, - // following the docs for SetParent() results in this - // code which plainly doesn't work -#if 0 - long dwStyle = ::GetWindowLong(GetHwnd(), GWL_STYLE); - dwStyle &= ~WS_POPUP; - dwStyle |= WS_CHILD; - ::SetWindowLong(GetHwnd(), GWL_STYLE, dwStyle); - ::SetParent(GetHwnd(), GetHwndOf(parent)); -#endif // 0 } }