mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 06:16:38 +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);
|
AddButtons(_countof(Buttons), Buttons);
|
||||||
|
|
||||||
/* Remember ideal width to use as a max width of buttons */
|
/* Remember the ideal width to use as a max width of buttons */
|
||||||
SIZE size;
|
UpdateMaxButtonsWidth();
|
||||||
GetIdealSize(FALSE, &size);
|
|
||||||
m_dButtonsWidthMax = size.cx;
|
|
||||||
|
|
||||||
return m_hWnd;
|
return m_hWnd;
|
||||||
}
|
}
|
||||||
|
@ -211,6 +209,14 @@ CMainToolbar::ShowButtonCaption(bool bShow)
|
||||||
SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle | TBSTYLE_EX_MIXEDBUTTONS);
|
SendMessageW(TB_SETEXTENDEDSTYLE, 0, dCurrentExStyle | TBSTYLE_EX_MIXEDBUTTONS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CMainToolbar::UpdateMaxButtonsWidth()
|
||||||
|
{
|
||||||
|
SIZE size;
|
||||||
|
GetIdealSize(FALSE, &size);
|
||||||
|
m_dButtonsWidthMax = size.cx;
|
||||||
|
}
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
CMainToolbar::GetMaxButtonsWidth() const
|
CMainToolbar::GetMaxButtonsWidth() const
|
||||||
{
|
{
|
||||||
|
@ -1553,8 +1559,12 @@ CApplicationView::ProcessWindowMessage(
|
||||||
|
|
||||||
index = m_Toolbar->GetButtonInfo(ID_RESETDB, &info);
|
index = m_Toolbar->GetButtonInfo(ID_RESETDB, &info);
|
||||||
if (index >= 0) m_Toolbar->DeleteButton(index);
|
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();
|
m_Toolbar->AutoSize();
|
||||||
|
|
||||||
RECT rTop;
|
RECT rTop;
|
||||||
|
@ -1793,7 +1803,7 @@ CApplicationView::OnSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||||
if (wParam == SIZE_MINIMIZED)
|
if (wParam == SIZE_MINIMIZED)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Size tool bar */
|
/* Resize the toolbar */
|
||||||
m_Toolbar->AutoSize();
|
m_Toolbar->AutoSize();
|
||||||
|
|
||||||
/* Automatically hide captions */
|
/* Automatically hide captions */
|
||||||
|
|
|
@ -297,6 +297,9 @@ class CMainToolbar : public CUiWindow<CToolbar<>>
|
||||||
void
|
void
|
||||||
ShowButtonCaption(bool bShow);
|
ShowButtonCaption(bool bShow);
|
||||||
|
|
||||||
|
void
|
||||||
|
UpdateMaxButtonsWidth();
|
||||||
|
|
||||||
DWORD
|
DWORD
|
||||||
GetMaxButtonsWidth() const;
|
GetMaxButtonsWidth() const;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue