Beispiel #1
0
        //初始化布局参数(lua用)
        public void InitLayoutParam(LayoutDirection dir_,
                                    int divNum_,
                                    float itemSizeX_, float itemSizeY_,
                                    float itemGapX_, float itemGapY_,
                                    float originX_, float originY_,
                                    float pivotX_, float pivotY_,
                                    float paddingL_, float paddingT_, float paddingR_, float paddingB_)
        {
            if (itemSizeX_ <= 0 || itemSizeY_ <= 0)
            {
                itemSizeX_ = m_layoutParam.itemSize.x;
                itemSizeY_ = m_layoutParam.itemSize.y;
            }

            if (pivotX_ < 0 || pivotY_ < 0)
            {
                pivotX_ = m_layoutParam.pivot.x;
                pivotY_ = m_layoutParam.pivot.y;
            }


            m_layoutParam.Init(
                dir_,
                divNum_,
                itemSizeX_, itemSizeY_,
                itemGapX_, itemGapY_,
                originX_, originY_,
                pivotX_, pivotY_,
                paddingL_, paddingT_, paddingR_, paddingB_);
        }
Beispiel #2
0
        private static IHtmlContent RenderBootstrapFormCheckGroup <TModel, TResult>(this IHtmlHelper <TModel> helper,
                                                                                    Expression <Func <TModel, TResult> > expression,
                                                                                    FormCheckType formCheckType,
                                                                                    IEnumerable <SelectListItem> selectListItems,
                                                                                    LayoutDirection layoutDirection = LayoutDirection.Horizontal,
                                                                                    object?htmlAttributes           = null)
        {
            var result = new HtmlContentBuilder();

            foreach (var item in selectListItems)
            {
                var inputTag = new TagBuilder("input")
                {
                    TagRenderMode = TagRenderMode.SelfClosing
                };

                inputTag.Attributes.Add("id", "_" + Crypto.RandomString());
                inputTag.Attributes.Add("name", helper.NameFor(expression));
                inputTag.Attributes.Add("value", item.Value);
                inputTag.Attributes.Add("type", formCheckType == FormCheckType.Switch ? "checkbox" : formCheckType.ToLower());
                if (item.Selected)
                {
                    inputTag.Attributes.Add("checked", "checked");
                }
                inputTag.MergeAttributes(htmlAttributes);

                var additionalCssClass = (layoutDirection == LayoutDirection.Horizontal ? "form-check-inline custom-control-inline" : "");
                var formCheck          = BootstrapFormCheck(inputTag, formCheckType, item.Text, additionalCssClass);

                result.AppendHtml(formCheck);
            }
            return(result);
        }
Beispiel #3
0
 public LayoutBox(LayoutDirection direction, float spacing, float padding)
 {
     PadLeft        = PadRight = PadTop = PadBottom = padding;
     this.Direction = direction;
     this.Spacing   = spacing;
     this.Align     = LayoutAlign.Center;
 }
Beispiel #4
0
    static RectTransform PopulateLayout(RectTransform container, LayoutDirection dir, int count)
    {
        bool vertical = dir == LayoutDirection.Vertical;

        if (vertical)
        {
            container.gameObject.AddComponent <VerticalLayoutGroup>().SetChildControl();
        }
        else
        {
            container.gameObject.AddComponent <HorizontalLayoutGroup>().SetChildControl();
        }
        List <GameObject> cretedObjects = new List <GameObject>();

        for (int i = 0; i < count; i++)
        {
            RectTransform child = container.AddChild();
            Undo.RegisterCreatedObjectUndo(child, "layoutt");
            cretedObjects.Add(child.gameObject);
            child.anchorMin = new Vector2(0, 0);
            child.anchorMax = new Vector2(1, 1);
            child.offsetMin = new Vector2(0, 0);
            child.offsetMax = new Vector2(0, 0);
            Image im = child.gameObject.AddComponent <Image>();
            im.color   = im.color.Random();
            child.name = "Item " + (i + 1);
            LayoutElement le = child.gameObject.AddComponent <LayoutElement>();
            le.flexibleHeight = (vertical ? 1f / count : 1);
            le.flexibleWidth  = (vertical ? 1 : 1f / count);
            child.localScale  = Vector3.one; //why do we need this
        }
        container.name = (vertical ? "VerticalLayout" : "HorizontalLayout");
        return(container);
    }
        private static double GetSide(Drawing.Rectangle r, LayoutDirection direction)
        {
            switch (direction)
            {
            case (LayoutDirection.Up):
            {
                return(r.Top);
            }

            case (LayoutDirection.Down):
            {
                return(r.Bottom);
            }

            case (LayoutDirection.Left):
            {
                return(r.Left);
            }

            case (LayoutDirection.Right):
            {
                return(r.Right);
            }

            default:
            {
                throw new System.ArgumentOutOfRangeException();
            }
            }
        }
Beispiel #6
0
        protected override void OnLayout(bool changed, int left, int top, int right, int bottom)
        {
            base.OnLayout(changed, left, top, right, bottom);

            if (Element is Xamarin.Forms.ScrollView scrollView && (scrollView.Orientation == ScrollOrientation.Horizontal || scrollView.Orientation == ScrollOrientation.Both))
            {
                var horizontal = (HorizontalScrollView)GetChildAt(0);
                var container  = (ViewGroup)horizontal.GetChildAt(0);

                if (LayoutDirection == LayoutDirection.Rtl)
                {
                    if (container.ChildCount == 1)
                    {
                        var content      = (ViewGroup)container.GetChildAt(0);
                        var desiredWidth = content.Width;

                        container.Layout(0, 0, content.Width, content.Height);
                        content.Layout(0, 0, desiredWidth, content.Height);
                    }
                }

                if (LayoutDirection != currentDirection)
                {
                    currentDirection = LayoutDirection;

                    horizontal.ScrollX = LayoutDirection == LayoutDirection.Ltr
                        ? 0
                        : container.Right;
                }
            }
        }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="element">The element that caused the layout operation.</param>
 /// <param name="other">The list of other elements that were affected by the operation.</param>
 /// <param name="direction">The direction that the layout should be performed in.</param>
 /// <param name="value">The value that the elements will be affected by in the layout direction.</param>
 internal LayoutOperation(VisualElement element, IEnumerable<VisualElement> other, LayoutDirection direction, double value)
 {
     RootElement = element;
     Elements = new [] { element }.Union(other).ToList();
     Direction = direction;
     Value = value;
 }
        public static LayoutDirection GetOpposite(LayoutDirection direction)
        {
            switch (direction)
            {
            case (LayoutDirection.Up):
            {
                return(LayoutDirection.Down);
            }

            case (LayoutDirection.Down):
            {
                return(LayoutDirection.Up);
            }

            case (LayoutDirection.Left):
            {
                return(LayoutDirection.Right);
            }

            case (LayoutDirection.Right):
            {
                return(LayoutDirection.Left);
            }

            default:
            {
                throw new System.ArgumentOutOfRangeException();
            }
            }
        }
Beispiel #9
0
 private InternalTree.LayoutDirection map_direction2(LayoutDirection input_dir)
 {
     InternalTree.LayoutDirection dir;
     if (input_dir == LayoutDirection.Down)
     {
         dir = InternalTree.LayoutDirection.Down;
     }
     else if (input_dir == LayoutDirection.Up)
     {
         dir = InternalTree.LayoutDirection.Up;
     }
     else if (input_dir == LayoutDirection.Left)
     {
         dir = InternalTree.LayoutDirection.Left;
     }
     else if (input_dir == LayoutDirection.Right)
     {
         dir = InternalTree.LayoutDirection.Right;
     }
     else
     {
         dir = InternalTree.LayoutDirection.Down;
     }
     return(dir);
 }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Layout == LayoutDirection.Unknown)
     {
         this.Layout = LayoutDirection.Vertical;
     }
 }
        private static double _get_side(VisioAutomation.Geometry.Rectangle r, LayoutDirection direction)
        {
            switch (direction)
            {
            case (LayoutDirection.Up):
            {
                return(r.Top);
            }

            case (LayoutDirection.Down):
            {
                return(r.Bottom);
            }

            case (LayoutDirection.Left):
            {
                return(r.Left);
            }

            case (LayoutDirection.Right):
            {
                return(r.Right);
            }

            default:
            {
                throw new System.ArgumentOutOfRangeException();
            }
            }
        }
 public AGSStackLayoutComponent()
 {
     _isPaused        = true;
     OnLayoutChanged  = new AGSEvent();
     EntitiesToIgnore = new AGSConcurrentHashSet <string>();
     _direction       = LayoutDirection.Vertical;
     _relativeSpacing = -1f; //a simple vertical layout top to bottom by default.
 }
		public static TreeGraphNode Create(LayoutDirection direction, ObjectGraphNode objectNode)
		{
			switch (direction) {
					case LayoutDirection.TopBottom:	return new TreeNodeTB(objectNode);
					case LayoutDirection.LeftRight: return new TreeNodeLR(objectNode);
					default: throw new DebuggerVisualizerException("Unsupported layout direction: " + direction.ToString());
			}
		}
Beispiel #14
0
            void OnActionSheetRequested(Page sender, ActionSheetArguments arguments)
            {
                // Verify that the page making the request is part of this activity
                if (!PageIsInThisContext(sender))
                {
                    return;
                }

                var builder = new DialogBuilder(Activity);

                builder.SetTitle(arguments.Title);
                string[] items = arguments.Buttons.ToArray();
                builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which]));

                if (arguments.Cancel != null)
                {
                    builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel));
                }

                if (arguments.Destruction != null)
                {
                    builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction));
                }

                var dialog = builder.Create();

                builder.Dispose();
                //to match current functionality of renderer we set cancelable on outside
                //and return null
                if (arguments.FlowDirection == FlowDirection.MatchParent && sender is IVisualElementController ve)
                {
                    dialog.Window.DecorView.UpdateFlowDirection(ve);
                }
                else if (arguments.FlowDirection == FlowDirection.LeftToRight)
                {
                    dialog.Window.DecorView.LayoutDirection = LayoutDirection.Ltr;
                }
                else if (arguments.FlowDirection == FlowDirection.RightToLeft)
                {
                    dialog.Window.DecorView.LayoutDirection = LayoutDirection.Rtl;
                }

                dialog.SetCanceledOnTouchOutside(true);
                dialog.SetCancelEvent((o, e) => arguments.SetResult(null));
                dialog.Show();

                dialog.GetListView().TextDirection = GetTextDirection(sender, arguments.FlowDirection);
                LayoutDirection layoutDirection    = GetLayoutDirection(sender, arguments.FlowDirection);

                if (arguments.Cancel != null)
                {
                    ((dialog.GetButton((int)DialogButtonType.Positive).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection;
                }
                if (arguments.Destruction != null)
                {
                    ((dialog.GetButton((int)DialogButtonType.Negative).Parent) as global::Android.Views.View).LayoutDirection = layoutDirection;
                }
            }
Beispiel #15
0
 public Layout(Vector2 size, bool autoLayout, LayoutDirection autoLayoutDirection, LayoutStart autoLayoutStart, int spacing, string backgroundSprite = "")
 {
     Size                = size;
     AutoLayout          = autoLayout;
     AutoLayoutDirection = autoLayoutDirection;
     AutoLayoutStart     = autoLayoutStart;
     Spacing             = spacing;
     BackgroundSprite    = backgroundSprite;
 }
Beispiel #16
0
    IndexRange m_curContentRange = IndexRange.NullRange; //现有缓存条目的显示范围

    //methods
    /// <summary>
    /// 设置布局,缓冲数量等
    /// 注意:在ResetScroll前调用
    /// </summary>
    /// <param name="dir"></param>
    /// <param name="cachenum"></param>
    /// <param name="layout"></param>
    public void SetConfig(LayoutDirection dir = LayoutDirection.Vertical, int cachenum = 0, Layout layout = new Layout())
    {
        if (m_isValid)
        {
            return;
        }
        m_layoutDirection = dir;
        m_layout          = layout;
        m_cacheNum        = cachenum;
    }
 public void StartLayout(RectangleF bounds, LayoutDirection layoutDirection, LayoutDirection flowDirection)
 {
     _maxSize      = 0;
     _views        = new List <IViewLayoutBox>();
     _viewBounds   = bounds;
     _layoutToView = LayoutTransform(_viewBounds, layoutDirection, flowDirection);
     _viewToLayout = _layoutToView.Inverted();
     _layoutBounds = _viewToLayout.Transform(bounds);
     _layoutOrigin = _layoutBounds.Location;
 }
    public SimpleBuilder Group(int margin = 0, Vector2?minSize = null, Alignment align = Alignment.None)
    {
        AssertState();
        LayoutDirection dir = Layout.Direction == LayoutDirection.Vertical ? LayoutDirection.Horizontal : LayoutDirection.Vertical;

        LayoutNode child = new(dir, null, margin, minSize, alignment : align);

        Nodes.Add(child);
        return(new SimpleBuilder(this, child));
    }
Beispiel #19
0
 public void AddLogEntry(LayoutDirection direction, int frameId, LayoutReason reason, string description = null)
 {
     log.Add(new LayoutHistoryEntry()
     {
         direction   = direction,
         frameId     = frameId,
         reason      = reason,
         description = description
     });
 }
Beispiel #20
0
 public LayoutHelper(LayoutDirection direction)
 {
     _direction = direction;
     if (_direction == LayoutDirection.Vertical)
         GUILayout.BeginVertical();
     else
     {
         GUILayout.BeginHorizontal();
     }
 }
Beispiel #21
0
        private int _inUpdate; //For preventing re-entrancy

        public AGSStackLayoutComponent(IGameEvents gameEvents)
        {
            _gameEvents      = gameEvents;
            _isPaused        = true;
            _isDirty         = true;
            OnLayoutChanged  = new AGSEvent();
            EntitiesToIgnore = new AGSConcurrentHashSet <string>();
            _direction       = LayoutDirection.Vertical;
            _relativeSpacing = -1f; //a simple vertical layout top to bottom by default.
            gameEvents.OnRepeatedlyExecute.Subscribe(onRepeatedlyExecute);
        }
Beispiel #22
0
        public static TreeGraphNode Create(LayoutDirection direction, ObjectGraphNode objectNode)
        {
            switch (direction)
            {
            case LayoutDirection.TopBottom: return(new TreeNodeTB(objectNode));

            case LayoutDirection.LeftRight: return(new TreeNodeLR(objectNode));

            default: throw new DebuggerVisualizerException("Unsupported layout direction: " + direction.ToString());
            }
        }
Beispiel #23
0
 /// <summary>
 /// Determine if the size of the command is fixed in provided direction.
 /// </summary>
 /// <param name="dir">Direction to be tested.</param>
 /// <returns>true if fixed in requested direction; otherwise false</returns>
 public bool FixedByDirection(LayoutDirection dir)
 {
     if (dir == LayoutDirection.Vertical)
     {
         return(_fixedVert);
     }
     else
     {
         return(_fixedHorz);
     }
 }
Beispiel #24
0
 /// <summary>
 /// Gets a value indicating if command is visible in given direction.
 /// </summary>
 /// <param name="direction"></param>
 /// <returns></returns>
 public bool IsDirectionVisible(LayoutDirection direction)
 {
     // Must be visible and allowed to show in given direction
     if (direction == LayoutDirection.Horizontal)
     {
         return(Visible && ShowHorz);
     }
     else
     {
         return(Visible && ShowVert);
     }
 }
Beispiel #25
0
        public bool RanLayoutInFrame(LayoutDirection direction, int frameId)
        {
            for (int i = 0; i < log.size; i++)
            {
                if (log.array[i].frameId == frameId && log.array[i].direction == direction)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #26
0
 public static void SetAutoLayout(
     this UIPanel c,
     LayoutDirection direction,
     RectOffset padding = null,
     LayoutStart start  = LayoutStart.TopLeft
     )
 {
     c.autoLayout          = true;
     c.autoLayoutDirection = direction;
     c.autoLayoutStart     = start;
     c.autoLayoutPadding   = padding ?? Helper.ZeroOffset;
 }
        /*
         * Calculates transform matrix from layout coordinate system to view coordinate system.
         */
        private static Matrix2d LayoutTransform(RectangleF bounds, LayoutDirection layoutDirection, LayoutDirection flowDirection)
        {
            switch (layoutDirection)
            {
            case LayoutDirection.LeftRight:
                switch (flowDirection)
                {
                case LayoutDirection.TopBottom:
                    return(new Matrix2d());

                case LayoutDirection.BottomTop:
                    return(Matrix2d.Translation(0, bounds.Height) * Matrix2d.Stretch(1, -1));
                }
                break;

            case LayoutDirection.RightLeft:
                switch (flowDirection)
                {
                case LayoutDirection.TopBottom:
                    return(Matrix2d.Translation(bounds.Width, 0) * Matrix2d.Stretch(-1, 1));

                case LayoutDirection.BottomTop:
                    return(Matrix2d.Translation(bounds.Width, bounds.Height) * Matrix2d.Stretch(-1, -1));
                }
                break;

            case LayoutDirection.TopBottom:
                switch (flowDirection)
                {
                case LayoutDirection.LeftRight:
                    return(Matrix2d.Rotation(90) * Matrix2d.Stretch(1, -1));

                case LayoutDirection.RightLeft:
                    return(Matrix2d.Translation(bounds.Width, 0) * Matrix2d.Rotation(90));
                }
                break;

            case LayoutDirection.BottomTop:
                switch (flowDirection)
                {
                case LayoutDirection.LeftRight:
                    return(Matrix2d.Translation(0, bounds.Height) * Matrix2d.Rotation(-90));

                case LayoutDirection.RightLeft:
                    return(Matrix2d.Translation(bounds.Width, bounds.Height) * Matrix2d.Stretch(-1, 1) * Matrix2d.Rotation(-90));
                }
                break;
            }
            var message = $"Layout direction {layoutDirection} is not compatible with flow direction {flowDirection}";

            throw new ArgumentException(message);
        }
 internal ChartViewManager(StripChartX parentChart, Chart plotChart, PlotManager plotManager)
 {
     this._parentChart = parentChart;
     this._plotChart   = plotChart;
     this._plotManager = plotManager;
     this.MainPlotArea = new StripChartXPlotArea(parentChart, plotChart.ChartAreas[0]);
     this.MainPlotArea.ChartArea.Position.Auto = true;
     this._layoutDirection  = LayoutDirection.LeftToRight;
     this._oneWayChartNum   = 3;
     this.UseMainAreaConfig = true;
     this.SplitPlotAreas    = new StripChartXPlotAreaCollection(parentChart, plotChart.ChartAreas);
     AdaptView();
 }
Beispiel #29
0
 public LayoutGroupSpec(
     LayoutDirection layoutDirection,
     Padding padding             = new Padding(),
     float spacing               = 0f,
     TextAnchor childAlignment   = TextAnchor.UpperLeft,
     ChildBehavior childBehavior = new ChildBehavior())
 {
     LayoutDirection = layoutDirection;
     Padding         = padding;
     Spacing         = spacing;
     ChildAlignment  = childAlignment;
     ChildBehavior   = childBehavior;
 }
Beispiel #30
0
    static RectTransform CreateHoritontalOrVertical(LayoutDirection dir, int count)
    {
        RectTransform target = null;

        if (Selection.activeGameObject != null && Selection.activeGameObject.GetComponent <RectTransform>() != null)
        {
            target = Selection.activeGameObject.GetComponent <RectTransform>();
            Undo.RecordObject(target, "adding layout 1");
            Undo.RecordObject(Selection.activeGameObject, "Adding layout");
            return(PopulateLayout(target.AddImageChild().GetComponent <RectTransform>(), dir, count));
        }
        else
        {
            Debug.LogError("Works on selected rect, please create or select a Panel ");
            return(null);
        }

        var canvas = CreateCanvasIfNotPresent();


        RectTransform container = canvas.GetComponent <RectTransform>();

        {
            Debug.Log("rect selection");
            container = Selection.activeGameObject.GetComponent <RectTransform>();

            var newObj = new GameObject("Layout", typeof(RectTransform), typeof(Image));
            Undo.RegisterCreatedObjectUndo(newObj, "Layout");

            newObj.transform.SetParent(container);
            container = newObj.GetComponent <RectTransform>();
            Selection.activeObject = container;
            //            container=container.gameObject.AddChildRectTransform();
        }

        if (container == null)
        {
            Debug.Log("no container");
            var newCont = new GameObject("RectContainer", typeof(RectTransform), typeof(Image));
            Undo.RegisterCreatedObjectUndo(newCont, "Layout");
            container = newCont.GetComponent <RectTransform>();
        }

        Image a = container.GetComponent <Image>();

        if (a != null)
        {
            a.enabled = false;
        }
    }
Beispiel #31
0
 public static IScrollViewLayout GridLayout(int gridSize = 0, LayoutDirection direction = LayoutDirection.Vertical,
                                            float margin = 5, float subMargin           = 5, float topShift = 0, float bottomShift = 0, Vector2 forceSize = default)
 {
     return(new GridLayout(new GridLayoutSettings
     {
         direction = direction,
         forceSize = forceSize,
         marginVec = new Vector2(direction == LayoutDirection.Horizontal ? margin : subMargin, direction == LayoutDirection.Horizontal ? subMargin : margin),
         subMargin = subMargin,
         gridSize = gridSize,
         topShift = topShift,
         bottomShift = bottomShift,
     }));
 }
Beispiel #32
0
        public static IHtmlContent RadioButtonListFor <TModel, TResult>(this IHtmlHelper <TModel> helper,
                                                                        Expression <Func <TModel, TResult> > expression,
                                                                        Type enumType,
                                                                        LayoutDirection layoutDirection = LayoutDirection.Horizontal,
                                                                        object?htmlAttributes           = null)
        {
            if (enumType == null)
            {
                throw new ArgumentNullException(nameof(enumType));
            }
            var selectListItems = EnumHelper.ToSelectListItems(enumType);

            return(helper.RadioButtonListFor(expression, selectListItems, layoutDirection, htmlAttributes));
        }
Beispiel #33
0
		/// <summary>
		/// Calculates layout for given <see cref="ObjectGraph" />.
		/// </summary>
		/// <param name="objectGraph"></param>
		/// <returns></returns>
		public PositionedGraph CalculateLayout(ObjectGraph objectGraph, LayoutDirection direction, Expanded expanded)
		{
			layoutDirection = direction;

			treeNodeFor = new Dictionary<ObjectGraphNode, PositionedGraphNode>();
			seenNodes = new HashSet<PositionedGraphNode>();
			
			//TreeGraphNode tree = buildTreeRecursive(objectGraph.Root, expandedNodes);
			
			// convert ObjectGraph to PositionedGraph with TreeEdges
			var resultGraph = buildTreeGraph(objectGraph, expanded);
			// first layout pass
			calculateSubtreeSizes((TreeGraphNode)resultGraph.Root);
			// second layout pass
			calculateNodePosRecursive((TreeGraphNode)resultGraph.Root, 0, 0);
			
			//var neatoRouter = new NeatoEdgeRouter();
			//resultGraph = neatoRouter.CalculateEdges(resultGraph);
			resultGraph = new GraphEdgeRouter().RouteEdges(resultGraph);
			
			return resultGraph;
		}
 /// <summary>
 /// Initializes a new instance of a class
 /// </summary>
 public SliderControl()
 {
     Direction = LayoutDirection.Horizontal;
 }
Beispiel #35
0
		public TreeLayout(LayoutDirection layoutDirection)
		{
			this.LayoutDirection = layoutDirection;
		}
 /// <summary>
 /// Initializes a new instance of a class
 /// </summary>
 public LayoutControl()
 {
     Direction = LayoutDirection.Vertical;
 }
Beispiel #37
0
        /// <summary>
        /// Apply the layout operation to the given element.
        /// </summary>
        /// <param name="element">The element to apply the translation to.</param>
        /// <param name="length">The speed of the animation.</param>
        /// <param name="direction">The direction in which to perform the operation.</param>
        /// <param name="value">The amount to which to apply the translation.</param>
        /// <returns>A task which asynchronously performs the operation.</returns>
        static Task TranslateAsync(VisualElement element, uint length, LayoutDirection direction, double value)
        {
            if (Math.Abs(value) < Double.Epsilon)
            {
                return Task.FromResult(0);
            }

            var operation = LayoutOperation.Push(new LayoutOperation(element, CalculateAffectedElements(element), direction, value));

            return LayoutOperation.TranslateAsync(operation.Elements, length);
        }
 public LayoutOptions()
 {
     this.ResizeBorderWidth = new VA.Drawing.Size(0.5, 0.5);
     this.DefaultShapeSize = new VA.Drawing.Size(1.0, 0.75);
     this.LayoutDirection = LayoutDirection.TopToBottom;
 }        
Beispiel #39
0
		public MDBox (LayoutDirection direction, float spacing, float padding) : this (null, direction, spacing, padding)
		{
		}
Beispiel #40
0
		public MDBox (NSView unownedView, LayoutDirection direction, float spacing, float padding) : base (direction, spacing, padding)
		{
			View = unownedView ?? new NSView ();
			ownsView = unownedView == null;
		}
Beispiel #41
0
        // /////////////////////////////////////////////////////////////////////////////////
        // /////////////////////////////////////////////////////////////////////////////////
        /// <summary>
        /// Layout helper - Aligns this control to the specified direction of the spcecified
        /// control template.  This provides a means to specify control positions relative to
        /// previously created templates.
        /// </summary>
        /// <param name="toDirection"></param>
        /// <param name="ofControl"></param>
        /// <param name="padding"></param>
        public void AlignTo(LayoutDirection toDirection, ControlTemplate ofControl,int padding = 0)
        {
            switch (toDirection)
            {
                case LayoutDirection.North:
                    AlignNorth(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.NorthEast:
                    AlignNorthEast(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.East:
                    AlignEast(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.SouthEast:
                    AlignSouthEast(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.South:
                    AlignSouth(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.SouthWest:
                    AlignSouthWest(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.West:
                    AlignWest(ofControl.CalculateRect(), padding);
                    break;

                case LayoutDirection.NorthWest:
                    AlignNorthWest(ofControl.CalculateRect(), padding);
                    break;
            }
        }
 private InternalTree.LayoutDirection map_direction2(LayoutDirection input_dir)
 {
     InternalTree.LayoutDirection dir;
     if (input_dir == LayoutDirection.Down)
     {
         dir = InternalTree.LayoutDirection.Down;
     }
     else if (input_dir == LayoutDirection.Up)
     {
         dir = InternalTree.LayoutDirection.Up;
     }
     else if (input_dir == LayoutDirection.Left)
     {
         dir = InternalTree.LayoutDirection.Left;
     }
     else if (input_dir == LayoutDirection.Right)
     {
         dir = InternalTree.LayoutDirection.Right;
     }
     else
     {
         dir = InternalTree.LayoutDirection.Down;
     }
     return dir;
 }