Merge pull request #22838 from dan-masek:fix_issue_22837
Fix issue 22837: No more blank buttons on toolbar after resizing the window
This commit is contained in:
parent
5db4f1f7df
commit
aba2167d9c
@ -1939,26 +1939,19 @@ static LRESULT CALLBACK HGToolbarProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPAR
|
||||
case WM_NCCALCSIZE:
|
||||
{
|
||||
LRESULT ret = CallWindowProc(window->toolbar.toolBarProc, hwnd, uMsg, wParam, lParam);
|
||||
int rows = (int)SendMessage(hwnd, TB_GETROWS, 0, 0);
|
||||
CvTrackbar* trackbar = window->toolbar.first;
|
||||
|
||||
if(window->toolbar.rows != rows)
|
||||
{
|
||||
SendMessage(window->toolbar.toolbar, TB_BUTTONCOUNT, 0, 0);
|
||||
CvTrackbar* trackbar = window->toolbar.first;
|
||||
|
||||
for( ; trackbar != 0; trackbar = trackbar->next )
|
||||
{
|
||||
RECT rect = { 0 };
|
||||
SendMessage(window->toolbar.toolbar, TB_GETITEMRECT,
|
||||
(WPARAM)trackbar->id, (LPARAM)&rect);
|
||||
MoveWindow(trackbar->hwnd, rect.left + HG_BUDDY_WIDTH, rect.top,
|
||||
rect.right - rect.left - HG_BUDDY_WIDTH,
|
||||
rect.bottom - rect.top, FALSE);
|
||||
MoveWindow(trackbar->buddy, rect.left, rect.top,
|
||||
HG_BUDDY_WIDTH, rect.bottom - rect.top, FALSE);
|
||||
}
|
||||
window->toolbar.rows = rows;
|
||||
for (; trackbar != 0; trackbar = trackbar->next) {
|
||||
RECT rect = { 0 };
|
||||
SendMessage(window->toolbar.toolbar, TB_GETITEMRECT,
|
||||
(WPARAM)trackbar->id, (LPARAM)&rect);
|
||||
MoveWindow(trackbar->hwnd, rect.left + HG_BUDDY_WIDTH, rect.top,
|
||||
rect.right - rect.left - HG_BUDDY_WIDTH,
|
||||
rect.bottom - rect.top, FALSE);
|
||||
MoveWindow(trackbar->buddy, rect.left, rect.top,
|
||||
HG_BUDDY_WIDTH, rect.bottom - rect.top, FALSE);
|
||||
}
|
||||
window->toolbar.rows = static_cast<int>(SendMessage(hwnd, TB_GETROWS, 0, 0));
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user