[RAPPS] Merge CMainToolbar::Show/HideButtonCaption() into one single function.

This commit is contained in:
Hermès Bélusca-Maïto 2024-03-22 21:58:35 +01:00
parent e8cf32cf15
commit 385274e2dd
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 10 additions and 16 deletions

View file

@ -157,18 +157,14 @@ CMainToolbar::Create(HWND hwndParent)
return m_hWnd; return m_hWnd;
} }
VOID void
CMainToolbar::HideButtonCaption() CMainToolbar::ShowButtonCaption(bool bShow)
{ {
DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0); DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle | TBSTYLE_EX_MIXEDBUTTONS); if (bShow)
} SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle & ~TBSTYLE_EX_MIXEDBUTTONS);
else
VOID SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle | TBSTYLE_EX_MIXEDBUTTONS);
CMainToolbar::ShowButtonCaption()
{
DWORD dCurrentExStyle = (DWORD)SendMessageW(TB_GETEXTENDEDSTYLE, 0, 0);
SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle & ~TBSTYLE_EX_MIXEDBUTTONS);
} }
DWORD DWORD
@ -1737,11 +1733,11 @@ CApplicationView::OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (dSearchbarMargin > dToolbarTreshold) if (dSearchbarMargin > dToolbarTreshold)
{ {
m_Toolbar->ShowButtonCaption(); m_Toolbar->ShowButtonCaption(true);
} }
else if (dSearchbarMargin < dToolbarTreshold) else if (dSearchbarMargin < dToolbarTreshold)
{ {
m_Toolbar->HideButtonCaption(); m_Toolbar->ShowButtonCaption(false);
} }
RECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)}; RECT r = {0, 0, LOWORD(lParam), HIWORD(lParam)};

View file

@ -293,10 +293,8 @@ class CMainToolbar : public CUiWindow<CToolbar<>>
HWND HWND
Create(HWND hwndParent); Create(HWND hwndParent);
VOID void
HideButtonCaption(); ShowButtonCaption(bool bShow);
VOID
ShowButtonCaption();
DWORD DWORD
GetMaxButtonsWidth() const; GetMaxButtonsWidth() const;