TerminalManager.h 3.5 KB

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