X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/89424d9b35a32b6c450380d22dbb34268947644c..69d31e313035d5e22d9400ec946f6007f710910c:/src/msw/dialog.cpp diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 6dc0d62e04..592c23a9bc 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -40,7 +40,7 @@ #include "wx/msw/private.h" #include "wx/evtloop.h" -#include "wx/ptr_scpd.h" +#include "wx/scopedptr.h" #if defined(__SMARTPHONE__) && defined(__WXWINCE__) #include "wx/msw/wince/resources.h" @@ -150,7 +150,9 @@ void wxDialog::Init() #if wxUSE_TOOLBAR && defined(__POCKETPC__) m_dialogToolBar = NULL; #endif +#if wxUSE_DIALOG_SIZEGRIP m_hGripper = 0; +#endif // wxUSE_DIALOG_SIZEGRIP } bool wxDialog::Create(wxWindow *parent, @@ -179,6 +181,7 @@ bool wxDialog::Create(wxWindow *parent, CreateToolBar(); #endif +#if wxUSE_DIALOG_SIZEGRIP if ( HasFlag(wxRESIZE_BORDER) ) { CreateGripper(); @@ -186,46 +189,25 @@ bool wxDialog::Create(wxWindow *parent, Connect(wxEVT_CREATE, wxWindowCreateEventHandler(wxDialog::OnWindowCreate)); } +#endif // wxUSE_DIALOG_SIZEGRIP return true; } wxDialog::~wxDialog() { - m_isBeingDeleted = true; - // this will also reenable all the other windows for a modal dialog Show(false); +#if wxUSE_DIALOG_SIZEGRIP DestroyGripper(); +#endif // wxUSE_DIALOG_SIZEGRIP } // ---------------------------------------------------------------------------- // showing the dialogs // ---------------------------------------------------------------------------- -wxWindow *wxDialog::FindSuitableParent() const -{ - // first try to use the currently active window - HWND hwndFg = ::GetForegroundWindow(); - wxWindow *parent = hwndFg ? wxFindWinFromHandle((WXHWND)hwndFg) - : NULL; - if ( !parent ) - { - // next try the main app window - parent = wxTheApp->GetTopWindow(); - } - - // finally, check if the parent we found is really suitable - if ( !parent || parent == (wxWindow *)this || !parent->IsShown() ) - { - // don't use this one - parent = NULL; - } - - return parent; -} - bool wxDialog::Show(bool show) { if ( show == IsShown() ) @@ -278,13 +260,13 @@ void wxDialog::Raise() // show dialog modally int wxDialog::ShowModal() { - wxASSERT_MSG( !IsModal(), _T("ShowModal() can't be called twice") ); + wxASSERT_MSG( !IsModal(), wxT("ShowModal() can't be called twice") ); Show(); // EndModal may have been called from InitDialog handler (called from // inside Show()) and hidden the dialog back again - if ( !IsShown() ) + if ( IsShown() ) { // enter and run the modal loop wxDialogModalDataTiedPtr modalData(&m_modalData, @@ -297,7 +279,7 @@ int wxDialog::ShowModal() void wxDialog::EndModal(int retCode) { - wxASSERT_MSG( IsModal(), _T("EndModal() called for non modal dialog") ); + wxASSERT_MSG( IsModal(), wxT("EndModal() called for non modal dialog") ); SetReturnCode(retCode); @@ -308,6 +290,8 @@ void wxDialog::EndModal(int retCode) // wxDialog gripper handling // ---------------------------------------------------------------------------- +#if wxUSE_DIALOG_SIZEGRIP + void wxDialog::SetWindowStyleFlag(long style) { wxDialogBase::SetWindowStyleFlag(style); @@ -352,7 +336,7 @@ void wxDialog::DestroyGripper() // have been called yet) wxASSERT_MSG( !IsShown() || ::GetWindow((HWND)m_hGripper, GW_HWNDNEXT) == 0, - _T("Bug in wxWidgets: gripper should be at the bottom of Z-order") ); + wxT("Bug in wxWidgets: gripper should be at the bottom of Z-order") ); ::DestroyWindow((HWND) m_hGripper); m_hGripper = 0; } @@ -360,7 +344,7 @@ void wxDialog::DestroyGripper() void wxDialog::ShowGripper(bool show) { - wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") ); + wxASSERT_MSG( m_hGripper, wxT("shouldn't be called if we have no gripper") ); if ( show ) ResizeGripper(); @@ -370,7 +354,7 @@ void wxDialog::ShowGripper(bool show) void wxDialog::ResizeGripper() { - wxASSERT_MSG( m_hGripper, _T("shouldn't be called if we have no gripper") ); + wxASSERT_MSG( m_hGripper, wxT("shouldn't be called if we have no gripper") ); HWND hwndGripper = (HWND)m_hGripper; @@ -396,6 +380,8 @@ void wxDialog::OnWindowCreate(wxWindowCreateEvent& event) event.Skip(); } +#endif // wxUSE_DIALOG_SIZEGRIP + // ---------------------------------------------------------------------------- // wxWin event handlers // ---------------------------------------------------------------------------- @@ -477,6 +463,7 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar break; case WM_SIZE: +#if wxUSE_DIALOG_SIZEGRIP if ( m_hGripper ) { switch ( wParam ) @@ -489,6 +476,7 @@ WXLRESULT wxDialog::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lPar ShowGripper(true); } } +#endif // wxUSE_DIALOG_SIZEGRIP // the Windows dialogs unfortunately are not meant to be resizeable // at all and their standard class doesn't include CS_[VH]REDRAW