public override EditHitInfo CalcHitInfo(Point pt)
        {
            CustomTokenEditHitInfo hi = CreateHitInfo(pt) as CustomTokenEditHitInfo;

            if (!Bounds.Contains(pt))
            {
                return(hi);
            }
            foreach (CustomTokenEditTokenInfo tokenInfo in VisibleItems)
            {
                if (tokenInfo.Bounds.Contains(pt))
                {
                    hi.ResetHitObject(tokenInfo);
                    hi.ResetHitTest(TokenEditHitTest.Link);
                    hi.InCheckBox(false);

                    if (tokenInfo.CheckBoxGlyphBounds.Contains(pt))
                    {
                        hi.InCheckBox(true);
                    }
                    if (tokenInfo.GlyphBounds.Contains(pt))
                    {
                        hi.ResetHitTest(TokenEditHitTest.Glyph);
                    }
                    return(hi);
                }
            }
            if (ContentRect.Contains(pt))
            {
                hi.ResetHitTest(TokenEditHitTest.EditorRect);
            }

            return(hi);
        }
Ejemplo n.º 2
0
        internal override IInputElement InputHitTest(PTS.FSPOINT pt)
        {
            IInputElement ie = null;


            if (_pageContextOfThisPage.FloatingElementList != null)
            {
                for (int index = 0; index < _pageContextOfThisPage.FloatingElementList.Count && ie == null; index++)
                {
                    BaseParaClient floatingElement = _pageContextOfThisPage.FloatingElementList[index];

                    ie = floatingElement.InputHitTest(pt);
                }
            }

            if (ie == null)
            {
                // Query subpage details
                PTS.FSSUBPAGEDETAILS subpageDetails;
                PTS.Validate(PTS.FsQuerySubpageDetails(PtsContext.Context, _paraHandle.Value, out subpageDetails));

                if (Rect.Contains(pt))
                {
                    if (ContentRect.Contains(pt))
                    {
                        pt = new PTS.FSPOINT(pt.u - ContentRect.u, pt.v - ContentRect.v);

                        // Hittest subpage content. Subpage content may be simple or complex -
                        // depending of set of features used in the content of the page.
                        // (1) simple subpage (contains only one track)
                        // (2) complex subpage (contains columns)
                        if (PTS.ToBoolean(subpageDetails.fSimple))
                        {
                            ie = PtsHelper.InputHitTestTrack(PtsContext, pt, ref subpageDetails.u.simple.trackdescr);
                        }
                        else
                        {
                            // (2) complex page (contains columns)
                            // cBasicColumns == 0, means that subpage content is empty
                            if (subpageDetails.u.complex.cBasicColumns != 0)
                            {
                                // Retrieve description for each column.
                                PTS.FSTRACKDESCRIPTION[] arrayColumnDesc;
                                PtsHelper.TrackListFromSubpage(PtsContext, _paraHandle.Value, ref subpageDetails, out arrayColumnDesc);

                                // Arrange each track
                                for (int index = 0; index < arrayColumnDesc.Length && ie == null; index++)
                                {
                                    ie = PtsHelper.InputHitTestTrack(PtsContext, pt, ref arrayColumnDesc[index]);
                                }
                            }
                        }
                    }

                    if (ie == null)
                    {
                        ie = Paragraph.Element as IInputElement;
                    }
                }
            }

            return(ie);
        }