GUITools.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. //---------------------------------------------------------------------------
  2. #ifndef GUIToolsH
  3. #define GUIToolsH
  4. //---------------------------------------------------------------------------
  5. // from shlobj.h
  6. #define CSIDL_DESKTOP 0x0000 // <desktop>
  7. #define CSIDL_SENDTO 0x0009 // <user name>\SendTo
  8. #define CSIDL_DESKTOPDIRECTORY 0x0010 // <user name>\Desktop
  9. #define CSIDL_COMMON_DESKTOPDIRECTORY 0x0019 // All Users\Desktop
  10. #define CSIDL_APPDATA 0x001a // <user name>\Application Data
  11. #define CSIDL_PROGRAM_FILES 0x0026 // C:\Program Files
  12. #define CSIDL_PERSONAL 0x0005 // My Documents
  13. //---------------------------------------------------------------------------
  14. #include <FileMasks.H>
  15. #include <Tbx.hpp>
  16. //---------------------------------------------------------------------------
  17. class TSessionData;
  18. //---------------------------------------------------------------------------
  19. typedef void __fastcall (__closure* TProcessMessagesEvent)();
  20. //---------------------------------------------------------------------------
  21. bool __fastcall FindFile(UnicodeString & Path);
  22. bool __fastcall FindTool(const UnicodeString & Name, UnicodeString & Path);
  23. bool __fastcall ExecuteShell(const UnicodeString Path, const UnicodeString Params);
  24. bool __fastcall ExecuteShell(const UnicodeString Path, const UnicodeString Params,
  25. HANDLE & Handle);
  26. bool __fastcall ExecuteShellAndWait(HWND Handle, const UnicodeString Path,
  27. const UnicodeString Params, TProcessMessagesEvent ProcessMessages);
  28. bool __fastcall ExecuteShellAndWait(HWND Handle, const UnicodeString Command,
  29. TProcessMessagesEvent ProcessMessages);
  30. void __fastcall OpenSessionInPutty(const UnicodeString PuttyPath,
  31. TSessionData * SessionData);
  32. bool __fastcall SpecialFolderLocation(int PathID, UnicodeString & Path);
  33. UnicodeString __fastcall GetPersonalFolder();
  34. UnicodeString __fastcall GetDesktopFolder();
  35. UnicodeString __fastcall UniqTempDir(const UnicodeString BaseDir,
  36. const UnicodeString Identity, bool Mask = false);
  37. bool __fastcall DeleteDirectory(const UnicodeString DirName);
  38. UnicodeString __fastcall FormatDateTimeSpan(const UnicodeString TimeFormat, TDateTime DateTime);
  39. void __fastcall AddSessionColorImage(TCustomImageList * ImageList, TColor Color, int MaskIndex);
  40. void __fastcall SetSubmenu(TTBXCustomItem * Item);
  41. typedef int __fastcall (*TCalculateWidth)(UnicodeString Text, void * Arg);
  42. void __fastcall ApplyTabs(
  43. UnicodeString & Text, wchar_t Padding,
  44. TCalculateWidth CalculateWidth, void * CalculateWidthArg);
  45. TPanel * __fastcall CreateLabelPanel(TPanel * Parent, const UnicodeString & Label);
  46. void __fastcall SelectScaledImageList(TImageList * ImageList);
  47. void __fastcall CopyDataModule(TDataModule * TargetModule, TDataModule * SourceModule);
  48. void __fastcall CopyImageList(TImageList * TargetList, TImageList * SourceList);
  49. void __fastcall LoadDialogImage(TImage * Image, const UnicodeString & ImageName);
  50. int __fastcall DialogImageSize();
  51. void __fastcall HideComponentsPanel(TForm * Form);
  52. namespace Webbrowserex
  53. {
  54. class TWebBrowserEx;
  55. }
  56. using namespace Webbrowserex;
  57. TWebBrowserEx * __fastcall CreateBrowserViewer(TPanel * Parent, const UnicodeString & LoadingLabel);
  58. void __fastcall SetBrowserDesignModeOff(TWebBrowserEx * WebBrowser);
  59. void __fastcall AddBrowserLinkHandler(TWebBrowserEx * WebBrowser,
  60. const UnicodeString & Url, TNotifyEvent Handler);
  61. void __fastcall NavigateBrowserToUrl(TWebBrowserEx * WebBrowser, const UnicodeString & Url);
  62. //---------------------------------------------------------------------------
  63. class TLocalCustomCommand : public TFileCustomCommand
  64. {
  65. public:
  66. TLocalCustomCommand();
  67. TLocalCustomCommand(const TCustomCommandData & Data, const UnicodeString & Path);
  68. TLocalCustomCommand(const TCustomCommandData & Data, const UnicodeString & Path,
  69. const UnicodeString & FileName, const UnicodeString & LocalFileName,
  70. const UnicodeString & FileList);
  71. virtual bool __fastcall IsFileCommand(const UnicodeString & Command);
  72. bool __fastcall HasLocalFileName(const UnicodeString & Command);
  73. protected:
  74. virtual int __fastcall PatternLen(const UnicodeString & Command, int Index);
  75. virtual bool __fastcall PatternReplacement(const UnicodeString & Pattern,
  76. UnicodeString & Replacement, bool & Delimit);
  77. virtual void __fastcall DelimitReplacement(UnicodeString & Replacement, wchar_t Quote);
  78. private:
  79. UnicodeString FLocalFileName;
  80. };
  81. //---------------------------------------------------------------------------
  82. namespace Pngimagelist
  83. {
  84. class TPngImageList;
  85. class TPngImageCollectionItem;
  86. }
  87. using namespace Pngimagelist;
  88. //---------------------------------------------------------------------------
  89. class TFrameAnimation
  90. {
  91. public:
  92. __fastcall TFrameAnimation();
  93. void __fastcall Init(TPaintBox * PaintBox, const UnicodeString & Name);
  94. void __fastcall Start();
  95. void __fastcall Stop();
  96. private:
  97. TPaintBox * FPaintBox;
  98. TPngImageList * FImageList;
  99. int FFirstFrame;
  100. int FFirstLoopFrame;
  101. int FLastFrame;
  102. int FCurrentFrame;
  103. DWORD FNextFrameTick;
  104. TTimer * FTimer;
  105. bool FPainted;
  106. void __fastcall DoInit(TPaintBox * PaintBox, TPngImageList * ImageList, const UnicodeString & Name, bool Null);
  107. void __fastcall PaintBoxPaint(TObject * Sender);
  108. void __fastcall CalculateNextFrameTick();
  109. TPngImageCollectionItem * __fastcall GetCurrentImage();
  110. void __fastcall Animate();
  111. void __fastcall Timer(TObject * Sender);
  112. void __fastcall Repaint();
  113. };
  114. //---------------------------------------------------------------------------
  115. extern const UnicodeString PageantTool;
  116. extern const UnicodeString PuttygenTool;
  117. //---------------------------------------------------------------------------
  118. #endif