VCLCommon.h 6.2 KB

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