blob: ef4eefe19c1d911ed6497e8a19b5194fa715ef0b (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 | #include "stdafx.h"
INT_PTR SnapToList(WPARAM wParam, LPARAM Align)
{
	HWND hWnd = (HWND)wParam;
	HWND hWndList = g_clistApi.hwndContactList;
	RECT WndRect, ListRect;
	GetWindowRect(hWnd, &WndRect);
	GetWindowRect(hWndList, &ListRect);
	RECT AlignRect = ListRect;
	if ((!(MS_MW_STL_List_Left & Align)) && (MS_MW_STL_List_Right & Align))
		AlignRect.left = AlignRect.right;
	else if ((MS_MW_STL_List_Left & Align) && (!(MS_MW_STL_List_Right & Align)))
		AlignRect.right = AlignRect.left;
	if ((!(MS_MW_STL_List_Top & Align)) && (MS_MW_STL_List_Bottom & Align))
		AlignRect.top = AlignRect.bottom;
	else if ((MS_MW_STL_List_Top & Align) && (!(MS_MW_STL_List_Bottom & Align)))
		AlignRect.bottom = AlignRect.top;
	RECT ResultRect = WndRect;
	if ((MS_MW_STL_Wnd_Left & Align) && (MS_MW_STL_Wnd_Right & Align)) {
		ResultRect.left = AlignRect.left;
		ResultRect.right = AlignRect.right;
	}
	else if ((!(MS_MW_STL_Wnd_Left & Align)) && (MS_MW_STL_Wnd_Right & Align)) {
		ResultRect.left = AlignRect.right - (WndRect.right - WndRect.left);
		ResultRect.right = AlignRect.right;
	}
	else if ((MS_MW_STL_Wnd_Left & Align) && (!(MS_MW_STL_Wnd_Right & Align))) {
		ResultRect.left = AlignRect.left;
		ResultRect.right = AlignRect.left + (WndRect.right - WndRect.left);
	}
	if ((MS_MW_STL_Wnd_Top & Align) && (MS_MW_STL_Wnd_Bottom & Align)) {
		ResultRect.top = AlignRect.top;
		ResultRect.bottom = AlignRect.bottom;
	}
	else if ((!(MS_MW_STL_Wnd_Top & Align)) && (MS_MW_STL_Wnd_Bottom & Align)) {
		ResultRect.top = AlignRect.bottom - (WndRect.bottom - WndRect.top);
		ResultRect.bottom = AlignRect.bottom;
	}
	else if ((MS_MW_STL_Wnd_Top & Align) && (!(MS_MW_STL_Wnd_Bottom & Align))) {
		ResultRect.top = AlignRect.top;
		ResultRect.bottom = AlignRect.top + (WndRect.bottom - WndRect.top);
	}
	MoveWindow(hWnd, ResultRect.left, ResultRect.top, ResultRect.right - ResultRect.left, ResultRect.bottom - ResultRect.top, true);
	return 0;
}
 |