Skip to content

Commit

Permalink
Add DrawRoundedRect() function
Browse files Browse the repository at this point in the history
  • Loading branch information
sdottaka committed Jul 13, 2024
1 parent 5db5405 commit e95bd1d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions Src/BasicFlatStatusBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,7 @@ void CBasicFlatStatusBar::OnPaint()
CRect rcPart;
ctrl.GetRect(i, &rcPart);
if (m_bMouseTracking && (style & SBPS_CLICKABLE) != 0 && i == m_nTrackingPane)
DrawRoundedRectWithShadow(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, 0,
clr3DFaceLight, clr3DFace, clr3DFace);
DrawRoundedRect(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, clr3DFaceLight, clr3DFace);
const bool disabled = (style & SBPS_DISABLED) != 0;
if (!disabled)
{
Expand Down
4 changes: 4 additions & 0 deletions Src/Common/RoundedRectWithShadow.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@
#pragma once

void DrawRoundedRectWithShadow(HDC hdc, int left, int top, int width, int height, int radius, int shadowWidth, COLORREF roundedRectColor, COLORREF shadowColor, COLORREF backgroundColor);
inline void DrawRoundedRect(HDC hdc, int left, int top, int width, int height, int radius, COLORREF roundedRectColor, COLORREF backgroundColor)
{
DrawRoundedRectWithShadow(hdc, left, top, width, height, radius, 0, roundedRectColor, backgroundColor, backgroundColor);
}

2 changes: 1 addition & 1 deletion Src/Common/scbarcf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void CSizingControlBarCF::NcPaintGripper(CDC* pDC, const CRect& rcClient)
::GetSysColor(COLOR_GRADIENTINACTIVECAPTION);
const COLORREF clrBack = ::GetSysColor(COLOR_3DFACE);
const int radius = pointToPixel(2.25);
DrawRoundedRectWithShadow(pDC->m_hDC, rcGrip.left, rcGrip.top, rcGrip.Width(), rcGrip.Height(), radius, 0, clrCptn, clrBack, clrBack);
DrawRoundedRect(pDC->m_hDC, rcGrip.left, rcGrip.top, rcGrip.Width(), rcGrip.Height(), radius, clrCptn, clrBack);

// draw the caption text - first select a font
CFont font;
Expand Down
6 changes: 2 additions & 4 deletions Src/MergeStatusBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,15 @@ void CMergeStatusBar::OnPaint()
ctrl.GetRect(i, &rcPart);
const bool lighten = (m_bMouseTracking && (style & SBPS_CLICKABLE) != 0 && i == m_nTrackingPane);
if (lighten)
DrawRoundedRectWithShadow(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, 0,
clr3DFaceLight, clr3DFace, clr3DFace);
DrawRoundedRect(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, clr3DFaceLight, clr3DFace);
const bool disabled = (style & SBPS_DISABLED) != 0;
if (!disabled)
{
if (m_bDiff[i % nColumnsPerPane])
{
dc.SetTextColor(m_cachedColors.clrWordDiffText == -1 ?
theApp.GetMainSyntaxColors()->GetColor(COLORINDEX_NORMALTEXT) : m_cachedColors.clrWordDiffText);
DrawRoundedRectWithShadow(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, 0,
lighten ? clrWordDiffLight : m_cachedColors.clrWordDiff, clr3DFace, clr3DFace);
DrawRoundedRect(dc.m_hDC, rcPart.left, rcPart.top, rcPart.Width(), rcPart.Height(), radius, lighten ? clrWordDiffLight : m_cachedColors.clrWordDiff, clr3DFace);
}
else
{
Expand Down

0 comments on commit e95bd1d

Please sign in to comment.