コード例 #1
0
		protected override void ArrangeOverride (Size finalSize)
		{
			if (Child == null)
				return;
				
			Child.Arrange (new Rect (finalSize));
		}
コード例 #2
0
		protected override Size MeasureOverride (Size availableSize)
		{
			var width = X1.HasValue && X2.HasValue ? Math.Abs (X1.Value - X2.Value) : 0;
			var height = Y1.HasValue && Y2.HasValue ? Math.Abs (Y1.Value - Y2.Value) : 0;
			
			return new Size (width, height);
		}				
コード例 #3
0
		public void Resize (Size size)
		{			
			Width = size.Width;
			Height = size.Height;
			
			Resize ((int)Width, (int)Height);
		}
コード例 #4
0
ファイル: HBoxArea.cs プロジェクト: Octavio/moro.fkalc
			protected override void ArrangeOverride (Size finalSize)
			{
				if (!InternalChildren.Any (c => c.Visibility != Visibility.Collapsed))
					return;

				var x = 0d;
				var y = 0d;

				var baseLine = InternalChildren.Where (c => c.Visibility != Visibility.Collapsed)
					.Max (c => BaseLineCalculator.GetBaseLine (GetArea (c)) + c.Margin.Top);

				foreach (var child in InternalChildren.Where(c => c.Visibility != Visibility.Collapsed)) {	
					var width = child.DesiredSize.Width;
					var height = child.DesiredSize.Height;

					x += child.Margin.Left;	

					switch (child.VerticalAlignment) {
					
					case VerticalAlignment.Bottom:
						y = Height - height;
						break;					
					default:
						y = baseLine - BaseLineCalculator.GetBaseLine (GetArea (child));
						break;
					}

					child.Arrange (new Rect (new Point (x, y), new Size (width, height)));
				
					x += child.Width + child.Margin.Right;
				}
			}
コード例 #5
0
		protected override Size MeasureOverride (Size availableSize)
		{
			var size = base.MeasureOverride (availableSize);

			AdornerLayer.Measure (availableSize);

			return size;
		}
コード例 #6
0
		protected override Size MeasureOverride (Size availableSize)
		{
			foreach (var adorner in adorners) {
				adorner.Measure (availableSize);
			}

			return availableSize;
		}
コード例 #7
0
		protected override Size MeasureOverride (Size availableSize)
		{
			Content.Measure (availableSize);
			
			var margin = Content.GetProperty ("Margin") != null ? 
				(Thickness)Content.GetProperty ("Margin").Value : new Thickness (0);
			
			return new Size (Content.DesiredSize.Width + margin.Left + margin.Right, Content.DesiredSize.Height + margin.Bottom + margin.Top);
		}
コード例 #8
0
		protected override Size MeasureOverride (Size availableSize)
		{
			if (Child == null || Child.Visibility == Visibility.Collapsed)
				return new Size (0, 0);
			
			Child.Measure (availableSize);			
					
			return Child.DesiredSize;
		}
コード例 #9
0
		protected override Size MeasureOverride (Size availableSize)
		{
			if (Child == null)
				return new Size (0, 0);
			
			Child.Measure (availableSize);
			
			var width = Child.DesiredSize.Width + Padding.Left + Padding.Right + BorderThickness;
			var height = Child.DesiredSize.Height + Padding.Top + Padding.Bottom + BorderThickness;
			
			return new Size (width, height);
		}
コード例 #10
0
ファイル: HBoxArea.cs プロジェクト: Octavio/moro.fkalc
			protected override Size MeasureOverride (Size availableSize)
			{
				foreach (var child in InternalChildren.Where(c => c.Visibility != Visibility.Collapsed)) {
					child.Measure (availableSize);
				}
				
				var width = InternalChildren.Any () ? InternalChildren.Sum (c => c.DesiredSize.Width + c.Margin.Left + c.Margin.Right) : 0;
				var heightTop = InternalChildren.Any () ? InternalChildren.Max (c => BaseLineCalculator.GetBaseLine (GetArea (c)) + c.Margin.Top) : 0;			
				var heightBottom = InternalChildren.Any () ? InternalChildren.Max (c => c.DesiredSize.Height - BaseLineCalculator.GetBaseLine (GetArea (c)) + c.Margin.Bottom) : 0; 
						
				return new Size (width, heightTop + heightBottom);
			}
コード例 #11
0
		public Rect (double x, double y, double width, double height) : this()
		{
			X = x;
			Y = y;
			Width = width;
			Height = height;

			Size = new Size (Width, Height);

			TopLeft = new Point (x, y);
			TopRight = new Point (x + width, y);
			BottomLeft = new Point (x, y + height);
			BottomRight = new Point (x + width, y + height);
		}
コード例 #12
0
ファイル: ParenthesesArea.cs プロジェクト: Octavio/moro.fkalc
			protected void DrawArc (DrawingContext dc, Point start, Point end, Size size, SweepDirection sweepDirection)
			{
				var figure = new PathFigure ();
				figure.StartPoint = start;

				figure.Segments.Add (new ArcSegment () 
				{ 
					Point = end, Size = size, SweepDirection = sweepDirection
				}
				);
				
				var geometry = new PathGeometry ();
				geometry.Figures.Add (figure);

				dc.DrawGeometry (null, new Pen (Colors.Black, 2), geometry);
			}
コード例 #13
0
		protected void OnExposeEvent (object o, Gtk.ExposeEventArgs args)
		{
			using (var cr = Gdk.CairoHelper.Create(GdkWindow)) {				
			
				var width = 0;
				var height = 0;
			
				GetSize (out width, out height);
			
				var size = new Size (width, height);
			
				Owner.Measure (size);
				Owner.Arrange (new Rect (size));
				Owner.Render (new CairoContext (cr));
			}		
		}
コード例 #14
0
		protected override void ArrangeOverride (Size finalSize)
		{			
			var horizontalAligment = Content.GetProperty ("HorizontalAlignment") != null ?
				(HorizontalAlignment)Content.GetProperty ("HorizontalAlignment").Value : HorizontalAlignment.Stretch;
			
			var verticalAligment = Content.GetProperty ("VerticalAlignment") != null ?
				(VerticalAlignment)Content.GetProperty ("VerticalAlignment").Value : VerticalAlignment.Stretch;
			
			var margin = Content.GetProperty ("Margin") != null ? 
				(Thickness)Content.GetProperty ("Margin").Value : new Thickness (0);
			
			var x = margin.Left;
			var y = margin.Top;
			var width = Content.DesiredSize.Width;
			var height = Content.DesiredSize.Height;
			
			switch (horizontalAligment) {
			case HorizontalAlignment.Right:
				x = Width - width;
				break;
			case HorizontalAlignment.Center:
				x = (Width - width) / 2;
				break;
			case HorizontalAlignment.Stretch:
				width = finalSize.Width;
				break;			
			}			
			
			switch (verticalAligment) {
			case VerticalAlignment.Bottom:
				y = Height - height;
				break;
			case VerticalAlignment.Center:
				x = (Height - height) / 2;
				break;
			case VerticalAlignment.Stretch:
				height = finalSize.Height;
				break;		
			}
				
			Content.Arrange (new Rect (x, y, width - margin.Left - margin.Right, height - margin.Top - margin.Bottom));
		}
コード例 #15
0
		protected override void ArrangeOverride (Size finalSize)
		{
			foreach (var child in children.Where(c => c.Visibility != Visibility.Collapsed)) {				
				child.Arrange (new Rect (new Point (child.X, child.Y), child.DesiredSize));
			}
		}
コード例 #16
0
		protected sealed override Size MeasureCore (Size availableSize)
		{
			var size = MeasureOverride (availableSize);

			var height = HeightRequest ?? size.Height;
			var width = WidthRequest ?? size.Width;

			if (LayoutTransform != null) {
				savedSize = size;
				
				size = LayoutTransform.TransformBounds (new Rect (0, 0, width, height)).Size;
				height = size.Height;
				width = size.Width;
			}				
			
			return new Size (width, height);
		}
コード例 #17
0
		protected override void ArrangeOverride (Size finalSize)
		{
			if (Child == null)
				return;

			Child.Arrange (new Rect (Padding.Left + BorderThickness / 2, 
			                         Padding.Top + BorderThickness / 2,
			                         finalSize.Width - Padding.Left - Padding.Right - BorderThickness / 2, 
			                         finalSize.Height - Padding.Top - Padding.Bottom - BorderThickness / 2));
		}
コード例 #18
0
		protected virtual Size MeasureOverride (Size availableSize)
		{		
			return new Size (0, 0);
		}
コード例 #19
0
		protected virtual void ArrangeOverride (Size finalSize)
		{	
		}
コード例 #20
0
		protected override Size MeasureOverride (Size availableSize)
		{
			var child = GetVisualChild (0) as UIElement;
			
			if (child == null || child.Visibility == Visibility.Collapsed)
				return new Size (0, 0);
			
			child.Measure (availableSize);
			
			return child.DesiredSize;			
		}
コード例 #21
0
		protected override void ArrangeOverride (Size finalSize)
		{
			foreach (var adorner in adorners) {
				adorner.Arrange (new Rect (finalSize));
			}
		}
コード例 #22
0
		protected override void ArrangeOverride (Size finalSize)
		{
			var x = 0d;
			var y = 0d;
			
			foreach (var child in children.Where(c => c.Visibility != Visibility.Collapsed)) {	
				var width = child.DesiredSize.Width;
				var height = child.DesiredSize.Height;
				
				if (Orientation == Orientation.Vertical && child.HorizontalAlignment == HorizontalAlignment.Stretch) {
					width = finalSize.Width - child.Margin.Left - child.Margin.Right;
				}

				if (Orientation == Orientation.Horizontal && child.VerticalAlignment == VerticalAlignment.Stretch) {
					height = finalSize.Height - child.Margin.Top - child.Margin.Bottom;
				}

				if (Orientation == Orientation.Horizontal) {
					x += child.Margin.Left;	

					switch (child.VerticalAlignment) {
					case VerticalAlignment.Top:
						y = child.Margin.Top;
						break;
					case VerticalAlignment.Bottom:
						y = Height - child.Margin.Bottom - height;
						break;
					case VerticalAlignment.Center:
					default:
						y = (Height - height) / 2;
						break;
					}

				} else {
					y += child.Margin.Top;

					switch (child.HorizontalAlignment) {
					case HorizontalAlignment.Left:
						x = child.Margin.Left;
						break;
					case HorizontalAlignment.Right:
						x = Width - child.Margin.Right - width;
						break;
					case HorizontalAlignment.Center:
						x = (Width - width) / 2;
						break;
					}
				}

				child.Arrange (new Rect (new Point (x, y), new Size (width, height)));
				
				if (Orientation == Orientation.Horizontal)				
					x += child.Width + child.Margin.Right;
				else
					y += child.Height + child.Margin.Bottom;
			}
		}
コード例 #23
0
		protected override Size MeasureOverride (Size availableSize)
		{
			var collection = children.Where (c => c.Visibility != Visibility.Collapsed);

			if (!collection.Any ())
				return new Size ();

			foreach (var child in collection) {
				child.Measure (availableSize);
			}
			
			var width = 0d;
			var height = 0d;			
						
			if (Orientation == Orientation.Horizontal) {
				width = collection.Sum (c => c.DesiredSize.Width + c.Margin.Left + c.Margin.Right);

				height = collection.Where (c => c.DesiredSize.Height > 0).Max (c => c.DesiredSize.Height + c.Margin.Top + c.Margin.Bottom);
				height += collection.Any (c => c.DesiredSize.Height == 0) ? children.Where (c => c.DesiredSize.Height == 0).Max (c => c.Margin.Top + c.Margin.Bottom) : 0;
			} else {
				width = collection.Where (c => c.DesiredSize.Width > 0).Max (c => c.DesiredSize.Width + c.Margin.Left + c.Margin.Right);
				width += collection.Any (c => c.DesiredSize.Width == 0) ? children.Where (c => c.DesiredSize.Width == 0).Max (c => c.Margin.Left + c.Margin.Right) : 0;

				height = collection.Sum (c => c.DesiredSize.Height + c.Margin.Top + c.Margin.Bottom);			
			}
		
			return new Size (width, height);
		}
コード例 #24
0
		public void Measure (Size availableSize)
		{	
			DesiredSize = MeasureCore (availableSize);
		}
コード例 #25
0
		public void ShowSurface ()
		{		
			var size = new Size (Width, Height);

			Owner.Measure (size);
			Owner.Arrange (new Rect (Owner.DesiredSize));

			Resize (Owner.DesiredSize);
			Show ();
		}
コード例 #26
0
		protected override void ArrangeOverride (Size finalSize)
		{
			var child = GetVisualChild (0) as UIElement;
			
			if (child == null || child.Visibility == Visibility.Collapsed)
				return;
			
			child.Arrange (new Rect (finalSize));
		}
コード例 #27
0
		protected override void ArrangeOverride (Size finalSize)
		{
			base.ArrangeOverride (finalSize);

			AdornerLayer.Arrange (new Rect (finalSize));
		}
コード例 #28
0
		public Rect (Point location, Size size) : this (location.X, location.Y, size.Width, size.Height)
		{
		}
コード例 #29
0
		protected override Size MeasureOverride (Size availableSize)
		{
			var formatedText = new FormattedText (Text, FontFamily, FontSize, Foreground);

			return new Size (formatedText.Width, formatedText.Extent);
		}		
コード例 #30
0
		protected override Size MeasureOverride (Size availableSize)
		{
			foreach (var child in children.Where(c => c.Visibility != Visibility.Collapsed)) {
				child.Measure (availableSize);
			}			
			
			return new Size (0, 0);
		}