WinInterface.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. //---------------------------------------------------------------------------
  2. #ifndef WinInterfaceH
  3. #define WinInterfaceH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Buttons.hpp>
  7. #include <Interface.h>
  8. #include <WinConfiguration.h>
  9. #include <SynchronizeController.h>
  10. #ifdef LOCALINTERFACE
  11. #include <LocalInterface.h>
  12. #endif
  13. #define SITE_ICON 1
  14. #define SITE_FOLDER_ICON 2
  15. #define WORKSPACE_ICON 3
  16. class TStoredSessionList;
  17. class TConfiguration;
  18. class TTerminal;
  19. const int mpNeverAskAgainCheck = 0x01;
  20. const int mpAllowContinueOnError = 0x02;
  21. #define UPLOAD_IF_ANY_SWITCH L"UploadIfAny"
  22. #define UPLOAD_SWITCH L"Upload"
  23. #define JUMPLIST_SWITCH L"JumpList"
  24. #define DESKTOP_SWITCH L"Desktop"
  25. #define SEND_TO_HOOK_SWITCH L"SendToHook"
  26. #define UNSAFE_SWITCH L"Unsafe"
  27. #define NEWINSTANCE_SWICH L"NewInstance"
  28. #define KEYGEN_SWITCH L"KeyGen"
  29. #define KEYGEN_OUTPUT_SWITCH L"Output"
  30. #define KEYGEN_COMMENT_SWITCH L"Comment"
  31. #define KEYGEN_CHANGE_PASSPHRASE_SWITCH L"ChangePassphrase"
  32. #define LOG_SWITCH L"Log"
  33. #define INI_SWITCH L"Ini"
  34. #define FINGERPRINTSCAN_SWITCH L"FingerprintScan"
  35. struct TMessageParams
  36. {
  37. TMessageParams(unsigned int AParams = 0);
  38. TMessageParams(const TQueryParams * AParams);
  39. const TQueryButtonAlias * Aliases;
  40. unsigned int AliasesCount;
  41. unsigned int Params;
  42. unsigned int Timer;
  43. TQueryParamsTimerEvent TimerEvent;
  44. UnicodeString TimerMessage;
  45. unsigned int TimerAnswers;
  46. TQueryType TimerQueryType;
  47. unsigned int Timeout;
  48. unsigned int TimeoutAnswer;
  49. UnicodeString NeverAskAgainTitle;
  50. unsigned int NeverAskAgainAnswer;
  51. bool NeverAskAgainCheckedInitially;
  52. bool AllowHelp;
  53. UnicodeString ImageName;
  54. UnicodeString MoreMessagesUrl;
  55. TSize MoreMessagesSize;
  56. UnicodeString CustomCaption;
  57. private:
  58. inline void Reset();
  59. };
  60. class TCustomScpExplorerForm;
  61. TCustomScpExplorerForm * __fastcall CreateScpExplorer();
  62. void __fastcall ConfigureInterface();
  63. void __fastcall DoProductLicense();
  64. extern const UnicodeString AppName;
  65. void __fastcall SetOnForeground(bool OnForeground);
  66. void __fastcall FlashOnBackground();
  67. void __fastcall TerminateApplication();
  68. void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal, Exception * E);
  69. void __fastcall FormHelp(TCustomForm * Form);
  70. void __fastcall SearchHelp(const UnicodeString & Message);
  71. void __fastcall MessageWithNoHelp(const UnicodeString & Message);
  72. class TProgramParams;
  73. bool __fastcall CheckSafe(TProgramParams * Params);
  74. void __fastcall CheckLogParam(TProgramParams * Params);
  75. bool __fastcall CheckXmlLogParam(TProgramParams * Params);
  76. UnicodeString __fastcall GetToolbarsLayoutStr(TComponent * OwnerComponent);
  77. void __fastcall LoadToolbarsLayoutStr(TComponent * OwnerComponent, UnicodeString LayoutStr);
  78. namespace Tb2item { class TTBCustomItem; }
  79. namespace Tbx { class TTBXSeparatorItem; }
  80. Tbx::TTBXSeparatorItem * __fastcall AddMenuSeparator(Tb2item::TTBCustomItem * Menu);
  81. void __fastcall AddMenuLabel(Tb2item::TTBCustomItem * Menu, const UnicodeString & Label);
  82. // windows\WinHelp.cpp
  83. void __fastcall InitializeWinHelp();
  84. void __fastcall FinalizeWinHelp();
  85. // windows\WinInterface.cpp
  86. unsigned int __fastcall MessageDialog(const UnicodeString Msg, TQueryType Type,
  87. unsigned int Answers, UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  88. unsigned int __fastcall MessageDialog(int Ident, TQueryType Type,
  89. unsigned int Answers, UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  90. unsigned int __fastcall SimpleErrorDialog(const UnicodeString Msg, const UnicodeString MoreMessages = L"");
  91. unsigned int __fastcall MoreMessageDialog(const UnicodeString Message,
  92. TStrings * MoreMessages, TQueryType Type, unsigned int Answers,
  93. UnicodeString HelpKeyword, const TMessageParams * Params = NULL);
  94. unsigned int __fastcall ExceptionMessageDialog(Exception * E, TQueryType Type,
  95. const UnicodeString MessageFormat = L"", unsigned int Answers = qaOK,
  96. UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  97. unsigned int __fastcall FatalExceptionMessageDialog(Exception * E, TQueryType Type,
  98. int SessionReopenTimeout, const UnicodeString MessageFormat = L"", unsigned int Answers = qaOK,
  99. UnicodeString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  100. // forms\Custom.cpp
  101. TSessionData * __fastcall DoSaveSession(TSessionData * SessionData,
  102. TSessionData * OriginalSession, bool ForceDialog,
  103. TStrings * AdditionalFolders);
  104. void __fastcall SessionNameValidate(const UnicodeString & Text,
  105. const UnicodeString & OriginalName);
  106. bool __fastcall DoSaveWorkspaceDialog(UnicodeString & WorkspaceName,
  107. bool * SavePasswords, bool NotRecommendedSavingPasswords,
  108. bool & CreateShortcut, bool & EnableAutoSave);
  109. class TShortCuts;
  110. bool __fastcall DoShortCutDialog(TShortCut & ShortCut,
  111. const TShortCuts & ShortCuts, UnicodeString HelpKeyword);
  112. bool __fastcall DoCustomCommandOptionsDialog(
  113. const TCustomCommandType * Command, TStrings * CustomCommandOptions, unsigned int Flags,
  114. TCustomCommand * CustomCommandForOptions, const UnicodeString & Site);
  115. // windows\UserInterface.cpp
  116. bool __fastcall DoMasterPasswordDialog();
  117. bool __fastcall DoChangeMasterPasswordDialog(UnicodeString & NewPassword);
  118. // windows\WinMain.cpp
  119. int __fastcall Execute();
  120. void __fastcall GetLoginData(UnicodeString SessionName, TOptions * Options,
  121. TObjectList * DataList, UnicodeString & DownloadFile, bool NeedSession, TForm * LinkedForm);
  122. // forms\InputDlg.cpp
  123. struct TInputDialogData
  124. {
  125. TCustomEdit * Edit;
  126. };
  127. typedef void __fastcall (__closure *TInputDialogInitialize)
  128. (TObject * Sender, TInputDialogData * Data);
  129. bool __fastcall InputDialog(const UnicodeString ACaption,
  130. const UnicodeString APrompt, UnicodeString & Value, UnicodeString HelpKeyword = HELP_NONE,
  131. TStrings * History = NULL, bool PathInput = false,
  132. TInputDialogInitialize OnInitialize = NULL, bool Echo = true);
  133. // forms\About.cpp
  134. struct TRegistration
  135. {
  136. bool Registered;
  137. UnicodeString Subject;
  138. int Licenses;
  139. UnicodeString ProductId;
  140. bool NeverExpires;
  141. TDateTime Expiration;
  142. bool EduLicense;
  143. TNotifyEvent OnRegistrationLink;
  144. };
  145. void __fastcall DoAboutDialog(TConfiguration * Configuration,
  146. bool AllowLicense, TRegistration * Registration);
  147. void __fastcall DoAboutDialog(TConfiguration *Configuration);
  148. // forms\Cleanup.cpp
  149. bool __fastcall DoCleanupDialog(TStoredSessionList *SessionList,
  150. TConfiguration *Configuration);
  151. // forms\Console.cpp
  152. void __fastcall DoConsoleDialog(TTerminal * Terminal,
  153. const UnicodeString Command = L"", const TStrings * Log = NULL);
  154. // forms\Copy.cpp
  155. const coTemp = 0x001;
  156. const coDisableQueue = 0x002;
  157. const coDisableDirectory = 0x008; // not used anymore
  158. const coDoNotShowAgain = 0x020;
  159. const coDisableSaveSettings = 0x040; // not used anymore
  160. const coDoNotUsePresets = 0x080;
  161. const coAllowRemoteTransfer = 0x100;
  162. const coNoQueue = 0x200;
  163. const coNoQueueIndividually = 0x400;
  164. const coShortCutHint = 0x800;
  165. const coAllFiles = 0x1000;
  166. const cooDoNotShowAgain = 0x01;
  167. const cooRemoteTransfer = 0x02;
  168. const cooSaveSettings = 0x04;
  169. bool __fastcall DoCopyDialog(bool ToRemote,
  170. bool Move, TStrings * FileList, UnicodeString & TargetDirectory,
  171. TGUICopyParamType * Params, int Options, int CopyParamAttrs,
  172. TSessionData * SessionData, int * OutputOptions);
  173. // forms\CreateDirectory.cpp
  174. bool __fastcall DoCreateDirectoryDialog(UnicodeString & Directory,
  175. TRemoteProperties * Properties, int AllowedChanges, bool & SaveSettings);
  176. // forms\ImportSessions.cpp
  177. bool __fastcall DoImportSessionsDialog(TList * Imported);
  178. // forms\License.cpp
  179. enum TLicense { lcNoLicense = -1, lcWinScp, lcExpat };
  180. void __fastcall DoLicenseDialog(TLicense License);
  181. bool __fastcall DoLoginDialog(TStoredSessionList * SessionList, TList * DataList, TForm * LinkedForm);
  182. // forms\SiteAdvanced.cpp
  183. bool __fastcall DoSiteAdvancedDialog(TSessionData * SessionData);
  184. // forms\OpenDirectory.cpp
  185. enum TOpenDirectoryMode { odBrowse, odAddBookmark };
  186. bool __fastcall DoOpenDirectoryDialog(TOpenDirectoryMode Mode, TOperationSide Side,
  187. UnicodeString & Directory, TStrings * Directories, TTerminal * Terminal,
  188. bool AllowSwitch);
  189. // forms\LocatinoProfiles.cpp
  190. bool __fastcall LocationProfilesDialog(TOpenDirectoryMode Mode,
  191. TOperationSide Side, UnicodeString & LocalDirectory, UnicodeString & RemoteDirectory,
  192. TStrings * LocalDirectories, TStrings * RemoteDirectories, TTerminal * Terminal);
  193. // forms\Preferences.cpp
  194. enum TPreferencesMode { pmDefault, pmEditor, pmCustomCommands,
  195. pmQueue, pmLogging, pmUpdates, pmPresets, pmEditors, pmCommander,
  196. pmEditorInternal };
  197. class TCopyParamRuleData;
  198. struct TPreferencesDialogData
  199. {
  200. TCopyParamRuleData * CopyParamRuleData;
  201. };
  202. bool __fastcall DoPreferencesDialog(TPreferencesMode APreferencesMode,
  203. TPreferencesDialogData * DialogData = NULL);
  204. // forms\CustomCommand.cpp
  205. class TCustomCommandList;
  206. class TCustomCommandType;
  207. class TShortCuts;
  208. enum TCustomCommandsMode { ccmAdd, ccmEdit, ccmAdHoc };
  209. const ccoDisableRemote = 0x01;
  210. const ccoDisableRemoteFiles = 0x02;
  211. typedef void __fastcall (__closure *TCustomCommandValidate)
  212. (const TCustomCommandType & Command);
  213. bool __fastcall DoCustomCommandDialog(TCustomCommandType & Command,
  214. const TCustomCommandList * CustomCommandList,
  215. TCustomCommandsMode Mode, int Options, TCustomCommandValidate OnValidate,
  216. const TShortCuts * ShortCuts);
  217. // forms\CopyParamPreset.cpp
  218. class TCopyParamList;
  219. enum TCopyParamPresetMode { cpmAdd, cpmAddCurrent, cpmEdit, cpmDuplicate };
  220. bool __fastcall DoCopyParamPresetDialog(TCopyParamList * CopyParamList,
  221. int & Index, TCopyParamPresetMode Mode, TCopyParamRuleData * CurrentRuleData,
  222. const TCopyParamType & DefaultCopyParams);
  223. // forms\CopyParamCsutom.cpp
  224. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  225. int CopyParamAttrs);
  226. // forms\Properties.cpp
  227. class TRemoteProperties;
  228. class TRemoteTokenList;
  229. struct TCalculateSizeStats;
  230. const cpMode = 0x01;
  231. const cpOwner = 0x02;
  232. const cpGroup = 0x04;
  233. typedef void __fastcall (__closure *TCalculateSizeEvent)
  234. (TStrings * FileList, __int64 & Size, TCalculateSizeStats & Stats,
  235. bool & Close);
  236. typedef void __fastcall (__closure *TCalculatedChecksumCallbackEvent)(
  237. const UnicodeString & FileName, const UnicodeString & Alg, const UnicodeString & Hash);
  238. typedef void __fastcall (__closure *TCalculateChecksumEvent)
  239. (const UnicodeString & Alg, TStrings * FileList,
  240. TCalculatedChecksumCallbackEvent OnCalculatedChecksum, bool & Close);
  241. bool __fastcall DoPropertiesDialog(TStrings * FileList,
  242. const UnicodeString Directory, const TRemoteTokenList * GroupList,
  243. const TRemoteTokenList * UserList, TStrings * ChecksumAlgs,
  244. TRemoteProperties * Properties,
  245. int AllowedChanges, bool UserGroupByID, TCalculateSizeEvent OnCalculateSize,
  246. TCalculateChecksumEvent OnCalculateChecksum);
  247. bool __fastcall DoRemoteMoveDialog(bool Multi, UnicodeString & Target, UnicodeString & FileMask);
  248. enum TDirectRemoteCopy { drcDisallow, drcAllow, drcConfirmCommandSession };
  249. bool __fastcall DoRemoteCopyDialog(TStrings * Sessions, TStrings * Directories,
  250. TDirectRemoteCopy AllowDirectCopy, bool Multi, void *& Session,
  251. UnicodeString & Target, UnicodeString & FileMask, bool & DirectCopy, void * CurrentSession);
  252. // forms\SelectMask.cpp
  253. #ifdef CustomdirviewHPP
  254. bool __fastcall DoSelectMaskDialog(TCustomDirView * Parent, bool Select,
  255. TFileFilter * Filter, TConfiguration * Configuration);
  256. bool __fastcall DoFilterMaskDialog(TCustomDirView * Parent,
  257. TFileFilter * Filter);
  258. #endif
  259. // forms\EditMask.cpp
  260. bool __fastcall DoEditMaskDialog(TFileMasks & Mask);
  261. const spDelete = 0x01;
  262. const spNoConfirmation = 0x02;
  263. const spExistingOnly = 0x04;
  264. const spPreviewChanges = 0x40; // not used by core
  265. const spTimestamp = 0x100;
  266. const spNotByTime = 0x200;
  267. const spBySize = 0x400;
  268. const spSelectedOnly = 0x800;
  269. const spMirror = 0x1000;
  270. // forms\Synchronize.cpp
  271. const soDoNotUsePresets = 0x01;
  272. const soNoMinimize = 0x02;
  273. const soAllowSelectedOnly = 0x04;
  274. typedef void __fastcall (__closure *TGetSynchronizeOptionsEvent)
  275. (int Params, TSynchronizeOptions & Options);
  276. typedef void __fastcall (__closure *TSynchronizeSessionLog)
  277. (const UnicodeString & Message);
  278. typedef void __fastcall (__closure *TFeedSynchronizeError)
  279. (const UnicodeString & Message, TStrings * MoreMessages, TQueryType Type,
  280. const UnicodeString & HelpKeyword);
  281. bool __fastcall DoSynchronizeDialog(TSynchronizeParamType & Params,
  282. const TCopyParamType * CopyParams, TSynchronizeStartStopEvent OnStartStop,
  283. bool & SaveSettings, int Options, int CopyParamAttrs,
  284. TGetSynchronizeOptionsEvent OnGetOptions,
  285. TSynchronizeSessionLog OnSynchronizeSessionLog,
  286. TFeedSynchronizeError & OnFeedSynchronizeError,
  287. bool Start);
  288. // forms\FullSynchronize.cpp
  289. struct TUsableCopyParamAttrs;
  290. enum TSynchronizeMode { smRemote, smLocal, smBoth };
  291. const fsoDisableTimestamp = 0x01;
  292. const fsoDoNotUsePresets = 0x02;
  293. const fsoAllowSelectedOnly = 0x04;
  294. bool __fastcall DoFullSynchronizeDialog(TSynchronizeMode & Mode, int & Params,
  295. UnicodeString & LocalDirectory, UnicodeString & RemoteDirectory,
  296. TCopyParamType * CopyParams, bool & SaveSettings, bool & SaveMode,
  297. int Options, const TUsableCopyParamAttrs & CopyParamAttrs);
  298. // forms\SynchronizeChecklist.cpp
  299. class TSynchronizeChecklist;
  300. typedef void __fastcall (__closure *TCustomCommandMenuEvent)
  301. (TAction * Action, TStrings * LocalFileList, TStrings * RemoteFileList);
  302. bool __fastcall DoSynchronizeChecklistDialog(TSynchronizeChecklist * Checklist,
  303. TSynchronizeMode Mode, int Params,
  304. const UnicodeString LocalDirectory, const UnicodeString RemoteDirectory,
  305. TCustomCommandMenuEvent OnCustomCommandMenu);
  306. // forms\Editor.cpp
  307. typedef void __fastcall (__closure *TFileClosedEvent)
  308. (TObject * Sender, bool Forced);
  309. typedef void __fastcall (__closure *TAnyModifiedEvent)
  310. (TObject * Sender, bool & Modified);
  311. TForm * __fastcall ShowEditorForm(const UnicodeString FileName, TCustomForm * ParentForm,
  312. TNotifyEvent OnFileChanged, TNotifyEvent OnFileReload, TFileClosedEvent OnClose,
  313. TNotifyEvent OnSaveAll, TAnyModifiedEvent OnAnyModified,
  314. const UnicodeString Caption, bool StandaloneEditor, TColor Color);
  315. void __fastcall ReconfigureEditorForm(TForm * Form);
  316. void __fastcall EditorFormFileUploadComplete(TForm * Form);
  317. void __fastcall EditorFormFileSave(TForm * Form);
  318. bool __fastcall IsEditorFormModified(TForm * Form);
  319. bool __fastcall DoSymlinkDialog(UnicodeString & FileName, UnicodeString & PointTo,
  320. TOperationSide Side, bool & SymbolicLink, bool Edit, bool AllowSymbolic);
  321. // forms\FileSystemInfo.cpp
  322. struct TSpaceAvailable;
  323. struct TFileSystemInfo;
  324. struct TSessionInfo;
  325. typedef void __fastcall (__closure *TGetSpaceAvailable)
  326. (const UnicodeString Path, TSpaceAvailable & ASpaceAvailable, bool & Close);
  327. void __fastcall DoFileSystemInfoDialog(
  328. const TSessionInfo & SessionInfo, const TFileSystemInfo & FileSystemInfo,
  329. UnicodeString SpaceAvailablePath, TGetSpaceAvailable OnGetSpaceAvailable);
  330. // forms\MessageDlg.cpp
  331. void __fastcall AnswerNameAndCaption(
  332. unsigned int Answer, UnicodeString & Name, UnicodeString & Caption);
  333. TForm * __fastcall CreateMoreMessageDialog(const UnicodeString & Msg,
  334. TStrings * MoreMessages, TMsgDlgType DlgType, unsigned int Answers,
  335. const TQueryButtonAlias * Aliases, unsigned int AliasesCount,
  336. unsigned int TimeoutAnswer, TButton ** TimeoutButton,
  337. const UnicodeString & ImageName, const UnicodeString & NeverAskAgainCaption,
  338. const UnicodeString & MoreMessagesUrl, TSize MoreMessagesSize,
  339. const UnicodeString & CustomCaption);
  340. TForm * __fastcall CreateMoreMessageDialogEx(const UnicodeString Message, TStrings * MoreMessages,
  341. TQueryType Type, unsigned int Answers, UnicodeString HelpKeyword, const TMessageParams * Params);
  342. unsigned int __fastcall ExecuteMessageDialog(TForm * Dialog, unsigned int Answers, const TMessageParams * Params);
  343. void __fastcall InsertPanelToMessageDialog(TCustomForm * Form, TPanel * Panel);
  344. void __fastcall NavigateMessageDialogToUrl(TCustomForm * Form, const UnicodeString & Url);
  345. extern const UnicodeString MessagePanelName;
  346. extern const UnicodeString MainMessageLabelName;
  347. extern const UnicodeString MessageLabelName;
  348. extern const UnicodeString YesButtonName;
  349. extern const UnicodeString OKButtonName;
  350. // windows\Console.cpp
  351. enum TConsoleMode { cmNone, cmScripting, cmHelp, cmBatchSettings, cmKeyGen, cmFingerprintScan };
  352. int __fastcall Console(TConsoleMode Mode);
  353. // forms\EditorPreferences.cpp
  354. enum TEditorPreferencesMode { epmAdd, epmEdit, epmAdHoc };
  355. class TEditorData;
  356. bool __fastcall DoEditorPreferencesDialog(TEditorData * Editor,
  357. bool & Remember, TEditorPreferencesMode Mode, bool MayRemote);
  358. // forms\Find.cpp
  359. typedef void __fastcall (__closure *TFindEvent)
  360. (UnicodeString Directory, const TFileMasks & FileMask,
  361. TFileFoundEvent OnFileFound, TFindingFileEvent OnFindingFile);
  362. bool __fastcall DoFileFindDialog(UnicodeString Directory,
  363. TFindEvent OnFind, UnicodeString & Path);
  364. // forms\GenerateUrl.cpp
  365. void __fastcall DoGenerateUrlDialog(TSessionData * Data, TStrings * Paths);
  366. enum TFilesSelected { fsList, fsAll };
  367. void __fastcall DoGenerateTransferCodeDialog(
  368. bool ToRemote, bool Move, int CopyParamAttrs, TSessionData * Data, TFilesSelected FilesSelected,
  369. TStrings * FileList, const UnicodeString & Path, const TCopyParamType & CopyParam);
  370. void __fastcall CopyParamListButton(TButton * Button);
  371. const int cplNone = 0x00;
  372. const int cplCustomize = 0x01;
  373. const int cplCustomizeDefault = 0x02;
  374. const int cplSaveSettings = 0x04;
  375. const int cplGenerateCode = 0x08;
  376. void __fastcall CopyParamListPopup(TRect R, TPopupMenu * Menu,
  377. const TCopyParamType & Param, UnicodeString Preset, TNotifyEvent OnClick,
  378. int Options, int CopyParamAttrs, bool SaveSettings = false);
  379. int __fastcall CopyParamListPopupClick(TObject * Sender,
  380. TCopyParamType & Param, UnicodeString & Preset, int CopyParamAttrs,
  381. bool * SaveSettings = NULL);
  382. void __fastcall MenuPopup(TPopupMenu * Menu, TRect Rect, TComponent * PopupComponent);
  383. void __fastcall MenuPopup(TPopupMenu * Menu, TButton * Button);
  384. void __fastcall MenuPopup(TObject * Sender, const TPoint & MousePos, bool & Handled);
  385. void __fastcall MenuButton(TButton * Button);
  386. TComponent * __fastcall GetPopupComponent(TObject * Sender);
  387. TRect __fastcall CalculatePopupRect(TButton * Button);
  388. TRect __fastcall CalculatePopupRect(TControl * Control, TPoint MousePos);
  389. typedef void __fastcall (__closure *TColorChangeEvent)
  390. (TColor Color);
  391. TPopupMenu * __fastcall CreateSessionColorPopupMenu(TColor Color,
  392. TColorChangeEvent OnColorChange);
  393. void __fastcall CreateSessionColorMenu(TComponent * AOwner, TColor Color,
  394. TColorChangeEvent OnColorChange);
  395. void __fastcall CreateEditorBackgroundColorMenu(TComponent * AOwner, TColor Color,
  396. TColorChangeEvent OnColorChange);
  397. TPopupMenu * __fastcall CreateColorPopupMenu(TColor Color,
  398. TColorChangeEvent OnColorChange);
  399. void __fastcall FixButtonImage(TButton * Button);
  400. void __fastcall CenterButtonImage(TButton * Button);
  401. void __fastcall UpgradeSpeedButton(TSpeedButton * Button);
  402. int __fastcall AdjustLocaleFlag(const UnicodeString & S, TLocaleFlagOverride LocaleFlagOverride, bool Recommended, int On, int Off);
  403. void __fastcall SetGlobalMinimizeHandler(TCustomForm * Form, TNotifyEvent OnMinimize);
  404. void __fastcall ClearGlobalMinimizeHandler(TNotifyEvent OnMinimize);
  405. void __fastcall CallGlobalMinimizeHandler(TObject * Sender);
  406. bool __fastcall IsApplicationMinimized();
  407. void __fastcall ApplicationMinimize();
  408. void __fastcall ApplicationRestore();
  409. bool __fastcall HandleMinimizeSysCommand(TMessage & Message);
  410. void __fastcall WinInitialize();
  411. void __fastcall WinFinalize();
  412. void __fastcall ShowNotification(TTerminal * Terminal, const UnicodeString & Str,
  413. TQueryType Type);
  414. void __fastcall InitializeShortCutCombo(TComboBox * ComboBox,
  415. const TShortCuts & ShortCuts);
  416. void __fastcall SetShortCutCombo(TComboBox * ComboBox, TShortCut Value);
  417. TShortCut __fastcall GetShortCutCombo(TComboBox * ComboBox);
  418. bool __fastcall IsCustomShortCut(TShortCut ShortCut);
  419. class TAnimationsModule;
  420. TAnimationsModule * __fastcall GetAnimationsModule();
  421. void __fastcall ReleaseAnimationsModule();
  422. #ifdef _DEBUG
  423. void __fastcall ForceTracing();
  424. #endif
  425. //---------------------------------------------------------------------------
  426. #define HIDDEN_WINDOW_NAME L"WinSCPHiddenWindow3"
  427. //---------------------------------------------------------------------------
  428. struct TCopyDataMessage
  429. {
  430. enum { CommandCanCommandLine, CommandCommandLine, MainWindowCheck, RefreshPanel };
  431. static const unsigned int Version1 = 1;
  432. unsigned int Version;
  433. unsigned int Command;
  434. union
  435. {
  436. wchar_t CommandLine[10240];
  437. struct
  438. {
  439. wchar_t Session[1024];
  440. wchar_t Path[1024];
  441. } Refresh;
  442. };
  443. TCopyDataMessage()
  444. {
  445. Version = TCopyDataMessage::Version1;
  446. Command = static_cast<unsigned int>(-1);
  447. }
  448. };
  449. //---------------------------------------------------------------------------
  450. class TWinInteractiveCustomCommand : public TInteractiveCustomCommand
  451. {
  452. public:
  453. TWinInteractiveCustomCommand(
  454. TCustomCommand * ChildCustomCommand, const UnicodeString CustomCommandName, const UnicodeString HelpKeyword);
  455. protected:
  456. virtual void __fastcall Prompt(int Index, const UnicodeString & Prompt,
  457. UnicodeString & Value);
  458. virtual void __fastcall Execute(const UnicodeString & Command,
  459. UnicodeString & Value);
  460. virtual void __fastcall PatternHint(int Index, const UnicodeString & Pattern);
  461. private:
  462. UnicodeString FCustomCommandName;
  463. std::map<int, size_t> FIndexes;
  464. TUnicodeStringVector FPrompts;
  465. TUnicodeStringVector FDefaults;
  466. TUnicodeStringVector FValues;
  467. UnicodeString FHelpKeyword;
  468. };
  469. //---------------------------------------------------------------------------
  470. class TTrayIcon
  471. {
  472. public:
  473. __fastcall TTrayIcon(unsigned int Id);
  474. __fastcall ~TTrayIcon();
  475. void __fastcall PopupBalloon(UnicodeString Title, const UnicodeString & Str,
  476. TQueryType QueryType, unsigned int Timeout, TNotifyEvent OnBalloonClick,
  477. TObject * BalloonUserData);
  478. void __fastcall CancelBalloon();
  479. __property bool Visible = { read = FVisible, write = SetVisible };
  480. __property TNotifyEvent OnClick = { read = FOnClick, write = FOnClick };
  481. __property UnicodeString Hint = { read = GetHint, write = SetHint };
  482. protected:
  483. void __fastcall Update();
  484. bool __fastcall Notify(unsigned int Message);
  485. private:
  486. bool FVisible;
  487. NOTIFYICONDATA * FTrayIcon;
  488. TNotifyEvent FOnClick;
  489. TNotifyEvent FOnBalloonClick;
  490. TObject * FBalloonUserData;
  491. UINT FTaskbarCreatedMsg;
  492. void __fastcall WndProc(TMessage & Message);
  493. void __fastcall SetVisible(bool value);
  494. UnicodeString __fastcall GetHint();
  495. void __fastcall SetHint(UnicodeString value);
  496. void __fastcall BalloonCancelled();
  497. };
  498. //---------------------------------------------------------------------------
  499. #endif // WinInterfaceH