WinInterface.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. //---------------------------------------------------------------------------
  2. #ifndef WinInterfaceH
  3. #define WinInterfaceH
  4. //---------------------------------------------------------------------------
  5. #include <Classes.hpp>
  6. #include <Buttons.hpp>
  7. #include <Interface.h>
  8. #include <GUIConfiguration.h>
  9. #include <SynchronizeController.h>
  10. #ifdef LOCALINTERFACE
  11. #include <LocalInterface.h>
  12. #endif
  13. class TStoredSessionList;
  14. class TConfiguration;
  15. class TTerminal;
  16. const int mpNeverAskAgainCheck = 0x01;
  17. const int mpAllowContinueOnError = 0x02;
  18. struct TMessageParams
  19. {
  20. TMessageParams(unsigned int AParams = 0);
  21. TMessageParams(const TQueryParams * AParams);
  22. const TQueryButtonAlias * Aliases;
  23. unsigned int AliasesCount;
  24. unsigned int Params;
  25. unsigned int Timer;
  26. TQueryParamsTimerEvent TimerEvent;
  27. AnsiString TimerMessage;
  28. unsigned int TimerAnswers;
  29. unsigned int Timeout;
  30. unsigned int TimeoutAnswer;
  31. AnsiString NewerAskAgainTitle;
  32. int NewerAskAgainAnswer;
  33. private:
  34. inline void Reset();
  35. };
  36. class TCustomScpExplorerForm;
  37. TCustomScpExplorerForm * __fastcall CreateScpExplorer();
  38. void __fastcall ConfigureInterface();
  39. void __fastcall DoProductLicense();
  40. extern const AnsiString AppName;
  41. extern const AnsiString AppNameVersion;
  42. void __fastcall SetOnForeground(bool OnForeground);
  43. void __fastcall FlashOnBackground();
  44. void __fastcall ShowExtendedExceptionEx(TTerminal * Terminal, Exception * E);
  45. void __fastcall FormHelp(TForm * Form);
  46. AnsiString __fastcall GetToolbarsLayoutStr(const TComponent * OwnerComponent);
  47. void __fastcall LoadToolbarsLayoutStr(const TComponent * OwnerComponent, AnsiString LayoutStr);
  48. namespace Tb2item { class TTBCustomItem; }
  49. void __fastcall AddMenuSeparator(Tb2item::TTBCustomItem * Menu);
  50. // windows\WinHelp.cpp
  51. void __fastcall InitializeWinHelp();
  52. void __fastcall FinalizeWinHelp();
  53. // windows\WinInterface.cpp
  54. int __fastcall MessageDialog(const AnsiString Msg, TQueryType Type,
  55. int Answers, AnsiString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  56. int __fastcall MessageDialog(int Ident, TQueryType Type,
  57. int Answers, AnsiString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  58. int __fastcall SimpleErrorDialog(const AnsiString Msg, const AnsiString MoreMessages = "");
  59. int __fastcall MoreMessageDialog(const AnsiString Message,
  60. TStrings * MoreMessages, TQueryType Type, int Answers,
  61. AnsiString HelpKeyword, const TMessageParams * Params = NULL);
  62. int __fastcall ExceptionMessageDialog(Exception * E, TQueryType Type,
  63. const AnsiString MessageFormat = "", int Answers = qaOK,
  64. AnsiString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  65. int __fastcall FatalExceptionMessageDialog(Exception * E, TQueryType Type,
  66. const AnsiString MessageFormat = "", int Answers = qaOK,
  67. AnsiString HelpKeyword = HELP_NONE, const TMessageParams * Params = NULL);
  68. // windows\WinMain.cpp
  69. int __fastcall Execute();
  70. // forms\InputDlg.cpp
  71. struct TInputDialogData
  72. {
  73. TEdit * Edit;
  74. };
  75. typedef void __fastcall (__closure *TInputDialogInitialize)
  76. (TObject * Sender, TInputDialogData * Data);
  77. bool __fastcall InputDialog(const AnsiString ACaption,
  78. const AnsiString APrompt, AnsiString & Value, AnsiString HelpKeyword = HELP_NONE,
  79. TStrings * History = NULL, bool PathInput = false,
  80. TInputDialogInitialize OnInitialize = NULL);
  81. // forms\About.cpp
  82. struct TRegistration
  83. {
  84. bool Registered;
  85. AnsiString Subject;
  86. int Licenses;
  87. AnsiString ProductId;
  88. bool NeverExpires;
  89. TDateTime Expiration;
  90. bool EduLicense;
  91. AnsiString RegistrationLink;
  92. };
  93. void __fastcall DoAboutDialog(TConfiguration * Configuration,
  94. bool AllowLicense, TRegistration * Registration);
  95. void __fastcall DoAboutDialog(TConfiguration *Configuration);
  96. // forms\Cleanup.cpp
  97. bool __fastcall DoCleanupDialog(TStoredSessionList *SessionList,
  98. TConfiguration *Configuration);
  99. // forms\Console.cpp
  100. void __fastcall DoConsoleDialog(TTerminal * Terminal,
  101. const AnsiString Command = "", const TStrings * Log = NULL);
  102. // forms\Copy.cpp
  103. const coTemp = 0x01;
  104. const coDisableQueue = 0x02;
  105. const coDisableDirectory = 0x08; // not used anymore
  106. const coDisableNewerOnly = 0x10;
  107. const coDoNotShowAgain = 0x20;
  108. const coDisableSaveSettings = 0x40; // not used anymore
  109. const coDoNotUsePresets = 0x80;
  110. const coAllowRemoteTransfer = 0x100;
  111. const cooDoNotShowAgain = 0x01;
  112. const cooRemoteTransfer = 0x02;
  113. const cooSaveSettings = 0x04;
  114. bool __fastcall DoCopyDialog(bool ToRemote,
  115. bool Move, TStrings * FileList, AnsiString & TargetDirectory,
  116. TGUICopyParamType * Params, int Options, int CopyParamAttrs,
  117. int * OutputOptions);
  118. // forms\CopyParams.cpp
  119. enum TParamsForDirection { pdBoth, pdToRemote, pdToLocal, pdAll };
  120. // forms\CreateDirectory.cpp
  121. bool __fastcall DoCreateDirectoryDialog(AnsiString & Directory,
  122. TRemoteProperties * Properties, bool & SaveSettings);
  123. // forms\ImportSessions.cpp
  124. bool __fastcall DoImportSessionsDialog(TStoredSessionList *SessionList);
  125. // forms\License.cpp
  126. enum TLicense { lcNoLicense = -1, lcWinScp, lcPutty };
  127. void __fastcall DoLicenseDialog(TLicense License);
  128. // forms\Login.cpp
  129. // these flags are used in navigation tree of login dialog, change with care
  130. const loLocalDirectory = 0x01;
  131. const loLanguage = 0x02;
  132. const loTools = 0x04;
  133. const loLogWindow = 0x08;
  134. const loAbout = 0x10;
  135. const loPreferences = 0x20;
  136. const loExternalProtocols = 0x40;
  137. const loColor = 0x80;
  138. const loNone = 0x00;
  139. const loAddSession = (loLocalDirectory | loLogWindow | loColor);
  140. const loStartup = (loLocalDirectory | loLanguage | loTools |
  141. loLogWindow | loPreferences | loAbout | loColor);
  142. bool __fastcall DoLoginDialog(TStoredSessionList * SessionList,
  143. TSessionData * Data, int Options);
  144. // forms\OpenDirectory.cpp
  145. enum TOpenDirectoryMode { odBrowse, odAddBookmark };
  146. bool __fastcall DoOpenDirectoryDialog(TOpenDirectoryMode Mode, TOperationSide Side,
  147. AnsiString & Directory, TStrings * Directories, TTerminal * Terminal,
  148. bool AllowSwitch);
  149. // forms\LocatinoProfiles.cpp
  150. bool __fastcall LocationProfilesDialog(TOpenDirectoryMode Mode,
  151. TOperationSide Side, AnsiString & LocalDirectory, AnsiString & RemoteDirectory,
  152. TStrings * LocalDirectories, TStrings * RemoteDirectories, TTerminal * Terminal);
  153. // forms\Preferences.cpp
  154. enum TPreferencesMode { pmDefault, pmLogin, pmEditor, pmCustomCommands,
  155. pmQueue, pmTransfer, pmLogging, pmUpdates, pmPresets, pmEditors };
  156. typedef void __fastcall (__closure *TGetDefaultLogFileName)
  157. (System::TObject* Sender, AnsiString &DefaultLogFileName);
  158. class TCopyParamRuleData;
  159. struct TPreferencesDialogData
  160. {
  161. TCopyParamRuleData * CopyParamRuleData;
  162. };
  163. bool __fastcall DoPreferencesDialog(TPreferencesMode APreferencesMode,
  164. TPreferencesDialogData * DialogData = NULL);
  165. // forms\CustomCommand.cpp
  166. class TCustomCommands;
  167. enum TCustomCommandsMode { ccmAdd, ccmEdit, ccmAdHoc };
  168. const ccoDisableRemote = 0x01;
  169. typedef void __fastcall (__closure *TCustomCommandValidate)
  170. (const AnsiString & Command, int Params);
  171. bool __fastcall DoCustomCommandDialog(AnsiString & Description,
  172. AnsiString & Command, int & Params, const TCustomCommands * CustomCommands,
  173. TCustomCommandsMode Mode, int Options, TCustomCommandValidate OnValidate);
  174. // forms\CopyParamPreset.cpp
  175. class TCopyParamList;
  176. enum TCopyParamPresetMode { cpmAdd, cpmEdit, cpmDuplicate };
  177. bool __fastcall DoCopyParamPresetDialog(TCopyParamList * CopyParamList,
  178. int & Index, TCopyParamPresetMode Mode, TCopyParamRuleData * CurrentRuleData);
  179. // forms\CopyParamCsutom.cpp
  180. bool __fastcall DoCopyParamCustomDialog(TCopyParamType & CopyParam,
  181. int CopyParamAttrs);
  182. // forms\Properties.cpp
  183. class TRemoteProperties;
  184. struct TCalculateSizeStats;
  185. const cpMode = 0x01;
  186. const cpOwner = 0x02;
  187. const cpGroup = 0x04;
  188. typedef void __fastcall (__closure *TCalculateSizeEvent)
  189. (TStrings * FileList, __int64 & Size, TCalculateSizeStats & Stats,
  190. bool & Close);
  191. typedef void __fastcall (__closure *TCalculatedChecksumCallbackEvent)(
  192. const AnsiString & FileName, const AnsiString & Alg, const AnsiString & Hash);
  193. typedef void __fastcall (__closure *TCalculateChecksumEvent)
  194. (const AnsiString & Alg, TStrings * FileList,
  195. TCalculatedChecksumCallbackEvent OnCalculatedChecksum, bool & Close);
  196. bool __fastcall DoPropertiesDialog(TStrings * FileList,
  197. const AnsiString Directory, TStrings * GroupList, TStrings * UserList,
  198. TRemoteProperties * Properties, int AllowedChanges,
  199. TCalculateSizeEvent OnCalculateSize,
  200. TCalculateChecksumEvent OnCalculateChecksum);
  201. // forms\ComboInput.cpp
  202. bool __fastcall DoComboInputDialog(
  203. const AnsiString Caption, const AnsiString Prompt, AnsiString & Text,
  204. TStrings * Items, bool AllowEmpty, const AnsiString HelpKeyword);
  205. bool __fastcall DoRemoteMoveDialog(AnsiString & Target, AnsiString & FileMask);
  206. enum TDirectRemoteCopy { drcDisallow, drcAllow, drcConfirmCommandSession };
  207. bool __fastcall DoRemoteCopyDialog(TStrings * Sessions, TStrings * Directories,
  208. TDirectRemoteCopy AllowDirectCopy, void *& Session, AnsiString & Target, AnsiString & FileMask,
  209. bool & DirectCopy);
  210. // forms\SaveSession.cpp
  211. bool __fastcall DoSaveSessionDialog(AnsiString & SessionName,
  212. bool * SavePassword, TSessionData * OriginalSession);
  213. void __fastcall SessionNameValidate(const AnsiString & Text,
  214. TSessionData * RenamingSession = NULL);
  215. // forms\SelectMask.cpp
  216. #ifdef CustomDirViewHPP
  217. bool __fastcall DoSelectMaskDialog(TCustomDirView * Parent, bool Select,
  218. TFileFilter * Filter, TConfiguration * Configuration);
  219. #endif
  220. const spDelete = 0x01;
  221. const spNoConfirmation = 0x02;
  222. const spExistingOnly = 0x04;
  223. const spPreviewChanges = 0x40; // not used by core
  224. const spTimestamp = 0x100;
  225. const spNotByTime = 0x200;
  226. const spBySize = 0x400;
  227. const spSelectedOnly = 0x800;
  228. const spMirror = 0x1000;
  229. // forms\Synchronize.cpp
  230. const soDoNotUsePresets = 0x01;
  231. const soNoMinimize = 0x02;
  232. const soAllowSelectedOnly = 0x04;
  233. typedef void __fastcall (__closure *TGetSynchronizeOptionsEvent)
  234. (int Params, TSynchronizeOptions & Options);
  235. bool __fastcall DoSynchronizeDialog(TSynchronizeParamType & Params,
  236. const TCopyParamType * CopyParams, TSynchronizeStartStopEvent OnStartStop,
  237. bool & SaveSettings, int Options, int CopyParamAttrs,
  238. TGetSynchronizeOptionsEvent OnGetOptions, bool Start);
  239. // forms\FullSynchronize.cpp
  240. struct TUsableCopyParamAttrs;
  241. enum TSynchronizeMode { smRemote, smLocal, smBoth };
  242. const fsoDisableTimestamp = 0x01;
  243. const fsoDoNotUsePresets = 0x02;
  244. const fsoAllowSelectedOnly = 0x04;
  245. bool __fastcall DoFullSynchronizeDialog(TSynchronizeMode & Mode, int & Params,
  246. AnsiString & LocalDirectory, AnsiString & RemoteDirectory,
  247. TCopyParamType * CopyParams, bool & SaveSettings, bool & SaveMode,
  248. int Options, const TUsableCopyParamAttrs & CopyParamAttrs);
  249. // forms\SynchronizeChecklist.cpp
  250. class TSynchronizeChecklist;
  251. bool __fastcall DoSynchronizeChecklistDialog(TSynchronizeChecklist * Checklist,
  252. TSynchronizeMode Mode, int Params,
  253. const AnsiString LocalDirectory, const AnsiString RemoteDirectory);
  254. // forms\Editor.cpp
  255. TForm * __fastcall ShowEditorForm(const AnsiString FileName, TCustomForm * ParentForm,
  256. TNotifyEvent OnFileChanged, TNotifyEvent OnFileReload, TNotifyEvent OnClose,
  257. const AnsiString Caption = "");
  258. void __fastcall ReconfigureEditorForm(TForm * Form);
  259. bool __fastcall DoSymlinkDialog(AnsiString & FileName, AnsiString & PointTo,
  260. TOperationSide Side, bool & SymbolicLink, bool Edit, bool AllowSymbolic);
  261. // forms\FileSystemInfo.cpp
  262. struct TSpaceAvailable;
  263. struct TFileSystemInfo;
  264. struct TSessionInfo;
  265. typedef void __fastcall (__closure *TGetSpaceAvailable)
  266. (const AnsiString Path, TSpaceAvailable & ASpaceAvailable, bool & Close);
  267. void __fastcall DoFileSystemInfoDialog(
  268. const TSessionInfo & SessionInfo, const TFileSystemInfo & FileSystemInfo,
  269. AnsiString SpaceAvailablePath, TGetSpaceAvailable OnGetSpaceAvailable);
  270. // forms\MessageDlg.cpp
  271. TForm * __fastcall CreateMoreMessageDialog(const AnsiString & Msg,
  272. TStrings * MoreMessages, TMsgDlgType DlgType, TMsgDlgButtons Buttons,
  273. TQueryButtonAlias * Aliases = NULL, unsigned int AliasesCount = 0,
  274. TMsgDlgBtn TimeoutResult = mbHelp, TButton ** TimeoutButton = NULL);
  275. // windows\Console.cpp
  276. int __fastcall Console(bool Help);
  277. // windows\EditorPreferences.cpp
  278. enum TEditorPreferencesMode { epmAdd, epmEdit };
  279. class TEditorPreferences;
  280. bool __fastcall DoEditorPreferencesDialog(TEditorPreferences * Editor,
  281. TEditorPreferencesMode Mode);
  282. const int cplNone = 0x00;
  283. const int cplCustomize = 0x01;
  284. const int cplCustomizeDefault = 0x02;
  285. const int cplSaveSettings = 0x04;
  286. void __fastcall CopyParamListPopup(TPoint P, TPopupMenu * Menu,
  287. const TCopyParamType & Param, AnsiString Preset, TNotifyEvent OnClick,
  288. int Options, bool * SaveSettings = NULL);
  289. bool __fastcall CopyParamListPopupClick(TObject * Sender,
  290. TCopyParamType & Param, AnsiString & Preset, int CopyParamAttrs);
  291. void __fastcall MenuPopup(TPopupMenu * Menu, TPoint Point, TComponent * PopupComponent);
  292. void __fastcall MenuPopup(TPopupMenu * Menu, TButtonControl * Button);
  293. void __fastcall MenuPopup(TObject * Sender, const TPoint & MousePos, bool & Handled);
  294. void __fastcall UpgradeSpeedButton(TSpeedButton * Button);
  295. void __fastcall SetGlobalMinimizeHandler(TNotifyEvent OnMinimize);
  296. TNotifyEvent __fastcall GetGlobalMinimizeHandler();
  297. bool __fastcall IsGlobalMinimizeHandler();
  298. unsigned long __fastcall GetSpeedLimit(const AnsiString & Text);
  299. AnsiString __fastcall SetSpeedLimit(unsigned long Limit);
  300. void __fastcall ShowNotification(TTerminal * Terminal, const AnsiString & Str,
  301. TQueryType Type);
  302. //---------------------------------------------------------------------------
  303. class TWinInteractiveCustomCommand : public TInteractiveCustomCommand
  304. {
  305. public:
  306. TWinInteractiveCustomCommand(TCustomCommand * ChildCustomCommand,
  307. const AnsiString CustomCommandName);
  308. protected:
  309. virtual void __fastcall Prompt(int Index, const AnsiString & Prompt,
  310. AnsiString & Value);
  311. private:
  312. AnsiString FCustomCommandName;
  313. };
  314. //---------------------------------------------------------------------------
  315. struct TNotifyIconData5;
  316. //---------------------------------------------------------------------------
  317. class TTrayIcon
  318. {
  319. public:
  320. __fastcall TTrayIcon(unsigned int Id);
  321. __fastcall ~TTrayIcon();
  322. static bool __fastcall SupportsBalloons();
  323. void __fastcall PopupBalloon(const AnsiString & Title, const AnsiString & Str,
  324. TQueryType QueryType, unsigned int Timeout);
  325. void __fastcall CancelBalloon();
  326. __property bool Visible = { read = FVisible, write = SetVisible };
  327. __property TNotifyEvent OnClick = { read = FOnClick, write = FOnClick };
  328. __property AnsiString Hint = { read = GetHint, write = SetHint };
  329. protected:
  330. void __fastcall Update();
  331. bool __fastcall Notify(unsigned int Message);
  332. private:
  333. bool FVisible;
  334. TNotifyIconData5 * FTrayIcon;
  335. TNotifyEvent FOnClick;
  336. void __fastcall WndProc(TMessage & Message);
  337. void __fastcall SetVisible(bool value);
  338. AnsiString __fastcall GetHint();
  339. void __fastcall SetHint(AnsiString value);
  340. };
  341. //---------------------------------------------------------------------------
  342. #endif // WinInterfaceH