コード例 #1
0
        public PlayerView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            WantsLayer          = true;
            Layer.ZPosition     = 100;
            Layer.MasksToBounds = false;

            CoverImage       = new NSImageView();
            CoverImage.Image = NSImage.ImageNamed("EmptyCover");
            CoverImage.TranslatesAutoresizingMaskIntoConstraints = false;

            PlayerControls = new PlayerControlsView();
            SoundControl   = new SoundControlView();

            SongTitle             = NSLabel.CreateWithFont("SF UI Display Regular", 12);
            SongTitle.StringValue = "Artist - Song Title";
            SongTitle.Alignment   = NSTextAlignment.Center;
            SongTitle.TextColor   = NSColor.FromRgb(84, 84, 84);
            SongTitle.SetContentCompressionResistancePriority(500, NSLayoutConstraintOrientation.Horizontal);
            SongTitle.MaximumNumberOfLines = 2;
            SongTitle.LineBreakMode        = NSLineBreakMode.TruncatingTail;

            Progress = new PlayerProgressControl();

            AddSubview(Progress);
            AddSubview(CoverImage);
            AddSubview(PlayerControls);
            AddSubview(SongTitle);
            AddSubview(SoundControl);

            BuildConstraints();
        }