1 // OverwriteDialog.h 2 3 #ifndef __OVERWRITE_DIALOG_H 4 #define __OVERWRITE_DIALOG_H 5 6 #include "../../../Windows/Control/Dialog.h" 7 8 #include "DialogSize.h" 9 #include "OverwriteDialogRes.h" 10 11 namespace NOverwriteDialog 12 { 13 struct CFileInfo 14 { 15 bool SizeIsDefined; 16 bool TimeIsDefined; 17 UInt64 Size; 18 FILETIME Time; 19 UString Name; 20 SetTimeCFileInfo21 void SetTime(const FILETIME *t) 22 { 23 if (!t) 24 TimeIsDefined = false; 25 else 26 { 27 TimeIsDefined = true; 28 Time = *t; 29 } 30 } 31 SetSizeCFileInfo32 void SetSize(UInt64 size) 33 { 34 SizeIsDefined = true; 35 Size = size; 36 } 37 SetSizeCFileInfo38 void SetSize(const UInt64 *size) 39 { 40 if (!size) 41 SizeIsDefined = false; 42 else 43 SetSize(*size); 44 } 45 }; 46 } 47 48 class COverwriteDialog: public NWindows::NControl::CModalDialog 49 { 50 bool _isBig; 51 52 void SetFileInfoControl(int textID, int iconID, const NOverwriteDialog::CFileInfo &fileInfo); 53 virtual bool OnInit(); 54 bool OnButtonClicked(int buttonID, HWND buttonHWND); 55 void ReduceString(UString &s); 56 57 public: 58 bool ShowExtraButtons; 59 bool DefaultButton_is_NO; 60 61 COverwriteDialog()62 COverwriteDialog(): ShowExtraButtons(true), DefaultButton_is_NO(false) {} 63 64 INT_PTR Create(HWND parent = 0) 65 { 66 BIG_DIALOG_SIZE(280, 200); 67 #ifdef UNDER_CE 68 _isBig = isBig; 69 #else 70 _isBig = true; 71 #endif 72 return CModalDialog::Create(SIZED_DIALOG(IDD_OVERWRITE), parent); 73 } 74 75 NOverwriteDialog::CFileInfo OldFileInfo; 76 NOverwriteDialog::CFileInfo NewFileInfo; 77 }; 78 79 #endif 80