1370b324cSopenharmony_ci// OverwriteDialog.h
2370b324cSopenharmony_ci
3370b324cSopenharmony_ci#ifndef ZIP7_INC_OVERWRITE_DIALOG_H
4370b324cSopenharmony_ci#define ZIP7_INC_OVERWRITE_DIALOG_H
5370b324cSopenharmony_ci
6370b324cSopenharmony_ci#include "../../../Windows/Control/Dialog.h"
7370b324cSopenharmony_ci
8370b324cSopenharmony_ci#include "DialogSize.h"
9370b324cSopenharmony_ci#include "OverwriteDialogRes.h"
10370b324cSopenharmony_ci
11370b324cSopenharmony_cinamespace NOverwriteDialog
12370b324cSopenharmony_ci{
13370b324cSopenharmony_ci  struct CFileInfo
14370b324cSopenharmony_ci  {
15370b324cSopenharmony_ci    bool SizeIsDefined;
16370b324cSopenharmony_ci    bool TimeIsDefined;
17370b324cSopenharmony_ci    UInt64 Size;
18370b324cSopenharmony_ci    FILETIME Time;
19370b324cSopenharmony_ci    UString Name;
20370b324cSopenharmony_ci
21370b324cSopenharmony_ci    void SetTime(const FILETIME *t)
22370b324cSopenharmony_ci    {
23370b324cSopenharmony_ci      if (!t)
24370b324cSopenharmony_ci        TimeIsDefined = false;
25370b324cSopenharmony_ci      else
26370b324cSopenharmony_ci      {
27370b324cSopenharmony_ci        TimeIsDefined = true;
28370b324cSopenharmony_ci        Time = *t;
29370b324cSopenharmony_ci      }
30370b324cSopenharmony_ci    }
31370b324cSopenharmony_ci
32370b324cSopenharmony_ci    void SetSize(UInt64 size)
33370b324cSopenharmony_ci    {
34370b324cSopenharmony_ci      SizeIsDefined = true;
35370b324cSopenharmony_ci      Size = size;
36370b324cSopenharmony_ci    }
37370b324cSopenharmony_ci
38370b324cSopenharmony_ci    void SetSize(const UInt64 *size)
39370b324cSopenharmony_ci    {
40370b324cSopenharmony_ci      if (!size)
41370b324cSopenharmony_ci        SizeIsDefined = false;
42370b324cSopenharmony_ci      else
43370b324cSopenharmony_ci        SetSize(*size);
44370b324cSopenharmony_ci    }
45370b324cSopenharmony_ci  };
46370b324cSopenharmony_ci}
47370b324cSopenharmony_ci
48370b324cSopenharmony_ciclass COverwriteDialog: public NWindows::NControl::CModalDialog
49370b324cSopenharmony_ci{
50370b324cSopenharmony_ci  bool _isBig;
51370b324cSopenharmony_ci
52370b324cSopenharmony_ci  void SetFileInfoControl(unsigned textID, unsigned iconID, const NOverwriteDialog::CFileInfo &fileInfo);
53370b324cSopenharmony_ci  virtual bool OnInit() Z7_override;
54370b324cSopenharmony_ci  virtual bool OnButtonClicked(unsigned buttonID, HWND buttonHWND) Z7_override;
55370b324cSopenharmony_ci  void ReduceString(UString &s);
56370b324cSopenharmony_ci
57370b324cSopenharmony_cipublic:
58370b324cSopenharmony_ci  bool ShowExtraButtons;
59370b324cSopenharmony_ci  bool DefaultButton_is_NO;
60370b324cSopenharmony_ci
61370b324cSopenharmony_ci
62370b324cSopenharmony_ci  COverwriteDialog(): ShowExtraButtons(true), DefaultButton_is_NO(false) {}
63370b324cSopenharmony_ci
64370b324cSopenharmony_ci  INT_PTR Create(HWND parent = NULL)
65370b324cSopenharmony_ci  {
66370b324cSopenharmony_ci    BIG_DIALOG_SIZE(280, 200);
67370b324cSopenharmony_ci    #ifdef UNDER_CE
68370b324cSopenharmony_ci    _isBig = isBig;
69370b324cSopenharmony_ci    #else
70370b324cSopenharmony_ci    _isBig = true;
71370b324cSopenharmony_ci    #endif
72370b324cSopenharmony_ci    return CModalDialog::Create(SIZED_DIALOG(IDD_OVERWRITE), parent);
73370b324cSopenharmony_ci  }
74370b324cSopenharmony_ci
75370b324cSopenharmony_ci  NOverwriteDialog::CFileInfo OldFileInfo;
76370b324cSopenharmony_ci  NOverwriteDialog::CFileInfo NewFileInfo;
77370b324cSopenharmony_ci};
78370b324cSopenharmony_ci
79370b324cSopenharmony_ci#endif
80