[SDK] cicuif.h: Reduce magic numbers (#6334)

Improve human readability.
JIRA issue: CORE-19360
- Define some flags of m_style.
- Define some flags of dwDrawFlags.
- Reduce some magic numbers.
This commit is contained in:
Katayama Hirofumi MZ 2024-01-12 13:40:28 +09:00 committed by GitHub
parent 4287f07c75
commit f51258ae51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -193,19 +193,6 @@ public:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Flags for CUIFObject::m_style
enum
{
UIF_STYLE_CHILD = 0x1,
UIF_STYLE_TOPMOST = 0x2,
UIF_STYLE_TOOLWINDOW = 0x4,
UIF_STYLE_TOOLTIP = 0x20,
UIF_STYLE_SHADOW = 0x40,
UIF_STYLE_RTL = 0x200,
UIF_STYLE_VERTICAL = 0x400,
UIF_STYLE_THEMED = 0x80000000,
};
class CUIFObject : public CUIFTheme class CUIFObject : public CUIFTheme
{ {
protected: protected:
@ -432,6 +419,13 @@ BOOL cicGetIconBitmaps(HICON hIcon, HBITMAP *hbm1, HBITMAP *hbm2, const SIZE *pS
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Flags for dwDrawFlags
enum
{
UIF_DRAW_PRESSED = 0x10,
UIF_DRAW_DISABLED = 0x20,
};
class CUIFScheme class CUIFScheme
{ {
public: public:
@ -514,6 +508,22 @@ CUIFScheme *cicCreateUIFScheme(DWORD type);
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// m_style flags for CUIFWindow
enum
{
UIF_WINDOW_CHILD = 0x1,
UIF_WINDOW_TOPMOST = 0x2,
UIF_WINDOW_TOOLWINDOW = 0x4,
UIF_WINDOW_DLGFRAME = 0x8,
UIF_WINDOW_TOOLTIP = 0x20,
UIF_WINDOW_SHADOW = 0x40,
UIF_WINDOW_WORKAREA = 0x80,
UIF_WINDOW_MONITOR = 0x100,
UIF_WINDOW_LAYOUTRTL = 0x200,
UIF_WINDOW_NOMOUSEMSG = 0x400,
UIF_WINDOW_ENABLETHEMED = 0x80000000,
};
class CUIFWindow : public CUIFObject class CUIFWindow : public CUIFObject
{ {
protected: protected:
@ -674,6 +684,21 @@ public:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// m_style flags for CUIFButton
enum
{
UIF_BUTTON_H_ALIGN_LEFT = 0,
UIF_BUTTON_H_ALIGN_CENTER = 0x1,
UIF_BUTTON_H_ALIGN_RIGHT = 0x2,
UIF_BUTTON_H_ALIGN_MASK = UIF_BUTTON_H_ALIGN_CENTER | UIF_BUTTON_H_ALIGN_RIGHT,
UIF_BUTTON_V_ALIGN_TOP = 0,
UIF_BUTTON_V_ALIGN_MIDDLE = 0x4,
UIF_BUTTON_V_ALIGN_BOTTOM = 0x8,
UIF_BUTTON_V_ALIGN_MASK = UIF_BUTTON_V_ALIGN_MIDDLE | UIF_BUTTON_V_ALIGN_BOTTOM,
UIF_BUTTON_LARGE_ICON = 0x100,
UIF_BUTTON_VERTICAL = 0x400,
};
class CUIFButton : public CUIFObject class CUIFButton : public CUIFObject
{ {
protected: protected:
@ -729,6 +754,12 @@ public:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// m_style flags for CUIFGripper
enum
{
UIF_GRIPPER_VERTICAL = 0x1,
};
class CUIFGripper : public CUIFObject class CUIFGripper : public CUIFObject
{ {
protected: protected:
@ -1051,7 +1082,7 @@ inline STDMETHODIMP_(void) CUIFObject::Initialize()
inline STDMETHODIMP_(void) CUIFObject::OnPaint(HDC hDC) inline STDMETHODIMP_(void) CUIFObject::OnPaint(HDC hDC)
{ {
if (!(m_pWindow->m_style & UIF_STYLE_THEMED) || !OnPaintTheme(hDC)) if (!(m_pWindow->m_style & UIF_WINDOW_ENABLETHEMED) || !OnPaintTheme(hDC))
OnPaintNoTheme(hDC); OnPaintNoTheme(hDC);
} }
@ -1261,7 +1292,7 @@ inline BOOL CUIFObject::IsRTL()
{ {
if (!m_pWindow) if (!m_pWindow)
return FALSE; return FALSE;
return !!(m_pWindow->m_style & UIF_STYLE_RTL); return !!(m_pWindow->m_style & UIF_WINDOW_LAYOUTRTL);
} }
inline CUIFObject* CUIFObject::ObjectFromPoint(POINT pt) inline CUIFObject* CUIFObject::ObjectFromPoint(POINT pt)
@ -1510,7 +1541,7 @@ CUIFSchemeDef::DrawCtrlBkgd(HDC hDC, LPCRECT prc, DWORD unused, DWORD dwDrawFlag
{ {
::FillRect(hDC, prc, GetBrush(9)); ::FillRect(hDC, prc, GetBrush(9));
if (!(dwDrawFlags & 0x10) && (dwDrawFlags & 0x2)) if (!(dwDrawFlags & UIF_DRAW_PRESSED) && (dwDrawFlags & 0x2))
return; return;
HBRUSH hbrDither = cicCreateDitherBrush(); HBRUSH hbrDither = cicCreateDitherBrush();
@ -1552,7 +1583,7 @@ CUIFSchemeDef::DrawCtrlText(
cchText = lstrlenW(pszText); cchText = lstrlenW(pszText);
RECT rc = *prc; RECT rc = *prc;
if (dwDrawFlags & 0x20) if (dwDrawFlags & UIF_DRAW_DISABLED)
{ {
::OffsetRect(&rc, 1, 1); ::OffsetRect(&rc, 1, 1);
::SetTextColor(hDC, ::GetSysColor(COLOR_BTNHIGHLIGHT)); ::SetTextColor(hDC, ::GetSysColor(COLOR_BTNHIGHLIGHT));
@ -1585,7 +1616,7 @@ CUIFSchemeDef::DrawCtrlIcon(HDC hDC, LPCRECT prc, HICON hIcon, DWORD dwDrawFlags
else else
{ {
UINT uFlags = DST_PREFIXTEXT | DST_TEXT; UINT uFlags = DST_PREFIXTEXT | DST_TEXT;
if (dwDrawFlags & 0x20) if (dwDrawFlags & UIF_DRAW_DISABLED)
uFlags |= (DSS_MONO | DSS_DISABLED); uFlags |= (DSS_MONO | DSS_DISABLED);
::DrawState(hDC, 0, 0, (LPARAM)hIcon, 0, prc->left, prc->top, 0, 0, uFlags); ::DrawState(hDC, 0, 0, (LPARAM)hIcon, 0, prc->left, prc->top, 0, 0, uFlags);
} }
@ -2182,17 +2213,17 @@ CUIFWindow::Initialize()
cicUpdateUIFSys(); cicUpdateUIFSys();
cicUpdateUIFScheme(); cicUpdateUIFScheme();
if (m_style & UIF_STYLE_TOOLTIP) if (m_style & UIF_WINDOW_TOOLTIP)
{ {
DWORD style = (m_style & UIF_STYLE_RTL) | UIF_STYLE_TOPMOST | 0x10; DWORD style = (m_style & UIF_WINDOW_LAYOUTRTL) | UIF_WINDOW_TOPMOST | 0x10;
m_pToolTip = new(cicNoThrow) CUIFToolTip(m_hInst, style, this); m_pToolTip = new(cicNoThrow) CUIFToolTip(m_hInst, style, this);
if (m_pToolTip) if (m_pToolTip)
m_pToolTip->Initialize(); m_pToolTip->Initialize();
} }
if (m_style & UIF_STYLE_SHADOW) if (m_style & UIF_WINDOW_SHADOW)
{ {
m_pShadow = new(cicNoThrow) CUIFShadow(m_hInst, UIF_STYLE_TOPMOST, this); m_pShadow = new(cicNoThrow) CUIFShadow(m_hInst, UIF_WINDOW_TOPMOST, this);
if (m_pShadow) if (m_pShadow)
m_pShadow->Initialize(); m_pShadow->Initialize();
} }
@ -2288,14 +2319,14 @@ CUIFWindow::GetWndStyle()
{ {
DWORD ret; DWORD ret;
if (m_style & UIF_STYLE_CHILD) if (m_style & UIF_WINDOW_CHILD)
ret = WS_CHILD | WS_CLIPSIBLINGS; ret = WS_CHILD | WS_CLIPSIBLINGS;
else else
ret = WS_POPUP | WS_DISABLED; ret = WS_POPUP | WS_DISABLED;
if (m_style & 0x10000000) if (m_style & 0x10000000)
ret |= WS_BORDER; ret |= WS_BORDER;
else if (m_style & 0x8) else if (m_style & UIF_WINDOW_DLGFRAME)
ret |= WS_DLGFRAME; ret |= WS_DLGFRAME;
else if ((m_style & 0x20000000) || (m_style & 0x10)) else if ((m_style & 0x20000000) || (m_style & 0x10))
ret |= WS_BORDER; ret |= WS_BORDER;
@ -2307,11 +2338,11 @@ inline STDMETHODIMP_(DWORD)
CUIFWindow::GetWndStyleEx() CUIFWindow::GetWndStyleEx()
{ {
DWORD ret = 0; DWORD ret = 0;
if (m_style & UIF_STYLE_TOPMOST) if (m_style & UIF_WINDOW_TOPMOST)
ret = WS_EX_TOPMOST; ret |= WS_EX_TOPMOST;
if (m_style & UIF_STYLE_TOOLWINDOW) if (m_style & UIF_WINDOW_TOOLWINDOW)
ret |= WS_EX_TOOLWINDOW; ret |= WS_EX_TOOLWINDOW;
if (m_style & UIF_STYLE_RTL) if (m_style & UIF_WINDOW_LAYOUTRTL)
ret |= WS_EX_LAYOUTRTL; ret |= WS_EX_LAYOUTRTL;
return ret; return ret;
} }
@ -2334,7 +2365,7 @@ inline void CUIFWindow::Show(BOOL bVisible)
if (!IsWindow(m_hWnd)) if (!IsWindow(m_hWnd))
return; return;
if (bVisible && (m_style & UIF_STYLE_TOPMOST)) if (bVisible && (m_style & UIF_WINDOW_TOPMOST))
::SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE); ::SetWindowPos(m_hWnd, NULL, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
m_bVisible = bVisible; m_bVisible = bVisible;
@ -2522,7 +2553,7 @@ CUIFWindow::WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
m_pToolTip->RelayEvent(&msg); m_pToolTip->RelayEvent(&msg);
} }
if (!(m_style & UIF_STYLE_VERTICAL)) if (!(m_style & UIF_WINDOW_NOMOUSEMSG))
HandleMouseMsg(HIWORD(lParam), Point.x, Point.y); HandleMouseMsg(HIWORD(lParam), Point.x, Point.y);
return TRUE; return TRUE;
@ -2731,42 +2762,31 @@ CUIFWindow::WindowProcedure(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
inline BOOL inline BOOL
CUIFWindow::GetWorkArea(LPCRECT prcWnd, LPRECT prcWorkArea) CUIFWindow::GetWorkArea(LPCRECT prcWnd, LPRECT prcWorkArea)
{ {
if (!(m_style & 0x180)) if (!(m_style & (UIF_WINDOW_WORKAREA | UIF_WINDOW_MONITOR)))
return 0; return FALSE;
HMONITOR hMon = ::MonitorFromRect(prcWnd, MONITOR_DEFAULTTONEAREST); HMONITOR hMon = ::MonitorFromRect(prcWnd, MONITOR_DEFAULTTONEAREST);
MONITORINFO mi; MONITORINFO mi;
mi.cbSize = sizeof(MONITORINFO); mi.cbSize = sizeof(MONITORINFO);
if (!hMon || !::GetMonitorInfo(hMon, &mi)) if (!hMon || !::GetMonitorInfo(hMon, &mi))
{ {
if (m_style & 0x80) if (m_style & UIF_WINDOW_WORKAREA)
return ::SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0); return ::SystemParametersInfo(SPI_GETWORKAREA, 0, prcWorkArea, 0);
if (m_style & 0x100) prcWorkArea->left = prcWorkArea->top = 0;
{ prcWorkArea->right = ::GetSystemMetrics(SM_CXSCREEN);
prcWorkArea->top = 0; prcWorkArea->bottom = ::GetSystemMetrics(SM_CYSCREEN);
prcWorkArea->left = 0; return TRUE;
prcWorkArea->right = ::GetSystemMetrics(SM_CXSCREEN);
prcWorkArea->bottom = ::GetSystemMetrics(SM_CYSCREEN);
return TRUE;
}
return FALSE;
} }
if (m_style & 0x80) if (m_style & UIF_WINDOW_WORKAREA)
{ {
*prcWorkArea = mi.rcWork; *prcWorkArea = mi.rcWork;
return TRUE; return TRUE;
} }
if (m_style & 0x100) *prcWorkArea = mi.rcMonitor;
{ return TRUE;
*prcWorkArea = mi.rcMonitor;
return TRUE;
}
return FALSE;
} }
inline void inline void
@ -2820,7 +2840,7 @@ CUIFWindow::PaintObject(HDC hDC, LPCRECT prc)
::SetViewportOrgEx(hMemDC, -pRect->left, -pRect->top, NULL); ::SetViewportOrgEx(hMemDC, -pRect->left, -pRect->top, NULL);
if ((FAILED(CUIFTheme::EnsureThemeData(m_hWnd)) || if ((FAILED(CUIFTheme::EnsureThemeData(m_hWnd)) ||
!(m_style & UIF_STYLE_CHILD) || !(m_style & UIF_WINDOW_CHILD) ||
FAILED(DrawThemeParentBackground(m_hWnd, hMemDC, &m_rc))) && FAILED(DrawThemeParentBackground(m_hWnd, hMemDC, &m_rc))) &&
FAILED(DrawThemeBackground(hMemDC, m_iStateId, &m_rc, 0))) FAILED(DrawThemeBackground(hMemDC, m_iStateId, &m_rc, 0)))
{ {
@ -3025,7 +3045,7 @@ CUIFWindow::OnAnimationStart()
/// @unimplemented /// @unimplemented
inline CUIFShadow::CUIFShadow(HINSTANCE hInst, DWORD style, CUIFWindow *pShadowOwner) inline CUIFShadow::CUIFShadow(HINSTANCE hInst, DWORD style, CUIFWindow *pShadowOwner)
: CUIFWindow(hInst, (style | UIF_STYLE_TOOLWINDOW)) : CUIFWindow(hInst, (style | UIF_WINDOW_TOOLWINDOW))
{ {
m_pShadowOrToolTipOwner = pShadowOwner; m_pShadowOrToolTipOwner = pShadowOwner;
m_rgbShadowColor = RGB(0, 0, 0); m_rgbShadowColor = RGB(0, 0, 0);
@ -3610,7 +3630,7 @@ inline void CUIFButton::DrawIconProc(HDC hDC, LPRECT prc, BOOL bPressed)
::FillRect(hMemDC, &rc, hbrWhite); ::FillRect(hMemDC, &rc, hbrWhite);
} }
if (m_style & 0x100) if (m_style & UIF_BUTTON_LARGE_ICON)
{ {
::DrawIconEx(hMemDC, ::DrawIconEx(hMemDC,
2 + bPressed, 2 + bPressed, 2 + bPressed, 2 + bPressed,
@ -3636,6 +3656,7 @@ inline void CUIFButton::DrawIconProc(HDC hDC, LPRECT prc, BOOL bPressed)
::DeleteDC(hMemDC); ::DeleteDC(hMemDC);
} }
/// @unimplemented
inline void inline void
CUIFButton::DrawTextProc(HDC hDC, LPCRECT prc, BOOL bPressed) CUIFButton::DrawTextProc(HDC hDC, LPCRECT prc, BOOL bPressed)
{ {
@ -3648,16 +3669,16 @@ CUIFButton::DrawTextProc(HDC hDC, LPCRECT prc, BOOL bPressed)
::GetTextExtentPoint32W(hDC, m_pszButtonText, cchText, &textSize); ::GetTextExtentPoint32W(hDC, m_pszButtonText, cchText, &textSize);
INT xText, yText; INT xText, yText;
if ((m_style & (UIF_STYLE_CHILD | UIF_STYLE_TOPMOST)) == UIF_STYLE_CHILD) if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_CENTER)
xText = (m_rc.right - m_rc.left - textSize.cx) / 2; xText = (m_rc.right - m_rc.left - textSize.cx) / 2;
else if ((m_style & (UIF_STYLE_CHILD | UIF_STYLE_TOPMOST)) == UIF_STYLE_TOPMOST) else if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_RIGHT)
xText = m_rc.right - m_rc.left - textSize.cx; xText = m_rc.right - m_rc.left - textSize.cx;
else else
xText = 0; xText = 0;
if ((m_style & 0xC) == UIF_STYLE_TOOLWINDOW) if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_MIDDLE)
yText = (m_rc.bottom - m_rc.top - textSize.cy) / 2; yText = (m_rc.bottom - m_rc.top - textSize.cy) / 2;
else if ((m_style & 0xC) == 0x8) else if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_BOTTOM)
yText = m_rc.bottom - m_rc.top - textSize.cy; yText = m_rc.bottom - m_rc.top - textSize.cy;
else else
yText = 0; yText = 0;
@ -3741,7 +3762,7 @@ CUIFButton::GetTextSize(LPCWSTR pszText, LPSIZE pSize)
::GetTextExtentPoint32W(hDC, pszText, cchText, pSize); ::GetTextExtentPoint32W(hDC, pszText, cchText, pSize);
} }
if (m_style & UIF_STYLE_VERTICAL) if (m_style & UIF_BUTTON_VERTICAL)
{ {
INT tmp = pSize->cx; INT tmp = pSize->cx;
pSize->cx = pSize->cy; pSize->cx = pSize->cy;
@ -3757,7 +3778,7 @@ CUIFButton::OnLButtonDown(LONG x, LONG y)
{ {
SetStatus(1); SetStatus(1);
StartCapture(); StartCapture();
if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) if ((m_style & 0x30) == 0x20)
NotifyCommand(1, 0); NotifyCommand(1, 0);
} }
@ -3770,7 +3791,7 @@ CUIFButton::OnLButtonUp(LONG x, LONG y)
if (bCapture) if (bCapture)
EndCapture(); EndCapture();
BOOL bNotInObject = (m_style & 0x30) == UIF_STYLE_TOOLTIP; BOOL bNotInObject = (m_style & 0x30) == 0x20;
if ((m_style & 0x30) != 0x10) if ((m_style & 0x30) != 0x10)
{ {
bNotInObject = !PtInObject(pt); bNotInObject = !PtInObject(pt);
@ -3807,7 +3828,7 @@ CUIFButton::OnLButtonUp(LONG x, LONG y)
inline void CUIFButton::OnMouseIn(LONG x, LONG y) inline void CUIFButton::OnMouseIn(LONG x, LONG y)
{ {
if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) if ((m_style & 0x30) == 0x20)
{ {
if (IsCapture()) if (IsCapture())
SetStatus(0); SetStatus(0);
@ -3825,7 +3846,7 @@ inline void CUIFButton::OnMouseIn(LONG x, LONG y)
inline void CUIFButton::OnMouseOut(LONG x, LONG y) inline void CUIFButton::OnMouseOut(LONG x, LONG y)
{ {
if ((m_style & 0x30) == UIF_STYLE_TOOLTIP) if ((m_style & 0x30) == 0x20)
SetStatus(0); SetStatus(0);
else if (IsCapture()) else if (IsCapture())
SetStatus(3); SetStatus(3);
@ -3935,13 +3956,13 @@ inline DWORD CUIFButton2::MakeDrawFlag()
{ {
DWORD dwDrawFlags = 0; DWORD dwDrawFlags = 0;
if (m_bPressed) if (m_bPressed)
dwDrawFlags |= 0x10; dwDrawFlags |= UIF_DRAW_PRESSED;
if (m_uButtonStatus == 1) if (m_uButtonStatus == 1)
dwDrawFlags |= 0x2; dwDrawFlags |= 0x2;
else if (2 <= m_uButtonStatus && m_uButtonStatus <= 3) else if (2 <= m_uButtonStatus && m_uButtonStatus <= 3)
dwDrawFlags |= 0x1; dwDrawFlags |= 0x1;
if (!m_bEnable) if (!m_bEnable)
dwDrawFlags |= 0x20; dwDrawFlags |= UIF_DRAW_DISABLED;
return dwDrawFlags; return dwDrawFlags;
} }
@ -3999,7 +4020,7 @@ CUIFButton2::OnPaintNoTheme(HDC hDC)
cyContent = m_BitmapSize.cy; cyContent = m_BitmapSize.cy;
} }
if (m_style & 0x400) if (m_style & UIF_BUTTON_VERTICAL)
{ {
cxyBorders = ((cyText && cyContent) ? 2 : 0); cxyBorders = ((cyText && cyContent) ? 2 : 0);
@ -4019,31 +4040,31 @@ CUIFButton2::OnPaintNoTheme(HDC hDC)
} }
INT xOffset, yOffset; INT xOffset, yOffset;
if ((m_style & 3) == 1) // center if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_CENTER)
xOffset = (rcBack.left + rcBack.right - cxButton) / 2; xOffset = (rcBack.left + rcBack.right - cxButton) / 2;
else if ((m_style & 3) == 2) // right else if ((m_style & UIF_BUTTON_H_ALIGN_MASK) == UIF_BUTTON_H_ALIGN_RIGHT)
xOffset = rcBack.right - cxText - 2; xOffset = rcBack.right - cxText - 2;
else // left else
xOffset = rcBack.left + 2; xOffset = rcBack.left + 2;
if ((m_style & 0xC) == 4) // middle if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_MIDDLE)
yOffset = (rcBack.top + rcBack.bottom - cyButton) / 2; yOffset = (rcBack.top + rcBack.bottom - cyButton) / 2;
else if ((m_style & 0xC) == 8) // bottom else if ((m_style & UIF_BUTTON_V_ALIGN_MASK) == UIF_BUTTON_V_ALIGN_BOTTOM)
yOffset = rcBack.bottom - cyButton - 2; yOffset = rcBack.bottom - cyButton - 2;
else // top else
yOffset = rcBack.top + 2; yOffset = rcBack.top + 2;
RECT rc = { xOffset, yOffset, xOffset + cxButton, cyButton + yOffset }; RECT rc = { xOffset, yOffset, xOffset + cxButton, cyButton + yOffset };
SIZE offsetSize = { 0, 0 }; SIZE offsetSize = { 0, 0 };
DWORD dwDrawFlags = MakeDrawFlag(); DWORD dwDrawFlags = MakeDrawFlag();
m_pScheme->GetCtrlFaceOffset(((m_style & UIF_STYLE_RTL) ? 165 : 84), m_pScheme->GetCtrlFaceOffset(((m_style & 0x200) ? 165 : 84),
dwDrawFlags, dwDrawFlags,
&offsetSize); &offsetSize);
::OffsetRect(&rc, offsetSize.cx, offsetSize.cy); ::OffsetRect(&rc, offsetSize.cx, offsetSize.cy);
RECT rcImage, rcText; RECT rcImage, rcText;
if (m_style & UIF_STYLE_VERTICAL) // vertical if (m_style & UIF_BUTTON_VERTICAL)
{ {
rcImage.left = (rc.left + rc.right - cxContent) / 2; rcImage.left = (rc.left + rc.right - cxContent) / 2;
rcImage.top = rc.top; rcImage.top = rc.top;
@ -4071,12 +4092,12 @@ CUIFButton2::OnPaintNoTheme(HDC hDC)
m_pScheme->DrawCtrlBkgd(hdcMem, m_pScheme->DrawCtrlBkgd(hdcMem,
&rcBack, &rcBack,
((m_style & UIF_STYLE_RTL) ? 165 : 84), ((m_style & 0x200) ? 165 : 84),
dwDrawFlags); dwDrawFlags);
if (m_pszButtonText) if (m_pszButtonText)
{ {
m_pScheme->DrawCtrlText(hdcMem, &rcText, m_pszButtonText, -1, dwDrawFlags, m_pScheme->DrawCtrlText(hdcMem, &rcText, m_pszButtonText, -1, dwDrawFlags,
!!(m_style & UIF_STYLE_VERTICAL)); !!(m_style & UIF_BUTTON_VERTICAL));
} }
if (m_ButtonIcon.m_hIcon) if (m_ButtonIcon.m_hIcon)
@ -4089,7 +4110,7 @@ CUIFButton2::OnPaintNoTheme(HDC hDC)
m_pScheme->DrawCtrlEdge(hdcMem, m_pScheme->DrawCtrlEdge(hdcMem,
&rcBack, &rcBack,
((m_style & UIF_STYLE_RTL) ? 165 : 84), ((m_style & 0x200) ? 165 : 84),
dwDrawFlags); dwDrawFlags);
::BitBlt(hDC, m_rc.left, m_rc.top, width, height, hdcMem, 0, 0, SRCCOPY); ::BitBlt(hDC, m_rc.left, m_rc.top, width, height, hdcMem, 0, 0, SRCCOPY);
@ -4106,7 +4127,7 @@ CUIFGripper::CUIFGripper(CUIFObject *pParent, LPCRECT prc, DWORD style)
{ {
m_iStateId = 0; m_iStateId = 0;
m_pszClassList = L"REBAR"; m_pszClassList = L"REBAR";
if (m_style & 1) if (m_style & UIF_GRIPPER_VERTICAL)
m_iPartId = RP_GRIPPERVERT; m_iPartId = RP_GRIPPERVERT;
else else
m_iPartId = RP_GRIPPER; m_iPartId = RP_GRIPPER;
@ -4153,7 +4174,7 @@ CUIFGripper::OnPaintTheme(HDC hDC)
if (FAILED(EnsureThemeData(*m_pWindow))) if (FAILED(EnsureThemeData(*m_pWindow)))
return FALSE; return FALSE;
if (m_style & 1) if (m_style & UIF_GRIPPER_VERTICAL)
{ {
m_rc.top += 2; m_rc.top += 2;
m_rc.bottom -= 2; m_rc.bottom -= 2;
@ -4175,12 +4196,12 @@ CUIFGripper::OnPaintNoTheme(HDC hDC)
{ {
if (m_pScheme) if (m_pScheme)
{ {
m_pScheme->DrawDragHandle(hDC, &m_rc, !!(m_style & 1)); m_pScheme->DrawDragHandle(hDC, &m_rc, !!(m_style & UIF_GRIPPER_VERTICAL));
return; return;
} }
RECT rc; RECT rc;
if (m_style & 1) if (m_style & UIF_GRIPPER_VERTICAL)
rc = { m_rc.left, m_rc.top + 1, m_rc.right, m_rc.top + 4 }; rc = { m_rc.left, m_rc.top + 1, m_rc.right, m_rc.top + 4 };
else else
rc = { m_rc.left + 1, m_rc.top, m_rc.left + 4, m_rc.bottom }; rc = { m_rc.left + 1, m_rc.top, m_rc.left + 4, m_rc.bottom };
@ -4200,7 +4221,7 @@ inline STDMETHODIMP_(void)
CUIFGripper::SetStyle(DWORD style) CUIFGripper::SetStyle(DWORD style)
{ {
m_style = style; m_style = style;
if (m_style & 1) if (m_style & UIF_GRIPPER_VERTICAL)
SetActiveTheme(L"REBAR", RP_GRIPPERVERT, 0); SetActiveTheme(L"REBAR", RP_GRIPPERVERT, 0);
else else
SetActiveTheme(L"REBAR", RP_GRIPPER, 0); SetActiveTheme(L"REBAR", RP_GRIPPER, 0);