Exemple #1
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 #2
0
        /*
         * function collapseOption(opt)
         * {
         * //stdout.println("collapse");
         * while(opt.length > 1)
         * opt.last.remove();
         * opt.state.collapsed = true;
         * }
         */
        private void collapseOption(SciterElement opt)
        {
            while (opt.ChildCount > 1)
            {
                opt.Children.LastOrDefault().Delete();
            }

            opt.SetState(ElementState.Collapsed);

            //_logger.LogInformation($"{nameof(SynchronousArgumentFunction)} was executed!\n\t{string.Join(",", args.Select(s => s.AsInt32()))}");
        }
Exemple #3
0
        /*
         * function expandOption(opt)
         * {
         * //stdout.println("expand");
         * function appendChild(caption, path, isFolder) { (this super).appendOption(opt, caption, path, isFolder? false: undefined); }
         * this.ds.eachChild(opt.attributes["filename"], appendChild);
         * opt.state.expanded = true;
         * }
         */
        private void expandOption(SciterElement opt)
        {
            try
            {
                foreach (var file in Directory.GetDirectories(opt["filename"], "*.*", SearchOption.TopDirectoryOnly))
                {
                    appendChild(opt, Path.GetFileName(file), file, true);
                }

                foreach (var file in Directory.GetFiles(opt["filename"], "*.*", SearchOption.TopDirectoryOnly))
                {
                    appendChild(opt, Path.GetFileName(file), file, false);
                }

                opt.SetState(ElementState.Expanded);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                //throw;
            }
        }