Skip to content

Commit

Permalink
[Imp] Allow the main toolbar to wrap if the main window is too narrow.
Browse files Browse the repository at this point in the history
git-svn-id: https://source.openmpt.org/svn/openmpt/trunk/OpenMPT@22132 56274372-70c3-4bfc-bfc3-4c3a0b034d27
  • Loading branch information
sagamusix committed Nov 10, 2024
1 parent 61efc04 commit a593a51
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions mptrack/Mainbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,19 @@ void CToolBarEx::SetVertical()

CSize CToolBarEx::CalcDynamicLayout(int nLength, DWORD dwMode)
{
// Make the toolbar go into multiline mode when it's docked
if(dwMode & LM_HORZDOCK)
{
if(auto mainFrm = CMainFrame::GetMainFrame())
{
CRect rect;
mainFrm->GetClientRect(rect);
nLength = rect.right;
dwMode &= ~LM_HORZDOCK;
dwMode |= LM_COMMIT;
}
}

CSize sizeResult;
// if we're committing set the buttons appropriately
if(dwMode & LM_COMMIT)
Expand Down Expand Up @@ -227,9 +240,7 @@ END_MESSAGE_MAP()

BOOL CMainToolBar::Create(CWnd *parent)
{
DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY;

if(!CToolBar::Create(parent, dwStyle))
if(!CToolBar::Create(parent, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_SIZE_DYNAMIC | CBRS_TOOLTIPS | CBRS_FLYBY))
return FALSE;

SetButtons(MainButtons, static_cast<int>(std::size(MainButtons)));
Expand Down

0 comments on commit a593a51

Please sign in to comment.