private void SetupVersionTextField()
 {
     VersionTextField.StringValue = String.AppBuildVersion;
     VersionTextField.Font = Font.VersionTextField;
     VersionTextField.Alignment = NSTextAlignment.Center;
     VersionTextField.TextColor = NSColor.FromWhite((nfloat)0.8, 1);
 }
Esempio n. 2
0
        public override void DrawRect(CGRect dirtyRect)
        {
            if (Selected)
            {
                NSColor.White.SetFill();
                NSBezierPath.FillRect(dirtyRect);
            }
            else if (!darkTheme)
            {
                NSColor.FromRgb(245, 245, 245).Set();
                NSBezierPath.FillRect(dirtyRect);
            }

            if (!darkTheme)
            {
                NSColor.FromRgb(233, 233, 233).Set();
                NSBezierPath.FillRect(new CGRect(dirtyRect.X, 0, dirtyRect.Width, 1));
                NSBezierPath.FillRect(new CGRect(dirtyRect.Right - 1, 0, 1, dirtyRect.Height));
            }
            else if (!Selected)
            {
                NSColor.FromWhite(1.0f, 0.21f).Set();
                NSBezierPath.FillRect(new CGRect(dirtyRect.Right - 1, 0, 1, dirtyRect.Height));
            }
        }
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            SplitView.IsVertical   = true;
            SplitView.DividerStyle = NSSplitViewDividerStyle.Thin;
            SplitView.SetValueForKey(NSColor.FromWhite((nfloat)0.15, (nfloat)0.9), KeyPath.NSSplitView.DividerColor.NSString());
        }
 public Material(Vector4 color, double roughness, double metalness)
 {
     SCNMaterial = SCNMaterial.Create();
     SCNMaterial.LightingModelName      = SCNLightingModel.PhysicallyBased;
     SCNMaterial.Diffuse.ContentColor   = NSColor.FromRgba(color.X, color.Y, color.Z, color.W);
     SCNMaterial.Roughness.ContentColor = NSColor.FromWhite((float)roughness, 1);
     SCNMaterial.Metalness.ContentColor = NSColor.FromWhite((float)metalness, 1);
 }
 public LaunchWindowController() : base()
 {
     base.Window = new LaunchWindow(CGRect.Empty, Borderless | Closable | Miniaturizable | Titled, Buffered, false)
     {
         BackgroundColor       = NSColor.FromWhite((nfloat)0.125, (nfloat)0.98),
         ContentViewController = (NSViewController)Balsamic.Storyboard.Welcome.InstantiateInitialController(),
     };
 }
Esempio n. 6
0
        void Initialize()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            WantsLayer = true;

            shadow = new NSShadow();

            shadow.ShadowOffset     = new CGSize(0, -2);
            shadow.ShadowBlurRadius = 3;
            shadow.ShadowColor      = NSColor.FromWhite(0, 0.55f);
        }
Esempio n. 7
0
        public virtual void DrawTemplateImage(GraphicsHandler graphics, RectangleF source, RectangleF destination)
        {
            var imageSize = Size;
            // draw as a template image, and ignore color data
            var ctx = graphics.Control;

            ctx.SaveState();

            RectangleF destMask;

            if (destination.Size != source.Size)
            {
                // scale and position
                var scale = destination.Size / source.Size;
                destMask = new RectangleF(destination.Location - source.Location * scale, imageSize * scale);
            }
            else
            {
                // just position
                destMask = new RectangleF(destination.Location - source.Location, imageSize);
            }

            var destRect = destination.ToNS();
            var cgImage  = GetImage().AsCGImage(ref destRect, graphics.GraphicsContext, null);

            // clip to the image as a mask, using only alpha channel
            ctx.ClipToMask(destMask.ToNS(), cgImage);

            // set fill color based on current dark/light theme
            // this is the best approximation I can find to get it to draw the same as NSImageView
            // thus far..
            NSColor color;

            if (MacVersion.IsAtLeast(10, 14) && graphics.DisplayView.HasDarkTheme())
            {
                color = NSColor.FromWhite(1f, .55f);
            }
            else
            {
                color = NSColor.FromWhite(0, .5f);
            }
            color.SetFill();

            ctx.FillRect(destRect);
            ctx.RestoreState();
        }
Esempio n. 8
0
        internal static NSImage CreateSwatch(CGSize size, NSColor stroke = null, NSColor fill = null)
        {
            var image = new NSImage(size);

            image.LockFocus();
            var context = NSGraphicsContext.CurrentContext.CGContext;

            var rect = new CGRect(CGPoint.Empty, size);

            (fill ?? NSColor.FromWhite(1.0f, 0.9f)).SetFill();
            context.FillRect(rect);

            (stroke ?? NSColor.FromWhite(0.2f, 1.0f)).SetStroke();
            context.StrokeRectWithWidth(rect, 4.0f);

            image.UnlockFocus();
            return(image);
        }
Esempio n. 9
0
        public override void UpdateLayer()
        {
            Layer.BackgroundColor = NSColor.FromRgb(245, 245, 245).CGColor;

            if (arrowLayers != null)
            {
                arrowLayers.ForEach(layer => layer.RemoveFromSuperLayer());
            }

            arrowLayers = new List <CAShapeLayer> ();

            nfloat lastX    = 8;
            var    lastItem = items [items.Count - 1];

            foreach (var item in items)
            {
                item.Layer.Position = new CGPoint(lastX, Bounds.GetMidY() - 1);
                lastX += item.Layer.Frame.Width + 20;

                if (item.Equals(lastItem))
                {
                    continue;
                }

                var arrow = new CAShapeLayer();
                var path  = new NSBezierPath();
                path.MoveTo(new CGPoint(item.Layer.Frame.Right + 5, Bounds.Height));
                path.LineTo(new CGPoint(item.Layer.Frame.Right + 15, Bounds.GetMidY()));
                path.LineTo(new CGPoint(item.Layer.Frame.Right + 5, 0));

                arrow.ContentsScale = NSScreen.MainScreen.BackingScaleFactor;
                arrow.Path          = path.ToCGPath(false);
                arrow.FillColor     = null;
                arrow.StrokeColor   = NSColor.FromWhite(0.85f, 1.0f).CGColor;

                arrowLayers.Add(arrow);
                Layer.AddSublayer(arrow);
            }
        }
Esempio n. 10
0
            public TableViewController()
            {
                var rect = new CGRect(0, 0, 320, 480);

                TableView = new NSTableView(rect)
                {
                    RowHeight  = 44,
                    HeaderView = null,
                    //AllowsColumnResizing = false,
                    AllowsColumnReordering = false,
                    AllowsColumnSelection  = false,
                    AllowsEmptySelection   = true,
                    BackgroundColor        = NSColor.FromWhite((nfloat)(247.0 / 255.0), 1),
                };
                TableView.AddColumn(new NSTableColumn("col0")
                {
                    Width = rect.Width,
                });
                var scroll = new NSScrollView(rect);

                scroll.DocumentView        = TableView;
                scroll.HasVerticalScroller = true;
                View = scroll;
            }