Example #1
0
        public static void LoadStyles()
        {
            if (IdeApp.Preferences.UserInterfaceTheme == Theme.Light)
            {
                HeaderBackgroundColor        = NSColor.FromRgb(0.98f, 0.98f, 0.98f);
                HeaderBorderBackgroundColor  = NSColor.FromRgb(0.96f, 0.96f, 0.96f);
                LabelSelectedForegroundColor = NSColor.Highlight;
                ToolbarBackgroundColor       = NSColor.White;
                CellBackgroundSelectedColor  = NSColor.FromRgb(0.36f, 0.54f, 0.90f);

                PropertyPad = new PropertyPadStyle {
                    Checkerboard0             = NSColor.FromRgb(255, 255, 255),
                    Checkerboard1             = NSColor.FromRgb(217, 217, 217),
                    PanelTabBackground        = NSColor.FromRgb(248, 247, 248),
                    TabBorderColor            = NSColor.FromRgba(0, 0, 0, 25),
                    ValueBlockBackgroundColor = NSColor.FromRgba(0, 0, 0, 20)
                };
            }
            else
            {
                CellBackgroundSelectedColor  = NSColor.FromRgb(0.38f, 0.55f, 0.91f);
                HeaderBackgroundColor        = NSColor.FromRgb(0.29f, 0.29f, 0.29f);
                HeaderBorderBackgroundColor  = NSColor.FromRgb(0.29f, 0.29f, 0.29f);
                LabelSelectedForegroundColor = NSColor.SelectedText;
                ToolbarBackgroundColor       = NSColor.FromRgb(0.25f, 0.25f, 0.25f);

                PropertyPad = new PropertyPadStyle {
                    Checkerboard0             = NSColor.FromRgb(38, 38, 38),
                    Checkerboard1             = NSColor.FromRgb(0, 0, 0),
                    PanelTabBackground        = NSColor.FromRgb(85, 85, 85),
                    TabBorderColor            = NSColor.FromRgba(255, 255, 255, 0),
                    ValueBlockBackgroundColor = NSColor.FromRgba(255, 255, 255, 25)
                };
            }
        }
Example #2
0
        private void ShowLoginErrorPopover(PopoverContentView contentView, NSView positioningView = null)
        {
            if (__LoginPopoverErrorInfo != null)
            {
                __LoginPopoverErrorInfo.Close();
                __LoginPopoverErrorInfo = null;
            }

            // create and show popover
            __LoginPopoverErrorInfo = new NSPopover();

            NSViewController popoverControllerConnectionError = new NSViewController();

            contentView.BackgroundColor           = NSColor.FromRgb(251, 56, 65);
            popoverControllerConnectionError.View = contentView;

            __LoginPopoverErrorInfo.ContentViewController = popoverControllerConnectionError;
            __LoginPopoverErrorInfo.Behavior = NSPopoverBehavior.Transient;

            if (positioningView == null)
            {
                positioningView = GuiTextViewUser;
            }
            __LoginPopoverErrorInfo.Show(GuiTextViewUser.Bounds, positioningView, NSRectEdge.MinYEdge);
        }
Example #3
0
        //public override CoreGraphics.CGSize IntrinsicContentSize => new CGSize (150, 100);

        public PlaylistsView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            var scrollView = new NSScrollView();

            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            OutlineView                     = new NSOutlineView();
            OutlineView.HeaderView          = null;
            OutlineView.FloatsGroupRows     = false;
            OutlineView.BackgroundColor     = NSColor.FromRgb(245, 245, 245);
            OutlineView.IndentationPerLevel = 4;

            var outlineColumn = new NSTableColumn();

            outlineColumn.Editable = false;
            outlineColumn.MinWidth = 100;

            OutlineView.AddColumn(outlineColumn);
            OutlineView.OutlineTableColumn = outlineColumn;
            outlineColumn.Dispose();
            outlineColumn = null;

            scrollView.DocumentView = OutlineView;

            AddSubview(scrollView);

            AddConstraints(NSLayoutExtensions.FillHorizontal(scrollView, false));
            AddConstraints(NSLayoutExtensions.FillVertical(scrollView, false));
            AddConstraint(NSLayoutExtensions.MinimumWidth(this, 100));
        }
Example #4
0
        public WelcomeView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;

            redditIcon = new NSImageView();
            redditIcon.TranslatesAutoresizingMaskIntoConstraints = false;
            redditIcon.Image = NSImage.ImageNamed("RedditIconBig");

            applicationName             = NSLabel.CreateWithFont("SF UI Display Medium", 23);
            applicationName.TextColor   = NSColor.FromRgb(34, 34, 34);
            applicationName.StringValue = "Reddit Player";

            helperText             = NSLabel.CreateWithFont("SF UI Display Regular", 14);
            helperText.TextColor   = NSColor.FromRgb(170, 170, 170);
            helperText.StringValue = "Welcome to reddit player. You can start listening by selecting one of the featured genres from the sidebar or you can use search bar to find your favorite genre subreddit.";
            helperText.Alignment   = NSTextAlignment.Center;
            //helperText.UsesSingleLineMode = false;
            helperText.LineBreakMode = NSLineBreakMode.ByWordWrapping;

            AddSubview(redditIcon);
            AddSubview(applicationName);
            AddSubview(helperText);

            BuildDefaultContstraints();
        }
Example #5
0
        public void AddItem(string identifier, string title)
        {
            var layer = new CATextLayer();

            layer.String = title;
            layer.SetFont("SF UI Text Bold");
            layer.FontSize        = 12;
            layer.ForegroundColor = NSColor.FromRgb(80, 80, 80).CGColor;
            layer.ContentsScale   = NSScreen.MainScreen.BackingScaleFactor;

            var attrs = new NSStringAttributes();

            attrs.Font = NSFont.FromFontName("SF UI Text Bold", 12);

            var stringSize = NSStringDrawing.StringSize(layer.String, attrs);
            var frame      = new CGRect(new CGPoint(0, 0), stringSize);

            layer.Frame       = frame;
            layer.AnchorPoint = new CGPoint(0, 0.5f);

            items.Add(new BreadcrumbViewItem {
                Identifier = identifier,
                Title      = title,
                Layer      = layer
            });

            Layer.AddSublayer(layer);

            NeedsDisplay = true;
        }
Example #6
0
        public SearchBarView()
        {
            TranslatesAutoresizingMaskIntoConstraints = false;
            WantsLayer            = true;
            Layer.BackgroundColor = NSColor.White.CGColor;

            searchIcon       = new NSImageView();
            searchIcon.Image = NSImage.ImageNamed("Search");
            searchIcon.TranslatesAutoresizingMaskIntoConstraints = false;

            SearchField = new NSTextField();
            SearchField.DrawsBackground = false;
            SearchField.FocusRingType   = NSFocusRingType.None;
            SearchField.Bordered        = false;
            SearchField.TranslatesAutoresizingMaskIntoConstraints = false;
            SearchField.Font              = NSFont.FromFontName("SF UI Display Regular", 14);
            SearchField.TextColor         = NSColor.FromRgb(100, 100, 100);
            SearchField.PlaceholderString = "Search music here...";

            ProgressIndicator = new NSProgressIndicator();
            ProgressIndicator.TranslatesAutoresizingMaskIntoConstraints = false;
            ProgressIndicator.Style = NSProgressIndicatorStyle.Spinning;
            //ProgressIndicator.Hidden = true;

            AddSubview(searchIcon);
            AddSubview(SearchField);
            AddSubview(ProgressIndicator);

            ProgressIndicator.StartAnimation(this);

            BuildConstraints();
        }
Example #7
0
        public NativeMacOsCell(NSString cellId)
        {
            Identifier            = cellId;
            WantsLayer            = true;
            Layer.BackgroundColor = NSColor.FromRgb(218, 255, 127).CGColor;

            _imageView = new NSImageView();

            _headingLabel = new NSTextField()
            {
                Font            = NSFont.FromFontName("Cochin-BoldItalic", 22f),
                TextColor       = NSColor.FromRgb(127, 51, 0),
                BackgroundColor = NSColor.Clear
            };

            _subheadingLabel = new NSTextField()
            {
                Font            = NSFont.FromFontName("AmericanTypewriter", 12f),
                TextColor       = NSColor.FromRgb(38, 127, 0),
                Alignment       = NSTextAlignment.Center,
                BackgroundColor = NSColor.Clear
            };

            AddSubview(_headingLabel);
            AddSubview(_subheadingLabel);
            AddSubview(_imageView);
        }
Example #8
0
        private void Initialize()
        {
            string title          = Title;
            string alternateTitle = AlternateTitle;

            AttributedTitle = new NSAttributedString(
                title,
                new NSStringAttributes
            {
                Font            = Font,
                ForegroundColor = NSColor.FromRgb(58, 135, 253),
                ParagraphStyle  = new NSMutableParagraphStyle {
                    Alignment = NSTextAlignment.Left
                }
            });
            Bordered = false;

            try
            {
                if (string.IsNullOrEmpty(alternateTitle))
                {
                    Url = new NSUrl(title);
                }
                else
                {
                    Url = new NSUrl(alternateTitle);
                }
            }
            catch
            {
                Url = null;
            }
        }
Example #9
0
        public override void DrawSelection(CoreGraphics.CGRect dirtyRect)
        {
            //base.DrawRect(dirtyRect);

            //        if (self.selectionHighlightStyle != NSTableViewSelectionHighlightStyleNone)
            //        {
            //            NSRect selectionRect = NSInsetRect(self.bounds, 2.5, 2.5);
            //    [[NSColor colorWithCalibratedWhite:.65 alpha:1.0] setStroke];
            //    [[NSColor redColor] setFill];
            //    NSBezierPath* selectionPath = [NSBezierPath bezierPathWithRoundedRect: selectionRect xRadius: 6 yRadius: 6];
            //    [selectionPath fill];
            //    [selectionPath stroke];
            //}

            if (this.SelectionHighlightStyle != NSTableViewSelectionHighlightStyle.None)
            {
                //NSColor.FromCalibratedWhite(0.65f, 1.0f).SetStroke();
                NSColor.FromRgb(51, 153, 255).SetStroke();
                NSColor.FromRgb(51, 153, 255).SetFill();
                //NSColor.White.SetStroke();
                var selectionPath = NSBezierPath.FromRoundedRect(dirtyRect, 0, 0);

                selectionPath.Fill();
                selectionPath.Stroke();
            }
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            __InitialLogoutAllBtnFrame = UIButtonLogOutAll.Frame;

            UpdateUI();

            UIButtonTryAgain.AttributedTitle = new NSAttributedString(
                LocalizedStrings.Instance.LocalizedString("Button_TryAgain", "Try again"),
                new NSStringAttributes
            {
                ForegroundColor = NSColor.FromRgb(23, 143, 230),
                Font            = UIUtils.GetSystemFontOfSize(14f),
                ParagraphStyle  = new NSMutableParagraphStyle {
                    Alignment = NSTextAlignment.Center
                }
            });

            // witching light\dark theme
            View.OnApperianceChanged += () =>
            {
                UpdateUI();
            };
        }
Example #11
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));
            }
        }
Example #12
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();
        }
Example #13
0
        public void SetItem(GenericOutlineItemWrapper item)
        {
            this.item = item;

            if (!item.IsCategory)
            {
                ImageView.Image     = NSImage.ImageNamed(item.Icon).Tint(NSColor.FromRgb(45, 45, 45));
                TextField.Font      = NSFont.FromFontName("SF UI Display Regular", 14);
                TextField.TextColor = NSColor.FromRgb(45, 45, 45);
                AddSubview(ImageView);
            }
            else
            {
                ImageView.RemoveFromSuperview();
                TextField.Font      = NSFont.FromFontName("SF UI Display Medium", 13);
                TextField.TextColor = NSColor.FromRgb(135, 135, 135);
            }

            TextField.StringValue = item.Text;

            if (cachedIsCategory != item.IsCategory)
            {
                cachedIsCategory = item.IsCategory;
                RebuildConstraints();
            }
        }
Example #14
0
        public PlaylistDetailView()
        {
            TitleLabel            = NSLabel.CreateWithFont(TitleFontName, TitleFontSize);
            TitleLabel.Identifier = "TitleLabel";
            TitleLabel.TextColor  = NSColor.FromRgb(51, 51, 51);

            DescriptionLabel            = NSLabel.CreateWithFont(DescriptionFontName, DescriptionFontSize);
            DescriptionLabel.Identifier = "DescriptionLabel";
            DescriptionLabel.TextColor  = NSColor.FromRgb(142, 142, 142);

            SongsTable = new SongsListView();

            outerStack = new NSStackView();
            outerStack.TranslatesAutoresizingMaskIntoConstraints = false;
            outerStack.Orientation  = NSUserInterfaceLayoutOrientation.Vertical;
            outerStack.Distribution = NSStackViewDistribution.Fill;
            outerStack.Spacing      = 10;
            outerStack.EdgeInsets   = new NSEdgeInsets(20, 0, 0, 0);

            outerStack.AddArrangedSubview(TitleLabel);
            outerStack.AddArrangedSubview(DescriptionLabel);
            outerStack.AddArrangedSubview(SongsTable);

            AddSubview(outerStack);

            AddConstraint(MinimumHeight(SongsTable, 100));
            AddConstraints(FillHorizontal(true, TitleLabel, DescriptionLabel));
            AddConstraints(FillHorizontal(outerStack, false));
            AddConstraints(FillVertical(outerStack, false));
        }
Example #15
0
            public override NSView GetView(NSOutlineView outlineView, NSTableColumn tableColumn, NSObject item)
            {
                var oview = outlineView.MakeView(tableColumn.Identifier, this);
                var view  = oview as NSTableCellView;

                if (view == null)
                {
                    view = new NSTableCellView();
                }

                if (item == null)
                {
                    view.TextField.StringValue = "ROOT";
                }
                else if (item is MacFindResultGroupViewModel groupViewModel)
                {
                    var attributedBuffer = new NSMutableAttributedString(groupViewModel.FileName);
                    attributedBuffer.BeginEditing();
                    if (!string.IsNullOrEmpty(groupViewModel.RelativeFilePath))
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    $" {groupViewModel.RelativeFilePath}",
                                                    //font: slightly smaller
                                                    foregroundColor: NSColor.Gray));
                    }
                    attributedBuffer.EndEditing();
                    view.TextField.AttributedStringValue = attributedBuffer;
                }
                else if (item is MacFindResultViewModel resultViewModel)
                {
                    // TODO: Trim string, adjust offsets. Decide what to do if offsets are in leading/trailing space (probably don't trim at all?)

                    var attributedBuffer = new NSMutableAttributedString();
                    attributedBuffer.BeginEditing();

                    if (resultViewModel.StartColumn > 0)
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    resultViewModel.PreviewText.Substring(0, resultViewModel.StartColumn)));
                    }

                    attributedBuffer.Append(new NSAttributedString(
                                                resultViewModel.PreviewText.Substring(
                                                    resultViewModel.StartColumn,
                                                    resultViewModel.EndColumn - resultViewModel.StartColumn),
                                                backgroundColor: NSColor.FromRgb(240, 193, 163)));//240	193	163

                    if (resultViewModel.EndColumn < resultViewModel.PreviewText.Length)
                    {
                        attributedBuffer.Append(new NSAttributedString(
                                                    resultViewModel.PreviewText.Substring(resultViewModel.EndColumn)));
                    }

                    attributedBuffer.EndEditing();
                    view.TextField.AttributedStringValue = attributedBuffer;
                }

                return(view);
            }
Example #16
0
 static NSColor NormalizeColor(NSColor color)
 {
     return(NSColor.FromRgb(
                NormalizeColor(color.RedComponent),
                NormalizeColor(color.GreenComponent),
                NormalizeColor(color.BlueComponent)
                ));
 }
Example #17
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            //GuiConnectButtonView
            __ConnectButtonViewController = new ConnectButtonViewController();
            __ConnectButtonViewController.SetViewModel(__MainViewModel);
            InitializeSubView(__ConnectButtonViewController, GuiConnectButtonView);

            //Initialize servers view Single\MultiHop
            __ServerSelectionController = new ServerSelectionViewController();
            __ServerSelectionController.SetViewModel(__MainViewModel);
            __ServerSelectionController.OnEntryServerClick += __ServerSelectionController_OnEntryServerClick;
            __ServerSelectionController.OnExitServerClick  += __ServerSelectionController_OnExitServerClick;
            __ServerSelectionController.OnFrameChanged     += __ServerSelectionController_OnFrameChanged;
            InitializeSubView(__ServerSelectionController, GuiServerSelectionView);

            UpdateWindowSize();

            GuiFirewallSwitchControl.ValueChanged += GuiFirewallSwitchControl_ValueChanged;

            // AntiTracker switcher
            GuiAntiTrackerSwitchControl.ValueChanged += (object sender, EventArgs e) => { __MainViewModel.IsAntiTrackerEnabled = GuiAntiTrackerSwitchControl.Value; };
            Action updateAntiTrackerSwitcherColor = () =>
            {
                if (__MainViewModel.Settings.IsAntiTrackerHardcore)
                {
                    GuiAntiTrackerSwitchControl.SwitchOnBackgroundColor = NSColor.FromRgb(255, 0, 57);      // red
                }
                else
                {
                    GuiAntiTrackerSwitchControl.SwitchOnBackgroundColor = NSColor.FromRgb(61, 161, 235);    // blue
                }
                if (!NSThread.IsMain)
                {
                    InvokeOnMainThread(() => { GuiAntiTrackerSwitchControl.NeedsDisplay = true; });
                }
                else
                {
                    GuiAntiTrackerSwitchControl.NeedsDisplay = true;
                }
            };

            updateAntiTrackerSwitcherColor();
            __MainViewModel.Settings.PropertyChanged += (sender, e) =>
            {
                if (nameof(__MainViewModel.Settings.IsAntiTrackerHardcore).Equals(e.PropertyName))
                {
                    updateAntiTrackerSwitcherColor();
                }
            };

            // Update UI
            UpdateUI();
        }
Example #18
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            // Remover titulo de la ventana
            base.Window.Title = "";
            // Hacer transparente la barra de titulo de la ventana
            base.Window.TitlebarAppearsTransparent = true;

            // Define color de fondo de la ventana a 5A5C5C
            base.Window.BackgroundColor = NSColor.FromRgb(88 / 255f, 86 / 255f, 86 / 255f);
        }
        public static NSColor SetColorDarker(NSColor color)
        {
            if (color == null)
            {
                return(null);
            }

            if (Colors.IsDarkMode)
            {
                return(NSColor.FromRgb(color.RedComponent * 0.8f, color.GreenComponent * 0.8f, color.BlueComponent * 0.8f));
            }
            return(NSColor.FromRgb(color.RedComponent * 0.9f, color.GreenComponent * 0.9f, color.BlueComponent * 0.9f));
        }
Example #20
0
        private void Initialize()
        {
            CornerRadius    = 4;
            BorderLineWidth = 1;
            BorderColor     = NSColor.FromRgb(222, 238, 253);

            Cell       = new CustomTextFieldCell();
            Bordered   = true;
            Bezeled    = true;
            Enabled    = true;
            Editable   = true;
            Selectable = true;
        }
Example #21
0
        /// <summary>
        /// Applies the style grey button.
        /// </summary>
        public static void ApplyStyleGreyButton(CustomButton btn, string title)
        {
            NSColor ButtonBorderColor = NSColor.FromRgb(223, 223, 235);
            NSColor ButtonColor       = NSColor.FromRgb(250, 252, 255);
            NSColor ButtonTextColor   = NSColor.FromRgb(38, 57, 77);

            btn.BorderLineWidth      = 1f;
            btn.BorderColor          = ButtonBorderColor;
            btn.TitleFont            = UIUtils.GetSystemFontOfSize(14f, NSFontWeight.Semibold);
            btn.TitleText            = title;
            btn.BackgroundColor      = ButtonColor;
            btn.TitleForegroundColor = ButtonTextColor;
        }
Example #22
0
        /// <summary>
        /// Applies the style navigation button.
        /// </summary>
        public static void ApplyStyleNavigationButton(CustomButton button, string title, NSImage image = null)
        {
            if (button == null)
            {
                return;
            }

            SetBaseStyle(button, title, image);

            button.TitleForegroundColor = NSColor.FromRgb(122, 138, 153);
            button.CornerRadius         = 0;
            button.BorderColor          = NSColor.FromRgb(122, 138, 153);
            button.Gradient             = null;
        }
Example #23
0
        public override void WindowDidLoad()
        {
            base.WindowDidLoad();

            CGSize size = new CGSize();

            size.Width          = 869;
            size.Height         = 451;
            this.Window.MinSize = size;
            //this.Window.TitlebarAppearsTransparent = true;
            //this.Window.MovableByWindowBackground = true;
            this.Window.BackgroundColor = NSColor.FromRgb(45, 146, 255);
            // this.Window.BackgroundColor = NSColor.FromRgb(78, 47, 161);
        }
Example #24
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Do any additional setup after loading the view.

            for (int i = 0; i < 10; i++)
            {
                var v = new SquareView();
                v.Frame   = new CoreGraphics.CGRect(0, 0, 20, 20);
                v.Color   = NSColor.FromRgb((256.0f / i) / 256.0f, 0, 0);
                v.AltText = $"Square {i}";

                container.AddSquare(v);
            }
        }
Example #25
0
        /// <summary>
        /// We are using separate layer for higliting elements on a main view
        /// This method is highliting GUI element depends on current introduction step
        /// </summary>
        public void DrawLayer(NSView view, CGRect dirtyRect)
        {
            var     bg        = Colors.WindowBackground;
            NSColor fillColor = NSColor.FromRgba(bg.RedComponent, bg.GreenComponent, bg.BlueComponent, 0.4f);

            NSColor strokeColor = NSColor.FromRgb(50, 158, 230);
            nfloat  strokeWidth = 2;

            if (__InotroductionStage != IntroductionStageEnum.Finished)
            {
                NSBezierPath fillRect = NSBezierPath.FromRect(dirtyRect);
                fillColor.SetFill();
                fillRect.Fill();
            }

            if (__InotroductionStage == IntroductionStageEnum.Firewall)
            {
                CGRect fwRect = __MainViewController.GetFirewallControlViewRect();

                NSBezierPath firewallPath = NSBezierPath.FromRoundedRect(fwRect, fwRect.Height / 2, fwRect.Height / 2);
                firewallPath.LineWidth = strokeWidth;
                strokeColor.SetStroke();
                firewallPath.Stroke();
            }

            if (__InotroductionStage == IntroductionStageEnum.ConnectBtn)
            {
                // CONNECT BUTTON
                CGRect       circleRect    = __MainViewController.GetConnectButtonViewRect();
                NSBezierPath connectBthPth = NSBezierPath.FromRoundedRect(circleRect, circleRect.Width / 2, circleRect.Height / 2);
                connectBthPth.LineWidth = strokeWidth;
                strokeColor.SetStroke();
                connectBthPth.Stroke();
            }

            if (__InotroductionStage == IntroductionStageEnum.Servers)
            {
                // SERVERS SELECTION
                CGRect serversRect = __MainViewController.GetServerSelectionViewRect();
                serversRect = new CGRect(serversRect.X + 3, serversRect.Y + 3, serversRect.Width - 6, serversRect.Height - 6);
                NSBezierPath serversViewPath = NSBezierPath.FromRoundedRect(serversRect, 4, 4);
                serversViewPath.LineWidth = strokeWidth;
                strokeColor.SetStroke();
                serversViewPath.Stroke();
            }
        }
Example #26
0
        public NetworkActionButton(NetworkAction networkAction,
                                   ViewModelNetworksSettings networksSettingsModel,
                                   float width) : base()
        {
            NetworkAction         = networkAction;
            NetworksSettingsModel = networksSettingsModel;
            const int constButtonHeight = 35;
            const int constImgHeight    = 16;

            Bordered = false;
            Title    = "";
            Frame    = new CGRect(0, 0, width, constButtonHeight);

            // wifi icon
            var wifiIconView = new NSImageView();

            wifiIconView.Frame = new CGRect(20, (constButtonHeight - constImgHeight) / 2, constImgHeight, constImgHeight);
            wifiIconView.Image = NSImage.ImageNamed("iconWiFiSmallBlue");
            AddSubview(wifiIconView);

            // title
            __Title           = UIUtils.NewLabel(networkAction.Network.SSID);
            __Title.Frame     = new CGRect(49, wifiIconView.Frame.Y, width / 2, 18);
            __Title.TextColor = NSColor.FromRgb(38, 57, 77);
            AddSubview(__Title);

            WiFiActionTypeEnum action = networkAction.Action;

            if (action == WiFiActionTypeEnum.Default)
            {
                action = networksSettingsModel.NetworkActions.DefaultActionType;
            }

            System.nfloat xpos = __Title.Frame.Width + __Title.Frame.X + 20;

            //action
            __PopUpButton          = new NSPopUpButton();
            __PopUpButton.Bordered = false;
            __PopUpButton.Frame    = new CGRect(xpos, (constButtonHeight - 24) / 2, width - xpos - 10, 24);
            AddSubview(__PopUpButton);

            networkAction.PropertyChanged += NetworkAction_PropertyChanged;
            NetworksSettingsModel.NetworkActions.PropertyChanged += NetworkActions_PropertyChanged;

            CreatePopupButtonElements();
        }
Example #27
0
        /// <summary>
        /// Applies the style navigation button.
        /// </summary>
        public static void ApplyStyleNavigationButtonV2(CustomButton button, string title, NSImage image = null)
        {
            if (button == null)
            {
                return;
            }

            SetBaseStyle(button, title, image);

            button.TitleForegroundColor = NSColor.FromRgb(152, 170, 186);
            button.CornerRadius         = 0;
            button.BorderColor          = NSColor.FromRgb(122, 138, 153);
            button.Gradient             = null;

            button.TitleFont = UIUtils.GetSystemFontOfSize(14f, NSFontWeight.Regular);//   Thin);

            button.DoNotChangeColorWhenDisabled = true;
        }
Example #28
0
 public static void LoadStyles()
 {
     if (IdeApp.Preferences.UserInterfaceTheme == Theme.Light)
     {
         HeaderBackgroundColor        = NSColor.FromRgb(0.98f, 0.98f, 0.98f);
         HeaderBorderBackgroundColor  = NSColor.FromRgb(0.96f, 0.96f, 0.96f);
         LabelSelectedForegroundColor = NSColor.Highlight;
         ToolbarBackgroundColor       = NSColor.White;
         CellBackgroundSelectedColor  = NSColor.FromRgb(0.36f, 0.54f, 0.90f);
     }
     else
     {
         CellBackgroundSelectedColor  = NSColor.FromRgb(0.38f, 0.55f, 0.91f);
         HeaderBackgroundColor        = NSColor.FromRgb(0.29f, 0.29f, 0.29f);
         HeaderBorderBackgroundColor  = NSColor.FromRgb(0.29f, 0.29f, 0.29f);
         LabelSelectedForegroundColor = NSColor.SelectedText;
         ToolbarBackgroundColor       = NSColor.FromRgb(0.25f, 0.25f, 0.25f);
     }
 }
Example #29
0
        private void Initialize()
        {
            // initialize default values
            CornerRadius = 4;

            GradientAngle = 90;
            ImagePosition = NSCellImagePosition.ImageLeft;

            TitleText            = "Button";
            TitleForegroundColor = NSColor.FromRgb(255, 255, 255);
            TitleFont            = UIUtils.GetSystemFontOfSize(16f, NSFontWeight.Semibold);

            Gradient = new NSGradient(NSColor.FromRgb(58, 156, 217), NSColor.FromRgb(20, 130, 222));

            BorderColor     = NSColor.FromRgb(48, 147, 209);
            BorderLineWidth = 0.5f;

            IconLocation = IconLocationEnum.Right_BeforeCenteredText;
        }
Example #30
0
        public override void DrawRect(CoreGraphics.CGRect dirtyRect)
        {
            if (DarkTheme)
            {
                NSColor.Clear.Set();
                NSGraphics.RectFill(dirtyRect, NSCompositingOperation.SourceOver);
                return;
            }
            else
            {
                NSColor.FromRgb(245, 245, 245).Set();
                NSBezierPath.FillRect(dirtyRect);
            }

            if (dirtyRect.Y == 0 && !DarkTheme)
            {
                NSColor.FromRgb(233, 233, 233).Set();
                NSBezierPath.FillRect(new CGRect(dirtyRect.X, 0, dirtyRect.Width, 1));
            }
        }