mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
resize taskbar buttons according to number of running applications
svn path=/trunk/; revision=8406
This commit is contained in:
parent
fbd78a5a3a
commit
15eee1ef26
1 changed files with 19 additions and 3 deletions
|
@ -87,7 +87,7 @@ LRESULT TaskBar::Init(LPCREATESTRUCT pcs)
|
||||||
CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE,
|
CCS_TOP|CCS_NODIVIDER | TBSTYLE_LIST|TBSTYLE_TOOLTIPS|TBSTYLE_WRAPABLE,
|
||||||
IDW_TASKTOOLBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON));
|
IDW_TASKTOOLBAR, 0, 0, 0, NULL, 0, 0, 0, 16, 16, sizeof(TBBUTTON));
|
||||||
|
|
||||||
SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(80,160));
|
SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(TASKBUTTONWIDTH_MIN,TASKBUTTONWIDTH_MAX));
|
||||||
//SendMessage(_htoolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
|
//SendMessage(_htoolbar, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
|
||||||
//SendMessage(_htoolbar, TB_SETDRAWTEXTFLAGS, DT_CENTER|DT_VCENTER, DT_CENTER|DT_VCENTER);
|
//SendMessage(_htoolbar, TB_SETDRAWTEXTFLAGS, DT_CENTER|DT_VCENTER, DT_CENTER|DT_VCENTER);
|
||||||
//SetWindowFont(_htoolbar, GetStockFont(ANSI_VAR_FONT), FALSE);
|
//SetWindowFont(_htoolbar, GetStockFont(ANSI_VAR_FONT), FALSE);
|
||||||
|
@ -321,7 +321,7 @@ BOOL CALLBACK TaskBar::EnumWndProc(HWND hwnd, LPARAM lparam)
|
||||||
entry._btn_idx = SendMessage(pThis->_htoolbar, TB_BUTTONCOUNT, 0, 0);
|
entry._btn_idx = SendMessage(pThis->_htoolbar, TB_BUTTONCOUNT, 0, 0);
|
||||||
|
|
||||||
SendMessage(pThis->_htoolbar, TB_INSERTBUTTON, entry._btn_idx, (LPARAM)&btn);
|
SendMessage(pThis->_htoolbar, TB_INSERTBUTTON, entry._btn_idx, (LPARAM)&btn);
|
||||||
SendMessage(pThis->_htoolbar, TB_AUTOSIZE, 0, 0); ///@todo useless?
|
pThis->ResizeButtons();
|
||||||
} else {
|
} else {
|
||||||
// refresh attributes of existing buttons
|
// refresh attributes of existing buttons
|
||||||
if (btn.fsState != entry._fsState)
|
if (btn.fsState != entry._fsState)
|
||||||
|
@ -419,7 +419,7 @@ void TaskBar::Refresh()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SendMessage(_htoolbar, TB_AUTOSIZE, 0, 0); ///@todo useless?
|
ResizeButtons();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,3 +431,19 @@ TaskBarMap::iterator TaskBarMap::find_id(int id)
|
||||||
|
|
||||||
return end();
|
return end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TaskBar::ResizeButtons()
|
||||||
|
{
|
||||||
|
int btns = _map.size();
|
||||||
|
|
||||||
|
if (btns > 0) {
|
||||||
|
int width = ClientRect(_hwnd).right / btns;
|
||||||
|
if (width < TASKBUTTONWIDTH_MIN)
|
||||||
|
width = TASKBUTTONWIDTH_MIN;
|
||||||
|
else if (width > TASKBUTTONWIDTH_MAX)
|
||||||
|
width = TASKBUTTONWIDTH_MAX;
|
||||||
|
|
||||||
|
SendMessage(_htoolbar, TB_SETBUTTONWIDTH, 0, MAKELONG(TASKBUTTONWIDTH_MIN,width));
|
||||||
|
// SendMessage(_htoolbar, TB_AUTOSIZE, 0, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue