public void RecreateTagPath(uint uid, List <uint> uidstack, List <string> tagpath)
        {
            if (actual_uidstack != null &&
                actual_uidstack.Count >= uidstack.Count &&
                Enumerable.SequenceEqual(uidstack, actual_uidstack.Take(uidstack.Count)))
            {
                var r    = _se.ChildrenCount;
                var rrrr = _se.SelectAll("*");

                var el_li = _se.SelectAll("li").Single(li => li.ExpandoValue["uuid"].Get(-1) == uid);
                el_li.SetState(SciterXDom.ELEMENT_STATE_BITS.STATE_CURRENT);
            }
            else
            {
                ResetTagPath();
                actual_uidstack = uidstack;

                for (int i = 0; i < tagpath.Count; i++)
                {
                    var el_li = SciterElement.Create("li");
                    _se.Append(el_li);

                    el_li.SetHTML("<text>" + tagpath[i] + "</text>");
                    el_li.ExpandoValue["uuid"] = new SciterValue(uidstack[i]);

                    if (uidstack[i] == uid)
                    {
                        el_li.SetState(SciterXDom.ELEMENT_STATE_BITS.STATE_CURRENT);
                    }
                }

                App.AppHost.InvokePost(() => _se.Refresh());
            }
        }
Exemple #2
0
        // tree DOM handling
        private static void AddElement(SciterElement tree_el_parent, SciterElement origin_el_add)
        {
            SciterNode origin_nd = origin_el_add.ToNode();

            Debug.Assert(origin_nd.IsElement);

            string        tag         = origin_el_add.Tag;
            SciterElement tree_el_new = SciterElement.Create("option");

            tree_el_parent.Append(tree_el_new);
            uint uid = origin_el_add.UID; Debug.Assert(uid != 0);

            tree_el_new.SetAttribute("value", uid.ToString());
            tree_el_new.SetHTML(UI_ElementCaption(origin_el_add));


            bool has_real_childs = false;
            uint nchilds         = origin_nd.ChildrenCount;

            for (uint i = 0; i < nchilds; i++)
            {
                SciterNode nd = origin_nd[i];
                if (nd.IsElement)
                {
                    AddElement(tree_el_new, nd.ToElement());
                    has_real_childs = true;
                }
                else
                {
                    bool new_option = AddNode(tree_el_new, uid, nd);
                    if (new_option)
                    {
                        has_real_childs = true;
                    }
                }
            }

            if (has_real_childs)
            {
                if (tag == "html" || tag == "body")
                {
                    tree_el_new.SetState(SciterXDom.ELEMENT_STATE_BITS.STATE_EXPANDED);                    //tree_el_new.set_attribute("expanded", "");
                }
                else
                {
                    tree_el_new.SetState(SciterXDom.ELEMENT_STATE_BITS.STATE_COLLAPSED);
                }
            }
        }
Exemple #3
0
        private static bool AddNode(SciterElement tree_el_parent, uint origin_parent_uid, SciterNode origin_nd)
        {
            Debug.Assert(origin_nd.ChildrenCount == 0);

            if (origin_nd.IsComment)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(origin_nd.Text))
            {
                return(false);
            }

            SciterElement tree_el_new = SciterElement.Create("option");

            tree_el_parent.Append(tree_el_new);
            tree_el_new.SetAttribute("value", origin_parent_uid.ToString());            // UID
            tree_el_new.Text = origin_nd.Text;
            return(true);
        }