Progress.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. //----------------------------------------------------------------------------
  2. #ifndef ProgressH
  3. #define ProgressH
  4. //----------------------------------------------------------------------------
  5. #include "HistoryComboBox.hpp"
  6. #include "PathLabel.hpp"
  7. #include <System.Classes.hpp>
  8. #include <Vcl.ComCtrls.hpp>
  9. #include <Vcl.Controls.hpp>
  10. #include <Vcl.ExtCtrls.hpp>
  11. #include <Vcl.StdCtrls.hpp>
  12. //----------------------------------------------------------------------------
  13. #include <FileOperationProgress.h>
  14. //----------------------------------------------------------------------------
  15. class TProgressForm : public TForm
  16. {
  17. __published:
  18. TAnimate *Animate;
  19. TButton *CancelButton;
  20. TButton *MinimizeButton;
  21. TPanel *MainPanel;
  22. TLabel *Label1;
  23. TPathLabel *FileLabel;
  24. TLabel *TargetLabel;
  25. TPathLabel *TargetPathLabel;
  26. TProgressBar *TopProgress;
  27. TPanel *TransferPanel;
  28. TLabel *Label3;
  29. TLabel *TimeElapsedLabel;
  30. TLabel *StartTimeLabelLabel;
  31. TLabel *StartTimeLabel;
  32. TLabel *Label4;
  33. TLabel *BytesTransferedLabel;
  34. TLabel *Label12;
  35. TLabel *CPSLabel;
  36. TProgressBar *BottomProgress;
  37. TTimer *UpdateTimer;
  38. TPanel *SpeedPanel;
  39. TLabel *SpeedLabel2;
  40. TLabel *TimeLeftLabelLabel;
  41. TLabel *TimeLeftLabel;
  42. THistoryComboBox *SpeedCombo;
  43. TLabel *OnceDoneOperationLabel;
  44. TComboBox *OnceDoneOperationCombo;
  45. void __fastcall UpdateTimerTimer(TObject *Sender);
  46. void __fastcall FormShow(TObject *Sender);
  47. void __fastcall FormHide(TObject *Sender);
  48. void __fastcall CancelButtonClick(TObject *Sender);
  49. void __fastcall MinimizeButtonClick(TObject *Sender);
  50. void __fastcall SpeedComboExit(TObject *Sender);
  51. void __fastcall SpeedComboSelect(TObject *Sender);
  52. void __fastcall SpeedComboKeyPress(TObject *Sender, wchar_t &Key);
  53. void __fastcall OnceDoneOperationComboSelect(TObject *Sender);
  54. void __fastcall OnceDoneOperationComboCloseUp(TObject *Sender);
  55. private:
  56. TCancelStatus FCancel;
  57. TFileOperationProgressType FData;
  58. bool FDataGot;
  59. bool FDataReceived;
  60. TFileOperation FLastOperation;
  61. bool FLastTotalSizeSet;
  62. bool FMinimizedByMe;
  63. int FUpdateCounter;
  64. bool FAsciiTransferChanged;
  65. bool FResumeStatusChanged;
  66. void * FShowAsModalStorage;
  67. TDateTime FLastUpdate;
  68. bool FDeleteToRecycleBin;
  69. bool FReadOnly;
  70. unsigned long FCPSLimit;
  71. TOnceDoneOperation FOnceDoneOperation;
  72. TProgressBar * FOperationProgress;
  73. TProgressBar * FFileProgress;
  74. TDateTime FStarted;
  75. TDateTime FSinceLastUpdate;
  76. bool FModalBeginHooked;
  77. TNotifyEvent FPrevApplicationModalBegin;
  78. int FModalLevel;
  79. void __fastcall SetOnceDoneOperation(TOnceDoneOperation value);
  80. void __fastcall SetAllowMinimize(bool value);
  81. bool __fastcall GetAllowMinimize();
  82. void __fastcall SetReadOnly(bool value);
  83. void __fastcall GlobalMinimize(TObject * Sender);
  84. void __fastcall ApplicationModalBegin(TObject * Sender);
  85. protected:
  86. void __fastcall CancelOperation();
  87. void __fastcall UpdateControls();
  88. void __fastcall ApplyCPSLimit();
  89. void __fastcall ResetOnceDoneOperation();
  90. bool __fastcall ReceiveData(bool Force, int ModalLevelOffset);
  91. public:
  92. static UnicodeString __fastcall OperationName(TFileOperation Operation, TOperationSide Side);
  93. virtual __fastcall ~TProgressForm();
  94. void __fastcall SetProgressData(TFileOperationProgressType & AData);
  95. virtual __fastcall TProgressForm(TComponent * AOwner);
  96. __property TCancelStatus Cancel = { read = FCancel };
  97. __property TOnceDoneOperation OnceDoneOperation = { read=FOnceDoneOperation, write=SetOnceDoneOperation };
  98. __property bool AllowMinimize = { read=GetAllowMinimize, write=SetAllowMinimize };
  99. __property bool DeleteToRecycleBin = { read=FDeleteToRecycleBin, write=FDeleteToRecycleBin };
  100. __property bool ReadOnly = { read=FReadOnly, write=SetReadOnly };
  101. };
  102. //----------------------------------------------------------------------------
  103. #endif