Interface.h 5.0 KB

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