Exemple #1
0
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;
}
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);
        }
      }
    }
  }
}
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();
}