unit uMagnetic;
interface
uses
Windows,
// SysUtils,
Messages,
Classes,
uMagneticClient,
uMagneticDll;
type
TWND_INFO =
record
h_wnd: HWND;
hWndParent: HWND;
pOldWinProc: TFNWndProc;
Glue: Boolean;
end;
TMagnetic =
class(TInterfacedObject, ISkinMagnetic, ISkinMagneticEx)
constructor Create;
destructor Destroy;
override;
private
FSnapWidth: Integer;
m_uWndInfo:
array of TWND_INFO;
m_rcWnd:
array of TRect;
m_lWndCount: Integer;
m_ptAnchor: TPOINT;
m_ptOffset: TPOINT;
m_ptCurr: TPOINT;
m_ptLast: TPOINT;
lOldSetting: Integer;
function GetSnapWidth: Integer;
procedure SetSnapWidth(
const Value: Integer);
procedure pvSizeRect(
Handle: HWND;
var rcWnd: TRect; lfEdge: Integer);
procedure pvMoveRect(
Handle: HWND;
var rcWnd: TRect);
procedure pvCheckGlueing;
function pvWndsConnected(
const rcWnd1, rcWnd2: TRect): Boolean;
function pvWndGetInfoIndex(
Handle: HWND): Integer;
function pvWndParentGetInfoIndex(hWndParent: HWND): Integer;
function zSubclass_Proc(
var Wnd: HWND;
var Msg: UINT;
var wParam: wParam;
var lParam: lParam): LRESULT;
function getWND_INFO(aHandle: HWND;
var Wnd_info: TWND_INFO): Boolean;
public
function AddMagneticWindow(
Handle: HWND; hWndParent: HWND): Boolean;
function RemoveMagneticWindow(
Handle: HWND): Boolean;
procedure CheckGlueing;
property SnapWidth: Integer
read GetSnapWidth
write SetSnapWidth;
function SetFullWindowDrag(HWND: DWORD; ShowFullWindow: Boolean): Boolean;
end;
function SkinMagnetic : ISkinMagnetic;
stdcall;
implementation
var
MagneticWnd: ISkinMagneticEx =
nil;
function SubFormWindowProc(Wnd: HWND; Msg: UINT; wParam: wParam; lParam: lParam): LRESULT;
stdcall;
begin
result := MagneticWnd.zSubclass_Proc(Wnd, Msg, wParam, lParam);
end;
function SkinMagnetic : ISkinMagnetic;
stdcall;
begin
if MagneticWnd =
nil then
MagneticWnd := TMagnetic.Create;
result := MagneticWnd
as ISkinMagnetic;
end;
initialization
finalization
MagneticWnd :=
nil;
end.