mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[RAPPS] Recalculate the toolbar max buttons width when deleting the buttons (#6655)
Done so that the toolbar can display correctly the buttons, and their labels if possible, when resizing the RAPPS window.
This commit is contained in:
parent
9835ea27d2
commit
f23394986a
2 changed files with 18 additions and 5 deletions
|
@ -193,10 +193,8 @@ CMainToolbar::Create(HWND hwndParent)
|
|||
|
||||
AddButtons(_countof(Buttons), Buttons);
|
||||
|
||||
/* Remember ideal width to use as a max width of buttons */
|
||||
SIZE size;
|
||||
GetIdealSize(FALSE, &size);
|
||||
m_dButtonsWidthMax = size.cx;
|
||||
/* Remember the ideal width to use as a max width of buttons */
|
||||
UpdateMaxButtonsWidth();
|
||||
|
||||
return m_hWnd;
|
||||
}
|
||||
|
@ -211,6 +209,14 @@ CMainToolbar::ShowButtonCaption(bool bShow)
|
|||
SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle | TBSTYLE_EX_MIXEDBUTTONS);
|
||||
}
|
||||
|
||||
void
|
||||
CMainToolbar::UpdateMaxButtonsWidth()
|
||||
{
|
||||
SIZE size;
|
||||
GetIdealSize(FALSE, &size);
|
||||
m_dButtonsWidthMax = size.cx;
|
||||
}
|
||||
|
||||
DWORD
|
||||
CMainToolbar::GetMaxButtonsWidth() const
|
||||
{
|
||||
|
@ -1553,8 +1559,12 @@ CApplicationView::ProcessWindowMessage(
|
|||
|
||||
index = m_Toolbar->GetButtonInfo(ID_RESETDB, &info);
|
||||
if (index >= 0) m_Toolbar->DeleteButton(index);
|
||||
|
||||
/* Update the ideal width to use as a max width of buttons */
|
||||
m_Toolbar->UpdateMaxButtonsWidth();
|
||||
}
|
||||
|
||||
/* Resize the toolbar */
|
||||
m_Toolbar->AutoSize();
|
||||
|
||||
RECT rTop;
|
||||
|
@ -1793,7 +1803,7 @@ CApplicationView::OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
if (wParam == SIZE_MINIMIZED)
|
||||
return;
|
||||
|
||||
/* Size tool bar */
|
||||
/* Resize the toolbar */
|
||||
m_Toolbar->AutoSize();
|
||||
|
||||
/* Automatically hide captions */
|
||||
|
|
|
@ -297,6 +297,9 @@ class CMainToolbar : public CUiWindow<CToolbar<>>
|
|||
void
|
||||
ShowButtonCaption(bool bShow);
|
||||
|
||||
void
|
||||
UpdateMaxButtonsWidth();
|
||||
|
||||
DWORD
|
||||
GetMaxButtonsWidth() const;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue