mirror of
https://github.com/winscp/winscp.git
synced 2026-10-24 02:28:55 +03:00
139 lines
7.4 KiB
C++
139 lines
7.4 KiB
C++
//---------------------------------------------------------------------------
|
|
#ifndef VCLCommonH
|
|
#define VCLCommonH
|
|
//---------------------------------------------------------------------------
|
|
#include "Common.h"
|
|
#include "Configuration.h"
|
|
#include "Exceptions.h"
|
|
#include <ComCtrls.hpp>
|
|
#include <HistoryComboBox.h>
|
|
//---------------------------------------------------------------------------
|
|
extern const UnicodeString ContextSeparator;
|
|
//---------------------------------------------------------------------------
|
|
void __fastcall FixListColumnWidth(TListView * TListView, int Index);
|
|
void __fastcall AutoSizeListColumnsWidth(TListView * ListView, int ColumnToShrinkIndex = -1);
|
|
bool UseDarkModeForControl(TControl * Control);
|
|
void __fastcall EnableControl(TControl* Control, bool Enable);
|
|
void __fastcall ReadOnlyControl(TControl * Control, bool ReadOnly = true);
|
|
void __fastcall ReadOnlyAndEnabledControl(TControl * Control, bool ReadOnly, bool Enabled);
|
|
void SetEditPasswordMode(TEdit * Edit, bool Password = true);
|
|
int CalculateCheckBoxWidth(TControl * Control, const UnicodeString & Caption);
|
|
void AutoSizeCheckBox(TCheckBox * CheckBox);
|
|
void __fastcall InitializeSystemSettings();
|
|
void __fastcall FinalizeSystemSettings();
|
|
void __fastcall LocalSystemSettings(TForm * Control);
|
|
void __fastcall UseSystemSettingsPre(TForm * Control);
|
|
void __fastcall UseSystemSettingsPost(TForm * Control);
|
|
void __fastcall UseSystemSettings(TForm * Control);
|
|
void __fastcall ResetSystemSettings(TForm * Control);
|
|
TColor GetControlColor(TControl * Control);
|
|
void UseDarkMode(TForm * Form);
|
|
void ApplyColorMode(TForm * Form);
|
|
void ApplyColorModeOnControl(TControl * Control);
|
|
void UsesCustomColorMode(TForm * Form);
|
|
void __fastcall LinkLabel(TStaticText * StaticText, UnicodeString Url = L"",
|
|
TNotifyEvent OnEnter = NULL);
|
|
void __fastcall LinkActionLabel(TStaticText * StaticText);
|
|
void __fastcall LinkAppLabel(TStaticText * StaticText);
|
|
void __fastcall HintLabel(TStaticText * StaticText, UnicodeString Hint = L"");
|
|
void __fastcall HotTrackLabel(TLabel * Label);
|
|
void __fastcall SetLabelHintPopup(TLabel * Label, const UnicodeString & Hint);
|
|
bool __fastcall HasLabelHintPopup(TControl * Control, const UnicodeString & HintStr);
|
|
void __fastcall FixComboBoxResizeBug(TCustomComboBox * ComboBox);
|
|
void __fastcall ShowAsModal(TForm * Form, void *& Storage, bool BringToFront = true, bool TriggerModalStarted = false);
|
|
void __fastcall HideAsModal(TForm * Form, void *& Storage);
|
|
bool __fastcall ReleaseAsModal(TForm * Form, void *& Storage);
|
|
bool __fastcall IsMainFormLike(TCustomForm * Form);
|
|
void SelectDirectoryForEdit(THistoryComboBox * Edit);
|
|
enum TListViewCheckAll { caCheck, caUncheck, caToggle };
|
|
bool __fastcall ListViewAnyChecked(TListView * ListView, bool Checked = true);
|
|
void __fastcall ListViewCheckAll(TListView * ListView,
|
|
TListViewCheckAll CheckAll);
|
|
void __fastcall ComboAutoSwitchInitialize(TComboBox * ComboBox);
|
|
void __fastcall ComboAutoSwitchLoad(TComboBox * ComboBox, TAutoSwitch Value);
|
|
TAutoSwitch __fastcall ComboAutoSwitchSave(TComboBox * ComboBox);
|
|
void __fastcall CheckBoxAutoSwitchLoad(TCheckBox * CheckBox, TAutoSwitch Value);
|
|
TAutoSwitch __fastcall CheckBoxAutoSwitchSave(TCheckBox * CheckBox);
|
|
void __fastcall InstallPathWordBreakProc(TWinControl * Control);
|
|
void __fastcall SetVerticalControlsOrder(TControl ** ControlsOrder, int Count);
|
|
void __fastcall SetHorizontalControlsOrder(TControl ** ControlsOrder, int Count);
|
|
void __fastcall MakeNextInTabOrder(TWinControl * Control, TWinControl * After);
|
|
void __fastcall CutFormToDesktop(TForm * Form);
|
|
TRect GetCenterRect(TControl * CenterControl, Forms::TMonitor * CenterMonitor);
|
|
void CenterFormOn(TRect & Bounds, const TRect & CenterRect);
|
|
void CenterFormOn(TRect & Bounds, TControl * CenterControl, Forms::TMonitor * CenterMonitor);
|
|
void UpdateFormPosition(TCustomForm * Form, TPosition Position, Forms::TMonitor * Monitor = nullptr);
|
|
void __fastcall ResizeForm(TCustomForm * Form, int Width, int Height);
|
|
TComponent * __fastcall GetFormOwner();
|
|
TForm * __fastcall GetMainForm();
|
|
void __fastcall SetCorrectFormParent(TForm * Form);
|
|
void __fastcall InvokeHelp(TWinControl * Control);
|
|
int OffsetToVerticallyCenterWith(TControl * Control, TControl * CenterWithControl);
|
|
void VerticallyCenterWith(TControl * Control, TControl * CenterWithControl);
|
|
void __fastcall FixFormIcons(TForm * Form);
|
|
Forms::TMonitor * __fastcall FormMonitor(TCustomForm * Form);
|
|
int __fastcall GetLastMonitor();
|
|
void __fastcall SetLastMonitor(int MonitorNum);
|
|
TForm * __fastcall _SafeFormCreate(TMetaClass * FormClass, TComponent * Owner);
|
|
template<class FormType>
|
|
FormType * __fastcall SafeFormCreate(TComponent * Owner = NULL)
|
|
{
|
|
return dynamic_cast<FormType *>(_SafeFormCreate(__classid(FormType), Owner));
|
|
}
|
|
TModalResult __fastcall DefaultResult(TCustomForm * Form, TButton * DefaultButton = NULL);
|
|
void __fastcall DefaultButton(TButton * Button, bool Default);
|
|
void __fastcall MemoKeyDown(TObject * Sender, WORD & Key, TShiftState Shift);
|
|
void __fastcall UseDesktopFont(TControl * Control);
|
|
void __fastcall UpdateDesktopFont();
|
|
UnicodeString __fastcall FormatFormCaption(
|
|
TCustomForm * Form, const UnicodeString & Caption, const UnicodeString & SessionName = UnicodeString());
|
|
UnicodeString __fastcall FormatMainFormCaption(
|
|
const UnicodeString & Caption, const UnicodeString & SessionName = UnicodeString());
|
|
TShiftState __fastcall AllKeyShiftStates();
|
|
void __fastcall RealignControl(TControl * Control);
|
|
void __fastcall HookFormActivation(TCustomForm * Form);
|
|
void __fastcall UnhookFormActivation(TCustomForm * Form);
|
|
void __fastcall ShowFormNoActivate(TForm * Form);
|
|
typedef void __fastcall (*TRescaleEvent)(TComponent * Sender, TObject * Token);
|
|
void __fastcall SetRescaleFunction(
|
|
TComponent * Component, TRescaleEvent OnRescale, TObject * Token = NULL, bool OwnsToken = false);
|
|
TWindowState GetWindowStateBeforeMimimize(TForm * Form);
|
|
void __fastcall CountClicksForWindowPrint(TForm * Form);
|
|
bool IsButtonBeingClicked(TButtonControl * Button);
|
|
bool IsCancelButtonBeingClicked(TControl * Control);
|
|
TCanvas * CreateControlCanvas(TControl * Control);
|
|
void AutoSizeButton(TButton * Button);
|
|
namespace Tb2item { class TTBCustomItem; }
|
|
void GiveTBItemPriority(Tb2item::TTBCustomItem * Item);
|
|
void DeleteChildren(TWinControl * Control);
|
|
TSize CalculateLabelSize(TCanvas * Canvas, int Width, const UnicodeString & Caption, int Flags);
|
|
void AutoSizeLabel(TLabel * Label);
|
|
void AutoSizeLabel(TStaticText * Label);
|
|
void SetAccessibleName(TWinControl * Control, const UnicodeString & Name);
|
|
void SetAccessibleRole(TWinControl * Control, int Role);
|
|
template<class ComponentType>
|
|
ComponentType * FindComponentInstance(TComponent * Owner)
|
|
{
|
|
TComponent * Component = Owner->FindComponent(ComponentType::QualifiedClassName());
|
|
return (Component == nullptr) ? nullptr : DebugNotNull(dynamic_cast<ComponentType *>(Component));
|
|
}
|
|
template<class ComponentType>
|
|
void InsertComponentInstance(TComponent * Owner, ComponentType * Component)
|
|
{
|
|
Component->Name = ComponentType::QualifiedClassName();
|
|
Owner->InsertComponent(Component);
|
|
}
|
|
template<class ComponentType>
|
|
ComponentType * GetComponentInstance(TComponent * Owner)
|
|
{
|
|
auto Component = FindComponentInstance<ComponentType>(Owner);
|
|
if (Component == nullptr)
|
|
{
|
|
Component = new ComponentType();
|
|
InsertComponentInstance(Owner, Component);
|
|
}
|
|
return Component;
|
|
}
|
|
//---------------------------------------------------------------------------
|
|
#endif // VCLCommonH
|