Interface.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. //---------------------------------------------------------------------------
  2. #ifndef InterfaceH
  3. #define InterfaceH
  4. //---------------------------------------------------------------------------
  5. #include "Configuration.h"
  6. #include "SessionData.h"
  7. #define HELP_NONE ""
  8. //---------------------------------------------------------------------------
  9. TConfiguration * __fastcall CreateConfiguration();
  10. void __fastcall ShowExtendedException(Exception * E);
  11. bool __fastcall AppendExceptionStackTraceAndForget(TStrings *& MoreMessages);
  12. UnicodeString __fastcall GetCompanyRegistryKey();
  13. UnicodeString __fastcall GetRegistryKey();
  14. void * __fastcall BusyStart();
  15. void __fastcall BusyEnd(void * Token);
  16. UnicodeString __fastcall AppNameString();
  17. UnicodeString __fastcall SshVersionString();
  18. void __fastcall CopyToClipboard(UnicodeString Text);
  19. int __fastcall StartThread(void * SecurityAttributes, unsigned StackSize,
  20. TThreadFunc ThreadFunc, void * Parameter, unsigned CreationFlags,
  21. TThreadID & ThreadId);
  22. // Order of the values also define order of the buttons/answers on the prompts
  23. // MessageDlg relies on these to be <= 0x0000FFFF
  24. const unsigned int qaYes = 0x00000001;
  25. // MessageDlg relies that answer do not conflict with mrCancel (=0x2)
  26. const unsigned int qaNo = 0x00000004;
  27. const unsigned int qaOK = 0x00000008;
  28. const unsigned int qaCancel = 0x00000010;
  29. const unsigned int qaYesToAll = 0x00000020;
  30. const unsigned int qaNoToAll = 0x00000040;
  31. const unsigned int qaAbort = 0x00000080;
  32. const unsigned int qaRetry = 0x00000100;
  33. const unsigned int qaIgnore = 0x00000200;
  34. const unsigned int qaSkip = 0x00000400;
  35. const unsigned int qaAll = 0x00000800;
  36. const unsigned int qaHelp = 0x00001000;
  37. const unsigned int qaReport = 0x00002000;
  38. const unsigned int qaFirst = qaYes;
  39. const unsigned int qaLast = qaReport;
  40. const unsigned int qaNeverAskAgain = 0x00010000;
  41. const int qpFatalAbort = 0x01;
  42. const int qpNeverAskAgainCheck = 0x02;
  43. const int qpAllowContinueOnError = 0x04;
  44. const int qpIgnoreAbort = 0x08;
  45. struct TQueryButtonAlias
  46. {
  47. TQueryButtonAlias();
  48. unsigned int Button;
  49. UnicodeString Alias;
  50. TNotifyEvent OnClick;
  51. int GroupWith;
  52. TShiftState GrouppedShiftState;
  53. };
  54. typedef void __fastcall (__closure *TQueryParamsTimerEvent)(unsigned int & Result);
  55. enum TQueryType { qtConfirmation, qtWarning, qtError, qtInformation };
  56. struct TQueryParams
  57. {
  58. TQueryParams(unsigned int AParams = 0, UnicodeString AHelpKeyword = HELP_NONE);
  59. TQueryParams(const TQueryParams & Source);
  60. void Assign(const TQueryParams & Source);
  61. const TQueryButtonAlias * Aliases;
  62. unsigned int AliasesCount;
  63. unsigned int Params;
  64. unsigned int Timer;
  65. TQueryParamsTimerEvent TimerEvent;
  66. UnicodeString TimerMessage;
  67. unsigned int TimerAnswers;
  68. TQueryType TimerQueryType;
  69. unsigned int Timeout;
  70. unsigned int TimeoutAnswer;
  71. unsigned int NoBatchAnswers;
  72. UnicodeString HelpKeyword;
  73. };
  74. enum TPromptKind
  75. {
  76. pkPrompt,
  77. pkFileName,
  78. pkUserName,
  79. pkPassphrase,
  80. pkTIS,
  81. pkCryptoCard,
  82. pkKeybInteractive,
  83. pkPassword,
  84. pkNewPassword
  85. };
  86. enum TPromptUserParam { pupEcho = 0x01, pupRemember = 0x02 };
  87. bool __fastcall IsAuthenticationPrompt(TPromptKind Kind);
  88. bool __fastcall IsPasswordOrPassphrasePrompt(TPromptKind Kind, TStrings * Prompts);
  89. bool __fastcall IsPasswordPrompt(TPromptKind Kind, TStrings * Prompts);
  90. //---------------------------------------------------------------------------
  91. typedef void __fastcall (__closure *TFileFoundEvent)
  92. (TTerminal * Terminal, const UnicodeString FileName, const TRemoteFile * File,
  93. bool & Cancel);
  94. typedef void __fastcall (__closure *TFindingFileEvent)
  95. (TTerminal * Terminal, const UnicodeString Directory, bool & Cancel);
  96. //---------------------------------------------------------------------------
  97. class TOperationVisualizer
  98. {
  99. public:
  100. __fastcall TOperationVisualizer(bool UseBusyCursor = true);
  101. __fastcall ~TOperationVisualizer();
  102. private:
  103. bool FUseBusyCursor;
  104. void * FToken;
  105. };
  106. //---------------------------------------------------------------------------
  107. class TInstantOperationVisualizer : public TOperationVisualizer
  108. {
  109. public:
  110. __fastcall TInstantOperationVisualizer();
  111. __fastcall ~TInstantOperationVisualizer();
  112. private:
  113. TDateTime FStart;
  114. };
  115. //---------------------------------------------------------------------------
  116. struct TClipboardHandler
  117. {
  118. UnicodeString Text;
  119. void __fastcall Copy(TObject * /*Sender*/)
  120. {
  121. TInstantOperationVisualizer Visualizer;
  122. CopyToClipboard(Text);
  123. }
  124. };
  125. //---------------------------------------------------------------------------
  126. #endif