当前位置: 首页>>代码示例>>C++>>正文


C++ CGUILabelControl::SetHighlight方法代码示例

本文整理汇总了C++中CGUILabelControl::SetHighlight方法的典型用法代码示例。如果您正苦于以下问题:C++ CGUILabelControl::SetHighlight方法的具体用法?C++ CGUILabelControl::SetHighlight怎么用?C++ CGUILabelControl::SetHighlight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGUILabelControl的用法示例。


在下文中一共展示了CGUILabelControl::SetHighlight方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: UpdateLabel

void CGUIDialogKeyboardGeneric::UpdateLabel() // FIXME seems to be called twice for one USB SDL keyboard action/character
{
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_EDIT));
  if (pEdit)
  {
    CStdStringW edit = m_strEdit;
    pEdit->SetHighlight(0, 0);
    pEdit->SetSelection(0, 0);
    if (m_hiddenInput)
    { // convert to *'s
      edit.clear();
      if (m_lastRemoteClickTime + REMOTE_SMS_DELAY > CTimeUtils::GetFrameTime() && m_iCursorPos > 0)
      { // using the remove to input, so display the last key input
        edit.append(m_iCursorPos - 1, L'*');
        edit.append(1, m_strEdit[m_iCursorPos - 1]);
      }
      else
        edit.append(m_strEdit.size(), L'*');
    }
    else if (!m_strEditing.empty())
    {
      edit.insert(m_iCursorPos, m_strEditing);
      pEdit->SetHighlight(m_iCursorPos, m_iCursorPos + m_strEditing.size());
      if (m_iEditingLength > 0)
        pEdit->SetSelection(m_iCursorPos + m_iEditingOffset, m_iCursorPos + m_iEditingOffset + m_iEditingLength);
    }
    // convert back to utf8
    CStdString utf8Edit;
    g_charsetConverter.wToUTF8(edit, utf8Edit);
    pEdit->SetLabel(utf8Edit);
    // Send off a search message
    unsigned int now = CTimeUtils::GetFrameTime();
    // don't send until the REMOTE_SMS_DELAY has passed
    if (m_lastRemoteClickTime && m_lastRemoteClickTime + REMOTE_SMS_DELAY >= now)
      return;

    if (m_pCharCallback)
    {
      // do not send editing text comes from system input method
      if (!m_hiddenInput && !m_strEditing.empty())
        g_charsetConverter.wToUTF8(m_strEdit, utf8Edit);
      m_pCharCallback(this, utf8Edit);
    }
  }
}
开发者ID:lewy20041,项目名称:xbmclibmedia,代码行数:45,代码来源:GUIDialogKeyboardGeneric.cpp

示例2: FrameMove

void CGUIDialogNumeric::FrameMove()
{
  CStdString strLabel;
  unsigned int start = 0;
  unsigned int end = 0;
  if (m_mode == INPUT_PASSWORD)
  {
    for (unsigned int i=0; i < m_number.size(); i++)
      strLabel += '*';
  }
  else if (m_mode == INPUT_NUMBER)
  { // simple - just render text directly
    strLabel = m_number;
  }
  else if (m_mode == INPUT_TIME)
  { // format up the time
    strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
    start = m_block * 3;
    end = m_block * 3 + 2;
  }
  else if (m_mode == INPUT_TIME_SECONDS)
  { // format up the time
    strLabel = StringUtils::Format("%2d:%02d", m_datetime.wMinute, m_datetime.wSecond);
    start = m_block * 3;
    end = m_block * 3 + 2;
  }
  else if (m_mode == INPUT_DATE)
  { // format up the date
    strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
    start = m_block * 3;
    end = m_block * 3 + 2;
    if (m_block == 2)
      end = m_block * 3 + 4;
  }
  else if (m_mode == INPUT_IP_ADDRESS)
  { // format up the date
    strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
    start = m_block * 4;
    end = m_block * 4 + 3;
  }
  CGUILabelControl *pLabel = (CGUILabelControl *)GetControl(CONTROL_INPUT_LABEL);
  if (pLabel)
  {
    pLabel->SetLabel(strLabel);
    pLabel->SetHighlight(start, end);
  }
  CGUIDialog::FrameMove();
}
开发者ID:Anankin,项目名称:xbmc,代码行数:48,代码来源:GUIDialogNumeric.cpp

示例3: FrameMove

void CGUIDialogNumeric::FrameMove()
{
  std::string strLabel;
  unsigned int start = 0;
  unsigned int end = 0;
  if (m_mode == INPUT_PASSWORD)
    strLabel.assign(m_number.length(), '*');
  else if (m_mode == INPUT_NUMBER)
    strLabel = m_number;
  else if (m_mode == INPUT_TIME)
  { // format up the time
    strLabel = StringUtils::Format("%2d:%02d", m_datetime.wHour, m_datetime.wMinute);
    start = m_block * 3;
    end = m_block * 3 + 2;
  }
  else if (m_mode == INPUT_TIME_SECONDS)
  { // format up the time
    strLabel = StringUtils::Format("%2d:%02d:%02d", m_datetime.wHour, m_datetime.wMinute, m_datetime.wSecond);
    start = m_block * 3;
    end = m_block * 3 + 2;
  }
  else if (m_mode == INPUT_DATE)
  { // format up the date
    strLabel = StringUtils::Format("%2d/%2d/%4d", m_datetime.wDay, m_datetime.wMonth, m_datetime.wYear);
    start = m_block * 3;
    end = m_block * 3 + 2;
    if (m_block == 2)
      end = m_block * 3 + 4;
  }
  else if (m_mode == INPUT_IP_ADDRESS)
  { // format up the date
    strLabel = StringUtils::Format("%3d.%3d.%3d.%3d", m_ip[0], m_ip[1], m_ip[2], m_ip[3]);
    start = m_block * 4;
    end = m_block * 4 + 3;
  }
  CGUILabelControl *pLabel = dynamic_cast<CGUILabelControl *>(GetControl(CONTROL_INPUT_LABEL));
  if (pLabel)
  {
    pLabel->SetLabel(strLabel);
    pLabel->SetHighlight(start, end);
  }
  CGUIDialog::FrameMove();
}
开发者ID:idekker,项目名称:xbmc,代码行数:43,代码来源:GUIDialogNumeric.cpp


注:本文中的CGUILabelControl::SetHighlight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。