MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / InitListWnd

Method InitListWnd

ogsr_engine/xrGame/ui/UIXmlInit.cpp:568–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

566//////////////////////////////////////////////////////////////////////////
567
568bool CUIXmlInit::InitListWnd(CUIXml& xml_doc, LPCSTR path, int index, CUIListWnd* pWnd)
569{
570 R_ASSERT3(xml_doc.NavigateToNode(path, index), "XML node not found", path);
571
572 float x = xml_doc.ReadAttribFlt(path, index, "x");
573 float y = xml_doc.ReadAttribFlt(path, index, "y");
574
575 InitAlignment(xml_doc, path, index, x, y, pWnd);
576
577 float width = xml_doc.ReadAttribFlt(path, index, "width");
578 float height = xml_doc.ReadAttribFlt(path, index, "height");
579 float item_height = xml_doc.ReadAttribFlt(path, index, "item_height");
580 int active_background = xml_doc.ReadAttribInt(path, index, "active_bg");
581
582 // Init font from xml config file
583 string256 buf;
584 CGameFont* LocalFont = NULL;
585 u32 cl;
586
587 shared_str text_path = strconcat(sizeof(buf), buf, path, ":font");
588 InitFont(xml_doc, *text_path, index, cl, LocalFont);
589 if (LocalFont)
590 {
591 pWnd->SetFont(LocalFont);
592 pWnd->SetTextColor(cl);
593 }
594
595 pWnd->SetScrollBarProfile(xml_doc.ReadAttrib(path, index, "scroll_profile", "default"));
596 pWnd->Init(x, y, width, height, item_height);
597 pWnd->EnableActiveBackground(!!active_background);
598
599 if (xml_doc.ReadAttribInt(path, index, "always_show_scroll"))
600 {
601 pWnd->SetAlwaysShowScroll(true);
602 pWnd->EnableAlwaysShowScroll(true);
603 pWnd->EnableScrollBar(true);
604 }
605
606 if (xml_doc.ReadAttribInt(path, index, "always_hide_scroll"))
607 {
608 pWnd->SetAlwaysShowScroll(false);
609 pWnd->EnableAlwaysShowScroll(true);
610 }
611
612 bool bVertFlip = (1 == xml_doc.ReadAttribInt(path, index, "flip_vert", 0));
613 pWnd->SetVertFlip(bVertFlip);
614
615 return true;
616}
617
618//////////////////////////////////////////////////////////////////////////
619

Callers 2

InitMethod · 0.80
InitMethod · 0.80

Calls 12

NavigateToNodeMethod · 0.80
ReadAttribFltMethod · 0.80
ReadAttribIntMethod · 0.80
SetScrollBarProfileMethod · 0.80
ReadAttribMethod · 0.80
SetAlwaysShowScrollMethod · 0.80
EnableScrollBarMethod · 0.80
SetVertFlipMethod · 0.80
SetFontMethod · 0.45
SetTextColorMethod · 0.45
InitMethod · 0.45

Tested by

no test coverage detected