Exemple #1
0
        public StatusBar()
        {
            Cell       = new ColoredButtonCell();
            BezelStyle = NSBezelStyle.TexturedRounded;
            Title      = "";
            Enabled    = false;

            LoadStyles();

            // We don't need to resize the Statusbar here as a style change will trigger a complete relayout of the Awesomebar
            Ide.Gui.Styles.Changed += LoadStyles;

            textField.Cell             = new VerticallyCenteredTextFieldCell(0f);
            textField.Cell.StringValue = "";
            UpdateApplicationNamePlaceholderText();

            // The rect is empty because we use InVisibleRect to track the whole of the view.
            textFieldArea = new NSTrackingArea(CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
            textField.AddTrackingArea(textFieldArea);

            imageView.Frame = new CGRect(0.5, 0, 0, 0);
            imageView.Image = ImageService.GetIcon(Stock.StatusSteady).ToNSImage();

            buildResults        = new BuildResultsView();
            buildResults.Hidden = true;

            ctxHandler = new StatusBarContextHandler(this);

            updateHandler = delegate {
                int ec = 0, wc = 0;

                foreach (var t in TaskService.Errors)
                {
                    if (t.Severity == TaskSeverity.Error)
                    {
                        ec++;
                    }
                    else if (t.Severity == TaskSeverity.Warning)
                    {
                        wc++;
                    }
                }

                Runtime.RunInMainThread(delegate {
                    buildResults.Hidden      = (ec == 0 && wc == 0);
                    buildResults.ResultCount = ec > 0 ? ec : wc;

                    buildImageId           = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
                    buildResults.IconImage = ImageService.GetIcon(buildImageId, Gtk.IconSize.Menu).ToNSImage();

                    RepositionStatusIcons();
                });
            };

            updateHandler(null, null);

            TaskService.Errors.TasksAdded          += updateHandler;
            TaskService.Errors.TasksRemoved        += updateHandler;
            BrandingService.ApplicationNameChanged += ApplicationNameChanged;

            AddSubview(buildResults);
            AddSubview(imageView);
            AddSubview(textField);

            progressView = new ProgressView();
            AddSubview(progressView);
        }
		public StatusBar ()
		{
			Cell = new ColoredButtonCell ();
			BezelStyle = NSBezelStyle.TexturedRounded;
			Title = "";
			Enabled = false;

			LoadStyles ();

			// We don't need to resize the Statusbar here as a style change will trigger a complete relayout of the Awesomebar
			Ide.Gui.Styles.Changed += LoadStyles;

			textField.Cell = new VerticallyCenteredTextFieldCell (0f);
			textField.Cell.StringValue = "";
			UpdateApplicationNamePlaceholderText ();

			// The rect is empty because we use InVisibleRect to track the whole of the view.
			textFieldArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
			textField.AddTrackingArea (textFieldArea);

			imageView.Frame = new CGRect (0.5, 0, 0, 0);
			imageView.Image = ImageService.GetIcon (Stock.StatusSteady).ToNSImage ();

			buildResults = new BuildResultsView ();
			buildResults.Hidden = true;

			cancelButton = new CancelButton ();
			cancelButton.Activated += (o, e) => {
				cts?.Cancel ();
			};

			ctxHandler = new StatusBarContextHandler (this);

			updateHandler = delegate {
				int ec = 0, wc = 0;

				foreach (var t in TaskService.Errors) {
					if (t.Severity == TaskSeverity.Error)
						ec++;
					else if (t.Severity == TaskSeverity.Warning)
						wc++;
				}

				Runtime.RunInMainThread (delegate {
					buildResults.Hidden = (ec == 0 && wc == 0);
					buildResults.ResultCount = ec > 0 ? ec : wc;

					buildImageId = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
					buildResults.IconImage = ImageService.GetIcon (buildImageId, Gtk.IconSize.Menu).ToNSImage ();

					RepositionStatusIcons ();
				});
			};

			updateHandler (null, null);

			TaskService.Errors.TasksAdded += updateHandler;
			TaskService.Errors.TasksRemoved += updateHandler;
			BrandingService.ApplicationNameChanged += ApplicationNameChanged;

			AddSubview (cancelButton);
			AddSubview (buildResults);
			AddSubview (imageView);
			AddSubview (textField);

			progressView = new ProgressView ();
			AddSubview (progressView);
		}
Exemple #3
0
		public StatusBar ()
		{
			AllowsEditingTextAttributes = Selectable = Editable = false;

			textField.Cell = new VerticallyCenteredTextFieldCell (yOffset: -0.5f);
			textField.Cell.StringValue = "";
			textField.Cell.PlaceholderAttributedString = GetStatusString (BrandingService.ApplicationName, NSColor.DisabledControlText);

			// The rect is empty because we use InVisibleRect to track the whole of the view.
			textFieldArea = new NSTrackingArea (CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
			textField.AddTrackingArea (textFieldArea);

			imageView.Image = ImageService.GetIcon (Stock.StatusSteady).ToNSImage ();

			buildResults = new BuildResultsView ();
			buildResults.Hidden = true;
			AddSubview (buildResults);

			// Fixes a render glitch of a whiter bg than the others.
			if (MacSystemInformation.OsVersion >= MacSystemInformation.Yosemite)
				BezelStyle = NSTextFieldBezelStyle.Rounded;

			WantsLayer = true;
			Layer.CornerRadius = MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 6 : 4;
			ctxHandler = new StatusBarContextHandler (this);

			updateHandler = delegate {
				int ec = 0, wc = 0;

				foreach (var t in TaskService.Errors) {
					if (t.Severity == TaskSeverity.Error)
						ec++;
					else if (t.Severity == TaskSeverity.Warning)
						wc++;
				}

				Runtime.RunInMainThread (delegate {
					buildResults.Hidden = (ec == 0 && wc == 0);
					buildResults.ResultCount = ec > 0 ? ec : wc;

					buildImageId = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
					buildResults.IconImage = ImageService.GetIcon (buildImageId, Gtk.IconSize.Menu).ToNSImage ();

					RepositionStatusIcons ();
				});
			};

			updateHandler (null, null);

			TaskService.Errors.TasksAdded += updateHandler;
			TaskService.Errors.TasksRemoved += updateHandler;

			AddSubview (imageView);
			AddSubview (textField);
		}
Exemple #4
0
        public StatusBar()
        {
            var nsa = (INSAccessibility)this;

            // Pretend that this button is a Group
            AccessibilityRole           = NSAccessibilityRoles.GroupRole;
            nsa.AccessibilityIdentifier = "MainToolbar.StatusDisplay";

            Cell       = new ColoredButtonCell();
            BezelStyle = NSBezelStyle.TexturedRounded;
            Title      = "";
            Enabled    = false;

            LoadStyles();

            // We don't need to resize the Statusbar here as a style change will trigger a complete relayout of the Awesomebar
            Ide.Gui.Styles.Changed += LoadStyles;

            textField.Cell             = new VerticallyCenteredTextFieldCell(0f);
            textField.Cell.StringValue = "";

            textField.AccessibilityRole    = NSAccessibilityRoles.StaticTextRole;
            textField.AccessibilityEnabled = true;
            textField.AccessibilityHelp    = GettextCatalog.GetString("Status of the current operation");

            var tfNSA = (INSAccessibility)textField;

            tfNSA.AccessibilityIdentifier = "MainToolbar.StatusDisplay.Status";

            UpdateApplicationNamePlaceholderText();

            // The rect is empty because we use InVisibleRect to track the whole of the view.
            textFieldArea = new NSTrackingArea(CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
            textField.AddTrackingArea(textFieldArea);

            imageView.Frame = new CGRect(0.5, 0, 0, 0);
            imageView.Image = ImageService.GetIcon(Stock.StatusSteady).ToNSImage();

            // Hide this image from accessibility
            imageView.AccessibilityElement = false;

            buildResults        = new BuildResultsView();
            buildResults.Hidden = true;

            cancelButton            = new CancelButton();
            cancelButton.Activated += (o, e) => {
                cts?.Cancel();
            };

            ctxHandler = new StatusBarContextHandler(this);

            updateHandler = delegate {
                int ec = 0, wc = 0;

                foreach (var t in TaskService.Errors)
                {
                    if (t.Severity == TaskSeverity.Error)
                    {
                        ec++;
                    }
                    else if (t.Severity == TaskSeverity.Warning)
                    {
                        wc++;
                    }
                }

                Runtime.RunInMainThread(delegate {
                    buildResults.Hidden      = (ec == 0 && wc == 0);
                    buildResults.ResultCount = ec > 0 ? ec : wc;
                    buildResults.Type        = ec > 0 ? BuildResultsView.ResultsType.Error : BuildResultsView.ResultsType.Warning;

                    buildImageId           = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
                    buildResults.IconImage = ImageService.GetIcon(buildImageId, Gtk.IconSize.Menu).ToNSImage();

                    RepositionStatusIcons();
                });
            };

            updateHandler(null, null);

            TaskService.Errors.TasksAdded          += updateHandler;
            TaskService.Errors.TasksRemoved        += updateHandler;
            BrandingService.ApplicationNameChanged += ApplicationNameChanged;

            AddSubview(cancelButton);
            AddSubview(buildResults);
            AddSubview(imageView);
            AddSubview(textField);

            progressView = new ProgressView();
            AddSubview(progressView);

            var newChildren = new NSObject [] {
                textField, buildResults, progressView
            };

            AccessibilityChildren = newChildren;
        }
Exemple #5
0
        public StatusBar()
        {
            AllowsEditingTextAttributes = Selectable = Editable = false;

            textField.Cell             = new VerticallyCenteredTextFieldCell(yOffset: -0.5f);
            textField.Cell.StringValue = "";
            textField.Cell.PlaceholderAttributedString = GetStatusString(BrandingService.ApplicationName, NSColor.DisabledControlText);

            // The rect is empty because we use InVisibleRect to track the whole of the view.
            textFieldArea = new NSTrackingArea(CGRect.Empty, NSTrackingAreaOptions.MouseEnteredAndExited | NSTrackingAreaOptions.ActiveInKeyWindow | NSTrackingAreaOptions.InVisibleRect, this, null);
            textField.AddTrackingArea(textFieldArea);

            imageView.Image = ImageService.GetIcon(Stock.StatusSteady).ToNSImage();

            buildResults        = new BuildResultsView();
            buildResults.Hidden = true;
            AddSubview(buildResults);

            // Fixes a render glitch of a whiter bg than the others.
            if (MacSystemInformation.OsVersion >= MacSystemInformation.Yosemite)
            {
                BezelStyle = NSTextFieldBezelStyle.Rounded;
            }

            WantsLayer         = true;
            Layer.CornerRadius = MacSystemInformation.OsVersion >= MacSystemInformation.ElCapitan ? 6 : 4;
            ctxHandler         = new StatusBarContextHandler(this);

            updateHandler = delegate {
                int ec = 0, wc = 0;

                foreach (var t in TaskService.Errors)
                {
                    if (t.Severity == TaskSeverity.Error)
                    {
                        ec++;
                    }
                    else if (t.Severity == TaskSeverity.Warning)
                    {
                        wc++;
                    }
                }

                Runtime.RunInMainThread(delegate {
                    buildResults.Hidden      = (ec == 0 && wc == 0);
                    buildResults.ResultCount = ec > 0 ? ec : wc;

                    buildImageId           = ec > 0 ? "md-status-error-count" : "md-status-warning-count";
                    buildResults.IconImage = ImageService.GetIcon(buildImageId, Gtk.IconSize.Menu).ToNSImage();

                    RepositionStatusIcons();
                });
            };

            updateHandler(null, null);

            TaskService.Errors.TasksAdded   += updateHandler;
            TaskService.Errors.TasksRemoved += updateHandler;

            AddSubview(imageView);
            AddSubview(textField);
        }