VCLCommon.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. //---------------------------------------------------------------------------
  2. #ifndef VCLCommonH
  3. #define VCLCommonH
  4. //---------------------------------------------------------------------------
  5. #include "Common.h"
  6. #include "Configuration.h"
  7. #include "Exceptions.h"
  8. #include <ComCtrls.hpp>
  9. #include <HistoryComboBox.hpp>
  10. //---------------------------------------------------------------------------
  11. extern const UnicodeString ContextSeparator;
  12. //---------------------------------------------------------------------------
  13. void __fastcall FixListColumnWidth(TListView * TListView, int Index);
  14. void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrinkIndex = -1);
  15. bool UseDarkModeForControl(TControl * Control);
  16. void __fastcall EnableControl(TControl* Control, bool Enable);
  17. void __fastcall ReadOnlyControl(TControl * Control, bool ReadOnly = true);
  18. void __fastcall ReadOnlyAndEnabledControl(TControl * Control, bool ReadOnly, bool Enabled);
  19. int CalculateCheckBoxWidth(TControl * Control, const UnicodeString & Caption);
  20. void AutoSizeCheckBox(TCheckBox * CheckBox);
  21. void __fastcall InitializeSystemSettings();
  22. void __fastcall FinalizeSystemSettings();
  23. void __fastcall LocalSystemSettings(TForm * Control);
  24. void __fastcall UseSystemSettingsPre(TForm * Control);
  25. void __fastcall UseSystemSettingsPost(TForm * Control);
  26. void __fastcall UseSystemSettings(TForm * Control);
  27. void __fastcall ResetSystemSettings(TForm * Control);
  28. TColor GetControlColor(TControl * Control);
  29. void UseDarkMode(TForm * Form);
  30. void ApplyColorMode(TForm * Form);
  31. void __fastcall LinkLabel(TStaticText * StaticText, UnicodeString Url = L"",
  32. TNotifyEvent OnEnter = NULL);
  33. void __fastcall LinkActionLabel(TStaticText * StaticText);
  34. void __fastcall LinkAppLabel(TStaticText * StaticText);
  35. void __fastcall HintLabel(TStaticText * StaticText, UnicodeString Hint = L"");
  36. void __fastcall HotTrackLabel(TLabel * Label);
  37. void __fastcall SetLabelHintPopup(TLabel * Label, const UnicodeString & Hint);
  38. bool __fastcall HasLabelHintPopup(TControl * Control, const UnicodeString & HintStr);
  39. void __fastcall FixComboBoxResizeBug(TCustomComboBox * ComboBox);
  40. void __fastcall ShowAsModal(TForm * Form, void *& Storage, bool BringToFront = true, bool TriggerModalStarted = false);
  41. void __fastcall HideAsModal(TForm * Form, void *& Storage);
  42. bool __fastcall ReleaseAsModal(TForm * Form, void *& Storage);
  43. bool __fastcall IsMainFormLike(TCustomForm * Form);
  44. bool __fastcall SelectDirectory(UnicodeString & Path, const UnicodeString Prompt,
  45. bool PreserveFileName);
  46. void SelectDirectoryForEdit(THistoryComboBox * Edit);
  47. enum TListViewCheckAll { caCheck, caUncheck, caToggle };
  48. bool __fastcall ListViewAnyChecked(TListView * ListView, bool Checked = true);
  49. void __fastcall ListViewCheckAll(TListView * ListView,
  50. TListViewCheckAll CheckAll);
  51. void __fastcall ComboAutoSwitchInitialize(TComboBox * ComboBox);
  52. void __fastcall ComboAutoSwitchLoad(TComboBox * ComboBox, TAutoSwitch Value);
  53. TAutoSwitch __fastcall ComboAutoSwitchSave(TComboBox * ComboBox);
  54. void __fastcall CheckBoxAutoSwitchLoad(TCheckBox * CheckBox, TAutoSwitch Value);
  55. TAutoSwitch __fastcall CheckBoxAutoSwitchSave(TCheckBox * CheckBox);
  56. void __fastcall InstallPathWordBreakProc(TWinControl * Control);
  57. void __fastcall SetVerticalControlsOrder(TControl ** ControlsOrder, int Count);
  58. void __fastcall SetHorizontalControlsOrder(TControl ** ControlsOrder, int Count);
  59. void __fastcall MakeNextInTabOrder(TWinControl * Control, TWinControl * After);
  60. void __fastcall CutFormToDesktop(TForm * Form);
  61. void __fastcall UpdateFormPosition(TCustomForm * Form, TPosition Position);
  62. void __fastcall ResizeForm(TCustomForm * Form, int Width, int Height);
  63. TComponent * __fastcall GetFormOwner();
  64. TForm * __fastcall GetMainForm();
  65. void __fastcall SetCorrectFormParent(TForm * Form);
  66. void __fastcall InvokeHelp(TWinControl * Control);
  67. void __fastcall FixFormIcons(TForm * Form);
  68. Forms::TMonitor * __fastcall FormMonitor(TCustomForm * Form);
  69. int __fastcall GetLastMonitor();
  70. void __fastcall SetLastMonitor(int MonitorNum);
  71. TForm * __fastcall _SafeFormCreate(TMetaClass * FormClass, TComponent * Owner);
  72. template<class FormType>
  73. FormType * __fastcall SafeFormCreate(TComponent * Owner = NULL)
  74. {
  75. return dynamic_cast<FormType *>(_SafeFormCreate(__classid(FormType), Owner));
  76. }
  77. TModalResult __fastcall DefaultResult(TCustomForm * Form, TButton * DefaultButton = NULL);
  78. void __fastcall DefaultButton(TButton * Button, bool Default);
  79. void __fastcall MemoKeyDown(TObject * Sender, WORD & Key, TShiftState Shift);
  80. void __fastcall UseDesktopFont(TControl * Control);
  81. void __fastcall UpdateDesktopFont();
  82. UnicodeString __fastcall FormatFormCaption(
  83. TCustomForm * Form, const UnicodeString & Caption, const UnicodeString & SessionName = UnicodeString());
  84. UnicodeString __fastcall FormatMainFormCaption(
  85. const UnicodeString & Caption, const UnicodeString & SessionName = UnicodeString());
  86. TShiftState __fastcall AllKeyShiftStates();
  87. void __fastcall RealignControl(TControl * Control);
  88. void __fastcall HookFormActivation(TCustomForm * Form);
  89. void __fastcall UnhookFormActivation(TCustomForm * Form);
  90. void __fastcall ShowFormNoActivate(TForm * Form);
  91. typedef void __fastcall (*TRescaleEvent)(TComponent * Sender, TObject * Token);
  92. void __fastcall SetRescaleFunction(
  93. TComponent * Component, TRescaleEvent OnRescale, TObject * Token = NULL, bool OwnsToken = false);
  94. TWindowState GetWindowStateBeforeMimimize(TForm * Form);
  95. void __fastcall CountClicksForWindowPrint(TForm * Form);
  96. bool IsButtonBeingClicked(TButtonControl * Button);
  97. bool IsCancelButtonBeingClicked(TControl * Control);
  98. TCanvas * CreateControlCanvas(TControl * Control);
  99. void AutoSizeButton(TButton * Button);
  100. namespace Tb2item { class TTBCustomItem; }
  101. void GiveTBItemPriority(Tb2item::TTBCustomItem * Item);
  102. void DeleteChildren(TWinControl * Control);
  103. void AutoSizeLabel(TLabel * Label);
  104. void AutoSizeLabel(TStaticText * Label);
  105. //---------------------------------------------------------------------------
  106. #endif // VCLCommonH