本文整理汇总了C++中CGUIDialogProgressBarHandle::Percentage方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUIDialogProgressBarHandle::Percentage方法的具体用法?C++ CGUIDialogProgressBarHandle::Percentage怎么用?C++ CGUIDialogProgressBarHandle::Percentage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGUIDialogProgressBarHandle
的用法示例。
在下文中一共展示了CGUIDialogProgressBarHandle::Percentage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateState
void CGUIDialogExtendedProgressBar::UpdateState(unsigned int currentTime)
{
string strHeader;
string strTitle;
float fProgress(-1.0f);
{
CSingleLock lock(m_critSection);
// delete finished items
for (int iPtr = m_handles.size() - 1; iPtr >= 0; iPtr--)
{
if (m_handles.at(iPtr)->IsFinished())
{
delete m_handles.at(iPtr);
m_handles.erase(m_handles.begin() + iPtr);
}
}
if (!m_handles.size())
{
Close(false, 0, true, false);
return;
}
// ensure the current item is in our range
if (m_iCurrentItem >= m_handles.size())
m_iCurrentItem = m_handles.size() - 1;
// update the current item ptr
if (currentTime > m_iLastSwitchTime &&
currentTime - m_iLastSwitchTime >= ITEM_SWITCH_TIME_MS)
{
m_iLastSwitchTime = currentTime;
// select next item
if (++m_iCurrentItem > m_handles.size() - 1)
m_iCurrentItem = 0;
}
CGUIDialogProgressBarHandle *handle = m_handles.at(m_iCurrentItem);
if (handle)
{
strTitle = handle->Text();
strHeader = handle->Title();
fProgress = handle->Percentage();
}
}
SET_CONTROL_LABEL(CONTROL_LABELHEADER, strHeader);
SET_CONTROL_LABEL(CONTROL_LABELTITLE, strTitle);
if (fProgress > -1.0f)
{
SET_CONTROL_VISIBLE(CONTROL_PROGRESS);
CGUIProgressControl* pProgressCtrl=(CGUIProgressControl*)GetControl(CONTROL_PROGRESS);
if (pProgressCtrl) pProgressCtrl->SetPercentage(fProgress);
}
}