summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.MacOS/Extensions/ButtonExtensions.cs
blob: 1bdc62ae0038741def148bcf66ff3ea085ef755b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using System;
using AppKit;

namespace Xamarin.Forms.Platform.MacOS
{
	internal static class ButtonExtensions
	{
		public static NSCellImagePosition ToNSCellImagePosition(this Button control)
		{
			switch (control.ContentLayout.Position)
			{
				case Button.ButtonContentLayout.ImagePosition.Left:
					return NSCellImagePosition.ImageLeft;
				case Button.ButtonContentLayout.ImagePosition.Top:
					return NSCellImagePosition.ImageAbove;
				case Button.ButtonContentLayout.ImagePosition.Right:
					return NSCellImagePosition.ImageRight;
				case Button.ButtonContentLayout.ImagePosition.Bottom:
					return NSCellImagePosition.ImageBelow;
				default:
					return NSCellImagePosition.ImageOnly;
			}
		}
	}
}