Esempio n. 1
0
        static void SetTheme(NSWindow window)
        {
            if (IdeApp.Preferences.UserInterfaceSkin == Skin.Light)
            {
                window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
            }
            else
            {
                window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            }

            if (IdeApp.Preferences.UserInterfaceSkin == Skin.Light)
            {
                window.StyleMask &= ~NSWindowStyle.TexturedBackground;
                return;
            }

            if (window is NSPanel || window.ContentView.Class.Name != "GdkQuartzView")
            {
                window.BackgroundColor = MonoDevelop.Ide.Gui.Styles.BackgroundColor.ToNSColor();
            }
            else
            {
                object[] platforms = Mono.Addins.AddinManager.GetExtensionObjects("/MonoDevelop/Core/PlatformService");
                if (platforms.Length > 0)
                {
                    var platformService = (MonoDevelop.Ide.Desktop.PlatformService)platforms [0];
                    var image           = Xwt.Drawing.Image.FromResource(platformService.GetType().Assembly, "maintoolbarbg.png");

                    window.IsOpaque        = false;
                    window.BackgroundColor = NSColor.FromPatternImage(image.ToBitmap().ToNSImage());
                }
            }
            window.StyleMask |= NSWindowStyle.TexturedBackground;
        }
Esempio n. 2
0
        public override IView ConvertTo(FigmaNode currentNode, ProcessedNode parent, FigmaRendererService rendererService)
        {
            var view = new NSComboBox();

            var figmaInstance = (FigmaInstance)currentNode;
            var controlType   = figmaInstance.ToControlType();

            switch (controlType)
            {
            case NativeControlType.ComboBoxSmall:
            case NativeControlType.ComboBoxSmallDark:
                view.ControlSize = NSControlSize.Small;
                break;

            case NativeControlType.ComboBoxStandard:
            case NativeControlType.ComboBoxStandardDark:
                view.ControlSize = NSControlSize.Regular;
                break;
            }

            if (controlType.ToString().EndsWith("Dark", StringComparison.Ordinal))
            {
                view.Appearance = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
            }

            return(new View(view));
        }
Esempio n. 3
0
        public static void Init()
        {
            if (IsInitialized)
            {
                return;
            }
            IsInitialized = true;
            Color.SetAccent(Color.FromRgba(50, 79, 133, 255));

            Log.Listeners.Add(new DelegateLogListener((c, m) => Trace.WriteLine(m, c)));

#if __MOBILE__
            Device.SetIdiom(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? TargetIdiom.Tablet : TargetIdiom.Phone);
            Device.SetFlowDirection(UIApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());
#else
            Device.SetIdiom(TargetIdiom.Desktop);
            Device.SetFlowDirection(NSApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());
            var mojave = new NSOperatingSystemVersion(10, 14, 0);
            if (NSProcessInfo.ProcessInfo.IsOperatingSystemAtLeastVersion(mojave) &&
                typeof(NSApplication).GetProperty("Appearance") is PropertyInfo appearance &&
                appearance != null)
            {
                var aquaAppearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
                appearance.SetValue(NSApplication.SharedApplication, aquaAppearance);
            }
#endif
            Device.SetFlags(s_flags);
            Device.PlatformServices = new IOSPlatformServices();
            Device.Info             = new IOSDeviceInfo();

            Internals.Registrar.RegisterAll(new[]
                                            { typeof(ExportRendererAttribute), typeof(ExportCellAttribute), typeof(ExportImageSourceHandlerAttribute) });
            ExpressionSearch.Default = new iOSExpressionSearch();
        }
Esempio n. 4
0
            public override void LoadView()
            {
                View = new ContainerView(this);

                string appearance = EffectiveAppearanceName;

                NativeChild.RemoveFromSuperview();
                View.AddSubview(NativeChild);

                if (!string.IsNullOrEmpty(appearance) && appearance.IndexOf("Dark", StringComparison.Ordinal) >= 0)
                {
                    View.Appearance = NSAppearance.GetAppearance(MacSystemInformation.OsVersion < MacSystemInformation.Mojave ? NSAppearance.NameVibrantDark : new NSString("NSAppearanceNameDarkAqua"));
                }
                else
                {
                    View.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
                }

                WidgetSpacing padding = 0;

                if (Backend != null)
                {
                    padding = Backend.Frontend.Padding;
                }
                View.AddConstraints(new NSLayoutConstraint [] {
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Left, NSLayoutRelation.Equal, View, NSLayoutAttribute.Left, 1, (nfloat)padding.Left),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Right, NSLayoutRelation.Equal, View, NSLayoutAttribute.Right, 1, -(nfloat)padding.Right),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Top, NSLayoutRelation.Equal, View, NSLayoutAttribute.Top, 1, (nfloat)padding.Top),
                    NSLayoutConstraint.Create(NativeChild, NSLayoutAttribute.Bottom, NSLayoutRelation.Equal, View, NSLayoutAttribute.Bottom, 1, -(nfloat)padding.Bottom),
                });
            }
Esempio n. 5
0
 internal static NSAppearance GetAppearance()
 {
     return(IdeApp.Preferences.UserInterfaceTheme == Theme.Light
                         ? NSAppearance.GetAppearance(NSAppearance.NameAqua)
                         : MacSystemInformation.OsVersion < MacSystemInformation.Mojave
                                 ? NSAppearance.GetAppearance(NSAppearance.NameVibrantDark)
                                 : NSAppearance.GetAppearance(new NSString("NSAppearanceNameDarkAqua")));
 }
Esempio n. 6
0
        public static void Init(IActivationState activationState)
        {
            if (IsInitialized)
            {
                return;
            }

            ActivationState = activationState;
            IsInitialized   = true;

            Microsoft.Maui.Controls.Internals.Registrar.RegisterRendererToHandlerShim(RendererToHandlerShim.CreateShim);

            //TODO: MAUI Accent Color?
            Color.SetAccent(Color.FromRgba(50, 79, 133, 255));

            Log.Listeners.Add(new DelegateLogListener((c, m) => Trace.WriteLine(m, c)));

#if __MOBILE__
            Device.SetIdiom(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? TargetIdiom.Tablet : TargetIdiom.Phone);
            Device.SetFlowDirection(UIApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());
#else
            // Subscribe to notifications in OS Theme changes
            NSDistributedNotificationCenter.GetDefaultCenter().AddObserver((NSString)"AppleInterfaceThemeChangedNotification", (n) =>
            {
                var interfaceStyle = NSUserDefaults.StandardUserDefaults.StringForKey("AppleInterfaceStyle");

                var aquaAppearance = NSAppearance.GetAppearance(interfaceStyle == "Dark" ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
                NSApplication.SharedApplication.Appearance = aquaAppearance;

                Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(interfaceStyle == "Dark" ? OSAppTheme.Dark : OSAppTheme.Light));
            });

            Device.SetIdiom(TargetIdiom.Desktop);
            Device.SetFlowDirection(NSApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());

            if (IsMojaveOrNewer)
            {
                var interfaceStyle = NSUserDefaults.StandardUserDefaults.StringForKey("AppleInterfaceStyle");
                var aquaAppearance = NSAppearance.GetAppearance(interfaceStyle == "Dark" ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
                NSApplication.SharedApplication.Appearance = aquaAppearance;
            }
#endif
            Device.SetFlags(s_flags);
            var platformServices = new IOSPlatformServices();

            Device.PlatformServices = platformServices;

#if __MOBILE__
            Device.PlatformInvalidator = platformServices;
            Device.Info = new IOSDeviceInfo();
#else
            Device.Info = new Platform.macOS.MacDeviceInfo();
#endif

            Controls.Internals.Registrar.RegisterAll(new[]
                                                     { typeof(ExportRendererAttribute), typeof(ExportCellAttribute), typeof(ExportImageSourceHandlerAttribute), typeof(ExportFontAttribute) });
            ExpressionSearch.Default = new iOSExpressionSearch();
        }
Esempio n. 7
0
        public void NSAppearanceShouldLoadAppearanceNamed()
        {
            Asserts.EnsureYosemite();

            var appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);

            Assert.IsNotNull(appearance, "NSAppearanceShouldLoadAppearanceNamed - Failed to initialize appearance VibrantDark");
            Assert.AreEqual(appearance.Name, NSAppearance.NameVibrantDark.ToString(), "NSAppearanceShouldLoadAppearanceNamed - Appearance initialized with incorrect name.");
        }
Esempio n. 8
0
        void InitApp(CommandManager commandManager)
        {
            if (initedApp)
            {
                return;
            }

            commandManager.CommandActivating += OnCommandActivating;

            //mac-ify these command names
            commandManager.GetCommand(EditCommands.MonodevelopPreferences).Text = GettextCatalog.GetString("Preferences...");
            commandManager.GetCommand(EditCommands.DefaultPolicies).Text        = GettextCatalog.GetString("Policies...");
            commandManager.GetCommand(HelpCommands.About).Text = GetAboutCommandText();
            commandManager.GetCommand(MacIntegrationCommands.HideWindow).Text = GetHideWindowCommandText();
            commandManager.GetCommand(ToolCommands.AddinManager).Text         = GettextCatalog.GetString("Extensions...");

            initedApp = true;

            IdeApp.Workbench.RootWindow.DeleteEvent += HandleDeleteEvent;

            if (MacSystemInformation.OsVersion >= MacSystemInformation.Lion)
            {
                IdeApp.Workbench.RootWindow.Realized += (sender, args) => {
                    var win = GtkQuartz.GetWindow((Gtk.Window)sender);
                    win.CollectionBehavior |= NSWindowCollectionBehavior.FullScreenPrimary;
                };
            }

            PatchGtkTheme();
            NSNotificationCenter.DefaultCenter.AddObserver(NSCell.ControlTintChangedNotification, notif => Core.Runtime.RunInMainThread(
                                                               delegate {
                Styles.LoadStyle();
                PatchGtkTheme();
            }));


            Styles.Changed += (s, a) => {
                var colorPanel = NSColorPanel.SharedColorPanel;
                if (colorPanel.ContentView?.Superview?.Window == null)
                {
                    LoggingService.LogWarning("Updating shared color panel appearance failed, no valid window.");
                }
                IdeTheme.ApplyTheme(colorPanel.ContentView.Superview.Window);
                var appearance = colorPanel.ContentView.Superview.Window.Appearance;
                if (appearance == null)
                {
                    appearance = NSAppearance.GetAppearance(IdeApp.Preferences.UserInterfaceTheme == Theme.Light ? NSAppearance.NameAqua : NSAppearance.NameVibrantDark);
                }
                // The subviews of the shared NSColorPanel do not inherit the appearance of the main panel window
                // and need to be updated recursively.
                UpdateColorPanelSubviewsAppearance(colorPanel.ContentView.Superview, appearance);
            };

            // FIXME: Immediate theme switching disabled, until NSAppearance issues are fixed
            //IdeApp.Preferences.UserInterfaceTheme.Changed += (s,a) => PatchGtkTheme ();
        }
Esempio n. 9
0
        public void NSAppearanceShouldChangeCurrentAppearance()
        {
            Asserts.EnsureYosemite();

            var appearance = NSAppearance.CurrentAppearance;

            NSAppearance.CurrentAppearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);

            Assert.AreNotEqual(appearance, NSAppearance.CurrentAppearance, "NSAppearanceShouldChangeCurrentAppearance - Failed to change appearance.");
        }
Esempio n. 10
0
        public override void WindowDidLoad()
        {
            Window.Appearance                 = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            Window.StyleMask                  = Window.StyleMask | NSWindowStyle.FullSizeContentView;
            Window.TitleVisibility            = NSWindowTitleVisibility.Hidden;
            Window.TitlebarAppearsTransparent = true;
            Window.MovableByWindowBackground  = true;

            ImageView.Image = new NSImage("/Library/Desktop Pictures/Lion.jpg");
        }
Esempio n. 11
0
File: Forms.cs Progetto: hevey/maui
        static void SetupInit(IMauiContext context, InitializationOptions?maybeOptions = null)
        {
            MauiContext = context;

            Microsoft.Maui.Controls.Internals.Registrar.RegisterRendererToHandlerShim(RendererToHandlerShim.CreateShim);

            Application.AccentColor = Color.FromRgba(50, 79, 133, 255);

#if __MOBILE__
            Device.SetIdiom(UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad ? TargetIdiom.Tablet : TargetIdiom.Phone);
            Device.SetFlowDirection(UIApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());
#else
            if (!IsInitialized)
            {
                // Only need to do this once
                // Subscribe to notifications in OS Theme changes
                NSDistributedNotificationCenter.GetDefaultCenter().AddObserver((NSString)"AppleInterfaceThemeChangedNotification", (n) =>
                {
                    var interfaceStyle = NSUserDefaults.StandardUserDefaults.StringForKey("AppleInterfaceStyle");

                    var aquaAppearance = NSAppearance.GetAppearance(interfaceStyle == "Dark" ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
                    NSApplication.SharedApplication.Appearance = aquaAppearance;

                    Application.Current?.TriggerThemeChanged(new AppThemeChangedEventArgs(interfaceStyle == "Dark" ? OSAppTheme.Dark : OSAppTheme.Light));
                });
            }

            Device.SetIdiom(TargetIdiom.Desktop);
            Device.SetFlowDirection(NSApplication.SharedApplication.UserInterfaceLayoutDirection.ToFlowDirection());

            if (IsMojaveOrNewer)
            {
                var interfaceStyle = NSUserDefaults.StandardUserDefaults.StringForKey("AppleInterfaceStyle");
                var aquaAppearance = NSAppearance.GetAppearance(interfaceStyle == "Dark" ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
                NSApplication.SharedApplication.Appearance = aquaAppearance;
            }
#endif
            var platformServices = new IOSPlatformServices();

            Device.PlatformServices = platformServices;

#if __MOBILE__
            Device.PlatformInvalidator = platformServices;
#endif
            if (maybeOptions?.Flags.HasFlag(InitializationFlags.SkipRenderers) != true)
            {
                RegisterCompatRenderers();
            }

            ExpressionSearch.Default = new iOSExpressionSearch();

            IsInitialized = true;
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            HistoryTableView.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);

            VM = Locator.CurrentMutable.GetService <OperationViewModel>();
            var ds = new LapTimesDataSource(VM.LapTimes);

            HistoryTableView.DataSource = ds;
            HistoryTableView.Delegate   = new LapTimesViewDelegate(ds, VM.GetFormattedElapsed);
            CountChangedSubscription    = VM.LapTimes.CountChanged.Subscribe(_ => InvokeOnMainThread(HistoryTableView.ReloadData));
            ShowMsecSubscription        = VM.WhenAnyValue(vm => vm.ShowMilliseconds).Subscribe(_ => InvokeOnMainThread(HistoryTableView.ReloadData));
        }
Esempio n. 13
0
        public virtual NSAppearance GetVibrantAppearance(NSAppearance appearance)
        {
            if (appearance == null)
            {
                throw new ArgumentNullException(nameof(appearance));
            }

            if (appearance.Name == NSAppearance.NameDarkAqua || appearance.Name == NSAppearance.NameVibrantDark)
            {
                return(NSAppearance.GetAppearance(NSAppearance.NameVibrantDark));
            }

            return(NSAppearance.GetAppearance(NSAppearance.NameVibrantLight));
        }
Esempio n. 14
0
        public override IView ConvertTo(FigmaNode currentNode, ProcessedNode parent, FigmaRendererService rendererService)
        {
            var instance = (FigmaInstance)currentNode;

            var textBox = new TextBox();
            var view    = (NSTextField)textBox.NativeObject;

            var figmaInstance = (FigmaInstance)currentNode;
            var controlType   = figmaInstance.ToControlType();

            switch (controlType)
            {
            case NativeControlType.TextFieldSmall:
            case NativeControlType.TextFieldSmallDark:
                view.ControlSize = NSControlSize.Small;
                break;

            case NativeControlType.TextFieldStandard:
            case NativeControlType.TextFieldStandardDark:
                view.ControlSize = NSControlSize.Regular;
                break;
            }

            var texts = instance.children
                        .OfType <FigmaText>();

            var text = texts.FirstOrDefault(s => s.name == "lbl");

            if (text != null)
            {
                textBox.Text = text.characters;
                view.Configure(text);
            }

            var placeholder = texts.FirstOrDefault(s => s.name == "placeholder");

            if (placeholder != null)
            {
                view.PlaceholderString = placeholder.characters;
            }


            if (controlType.ToString().EndsWith("Dark", System.StringComparison.Ordinal))
            {
                view.Appearance = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
            }

            return(textBox);
        }
Esempio n. 15
0
        void LoadStyles(object sender = null, EventArgs args = null)
        {
            if (IdeApp.Preferences.UserInterfaceSkin == Skin.Dark)
            {
                Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            }
            else
            {
                Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
            }

            textField.Cell.PlaceholderAttributedString = GetStatusString(BrandingService.ApplicationName, ColorForType(MessageType.Ready));
            textColor = ColorForType(messageType);
            ReconstructString();
        }
Esempio n. 16
0
        public override void DidFinishLaunching(NSNotification notification)
        {
            // Insert code here to initialize your application

            storyboard = NSStoryboard.FromName("Main", null);
            controller = storyboard.InstantiateControllerWithIdentifier("PopupController") as ViewController;

            popover.ContentViewController = controller;
            popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameVibrantDark));

            statusBar = new StatusBarController(popover, "StatusBarIcon.png");

            //Registering the default settings loaded from the .plist file in the constructor
            NSUserDefaults.StandardUserDefaults.RegisterDefaults(defaultSettings);
        }
 public void ToggleDarkMode()
 {
     if (UsesDarkMode)
     {
         Window.Appearance    = NSAppearance.GetAppearance(NSAppearance.NameAqua);
         DarkModeButton.State = NSCellStateValue.Off;
         UsesDarkMode         = false;
     }
     else
     {
         Window.Appearance    = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
         DarkModeButton.State = NSCellStateValue.On;
         UsesDarkMode         = true;
     }
 }
Esempio n. 18
0
        void LoadStyles(object sender = null, EventArgs args = null)
        {
            if (IdeApp.Preferences.UserInterfaceSkin == Skin.Dark)
            {
                Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            }
            else
            {
                Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
            }

            UpdateApplicationNamePlaceholderText();
            textColor = ColorForType(messageType);
            ReconstructString();
        }
Esempio n. 19
0
 public LaunchWindow(CoreGraphics.CGRect contentRect, NSWindowStyle aStyle, NSBackingStore bufferingType, bool deferCreation) :
     base(contentRect, aStyle, bufferingType, deferCreation)
 {
     Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
     IsOpaque   = true;
     MovableByWindowBackground = true;
     ReleasedWhenClosed        = false;
     Title = NSBundle.MainBundle.GetName();
     TitlebarAppearsTransparent = true;
     TitleVisibility            = NSWindowTitleVisibility.Hidden;
     Toolbar = new NSToolbar()
     {
         ShowsBaselineSeparator = false
     };
 }
Esempio n. 20
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            Window.Appearance      = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            Window.TitleVisibility = NSWindowTitleVisibility.Hidden;

            SetupStatusDisplayTextField();

            _ = NotificationCenter.AddObserver(ToggleCollapsed.Name, notification =>
            {
                NSNumber?collapsed    = (NSNumber)notification.UserInfo.ObjectForKey(IsCollapsed.NSString());
                NSNumber?segmentIndex = (NSNumber)notification.UserInfo.ObjectForKey(SegmentIndex.NSString());
                ToggleSidebarSegmentedControl.SetSelected(!collapsed.BoolValue, segmentIndex.NIntValue);
            });
        }
Esempio n. 21
0
        public NativeViewHost()
        {
            Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantLight);

            WantsLayer            = true;
            Layer.BackgroundColor = NSColor.SystemOrangeColor.CGColor;

            var eventView = new NativeEventView();

            AddSubview(eventView);

            eventView.TranslatesAutoresizingMaskIntoConstraints = false;
            eventView.LeadingAnchor.ConstraintEqualToAnchor(LeadingAnchor).Active   = true;
            eventView.TrailingAnchor.ConstraintEqualToAnchor(TrailingAnchor).Active = true;
            eventView.TopAnchor.ConstraintEqualToAnchor(TopAnchor).Active           = true;
            eventView.BottomAnchor.ConstraintEqualToAnchor(BottomAnchor).Active     = true;
        }
Esempio n. 22
0
        // Called after the application is ready to open the GUI
        public override void DidFinishLaunching(NSNotification notification)
        {
            // Create container for popover
            Container container = Container.FreshController();

            // Furnish popover with content
            popover.ContentViewController = container;
            popover.Behavior = NSPopoverBehavior.Transient;
            popover.Delegate = new PopoverDelegate();
            popover.Animates = false;
            popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameLightContent));

            // Enable the tray item only after the app has launched
            statusItem.Button.Activated += StatusItem_Click;
            statusItem.Button.SendActionOn(NSEventType.OtherMouseUp);
            statusItem.Visible = true;
            Application.Current.SendStart();
        }
Esempio n. 23
0
        // View menu
        partial void ToggleDarkModeClicked(NSObject sender)
        {
            NSWindow window = NSApplication.SharedApplication.MainWindow;

            if (window.WindowController is DocumentWindowController)
            {
                (window.WindowController as DocumentWindowController).ToggleDarkMode();
            }
            else
            {
                if (window.EffectiveAppearance.Name == NSAppearance.NameDarkAqua)
                {
                    window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameAqua);
                }
                else
                {
                    window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
                }
            }
        }
Esempio n. 24
0
        public AppDelegate()
        {
            OperatingSystem os    = Environment.OSVersion;
            var             style = NSWindowStyle.Closable | NSWindowStyle.Resizable | NSWindowStyle.Miniaturizable | NSWindowStyle.Titled;

            var rect = new CoreGraphics.CGRect(200, 1000, 1024, 768);

            window                 = new NSWindow(rect, style, NSBackingStore.Buffered, false);
            window.Title           = "MyLogo 2019";   // choose your own Title here
            window.TitleVisibility = NSWindowTitleVisibility.Hidden;
            if (os.Version.Major < 18)
            {
                window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameVibrantDark);
            }
            else
            {
                window.Appearance = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
            }
            NSApplication.SharedApplication.ServicesProvider = this;
        }
Esempio n. 25
0
        partial void onClickThemePicker(NSObject sender)
        {
            if (_popoverViewController == null)
            {
                _popoverViewController = Storyboard.InstantiateControllerWithIdentifier("ThemePickerViewController") as ThemePickerViewController;
            }

            if (_popover == null)
            {
                _popover = new NSPopover();
                _popover.ContentViewController = _popoverViewController;
                _popover.SetAppearance(NSAppearance.GetAppearance(NSAppearance.NameVibrantLight));
                _popover.Animates     = true;
                _popover.Behavior     = NSPopoverBehavior.Transient;
                _popover.WeakDelegate = this;

                var button = sender as NSButton;
                _popover.Show(button.Frame, button, NSRectEdge.MaxXEdge);
            }
        }
Esempio n. 26
0
        public override IView ConvertTo(FigmaNode currentNode, ProcessedNode parent, FigmaRendererService rendererService)
        {
            var figmaInstance = (FigmaInstance)currentNode;

            var button = new ComboBox();
            var view   = (NSPopUpButton)button.NativeObject;

            var controlType = figmaInstance.ToControlType();

            switch (controlType)
            {
            case NativeControlType.PopUpButtonSmall:
            case NativeControlType.PopUpButtonSmallDark:
                view.ControlSize = NSControlSize.Small;
                break;

            case NativeControlType.PopUpButtonStandard:
            case NativeControlType.PopUpButtonStandardDark:
                view.ControlSize = NSControlSize.Regular;
                break;
            }

            var label = figmaInstance.children
                        .OfType <FigmaText>()
                        .FirstOrDefault(s => s.name == "lbl");

            if (label != null)
            {
                button.AddItem(label.characters);
                view.Font = label.style.ToNSFont();
            }

            if (controlType.ToString().EndsWith("Dark", StringComparison.Ordinal))
            {
                view.Appearance = NSAppearance.GetAppearance(NSAppearance.NameDarkAqua);
            }

            return(button);
        }
Esempio n. 27
0
        // If theme toggled, then notify our manager
        partial void OnThemeChanged(NSObject sender)
        {
            var themeControl = (NSSegmentedControl)sender;

            NSString appearance = NSAppearance.NameAqua;

            if (themeControl.SelectedSegment == 0)
            {
                if (NSProcessInfo.ProcessInfo.OperatingSystemVersion.Minor > 13)
                {
                    appearance = NSAppearance.NameDarkAqua;
                }
                else
                {
                    appearance = NSAppearance.NameVibrantDark;
                }
            }

            var realAppearance = NSAppearance.GetAppearance(appearance);

            ((HostResourceProvider)PropertyPanel.HostResourceProvider).CurrentAppearance = realAppearance;
            View.Appearance = realAppearance;
        }
Esempio n. 28
0
 void UpdateCell()
 {
     Appearance   = NSAppearance.GetAppearance(IdeApp.Preferences.UserInterfaceSkin == Skin.Dark ? NSAppearance.NameVibrantDark : NSAppearance.NameAqua);
     NeedsDisplay = true;
 }
Esempio n. 29
0
 public void SetAppareance(bool isDark)
 {
     base.Appearance = NSAppearance.GetAppearance(isDark ? NSAppearance.NameVibrantDark : NSAppearance.NameVibrantLight);
 }
Esempio n. 30
0
 public MonoDevelopHostResourceProvider()
 {
     CurrentAppearance = NSAppearance.GetAppearance(IdeApp.Preferences.UserInterfaceTheme == Theme.Dark ? NSAppearance.NameDarkAqua : NSAppearance.NameAqua);
 }