예제 #1
0
        protected internal override void SetContentOrientation(PageViewContentOrientation orientation, bool recursive)
        {
            this.currentSize = SizeF.Empty;
            this.buttonsPanel.SetContentOrientation(orientation, false);

            base.SetContentOrientation(orientation, recursive);
        }
예제 #2
0
 public virtual void Update()
 {
   this.sizeMode = (PageViewItemSizeMode) this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty);
   this.contentOrientation = (PageViewContentOrientation) this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty);
   this.itemSpacing = (int) this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty);
   this.vertical = this.GetIsVertical();
   this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width;
   this.paddingLength = this.vertical ? (float) this.itemLayout.Padding.Vertical : (float) this.itemLayout.Padding.Horizontal;
   Padding borderThickness = LightVisualElement.GetBorderThickness(this.itemLayout, true);
   this.borderLength = this.vertical ? (float) borderThickness.Vertical : (float) borderThickness.Horizontal;
   int num = 0;
   foreach (RadElement child in this.itemLayout.Children)
   {
     RadPageViewItem radPageViewItem = child as RadPageViewItem;
     if (radPageViewItem != null && radPageViewItem.Visibility != ElementVisibility.Collapsed)
     {
       radPageViewItem.Measure(this.GetMeasureSizeConstraint((RadItem) radPageViewItem));
       PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(radPageViewItem);
       itemSizeInfo.desiredSize = new SizeF(radPageViewItem.DesiredSize.Width, radPageViewItem.DesiredSize.Height);
       this.maxWidth = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth);
       this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight);
       this.items.Add(itemSizeInfo);
       itemSizeInfo.itemIndex = num++;
     }
   }
   this.itemCount = this.items.Count;
 }
예제 #3
0
        protected virtual void CalculateRotationAndOffset(
            PageViewContentOrientation orientation,
            ref float angle,
            ref float offsetX,
            ref float offsetY)
        {
            switch (orientation)
            {
            case PageViewContentOrientation.Horizontal180:
                angle   = 180f;
                offsetX = (float)(this.Bounds.Right - 1);
                offsetY = (float)(this.Bounds.Bottom - 1);
                break;

            case PageViewContentOrientation.Vertical90:
                angle   = 90f;
                offsetX = (float)(this.Bounds.Right - 1);
                offsetY = (float)this.Bounds.Y;
                break;

            case PageViewContentOrientation.Vertical270:
                angle   = 270f;
                offsetX = (float)this.Bounds.X;
                offsetY = (float)(this.Bounds.Bottom - 1);
                break;
            }
        }
예제 #4
0
        protected object ApplyOrientationTransform(IGraphics graphics, PageViewContentOrientation orientation)
        {
            if (orientation == PageViewContentOrientation.Auto ||
                orientation == PageViewContentOrientation.Horizontal)
            {
                return(null);
            }

            RectangleF bounds = this.Bounds;
            object     state  = graphics.SaveState();

            //the enginner constant 1 is used to fix floating-point error when transforming the device
            switch (orientation)
            {
            case PageViewContentOrientation.Vertical270:
                graphics.TranslateTransform(bounds.X, bounds.Bottom - 1);
                graphics.RotateTransform(270);
                break;

            case PageViewContentOrientation.Vertical90:
                graphics.TranslateTransform(bounds.Right - 1, bounds.Y);
                graphics.RotateTransform(90);
                break;

            case PageViewContentOrientation.Horizontal180:
                graphics.TranslateTransform(bounds.Right - 1, bounds.Bottom - 1);
                graphics.RotateTransform(180);
                break;
            }

            return(state);
        }
예제 #5
0
 protected override void InitializeFields()
 {
     base.InitializeFields();
     this.CaptureOnMouseDown       = true;
     this.borderAndFillOrientation = PageViewContentOrientation.Horizontal;
     this.contentOrientation       = PageViewContentOrientation.Horizontal;
     this.ImageLayout          = ImageLayout.None;
     this.ClipDrawing          = true;
     this.BypassLayoutPolicies = true;
 }
예제 #6
0
        protected virtual object ApplyOrientationTransform(
            IGraphics graphics,
            PageViewContentOrientation orientation)
        {
            if (orientation == PageViewContentOrientation.Auto || orientation == PageViewContentOrientation.Horizontal)
            {
                return((object)null);
            }
            object obj     = graphics.SaveState();
            float  angle   = 0.0f;
            float  offsetX = 0.0f;
            float  offsetY = 0.0f;

            this.CalculateRotationAndOffset(orientation, ref angle, ref offsetX, ref offsetY);
            graphics.TranslateTransform(offsetX, offsetY);
            graphics.RotateTransform(angle);
            return(obj);
        }
예제 #7
0
 protected internal virtual void SetBorderAndFillOrientation(
     PageViewContentOrientation orientation,
     bool recursive)
 {
     if (this.borderAndFillOrientation == orientation)
     {
         return;
     }
     this.borderAndFillOrientation = orientation;
     this.FillPrimitiveImpl.InvalidateFillCache(RadPageViewElement.ItemContentOrientationProperty);
     if (!recursive)
     {
         return;
     }
     foreach (RadElement child in this.Children)
     {
         (child as RadPageViewElementBase)?.SetBorderAndFillOrientation(orientation, recursive);
     }
 }
예제 #8
0
        public virtual void Update()
        {
            this.sizeMode           = (PageViewItemSizeMode)this.itemLayout.GetValue(RadPageViewElement.ItemSizeModeProperty);
            this.contentOrientation = (PageViewContentOrientation)this.itemLayout.GetValue(RadPageViewElement.ItemContentOrientationProperty);
            this.itemSpacing        = (int)this.itemLayout.GetValue(RadPageViewElement.ItemSpacingProperty);

            this.vertical        = this.GetIsVertical();
            this.availableLength = this.vertical ? this.availableSize.Height : this.availableSize.Width;
            this.paddingLength   = this.vertical ? this.itemLayout.Padding.Vertical : this.itemLayout.Padding.Horizontal;
            Padding border = this.itemLayout.GetBorderThickness(true);

            this.borderLength = this.vertical ? border.Vertical : border.Horizontal;
            int itemIndexCounter = 0;

            foreach (RadElement element in this.itemLayout.Children)
            {
                RadPageViewItem item = element as RadPageViewItem;
                if (item == null)
                {
                    continue;
                }

                if (item.Visibility == ElementVisibility.Collapsed)
                {
                    continue;
                }
                //TODO: Optimization - cache desired size per item and measure only when a layout property is changed
                item.Measure(this.GetMeasureSizeConstraint(item));

                PageViewItemSizeInfo itemSizeInfo = this.CreateItemSizeInfo(item);

                this.maxWidth  = Math.Max(itemSizeInfo.desiredSize.Width, this.maxWidth);
                this.maxHeight = Math.Max(itemSizeInfo.desiredSize.Height, this.maxHeight);

                this.items.Add(itemSizeInfo);

                itemSizeInfo.itemIndex = itemIndexCounter++;
            }

            this.itemCount = this.items.Count;
        }
        protected internal override void SetContentOrientation(
            PageViewContentOrientation orientation,
            bool recursive)
        {
            switch ((StripViewButtons)this.Tag)
            {
            case StripViewButtons.LeftScroll:
            case StripViewButtons.RightScroll:
                if (orientation == PageViewContentOrientation.Vertical270)
                {
                    orientation = PageViewContentOrientation.Vertical90;
                    break;
                }
                break;

            case StripViewButtons.Close:
                orientation = PageViewContentOrientation.Horizontal;
                break;
            }
            base.SetContentOrientation(orientation, recursive);
        }
예제 #10
0
        protected internal virtual void SetContentOrientation(PageViewContentOrientation orientation, bool recursive)
        {
            if (this.contentOrientation != orientation)
            {
                this.contentOrientation = orientation;
                this.FillPrimitiveImpl.InvalidateFillCache(RadPageViewElement.ItemContentOrientationProperty);
                this.InvalidateMeasure();
            }

            if (recursive)
            {
                foreach (RadElement child in this.Children)
                {
                    RadPageViewElementBase pageElement = child as RadPageViewElementBase;
                    if (pageElement != null)
                    {
                        pageElement.SetContentOrientation(orientation, recursive);
                    }
                }
            }
        }
예제 #11
0
        protected virtual void UpdateItemOrientation(IEnumerable items)
        {
            PageViewContentOrientation contentOrientation = this.ItemContentOrientation;

            if (contentOrientation == PageViewContentOrientation.Auto)
            {
                contentOrientation = this.GetAutomaticItemOrientation(true);
            }

            PageViewContentOrientation borderOrientation = this.ItemBorderAndFillOrientation;

            if (borderOrientation == PageViewContentOrientation.Auto)
            {
                borderOrientation = this.GetAutomaticItemOrientation(false);
            }

            foreach (RadPageViewItem item in items)
            {
                item.SetContentOrientation(contentOrientation, false);
                item.SetBorderAndFillOrientation(borderOrientation, false);
            }
        }
예제 #12
0
        protected internal override void SetContentOrientation(PageViewContentOrientation orientation, bool recursive)
        {
            StripViewButtons buttons = (StripViewButtons)this.Tag;

            switch (buttons)
            {
            //do not rotate scroll buttons by 270 degrees
            case StripViewButtons.LeftScroll:
            case StripViewButtons.RightScroll:
                if (orientation == PageViewContentOrientation.Vertical270)
                {
                    orientation = PageViewContentOrientation.Vertical90;
                }
                break;

            //do not rotate close button
            case StripViewButtons.Close:
                orientation = PageViewContentOrientation.Horizontal;
                break;
            }

            base.SetContentOrientation(orientation, recursive);
        }