예제 #1
0
        public MacDebuggerObjectNameView(MacObjectValueTreeView treeView) : base(treeView, "name")
        {
            ImageView = new NSImageView {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            TextField = new MacDebuggerTextField(this)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                MaximumNumberOfLines = 1,
                DrawsBackground      = false,
                Bordered             = false,
                Editable             = false
            };

            AddSubview(ImageView);
            AddSubview(TextField);

            AddNewExpressionButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AccessibilityTitle = GettextCatalog.GetString("Add new expression"),
                Image      = GetImage("gtk-add", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            AddNewExpressionButton.Activated += OnAddNewExpressionButtonClicked;

            PreviewButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Image      = GetImage("md-empty", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            PreviewButton.Activated += OnPreviewButtonClicked;
        }
        public MacDebuggerObjectValueView(MacObjectValueTreeView treeView) : base(treeView, "value")
        {
            spinner = new NSProgressIndicator(new CGRect(0, 0, ImageSize, ImageSize))
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Style         = NSProgressIndicatorStyle.Spinning,
                Indeterminate = true
            };

            statusIcon = new NSImageView {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            colorPreview = new NSView(new CGRect(0, 0, ImageSize, ImageSize))
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                WantsLayer = true
            };

            valueButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                Title      = GettextCatalog.GetString("Show More"),
                BezelStyle = NSBezelStyle.Inline
            };
            valueButton.Cell.UsesSingleLineMode = true;
            UpdateFont(valueButton, -3);
            valueButton.Activated += OnValueButtonActivated;

            int imageSize = treeView.CompactView ? CompactImageSize : ImageSize;

            viewerButton = new NSButton {
                AccessibilityTitle = GettextCatalog.GetString("Open Value Visualizer"),
                Image = GetImage(Gtk.Stock.Edit, imageSize, imageSize),
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            viewerButton.BezelStyle = NSBezelStyle.Inline;
            viewerButton.Bordered   = false;
            viewerButton.Activated += OnViewerButtonActivated;

            TextField = new MacDebuggerTextField(this)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode        = NSLineBreakMode.Clipping,
                MaximumNumberOfLines = 1,
                DrawsBackground      = false,
                Bordered             = false,
                Editable             = false
            };

            AddSubview(TextField);
        }
예제 #3
0
        public MacDebuggerObjectTypeView(MacObjectValueTreeView treeView) : base(treeView, "type")
        {
            TextField = new MacDebuggerTextField(this)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                BackgroundColor      = NSColor.Clear,
                MaximumNumberOfLines = 1,
                Bordered             = false,
                Editable             = false
            };

            AddSubview(TextField);

            TextField.CenterYAnchor.ConstraintEqualToAnchor(CenterYAnchor).Active                = true;
            TextField.LeadingAnchor.ConstraintEqualToAnchor(LeadingAnchor, MarginSize).Active    = true;
            TextField.TrailingAnchor.ConstraintEqualToAnchor(TrailingAnchor, -MarginSize).Active = true;
        }
        public MacDebuggerObjectNameView(MacObjectValueTreeView treeView) : base(treeView, "name")
        {
            ImageView = new NSImageView {
                TranslatesAutoresizingMaskIntoConstraints = false
            };

            TextField = new MacDebuggerTextField(this)
            {
                TranslatesAutoresizingMaskIntoConstraints = false,
                LineBreakMode        = NSLineBreakMode.Clipping,
                MaximumNumberOfLines = 1,
                DrawsBackground      = false,
                Bordered             = false,
                Editable             = false
            };

            AddSubview(ImageView);
            AddSubview(TextField);

            AddNewExpressionButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AccessibilityTitle = GettextCatalog.GetString("Add item to watch"),
                Image      = GetImage("gtk-add", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            AddNewExpressionButton.Activated += OnAddNewExpressionButtonClicked;

            PreviewButton = new NSButton {
                TranslatesAutoresizingMaskIntoConstraints = false,
                AccessibilityTitle = GettextCatalog.GetString("Open Preview Visualizer"),
                Image      = GetImage("md-empty", Gtk.IconSize.Menu),
                BezelStyle = NSBezelStyle.Inline,
                Bordered   = false
            };
            PreviewButton.Activated += OnPreviewButtonClicked;

            var contentTypeRegistry = CompositionManager.Instance.GetExportedValue <IContentTypeRegistryService> ();

            textBufferFactory = CompositionManager.Instance.GetExportedValue <ITextBufferFactoryService> ();
            var factory = CompositionManager.Instance.GetExportedValue <ICocoaTextEditorFactoryService> ();

            contentType = contentTypeRegistry.GetContentType(DebuggerCompletion.ContentType);
            var editorFormatMapService = CompositionManager.Instance.GetExportedValue <IEditorFormatMapService> ();
            var appearanceCategory     = Guid.NewGuid().ToString();
            var editorFormat           = editorFormatMapService.GetEditorFormatMap(appearanceCategory);

            var resourceDictionary = editorFormat.GetProperties("Plain Text");

            resourceDictionary [ClassificationFormatDefinition.TypefaceId]          = TextField.Font;
            resourceDictionary [ClassificationFormatDefinition.FontRenderingSizeId] = TextField.Font.PointSize - 1;
            editorFormat.SetProperties("Plain Text", resourceDictionary);

            var textBuffer = textBufferFactory.CreateTextBuffer("", contentType);

            editor = factory.CreateTextView(textBuffer);
            editor.Options.SetOptionValue(DefaultTextViewOptions.UseVisibleWhitespaceId, false);
            editor.Options.SetOptionValue(DefaultTextViewOptions.AppearanceCategory, appearanceCategory);
            editor.VisualElement.TranslatesAutoresizingMaskIntoConstraints = false;
            editorTextView = new NSView {
                TranslatesAutoresizingMaskIntoConstraints = false, WantsLayer = true
            };
            editorTextView.Layer.BackgroundColor = NSColor.White.CGColor;
            editorTextView.AddSubview(editor.VisualElement);

            editor.VisualElement.TopAnchor.ConstraintEqualToAnchor(editorTextView.TopAnchor).Active       = true;
            editor.VisualElement.LeftAnchor.ConstraintEqualToAnchor(editorTextView.LeftAnchor).Active     = true;
            editor.VisualElement.RightAnchor.ConstraintEqualToAnchor(editorTextView.RightAnchor).Active   = true;
            editor.VisualElement.BottomAnchor.ConstraintEqualToAnchor(editorTextView.BottomAnchor).Active = true;

            editor.LostAggregateFocus += OnEditorLostFocus;
        }