Exemple #1
0
        private void CreateOptionList(Interop.IHTMLSelectElement s)
        {
            if (_options == null)
            {
                _options = new OptionElementsCollection(s, base.HtmlEditor);
                _options.OnInsertHandler += new CollectionInsertHandler(_options_OnInsertHandler);
                _options.OnClearHandler  += new CollectionClearHandler(_options_OnClearHandler);
            }
            else
            {
                Debug.WriteLine("Recreate List");
                _options.OnInsertHandler -= new CollectionInsertHandler(_options_OnInsertHandler);
                _options.OnClearHandler  -= new CollectionClearHandler(_options_OnClearHandler);
                _options.Clear();
                Interop.IHTMLElement           selectElement = (Interop.IHTMLElement)s;
                Interop.IHTMLElementCollection options       = (Interop.IHTMLElementCollection)selectElement.GetChildren();
                for (int i = 0; i < options.GetLength(); i++)
                {
                    Interop.IHTMLElement el = (Interop.IHTMLElement)options.Item(i, i);
                    IOptionElement       oe = null;
                    switch (el.GetTagName())
                    {
                    case "OPTION":
                        oe = new OptionElement(el, base.HtmlEditor);
                        break;

                    case "OPTGROUP":
                        oe = new OptGroupElement(el, base.HtmlEditor);
                        break;
                    }
                    if (oe != null)
                    {
                        _options.Add(oe);
                    }
                }
                _options.OnInsertHandler += new CollectionInsertHandler(_options_OnInsertHandler);
                _options.OnClearHandler  += new CollectionClearHandler(_options_OnClearHandler);
            }
        }
        internal OptionElementsCollection(Interop.IHTMLSelectElement s, IHtmlEditor editor) : base()
        {
            selectElement = (Interop.IHTMLElement)s;
            Interop.IHTMLElementCollection options = (Interop.IHTMLElementCollection)selectElement.GetChildren();
            for (int i = 0; i < options.GetLength(); i++)
            {
                Interop.IHTMLElement el = (Interop.IHTMLElement)options.Item(i, i);
                object oe = null;
                switch (el.GetTagName())
                {
                case "OPTION":
                    oe = new OptionElement(el, editor);
                    break;

                case "OPTGROUP":
                    oe = new OptGroupElement(el, editor);
                    break;
                }
                if (oe != null)
                {
                    InnerList.Add(oe);
                }
            }
        }
Exemple #3
0
 internal ListBoxElement(Interop.IHTMLElement peer, IHtmlEditor editor) : base(peer, editor)
 {
     Interop.IHTMLSelectElement s = (Interop.IHTMLSelectElement)peer;
     s.size = this.size;
 }
Exemple #4
0
 internal SelectElement(Interop.IHTMLElement peer, IHtmlEditor editor) : base(peer, editor)
 {
     Interop.IHTMLSelectElement s = (Interop.IHTMLSelectElement)peer;
     CreateOptionList(s);
 }