Interface.h 4.7 KB

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