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


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

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


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

示例1: Load

bool CGUIDialog::Load(const CStdString& strFileName, bool bContainsPath)
{
  m_renderOrder = 1;
  if (!CGUIWindow::Load(strFileName, bContainsPath))
  {
    return false;
  }

  // Clip labels to extents
  if (m_vecControls.size())
  {
    CGUIControl* pBase = m_vecControls[0];

    for (ivecControls p = m_vecControls.begin() + 1; p != m_vecControls.end(); ++p)
    {
      if ((*p)->GetControlType() == CGUIControl::GUICONTROL_LABEL)
      {
        CGUILabelControl* pLabel = (CGUILabelControl*)(*p);

        if (!pLabel->GetWidth())
        {
          float spacing = (pLabel->GetXPosition() - pBase->GetXPosition()) * 2;
          pLabel->SetWidth(pBase->GetWidth() - spacing);
          pLabel->SetTruncate(true);
        }
      }
    }
  }

  return true;
}
开发者ID:Castlecard,项目名称:plex,代码行数:31,代码来源:GUIDialog.cpp

示例2: OnInitWindow

void CGUIDialogKeyboardGeneric::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  m_bIsConfirmed = false;
  m_isKeyboardNavigationMode = false;

  // fill in the keyboard layouts
  m_currentLayout = 0;
  m_layouts.clear();
  const KeyboardLayouts& keyboardLayouts = CKeyboardLayoutManager::GetInstance().GetLayouts();
  std::vector<CVariant> layoutNames = CSettings::GetInstance().GetList(CSettings::SETTING_LOCALE_KEYBOARDLAYOUTS);

  for (std::vector<CVariant>::const_iterator layoutName = layoutNames.begin(); layoutName != layoutNames.end(); ++layoutName)
  {
    KeyboardLayouts::const_iterator keyboardLayout = keyboardLayouts.find(layoutName->asString());
    if (keyboardLayout != keyboardLayouts.end())
      m_layouts.push_back(keyboardLayout->second);
  }

  // set alphabetic (capitals)
  UpdateButtons();

  // set heading
  if (!m_strHeading.empty())
  {
    SET_CONTROL_LABEL(CTL_LABEL_HEADING, m_strHeading);
    SET_CONTROL_VISIBLE(CTL_LABEL_HEADING);
  }
  else
  {
    SET_CONTROL_HIDDEN(CTL_LABEL_HEADING);
  }
  // set type
  {
    CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CTL_EDIT, m_hiddenInput ? CGUIEditControl::INPUT_TYPE_PASSWORD : CGUIEditControl::INPUT_TYPE_TEXT);
    OnMessage(msg);
  }
  SetEditText(m_text);

  // get HZLIST label options
  CGUILabelControl* pEdit = ((CGUILabelControl*)GetControl(CTL_LABEL_HZLIST));
  CLabelInfo labelInfo = pEdit->GetLabelInfo();
  m_listfont = labelInfo.font;
  m_listwidth = pEdit->GetWidth();
  m_hzcode.clear();
  m_words.clear();
  SET_CONTROL_LABEL(CTL_LABEL_HZCODE, "");
  SET_CONTROL_LABEL(CTL_LABEL_HZLIST, "");

  CVariant data;
  data["title"] = m_strHeading;
  data["type"] = !m_hiddenInput ? "keyboard" : "password";
  data["value"] = GetText();
  ANNOUNCEMENT::CAnnouncementManager::GetInstance().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
开发者ID:evilhamster,项目名称:xbmc,代码行数:56,代码来源:GUIDialogKeyboardGeneric.cpp

示例3: OnWindowLoaded

void CGUIDialog::OnWindowLoaded()
{
  CGUIWindow::OnWindowLoaded();

  // Clip labels to extents
  if (m_children.size())
  {
    CGUIControl* pBase = m_children[0];

    for (iControls p = m_children.begin() + 1; p != m_children.end(); ++p)
    {
      if ((*p)->GetControlType() == CGUIControl::GUICONTROL_LABEL)
      {
        CGUILabelControl* pLabel = (CGUILabelControl*)(*p);

        if (!pLabel->GetWidth())
        {
          float spacing = (pLabel->GetXPosition() - pBase->GetXPosition()) * 2;
          pLabel->SetWidth(pBase->GetWidth() - spacing);
        }
      }
    }
  }
}
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:24,代码来源:GUIDialog.cpp

示例4: OnWindowLoaded

void CGUIDialogKeyboardGeneric::OnWindowLoaded()
{
  CGUIEditControl *edit = (CGUIEditControl *)GetControl(CTL_EDIT);
  if (!edit && g_SkinInfo && g_SkinInfo->APIVersion() < ADDON::AddonVersion("5.2.0"))
  {
    // backward compatibility: convert label to edit control
    CGUILabelControl *label = (CGUILabelControl *)GetControl(CTL_LABEL_EDIT);
    if (label && label->GetControlType() == CGUIControl::GUICONTROL_LABEL)
    {
      // create a new edit control positioned in the same spot
      edit = new CGUIEditControl(label->GetParentID(), CTL_EDIT, label->GetXPosition(), label->GetYPosition(),
                                 label->GetWidth(), label->GetHeight(), CTextureInfo(), CTextureInfo(),
                                 label->GetLabelInfo(), "");
      AddControl(edit);
      m_defaultControl = CTL_EDIT;
      m_defaultAlways  = true;
    }
  }
  // show the cursor always
  if (edit)
    edit->SetShowCursorAlways(true);

  CGUIDialog::OnWindowLoaded();
}
开发者ID:cg110,项目名称:xbmc,代码行数:24,代码来源:GUIDialogKeyboardGeneric.cpp


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