Ejemplo n.º 1
0
        public virtual void invalidate()
        {
            if (isVisible() == false)
            {
                return;
            }

            Rectangle invalidateRc = mRectItem;

            ControlUI parent = this;
            Rectangle rcTtemp;
            Rectangle rcParent;

            while ((parent = parent.getParent()) != null)
            {
                rcTtemp  = invalidateRc;
                rcParent = parent.getPos();
                if (rcTtemp.IntersectsWith(rcParent) == true)
                {
                    invalidateRc.Intersect(rcParent);
                }
                else
                {
                    return;
                }
            }

            if (mManager != null)
            {
                mManager.invalidate(ref invalidateRc);
            }
        }
Ejemplo n.º 2
0
        public override void invalidate()
        {
            if (!isVisible())
            {
                return;
            }

            if (getParent() != null)
            {
                ContainerUI pParentContainer = (ContainerUI)getParent().getInterface("Container");
                if (pParentContainer != null)
                {
                    Rectangle rc      = pParentContainer.getPos();
                    Rectangle rcInset = pParentContainer.getInset();

                    int newLeft   = rc.Left + rcInset.Left;
                    int newRight  = rc.Right - rcInset.Right;
                    int newTop    = rc.Top + rcInset.Top;
                    int newBottom = rc.Bottom - rcInset.Bottom;
                    rc.X      = newLeft;
                    rc.Width  = newRight - newLeft;
                    rc.Y      = newTop;
                    rc.Height = newBottom - newTop;

                    ScrollbarUI pVerticalScrollbar = pParentContainer.getVerticalScrollbar();
                    if (pVerticalScrollbar != null && pVerticalScrollbar.isVisible())
                    {
                        rc.Width = rc.Right - pVerticalScrollbar.getFixedWidth() - rc.Left;
                    }
                    ScrollbarUI pHorizontalScrollbar = pParentContainer.getHorizontalScrollbar();
                    if (pHorizontalScrollbar != null && pHorizontalScrollbar.isVisible())
                    {
                        rc.Height = rc.Bottom - pHorizontalScrollbar.getFixedHeight() - rc.Top;
                    }

                    Rectangle invalidateRc = mRectItem;
                    if (!invalidateRc.IntersectsWith(mRectItem))
                    {
                        return;
                    }
                    invalidateRc.Intersect(mRectItem);

                    ControlUI pParent = getParent();
                    Rectangle rcTemp;
                    Rectangle rcParent;
                    while ((pParent = pParent.getParent()) != null)
                    {
                        rcTemp   = invalidateRc;
                        rcParent = pParent.getPos();
                        if (!rcTemp.IntersectsWith(rcParent))
                        {
                            return;
                        }
                        invalidateRc.Intersect(rcParent);
                    }

                    if (mManager != null)
                    {
                        mManager.invalidate(ref invalidateRc);
                    }
                }
                else
                {
                    base.invalidate();
                }
            }
            else
            {
                base.invalidate();
            }
        }
Ejemplo n.º 3
0
        protected void setPos0(Rectangle rc)
        {
            if (rc.Right < rc.Left)
            {
                int left = rc.Left;
                rc.Width = 0;
                rc.X     = left;
            }
            if (rc.Bottom < rc.Top)
            {
                int top = rc.Top;
                rc.Height = 0;
                rc.Y      = top;
            }

            Rectangle invalidateRc = mRectItem;

            if (invalidateRc.IsEmpty)
            {
                invalidateRc = rc;
            }

            mRectItem = rc;
            if (mManager == null)
            {
                return;
            }
            ControlUI pParent = null;

            if (mFloat)
            {
                if (!mFloatSetPos)
                {
                    mFloatSetPos = true;
                    mManager.sendNotify(this, "setpos");
                    mFloatSetPos = false;
                }

                pParent = getParent();
                if (pParent != null)
                {
                    Rectangle rcParentPos = pParent.getPos();
                    if (mXY.Width >= 0)
                    {
                        mXY.Width = mRectItem.Left - rcParentPos.Left;
                    }
                    else
                    {
                        mXY.Width = mRectItem.Right - rcParentPos.Right;
                    }

                    if (mXY.Height >= 0)
                    {
                        mXY.Height = mRectItem.Top - rcParentPos.Top;
                    }
                    else
                    {
                        mXY.Height = mRectItem.Bottom - rcParentPos.Bottom;
                    }
                }
            }

            mUpdateNeeded = false;

            // NOTE: SetPos() is usually called during the WM_PAINT cycle where all controls are
            //       being laid out. Calling UpdateLayout() again would be wrong. Refreshing the
            //       window won't hurt (if we're already inside WM_PAINT we'll just validate it out).
            invalidateRc.Intersect(mRectItem);

            pParent = this;
            Rectangle rcTemp;
            Rectangle rcParent;

            while ((pParent = pParent.getParent()) != null)
            {
                rcTemp   = invalidateRc;
                rcParent = pParent.getPos();
                if (rcTemp.IntersectsWith(rcParent) == false)
                {
                    rcTemp.Intersect(rcParent);
                    invalidateRc.Intersect(rcTemp);
                }
                else
                {
                    return;
                }
            }
            mManager.invalidate(ref invalidateRc);
        }