00001 /* 00002 Free Download Manager Copyright (c) 2003-2007 FreeDownloadManager.ORG 00003 Open Download Manager Copyright (c) 2008-2010 OpenDownloadManager.ORG 00004 */ 00005 00006 #include "stdafx.h" 00007 #include "FdmApp.h" 00008 #include "fsDialogsMgr.h" 00009 00010 #ifdef _DEBUG 00011 #undef THIS_FILE 00012 static char THIS_FILE[]=__FILE__; 00013 #define new DEBUG_NEW 00014 #endif 00015 00016 fsDialogsMgr::fsDialogsMgr() 00017 { 00018 00019 } 00020 00021 fsDialogsMgr::~fsDialogsMgr() 00022 { 00023 00024 } 00025 00026 void fsDialogsMgr::OnDoModal(CDialog* pDlg) 00027 { 00028 m_vDlgs.add (pDlg); 00029 } 00030 00031 void fsDialogsMgr::OnEndDialog(CDialog* pDlg) 00032 { 00033 int iIndex = FindDialog (pDlg); 00034 if (iIndex == -1) 00035 return; 00036 00037 m_vDlgs.del (iIndex); 00038 } 00039 00040 int fsDialogsMgr::FindDialog(CWnd* pWnd) 00041 { 00042 for (int i = m_vDlgs.size () - 1; i >= 0; i--) 00043 if (m_vDlgs [i] == pWnd) 00044 return i; 00045 00046 return -1; 00047 } 00048 00049 void fsDialogsMgr::EndAllDialogs() 00050 { 00051 try { 00052 00053 for (int i = m_vDlgs.size () - 1; i >= 0; i--) 00054 m_vDlgs [i]->SendMessage (WM_COMMAND, IDCANCEL); 00055 } 00056 catch (...) {} 00057 } 00058 00059 void fsDialogsMgr::OnDoModal(CPropertySheet *pSheet) 00060 { 00061 m_vDlgs.add (pSheet); 00062 } 00063 00064 void fsDialogsMgr::OnEndDialog(CPropertySheet *pSheet) 00065 { 00066 int iIndex = FindDialog (pSheet); 00067 00068 if (iIndex == -1) 00069 return; 00070 00071 m_vDlgs.del (iIndex); 00072 } 00073 00074 int fsDialogsMgr::DoModal(CDialog *dlg) 00075 { 00076 int res; 00077 OnDoModal (dlg); 00078 res = dlg->DoModal (); 00079 OnEndDialog (dlg); 00080 return res; 00081 } 00082 00083 int fsDialogsMgr::DoModal(CPropertySheet *sheet) 00084 { 00085 int res; 00086 OnDoModal (sheet); 00087 res = sheet->DoModal (); 00088 OnEndDialog (sheet); 00089 return res; 00090 }
1.5.6