Interface.h 4.8 KB

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