Example #1
0
        /// <summary>
        /// Creates a new instance of the <see cref="ElementRef"/> class
        /// </summary>
        /// <param name="he">element handle</param>
        /// <param name="rt">reference text</param>
        /// <param name="attach">uses existing handle</param>
        private ElementRef(Element he, ElementRefType rt, bool attach)
        {
            Debug.Assert(rt != ElementRefType.Weak || !attach, "Weak handle cannot be attached");

            _referenceType = rt;
            switch (_referenceType)
            {
                case ElementRefType.Weak:
                    GC.SuppressFinalize(this);

                    _elementHwnd = SciterDomApi.GetElementHwnd(he, true);
                    _element = new IntPtr(SciterDomApi.GetElementUID(he));
                    break;
                case ElementRefType.Normal:
                    _element = he.Handle;

                    if (!attach)
                    {
                        SciterDomApi.UseElement(he.Handle);
                    }

                    break;
                default:
                    throw new ArgumentOutOfRangeException("rt", rt.ToString());
            }
        }
Example #2
0
        /// <summary>
        /// Updates item text & type
        /// </summary>
        protected override void UpdateItem(int position, object item, Element element)
        {
            var container = GetItemsContainer();
            var row = container[position];

            for (int i = 0; i < _properties.Count; ++i)
            {
                var prop = _properties[i];
                var cellText = prop != null ? ConvertUtility.GetValue(prop, item) : String.Empty;

                row.Children[i].Text = cellText;
            }

            UpdateItemType(position, element);
        }
Example #3
0
        /// <summary>
        /// Dispatches key
        /// </summary>
        private bool ProcessKey(Element container, string keyname)
        {
            Debug.Assert(!String.IsNullOrEmpty(keyname), "keyname cannot be null");

            var selector = String.Format("[accesskey=='{0}'],[accesskey-alt=='{0}']", keyname);
            var element = container.Find(selector, e => e.IsVisible && e.IsEnabled);

            if (element != null)
            {
                if (element.CallBehaviorMethod(BehaviorMethods.DoClick))
                    return true;

                var parent = element.Parent;
                parent.SendEvent(BehaviorEventType.ActivateChild, element);
            }
            return false;
        }
Example #4
0
        /// <summary>
        /// SciterCallMethod - calls behavior specific method.
        /// </summary>
        public bool CallBehaviorMethod(Element he, BehaviorMethods methodId, out object result)
        {
            result = null;
            switch (methodId)
            {
                case BehaviorMethods.DoClick:
                    var methodParam = new METHOD_PARAMS() { methodID = (int)METHOD_PARAMS.BEHAVIOR_METHOD_IDENTIFIERS.DO_CLICK };
                    var res = SciterCallBehaviorMethod(he.Handle, ref methodParam);

                    if (res == ScDomResult.SCDOM_OK_NOT_HANDLED)
                        return false;

                    CheckResult(res);
                    return true;
            }

            return false;
        }
Example #5
0
 /// <summary>
 /// Determines the index of specified element in the container
 /// </summary>
 public int IndexOf(Element element)
 {
     return Element.Children.IndexOf(element);
 }
Example #6
0
 /// <summary>
 /// Updates item text & type
 /// </summary>
 protected override void UpdateItem(int position, object item, Element element)
 {
     element.Text = GetItemText(item);
     UpdateItemType(position, element);
 }
Example #7
0
            /// <summary>
            /// Creates a new instance of the <see cref="ElementContainer"/> class
            /// </summary>
            public ElementContainer(Element element)
            {
                #region Arguments checking
                if (element == null)
                    throw new ArgumentNullException("element");
                #endregion

                Element = element;
            }
Example #8
0
        /// <summary>
        /// Set current item
        /// </summary>
        protected virtual void SetCurrentItem(Element ctl, Element item)
        {
            // previously selected item
            var prev_current = ctl.Find(":root > :current");
            var prev = ctl.Find(":root > :expanded");

            if (prev_current != null && prev_current != item)
                prev_current.SetState(ElementState.None, ElementState.Current);

            if (prev != null)
            {
                if (prev == item)
                    return;

                prev.SetState(ElementState.None, ElementState.Current | ElementState.Expanded);
            }
            item.SetState(ElementState.Current | ElementState.Expanded);
            item.ScrollToView();
        }
Example #9
0
 /// <summary>
 /// Creates a new instance of the <see cref="ElementEventArgs"/> class
 /// </summary>
 /// <param name="element"></param>
 internal ElementEventArgs(Element element)
 {
     _element = element;
 }
 /// <summary>
 /// Creates a new instance of the <see cref="MethodCallEventArgs"/> class
 /// </summary>
 internal MethodCallEventArgs(Element element)
     : base(element)
 {
 }
Example #11
0
 /// <summary>
 /// Post event by sinking/bubbling on the parent/child chain of this element
 /// </summary>
 public void PostEvent(BehaviorEventType eventCode, Element source)
 {
     var reason = default(IntPtr);
     SciterDomApi.PostEvent(this, eventCode, reason, source);
 }
Example #12
0
 /// <summary>
 /// Send event by sinking/bubbling on the parent/child chain of this element
 /// </summary>
 public bool SendEvent(BehaviorEventType eventCode, Element source)
 {
     var reason = default(IntPtr);
     return SciterDomApi.SendEvent(this, eventCode, reason, source);
 }
Example #13
0
 /// <summary>
 /// Creates a new instance of the <see cref="DrawEventArgs"/> class
 /// </summary>
 internal DrawEventArgs(Element element)
     : base(element)
 {
 }
Example #14
0
            /// <summary>
            /// Determines the index of specified element in the container
            /// </summary>
            public int IndexOf(Element element)
            {
                var index = Element.Children.IndexOf(element);
                if (index > 0)
                    return index - HeaderSize;

                return -1;
            }
Example #15
0
 /// <summary>
 /// Inserts element at specified position
 /// </summary>
 public void InsertElement(Element element, int position)
 {
     Element.InsertElement(element, position + HeaderSize);
 }
Example #16
0
            /// <summary>
            /// Creates a new instance of the <see cref="ElementContainer"/> class
            /// </summary>
            public ElementContainer(Element element, int headerSize)
            {
                #region Arguments checking
                if (element == null)
                    throw new ArgumentNullException("element");
                if (headerSize < 0)
                    throw new ArgumentNullException("headerSize");
                #endregion

                Element = element;
                HeaderSize = headerSize;
            }
 /// <summary>
 /// Creates a new instance of the <see cref="AttachBehaviorEventArgs"/> class
 /// </summary>
 /// <param name="notification"></param>
 internal AttachBehaviorEventArgs(Element element, String behaviorName)
 {
     Element = element;
     BehaviorName = behaviorName;
 }
Example #18
0
        /// <summary>
        /// Find target item
        /// </summary>
        private Element FindTargetItem(Element ctl, Element target)
        {
            if (target == ctl)
                return null;

            if (target == null)
                return null;

            var parent = target.Parent;
            if (parent == null)
                return target;

            if (target.Test("li > .caption"))
                return parent;

            return FindTargetItem(ctl, parent);
        }
Example #19
0
 /// <summary>
 /// Inserts element at specified position
 /// </summary>
 public void InsertElement(Element element, int position)
 {
     Element.InsertElement(element, position);
 }
Example #20
0
 /// <summary>
 /// Deletes element from the DOM Tree
 /// </summary>        
 public void DeleteElement(Element element)
 {
     CheckResult(SciterDeleteElement(element.Handle));
 }
Example #21
0
            /// <summary>
            /// Stores element reference in the inline storage
            /// </summary>
            /// <returns>true if element was successfully stored</returns>
            private bool SetElementFast(IntPtr helement, Element element)
            {
                if (_eax.Key == IntPtr.Zero)
                {
                    _eax.Key = helement;
                    _eax.Value = element;

                    return true;
                }

                if (_ebx.Key == IntPtr.Zero)
                {
                    _ebx.Key = helement;
                    _ebx.Value = element;

                    return true;
                }

                if (_ecx.Key == IntPtr.Zero)
                {
                    _ecx.Key = helement;
                    _ecx.Value = element;

                    return true;
                }

                if (_edx.Key == IntPtr.Zero)
                {
                    _edx.Key = helement;
                    _edx.Value = element;

                    return true;
                }

                return false;
            }
Example #22
0
 /// <summary>
 /// Creates a new instance of the <see cref="InputEventArgs"/> class
 /// </summary>
 public InputEventArgs(Element element, Phase phase)
     : base(element)
 {
     Phase = phase;
 }
Example #23
0
 /// <summary>
 /// Creates a new instance of the <see cref="ElementRef"/> class
 /// </summary>
 internal ElementRef(Element he, ElementRefType rt)
     : this(he, rt, false)
 {
 }
Example #24
0
 /// <summary>
 /// Inserts child to the elemets tree
 /// </summary>
 public void InsertElement(Element child, int pos)
 {
     SciterDomApi.InsertElement(child, this, pos);
 }
Example #25
0
 /// <summary>
 /// Creates a new instance of the <see cref="MouseEventArgs"/> class
 /// </summary>        
 internal MouseEventArgs(Element element, Phase phase)
     : base(element, phase)
 {
 }
Example #26
0
 /// <summary>
 /// Shows block element (DIV) in popup window.
 /// </summary>
 public void ShowPopup(Element anchor, PopupPlacement placement)
 {
     SciterDomApi.ShowPopup(this, anchor, placement);
 }
Example #27
0
 /// <summary>
 /// Releases the mouse capture from the specified element.
 /// </summary>
 public void ReleaseCapture(Element element)
 {
     ReleaseCapture();
 }
Example #28
0
        /// <summary>
        /// Assigns a new dom element
        /// </summary>
        private void SetDomElement(Element element)
        {
            Debug.Assert(ElementRef == null);
            if (element != null)
            {
                ElementRef = element.Use();

                element.AttachBehavior(this);
                GC.ReRegisterForFinalize(this);

                // Forces element update after property synchronization
                element.Update();
            }
        }
Example #29
0
 /// <summary>
 /// Creates a new instance of the <see cref="FocusEventArgs"/> class
 /// </summary>
 internal FocusEventArgs(Element element, Phase phase)
     : base(element, phase)
 {
 }
        public uint dataType; // data text passed "as is" from HTMLayoutRequestElementData

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Creates a new instance of the <see cref="DataArrivedEventArgs"/> class
        /// </summary>
        internal DataArrivedEventArgs(Element element)
            : base(element)
        {
        }