void CGUIListItemLayout::LoadLayout(TiXmlElement *layout, int context, bool focused, float maxWidth, float maxHeight) { m_focused = focused; layout->QueryFloatAttribute("width", &m_width); layout->QueryFloatAttribute("height", &m_height); const char *condition = layout->Attribute("condition"); if (condition) m_condition = g_infoManager.Register(condition, context); m_isPlaying.Parse("listitem.isplaying", context); // ensure width and height are valid if (!m_width) m_width = maxWidth; if (!m_height) m_height = maxHeight; m_width = std::max(1.0f, m_width); m_height = std::max(1.0f, m_height); m_group.SetWidth(m_width); m_group.SetHeight(m_height); TiXmlElement *child = layout->FirstChildElement("control"); while (child) { LoadControl(child, &m_group); child = child->NextSiblingElement("control"); } }
//------------------------------------------------------------------------------ void SubscriberSetupPanel::LoadData() { // load data from the core engine try { mObject = theSubscriber; wxString label; Integer propertyCount = theSubscriber->GetParameterCount(); for (Integer i = 0; i < propertyCount; ++i) { if (mObject->IsParameterReadOnly(i) == false) { label = mObject->GetParameterText(i); LoadControl(label); } } } catch (BaseException &e) { MessageInterface::ShowMessage (wxT("SubscriberSetupPanel:LoadData() error occurred!\n%s\n"), e.GetFullMessage().c_str()); } // explicitly disable apply button // it is turned on in each of the panels EnableUpdate(false); }
STDMETHODIMP CMixerControl::Load(VARIANT v) { XMLDoc* pDoc = 0; XMLEl* pLibrary = 0; HRESULT hr; if(FAILED(hr = XMLOpen(v, &pDoc, &pLibrary))) { return hr; } // Load ourself up. hr = LoadControl(pLibrary); SAFE_RELEASE(pLibrary); XMLClose(&pDoc); return hr; }
void CGUIListItemLayout::LoadControl(TiXmlElement *child, CGUIControlGroup *group) { if (!group) return; CRect rect(group->GetXPosition(), group->GetYPosition(), group->GetXPosition() + group->GetWidth(), group->GetYPosition() + group->GetHeight()); CGUIControlFactory factory; CGUIControl *control = factory.Create(0, rect, child, true); // true indicating we're inside a list for the // different label control + defaults. if (control) { group->AddControl(control); if (control->IsGroup()) { TiXmlElement *grandChild = child->FirstChildElement("control"); while (grandChild) { LoadControl(grandChild, (CGUIControlGroup *)control); grandChild = grandChild->NextSiblingElement("control"); } } } }