TerminalManager.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //---------------------------------------------------------------------------
  2. #ifndef TerminalManagerH
  3. #define TerminalManagerH
  4. //---------------------------------------------------------------------------
  5. #include <Terminal.h>
  6. #include <FileOperationProgress.h>
  7. //---------------------------------------------------------------------------
  8. class TCustomScpExplorerForm;
  9. class TLogMemo;
  10. //---------------------------------------------------------------------------
  11. enum TTerminalPendingAction { tpNull, tpNone, tpReconnect, tpFree };
  12. //---------------------------------------------------------------------------
  13. class TTerminalManager : public TTerminalList
  14. {
  15. public:
  16. static TTerminalManager * __fastcall Instance(bool ForceCreation = true);
  17. static void __fastcall DestroyInstance();
  18. __fastcall TTerminalManager();
  19. __fastcall ~TTerminalManager();
  20. virtual TTerminal * __fastcall NewTerminal(TSessionData * Data);
  21. virtual void __fastcall FreeTerminal(TTerminal * Terminal);
  22. bool __fastcall ConnectActiveTerminal();
  23. void __fastcall ReconnectActiveTerminal();
  24. void __fastcall FreeActiveTerminal();
  25. void __fastcall CycleTerminals(bool Forward);
  26. __property TCustomScpExplorerForm * ScpExplorer = { read = FScpExplorer, write = SetScpExplorer };
  27. __property TTerminal * ActiveTerminal = { read = FActiveTerminal, write = SetActiveTerminal };
  28. __property int ActiveTerminalIndex = { read = GetActiveTerminalIndex, write = SetActiveTerminalIndex };
  29. __property AnsiString ActiveTerminalTitle = { read = GetActiveTerminalTitle };
  30. __property TStrings * TerminalList = { read = GetTerminalList };
  31. __property TLogMemo * LogMemo = { read = FLogMemo };
  32. __property TNotifyEvent OnLastTerminalClosed = { read = FOnLastTerminalClosed, write = FOnLastTerminalClosed };
  33. __property TNotifyEvent OnChangeTerminal = { read = FOnChangeTerminal, write = FOnChangeTerminal };
  34. __property TNotifyEvent OnTerminalListChanged = { read = FOnTerminalListChanged, write = FOnTerminalListChanged };
  35. private:
  36. static TTerminalManager * FInstance;
  37. TCustomScpExplorerForm * FScpExplorer;
  38. TTerminal * FActiveTerminal;
  39. TLogMemo * FLogMemo;
  40. bool FDestroying;
  41. TTerminalPendingAction FTerminalPendingAction;
  42. TNotifyEvent FOnLastTerminalClosed;
  43. TNotifyEvent FOnTerminalListChanged;
  44. TNotifyEvent FOnChangeTerminal;
  45. TStrings * FTerminalList;
  46. int FProgress;
  47. ::TFileOperation FOperation;
  48. void __fastcall CreateLogMemo();
  49. void __fastcall FreeLogMemo();
  50. void __fastcall SetScpExplorer(TCustomScpExplorerForm * value);
  51. void __fastcall SetActiveTerminal(TTerminal * value);
  52. void __fastcall SetLogMemo(TLogMemo * value);
  53. void __fastcall UpdateTerminal(TTerminal * Terminal);
  54. void __fastcall UpdateAll();
  55. void __fastcall ApplicationException(TObject * Sender, Exception * E);
  56. void __fastcall ConfigurationChange(TObject * Sender);
  57. void __fastcall TerminalQueryUser(TObject * Sender,
  58. const AnsiString Query, TStrings * MoreMessages, int Answers,
  59. int Params, int & Answer, TQueryType Type);
  60. void __fastcall FreeAll();
  61. void __fastcall TerminalReady();
  62. TStrings * __fastcall GetTerminalList();
  63. int __fastcall GetActiveTerminalIndex();
  64. AnsiString __fastcall GetActiveTerminalTitle();
  65. void __fastcall SaveTerminal(TTerminal * Terminal);
  66. void __fastcall SetActiveTerminalIndex(int value);
  67. void __fastcall OperationFinished(::TFileOperation Operation, TOperationSide Side,
  68. bool DragDrop, const AnsiString FileName, bool Success,
  69. bool & DisconnectWhenFinished);
  70. void __fastcall OperationProgress(TFileOperationProgressType & ProgressData,
  71. TCancelStatus & Cancel);
  72. void __fastcall UpdateAppTitle();
  73. void __fastcall DeleteLocalFile(const AnsiString FileName);
  74. };
  75. //---------------------------------------------------------------------------
  76. #endif