https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7898297c532f5a9846a3a…
commit 7898297c532f5a9846a3a4378b0b4df41a108230
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Jan 8 12:52:37 2024 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jan 8 12:52:37 2024 +0900
[SDK] cicuif.h: Add CUIFShadow (#6316)
Supporting TIPs...
JIRA issue: CORE-19360
- Half-implement CUIFShadow class.
---
sdk/include/reactos/cicero/cicuif.h | 157 +++++++++++++++++++++++++++++++++++-
1 file changed, 155 insertions(+), 2 deletions(-)
diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h
index 9a6e1fe6b6a..6e41ff1ca8e 100644
--- a/sdk/include/reactos/cicero/cicuif.h
+++ b/sdk/include/reactos/cicero/cicuif.h
@@ -397,8 +397,9 @@ protected:
CUIFToolTip *m_pToolTip;
CUIFShadow *m_pShadow;
BOOL m_bShowShadow;
- DWORD m_dwUnknown10;
+ CUIFWindow *m_pShadowOwner;
friend class CUIFObject;
+ friend class CUIFShadow;
public:
CUIFWindow(HINSTANCE hInst, DWORD style);
@@ -472,7 +473,28 @@ class CUIFToolTip : public CUIFWindow
class CUIFShadow : public CUIFWindow
{
- //FIXME
+protected:
+ COLORREF m_rgbShadowColor;
+ DWORD m_dwUnknown11[2];
+ INT m_xShadowDelta;
+ INT m_yShadowDelta;
+ BOOL m_bLayerAvailable;
+
+public:
+ CUIFShadow(HINSTANCE hInst, DWORD style, CUIFWindow *pShadowOwner);
+ ~CUIFShadow() override;
+
+ void InitSettings();
+ void InitShadow();
+ void AdjustWindowPos();
+ void OnOwnerWndMoved(BOOL bDoSize);
+
+ STDMETHOD_(void, Initialize)() override;
+ STDMETHOD_(DWORD, GetWndStyleEx)() override;
+ STDMETHOD_(void, OnPaint)(HDC hDC) override;
+ STDMETHOD_(LRESULT, OnWindowPosChanging)(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM
lParam) override;
+ STDMETHOD_(LRESULT, OnSettingChange)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
lParam) override;
+ STDMETHOD_(void, Show)(BOOL bVisible) override;
};
/////////////////////////////////////////////////////////////////////////////
@@ -2268,3 +2290,134 @@ inline STDMETHODIMP_(void)
CUIFWindow::OnAnimationStart()
{
}
+
+/////////////////////////////////////////////////////////////////////////////
+
+/// @unimplemented
+inline CUIFShadow::CUIFShadow(HINSTANCE hInst, DWORD style, CUIFWindow *pShadowOwner)
+ : CUIFWindow(hInst, (style | UIF_STYLE_TOOLWINDOW))
+{
+ m_pShadowOwner = pShadowOwner;
+ m_rgbShadowColor = RGB(0, 0, 0);
+ m_dwUnknown11[0] = 0;
+ m_dwUnknown11[1] = 0;
+ m_xShadowDelta = m_yShadowDelta = 0;
+ m_bLayerAvailable = FALSE;
+}
+
+inline CUIFShadow::~CUIFShadow()
+{
+ if (m_pShadowOwner)
+ m_pShadowOwner->m_pShadow = NULL;
+}
+
+/// @unimplemented
+inline void CUIFShadow::InitSettings()
+{
+ m_bLayerAvailable = FALSE;
+ m_rgbShadowColor = RGB(128, 128, 128);
+ m_xShadowDelta = m_yShadowDelta = 2;
+}
+
+/// @unimplemented
+inline void CUIFShadow::InitShadow()
+{
+ if (m_bLayerAvailable)
+ {
+ //FIXME
+ }
+}
+
+inline void CUIFShadow::AdjustWindowPos()
+{
+ HWND hwndOwner = m_pShadowOwner->m_hWnd;
+ if (!::IsWindow(m_hWnd))
+ return;
+
+ RECT rc;
+ ::GetWindowRect(hwndOwner, &rc);
+ ::SetWindowPos(m_hWnd, hwndOwner,
+ rc.left + m_xShadowDelta,
+ rc.top + m_yShadowDelta,
+ rc.right - rc.left,
+ rc.bottom - rc.top,
+ SWP_NOOWNERZORDER | SWP_NOACTIVATE);
+}
+
+inline void CUIFShadow::OnOwnerWndMoved(BOOL bDoSize)
+{
+ if (::IsWindow(m_hWnd) && ::IsWindowVisible(m_hWnd))
+ {
+ AdjustWindowPos();
+ if (bDoSize)
+ InitShadow();
+ }
+}
+
+inline STDMETHODIMP_(void)
+CUIFShadow::Initialize()
+{
+ InitSettings();
+ CUIFWindow::Initialize();
+}
+
+inline STDMETHODIMP_(DWORD)
+CUIFShadow::GetWndStyleEx()
+{
+ DWORD exstyle = CUIFWindow::GetWndStyleEx();
+ if (m_bLayerAvailable)
+ exstyle |= WS_EX_LAYERED;
+ return exstyle;
+}
+
+inline STDMETHODIMP_(void)
+CUIFShadow::OnPaint(HDC hDC)
+{
+ RECT rc = m_rc;
+ HBRUSH hBrush = ::CreateSolidBrush(m_rgbShadowColor);
+ ::FillRect(hDC, &rc, hBrush);
+ ::DeleteObject(hBrush);
+}
+
+inline STDMETHODIMP_(LRESULT)
+CUIFShadow::OnWindowPosChanging(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+ WINDOWPOS *wp = (WINDOWPOS *)lParam;
+ wp->hwndInsertAfter = m_pShadowOwner->m_hWnd;
+ return ::DefWindowProc(hWnd, Msg, wParam, lParam);
+}
+
+inline STDMETHODIMP_(LRESULT)
+CUIFShadow::OnSettingChange(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ InitSettings();
+
+ DWORD exstyle;
+ if (m_bLayerAvailable)
+ exstyle = ::GetWindowLongPtr(m_hWnd, GWL_EXSTYLE) | WS_EX_LAYERED;
+ else
+ exstyle = ::GetWindowLongPtr(m_hWnd, GWL_EXSTYLE) & ~WS_EX_LAYERED;
+
+ ::SetWindowLongPtr(m_hWnd, GWL_EXSTYLE, exstyle);
+
+ AdjustWindowPos();
+ InitShadow();
+
+ return ::DefWindowProc(hWnd, uMsg, wParam, lParam);
+}
+
+inline STDMETHODIMP_(void)
+CUIFShadow::Show(BOOL bVisible)
+{
+ if (bVisible && ::IsWindow(m_hWnd) && !::IsWindowVisible(m_hWnd))
+ {
+ AdjustWindowPos();
+ InitShadow();
+ }
+
+ if (::IsWindow(m_hWnd))
+ {
+ m_bVisible = bVisible;
+ ::ShowWindow(m_hWnd, (bVisible ? SW_SHOWNOACTIVATE : SW_HIDE));
+ }
+}