1// OverwriteDialog.h
2
3#ifndef ZIP7_INC_OVERWRITE_DIALOG_H
4#define ZIP7_INC_OVERWRITE_DIALOG_H
5
6#include "../../../Windows/Control/Dialog.h"
7
8#include "DialogSize.h"
9#include "OverwriteDialogRes.h"
10
11namespace NOverwriteDialog
12{
13  struct CFileInfo
14  {
15    bool SizeIsDefined;
16    bool TimeIsDefined;
17    UInt64 Size;
18    FILETIME Time;
19    UString Name;
20
21    void SetTime(const FILETIME *t)
22    {
23      if (!t)
24        TimeIsDefined = false;
25      else
26      {
27        TimeIsDefined = true;
28        Time = *t;
29      }
30    }
31
32    void SetSize(UInt64 size)
33    {
34      SizeIsDefined = true;
35      Size = size;
36    }
37
38    void SetSize(const UInt64 *size)
39    {
40      if (!size)
41        SizeIsDefined = false;
42      else
43        SetSize(*size);
44    }
45  };
46}
47
48class COverwriteDialog: public NWindows::NControl::CModalDialog
49{
50  bool _isBig;
51
52  void SetFileInfoControl(unsigned textID, unsigned iconID, const NOverwriteDialog::CFileInfo &fileInfo);
53  virtual bool OnInit() Z7_override;
54  virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
55  void ReduceString(UString &s);
56
57public:
58  bool ShowExtraButtons;
59  bool DefaultButton_is_NO;
60
61
62  COverwriteDialog(): ShowExtraButtons(true), DefaultButton_is_NO(false) {}
63
64  INT_PTR Create(HWND parent = NULL)
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