mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 10:31:43 +00:00
[EXPLORER][SHELL32][SHELL32_APITEST][SDK] AppBar: Initial support (#7778)
Supporting AppBars. JIRA issue: CORE-7237 - Rewrite shell32!SHAppBarMessage function. - Introduce CAppBarManager class in base/shell/explorer/appbar.cpp. - Add support of ABM_NEW, ABM_REMOVE, ABM_QUERYPOS, and ABM_SETPOS messages for AppBar in Tray Window.
This commit is contained in:
parent
378a335468
commit
f19c62c80e
9 changed files with 780 additions and 495 deletions
|
@ -10,6 +10,9 @@
|
|||
#include <shlwapi.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* Based on https://github.com/katahiromz/AppBarSample */
|
||||
|
||||
//#define VERBOSE
|
||||
|
@ -264,15 +267,15 @@ protected:
|
|||
switch (id)
|
||||
{
|
||||
case ID_ACTION:
|
||||
PostMessage(s_hwnd2, WM_COMMAND, ID_ACTION + 1, 0);
|
||||
PostMessageW(s_hwnd2, WM_COMMAND, ID_ACTION + 1, 0);
|
||||
break;
|
||||
case ID_ACTION + 1:
|
||||
hThread = CreateThread(NULL, 0, ActionThreadFunc, this, 0, NULL);
|
||||
if (!hThread)
|
||||
{
|
||||
skip("failed to create thread\n");
|
||||
PostMessage(s_hwnd1, WM_CLOSE, 0, 0);
|
||||
PostMessage(s_hwnd2, WM_CLOSE, 0, 0);
|
||||
PostMessageW(s_hwnd1, WM_CLOSE, 0, 0);
|
||||
PostMessageW(s_hwnd2, WM_CLOSE, 0, 0);
|
||||
return;
|
||||
}
|
||||
CloseHandle(hThread);
|
||||
|
@ -438,8 +441,10 @@ protected:
|
|||
|
||||
BOOL AppBar_SetSide(HWND hwnd, UINT uSide)
|
||||
{
|
||||
RECT rc;
|
||||
SetRect(&rc, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
|
||||
HMONITOR hMon = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTOPRIMARY);
|
||||
MONITORINFO mi = { sizeof(mi) };
|
||||
::GetMonitorInfo(hMon, &mi);
|
||||
RECT rc = mi.rcWork;
|
||||
|
||||
BOOL fAutoHide = FALSE;
|
||||
if (m_fAutoHide)
|
||||
|
@ -452,18 +457,21 @@ protected:
|
|||
|
||||
switch (uSide)
|
||||
{
|
||||
case ABE_TOP:
|
||||
rc.bottom = rc.top + m_cyHeight;
|
||||
break;
|
||||
case ABE_BOTTOM:
|
||||
rc.top = rc.bottom - m_cyHeight;
|
||||
break;
|
||||
case ABE_LEFT:
|
||||
rc.right = rc.left + m_cxWidth;
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
rc.left = rc.right - m_cxWidth;
|
||||
break;
|
||||
case ABE_TOP:
|
||||
rc.bottom = rc.top + m_cyHeight;
|
||||
break;
|
||||
case ABE_BOTTOM:
|
||||
rc.top = rc.bottom - m_cyHeight;
|
||||
break;
|
||||
case ABE_LEFT:
|
||||
rc.right = rc.left + m_cxWidth;
|
||||
break;
|
||||
case ABE_RIGHT:
|
||||
rc.left = rc.right - m_cxWidth;
|
||||
break;
|
||||
default:
|
||||
ASSERT(FALSE);
|
||||
break;
|
||||
}
|
||||
|
||||
APPBARDATA abd = { sizeof(abd) };
|
||||
|
@ -680,6 +688,7 @@ protected:
|
|||
AppBar_Register(hwnd);
|
||||
AppBar_SetSide(hwnd, ABE_TOP);
|
||||
|
||||
DPRINT1("OnCreate(%p) done\n", hwnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -975,6 +984,9 @@ public:
|
|||
RECT rc1, rc2, rcWork;
|
||||
DWORD dwTID = GetWindowThreadProcessId(s_hwnd1, NULL);
|
||||
|
||||
DPRINT1("DoAction\n");
|
||||
Sleep(INTERVAL);
|
||||
|
||||
GetWindowRect(s_hwnd1, &rc1);
|
||||
GetWindowRect(s_hwnd2, &rc2);
|
||||
GetWorkArea(&rcWork);
|
||||
|
@ -990,7 +1002,7 @@ public:
|
|||
ok_long(rcWork.top, s_rcWorkArea.top + 110);
|
||||
ok_long(rcWork.right, s_rcWorkArea.right);
|
||||
ok_long(rcWork.bottom, s_rcWorkArea.bottom);
|
||||
PostMessage(s_hwnd1, WM_CLOSE, 0, 0);
|
||||
PostMessageW(s_hwnd1, WM_CLOSE, 0, 0);
|
||||
Sleep(INTERVAL);
|
||||
|
||||
GetWindowRect(s_hwnd2, &rc2);
|
||||
|
@ -1101,7 +1113,7 @@ public:
|
|||
ok_long(rcWork.right, s_rcWorkArea.right);
|
||||
ok_long(rcWork.bottom, s_rcWorkArea.bottom);
|
||||
|
||||
PostMessage(s_hwnd2, WM_QUIT, 0, 0);
|
||||
PostMessageW(s_hwnd2, WM_QUIT, 0, 0);
|
||||
PostThreadMessage(dwTID, WM_QUIT, 0, 0);
|
||||
#undef INTERVAL
|
||||
}
|
||||
|
@ -1124,7 +1136,16 @@ START_TEST(SHAppBarMessage)
|
|||
return;
|
||||
}
|
||||
|
||||
DPRINT1("SM_CMONITORS: %d\n", GetSystemMetrics(SM_CMONITORS));
|
||||
if (GetSystemMetrics(SM_CMONITORS) != 1)
|
||||
{
|
||||
skip("Multi-monitor not supported yet\n");
|
||||
return;
|
||||
}
|
||||
|
||||
SystemParametersInfo(SPI_GETWORKAREA, 0, &s_rcWorkArea, FALSE);
|
||||
DPRINT1("s_rcWorkArea: %d, %d, %d, %d\n",
|
||||
s_rcWorkArea.left, s_rcWorkArea.top, s_rcWorkArea.right, s_rcWorkArea.bottom);
|
||||
|
||||
HWND hwnd1 = Window::DoCreateMainWnd(hInstance, TEXT("Test1"), 80, 80,
|
||||
WS_POPUP | WS_THICKFRAME | WS_CLIPCHILDREN);
|
||||
|
@ -1145,7 +1166,7 @@ START_TEST(SHAppBarMessage)
|
|||
s_hwnd1 = hwnd1;
|
||||
s_hwnd2 = hwnd2;
|
||||
|
||||
PostMessage(hwnd1, WM_COMMAND, ID_ACTION, 0);
|
||||
PostMessageW(hwnd1, WM_COMMAND, ID_ACTION, 0);
|
||||
|
||||
Window::DoMainLoop();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue