示例#1
0
            public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
            {
                var h         = Handler;
                var totalSize = splitView.IsVertical ? splitView.Bounds.Width : splitView.Bounds.Height;

                if (h.Panel1?.Visible != true)
                {
                    return(0);
                }

                if (h.Panel2?.Visible != true)
                {
                    return((nfloat)Math.Max(0, totalSize - splitView.DividerThickness));
                }

                if (!h.Enabled)
                {
                    return(h.Position);
                }

                if ((h.Panel1MinimumSize > 0 || h.Panel2MinimumSize > 0))
                {
                    // constrain to panel 2 minimum size
                    proposedPosition = (nfloat)Math.Min(totalSize - h.panel2MinimumSize - splitView.DividerThickness, proposedPosition);
                    // constrain to panel 1 minimum size
                    proposedPosition = (nfloat)Math.Max(proposedPosition, h.Panel1MinimumSize);
                    // constrain to size of control
                    proposedPosition = (nfloat)Math.Min(totalSize, proposedPosition);
                }

                return((nfloat)Math.Round(proposedPosition));
            }
示例#2
0
 public MainWindowView(IntPtr handle) : base(handle)
 {
     bottomView = Subviews.First(x => x.Identifier == "PlaybackBar");
     bottomView.AddSubview(new PlaybackBar(bottomView.Bounds));
     topView = Subviews.OfType <NSSplitView> ().First();
     LayoutSubviews();
 }
 public override nfloat SetMaxCoordinateOfSubview(NSSplitView splitView, nfloat proposedMaximumPosition, nint subviewDividerIndex)
 {
     if (subviewDividerIndex == 0)
     {
         return proposedMaximumPosition - 50;
     }
     return proposedMaximumPosition - 250;
 }
 public override nfloat SetMaxCoordinateOfSubview(NSSplitView splitView, nfloat proposedMaximumPosition, nint subviewDividerIndex)
 {
     if (subviewDividerIndex == 0)
     {
         return(proposedMaximumPosition - 50);
     }
     return(proposedMaximumPosition - 250);
 }
示例#5
0
            public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
            {
                if (subviewDividerIndex != 0)
                {
                    return(proposedPosition);
                }
                var middle = (splitView.MaxPositionOfDivider(0) - splitView.MinPositionOfDivider(0)) / 2;

                return(proposedPosition < middle ? middle : proposedPosition);
            }
示例#6
0
 public override float ConstrainSplitPosition(NSSplitView splitView, float proposedPosition, int subviewDividerIndex)
 {
     if (Handler.Enabled)
     {
         return(proposedPosition);
     }
     else
     {
         return(Handler.Position);
     }
 }
示例#7
0
            public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
            {
                var h = Handler;

                if (h == null)
                {
                    return(proposedPosition);
                }
                var totalSize = splitView.IsVertical ? splitView.Bounds.Width : splitView.Bounds.Height;

                if (h.Panel1?.Visible != true)
                {
                    return(0);
                }

                if (h.Panel2?.Visible != true)
                {
                    return((nfloat)Math.Max(0, totalSize - splitView.DividerThickness));
                }

                if (!h.Enabled)
                {
                    return(h.Position);
                }

                if ((h.Panel1MinimumSize > 0 || h.Panel2MinimumSize > 0))
                {
                    // constrain to panel 2 minimum size
                    proposedPosition = (nfloat)Math.Min(totalSize - h.panel2MinimumSize - splitView.DividerThickness, proposedPosition);
                    // constrain to panel 1 minimum size
                    proposedPosition = (nfloat)Math.Max(proposedPosition, h.Panel1MinimumSize);
                    // constrain to size of control
                    proposedPosition = (nfloat)Math.Min(totalSize, proposedPosition);
                }

                h.TriggerChangeStarted();

                var args = new SplitterPositionChangingEventArgs((int)Math.Round(proposedPosition));

                h.Callback.OnPositionChanging(h.Widget, args);
                if (args.Cancel)
                {
                    return(h.Position);
                }


                return((nfloat)Math.Round(proposedPosition));
            }
		public ViewController()
		{
			var split = new NSSplitView (new CGRect (0.0f, 0.0f, 400.0f, 400.0f)) { DividerStyle = NSSplitViewDividerStyle.Thin };
			var text = new NSTextField(new CGRect(0.0f, 0.0f, 64.0f, 16.0f));
			split.AddSubview (text);
			var button = new NSButton (new CGRect (0.0f, 0.0f, 64.0f, 16.0f)) {
				Title = "Go",
				StringValue = "https://www.google.com/" // TODO: This doesn't get set for some reason
			};
			button.Activated += (object sender, EventArgs e) => m_webView.LoadRequest (new NSUrlRequest (new NSUrl (text.StringValue)));
			split.AddSubview (button);

			var config = new WKWebViewConfiguration ();
			config.Preferences.SetValueForKey(NSNumber.FromBoolean(true), new NSString("developerExtrasEnabled"));
			m_webView = new WKWebView(new CGRect(0.0f, 0.0f, 400.0f, 400.0f), config);
			split.AddSubview (m_webView);
			View = split;
		}
 /// <inheritdoc/>
 public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
 {
     return(proposedPosition);
 }
 /// <inheritdoc/>
 public override bool CanCollapse(NSSplitView splitView, NSView subview)
 {
     return(true);
 }
 /// <inheritdoc/>
 public override bool ShouldHideDivider(NSSplitView splitView, nint dividerIndex)
 {
     return(true);
 }
示例#12
0
 public override nfloat SetMinCoordinateOfSubview(NSSplitView splitView, nfloat proposedMinimumPosition, nint subviewDividerIndex)
 {
     return(proposedMinimumPosition + 300);
 }
示例#13
0
 public override float SetMinCoordinateOfSubview(NSSplitView splitView, float proposedMinimumPosition, int subviewDividerIndex)
 {
     return 230;
 }
示例#14
0
		private NSRect splitView(NSSplitView splitView) additionalEffectiveRectOfDividerAtIndex(NSInteger dividerIndex)
示例#15
0
		private bool splitView(NSSplitView splitView) shouldHideDividerAtIndex(NSInteger dividerIndex)
示例#16
0
 public override CGRect GetEffectiveRect(NSSplitView splitView, CGRect proposedEffectiveRect, CGRect drawnRect,
                                         nint dividerIndex)
 {
     return(CGRect.Empty);
 }
示例#17
0
 public override nfloat ConstrainSplitPosition(NSSplitView splitView, nfloat proposedPosition, nint subviewDividerIndex)
 {
     return(Handler.Enabled ? proposedPosition : Handler.Position);
 }
示例#18
0
 public override void Resize(NSSplitView splitView, CGSize oldSize)
 {
     Handler?.ResizeSubviews(oldSize);
 }
示例#19
0
 public override void Resize(NSSplitView splitView, System.Drawing.SizeF oldSize)
 {
     SplitterHandler.ResizeSubviews(Handler, oldSize);
 }
示例#20
0
 private void SplitViewDidResize(NSSplitView splitView)
 {
     SetTableColumns();
 }
示例#21
0
        public InspectorWindow(IInspectDelegate inspectorDelegate, CGRect frame) : base(frame, NSWindowStyle.Titled | NSWindowStyle.Resizable, NSBackingStore.Buffered, false)
        {
            this.inspectorDelegate    = inspectorDelegate;
            ShowsToolbarButton        = false;
            MovableByWindowBackground = false;

            ContentView         = new NSSplitView();
            propertyEditorPanel = new PropertyEditorPanel();

            editorProvider = new PropertyEditorProvider();

            propertyEditorPanel.TargetPlatform = new TargetPlatform(editorProvider)
            {
                SupportsCustomExpressions = true,
                SupportsMaterialDesign    = true,
            };

            var currentThemeStyle = NSUserDefaults.StandardUserDefaults.StringForKey("AppleInterfaceStyle") ?? "Light";

            PropertyEditorPanel.ThemeManager.Theme = currentThemeStyle == "Dark" ? PropertyEditorTheme.Dark : PropertyEditorTheme.Light;

            //var stackView = NativeViewHelper.CreateVerticalStackView(margin);
            //splitView.AddSubview(stackView);

            //stackView.LeftAnchor.ConstraintEqualToAnchor(contentView.LeftAnchor, margin).Active = true;
            //stackView.RightAnchor.ConstraintEqualToAnchor(contentView.RightAnchor, -margin).Active = true;
            //stackView.TopAnchor.ConstraintEqualToAnchor(contentView.TopAnchor, margin).Active = true;

            //constraint = stackView.HeightAnchor.ConstraintEqualToConstant(contentView.Frame.Height - margin * 2);
            //constraint.Active = true;
            outlineView = new OutlineView();
            var outlineViewScrollView = new ScrollContainerView(outlineView);

            outlineView.SelectionNodeChanged += (s, e) =>
            {
                if (outlineView.SelectedNode is NodeView nodeView)
                {
                    RaiseFirstResponder?.Invoke(this, nodeView.Wrapper);
                }
            };

            outlineView.KeyPress += (sender, e) =>
            {
                if (e == DeleteKey)
                {
                    if (outlineView.SelectedNode is NodeView nodeView)
                    {
                        RaiseDeleteItem?.Invoke(this, nodeView.Wrapper);
                    }
                }
            };

            //TOOLBAR
            var toolbarTab = new NSTabView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            var toolbarTabViewWrapper = new MacTabWrapper(toolbarTab);

            toolbarTab.WantsLayer            = true;
            toolbarTab.Layer.BackgroundColor = NSColor.Red.CGColor;

            splitView.AddArrangedSubview(toolbarTab);

            //toolbarTab.LeftAnchor.ConstraintEqualToAnchor(contentView.LeftAnchor, margin).Active = true;
            //toolbarTab.RightAnchor.ConstraintEqualToAnchor(contentView.RightAnchor, -margin).Active = true;
            //toolbarTab.TopAnchor.ConstraintEqualToAnchor(contentView.TopAnchor, margin).Active = true;

            /////////////////

            var toolbarTabItem = new NSTabViewItem();

            toolbarTabItem.Label = "Toolbar";

            var toolbarStackView           = NativeViewHelper.CreateVerticalStackView();
            var toolbarHorizontalStackView = NativeViewHelper.CreateHorizontalStackView();

            toolbarSearchTextField          = new NSSearchField();
            toolbarSearchTextField.Changed += (object sender, EventArgs e) =>
            {
                Search();
            };

            toolbarHorizontalStackView.AddArrangedSubview(toolbarSearchTextField);

            var compactModeToggleButton = new ToggleButton();

            //compactModeToggleButton.Image = inspectorDelegate.GetImageResource("compact-display-16.png").NativeObject as NSImage;
            compactModeToggleButton.ToolTip = "Use compact display";
            toolbarHorizontalStackView.AddArrangedSubview(compactModeToggleButton);

            toolbarStackView.AddArrangedSubview(toolbarHorizontalStackView);

            toolbarView = new MacInspectorToolbarView();
            var toolbarViewScrollView = new ScrollContainerView(toolbarView);

            toolbarStackView.AddArrangedSubview(toolbarViewScrollView);

            toolbarTabItem.View = toolbarStackView;
            toolbarView.ActivateSelectedItem += (sender, e) =>
            {
                RaiseInsertItem?.Invoke(this, toolbarView.SelectedItem.TypeOfView);
            };

            var outlineTabItem = new NSTabViewItem();

            outlineTabItem.Label = "View Hierarchy";
            outlineTabItem.View  = outlineViewScrollView;

            toolbarTab.Add(outlineTabItem);
            toolbarTab.Add(toolbarTabItem);

            foreach (var module in InspectorContext.Current.Modules)
            {
                if (!module.IsEnabled)
                {
                    continue;
                }
                module.Load(this, toolbarTabViewWrapper);
            }

            //===================

            //Method list view
            methodListView = new MethodListView();
            methodListView.AddColumn(new NSTableColumn("col")
            {
                Title = "Methods"
            });
            methodListView.DoubleClick += MethodListView_DoubleClick;

            scrollView = new ScrollContainerView(methodListView);
            scrollView.TranslatesAutoresizingMaskIntoConstraints = false;

            var titleContainter = NativeViewHelper.CreateHorizontalStackView();

            //titleContainter.WantsLayer = true;
            //titleContainter.Layer.BackgroundColor = NSColor.Gray.CGColor;

            methodSearchView = new NSSearchField()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            titleContainter.AddArrangedSubview(methodSearchView);
            methodSearchView.WidthAnchor.ConstraintEqualToConstant(180).Active = true;

            IImageWrapper  invokeImage  = inspectorDelegate.GetImageResource("execute-16.png");
            IButtonWrapper invokeButton = inspectorDelegate.GetImageButton(invokeImage);

            invokeButton.SetTooltip("Invoke Method!");
            invokeButton.SetWidth(ButtonWidth);

            titleContainter.AddArrangedSubview((NSView)invokeButton.NativeObject);
            invokeButton.Pressed += (s, e) => InvokeSelectedView();

            titleContainter.AddArrangedSubview(NativeViewHelper.CreateLabel("Result: "));

            resultMessage = NativeViewHelper.CreateLabel("");
            resultMessage.LineBreakMode = NSLineBreakMode.ByWordWrapping;

            titleContainter.AddArrangedSubview(resultMessage);

            var methodStackPanel = NativeViewHelper.CreateVerticalStackView();

            methodStackPanel.TranslatesAutoresizingMaskIntoConstraints = false;
            methodStackPanel.AddArrangedSubview(titleContainter);
            titleContainter.LeftAnchor.ConstraintEqualToAnchor(methodStackPanel.LeftAnchor, 0).Active   = true;
            titleContainter.RightAnchor.ConstraintEqualToAnchor(methodStackPanel.RightAnchor, 0).Active = true;

            methodStackPanel.AddArrangedSubview(scrollView);
            /////

            var tabPropertyPanel = new NSTabViewItem();

            tabPropertyPanel.View  = propertyEditorPanel;
            tabPropertyPanel.Label = "Properties";

            var tabMethod = new NSTabViewItem();

            tabMethod.View.AddSubview(methodStackPanel);
            methodStackPanel.LeftAnchor.ConstraintEqualToAnchor(tabMethod.View.LeftAnchor, 0).Active     = true;
            methodStackPanel.RightAnchor.ConstraintEqualToAnchor(tabMethod.View.RightAnchor, 0).Active   = true;
            methodStackPanel.TopAnchor.ConstraintEqualToAnchor(tabMethod.View.TopAnchor, 0).Active       = true;
            methodStackPanel.BottomAnchor.ConstraintEqualToAnchor(tabMethod.View.BottomAnchor, 0).Active = true;

            tabMethod.Label = "Methods";

            tabView = new NSTabView()
            {
                TranslatesAutoresizingMaskIntoConstraints = false
            };
            tabView.Add(tabPropertyPanel);
            tabView.Add(tabMethod);
            splitView.AddArrangedSubview(tabView);

            //tabView.LeftAnchor.ConstraintEqualToAnchor(stackView.LeftAnchor, 0).Active = true;
            //tabView.RightAnchor.ConstraintEqualToAnchor(stackView.RightAnchor, 0).Active = true;

            methodSearchView.Activated += (sender, e) =>
            {
                if (viewSelected != null)
                {
                    methodListView.SetObject(viewSelected.NativeObject, methodSearchView.StringValue);
                }
            };

            compactModeToggleButton.Activated += (sender, e) =>
            {
                toolbarView.ShowOnlyImages(!toolbarView.IsImageMode);
            };

            toolbarView.ShowOnlyImages(true);
            splitView.SetPositionOfDivider(300, 0);
        }
示例#22
0
 public override void Resize(NSSplitView splitView, CGSize oldSize)
 {
     SplitterHandler.ResizeSubviews(Handler, oldSize);
 }
示例#23
0
		private CGFloat splitView(NSSplitView splitView) constrainSplitPosition(CGFloat proposedPosition) ofSubviewAt(NSInteger dividerIndex)
示例#24
0
		private CGFloat splitView(NSSplitView splitView) constrainMaxCoordinate(CGFloat proposedMax) ofSubviewAt(NSInteger dividerIndex)
示例#25
0
		private void splitView(NSSplitView splitView) resizeSubviewsWithOldSize(NSSize oldSize)
示例#26
0
			public override float ConstrainSplitPosition (NSSplitView splitView, float proposedPosition, int subviewDividerIndex)
			{
				if (subviewDividerIndex != 0)
					return proposedPosition;
				var middle = (splitView.MaxPositionOfDivider (0) - splitView.MinPositionOfDivider (0)) / 2;
				return proposedPosition < middle ? middle : proposedPosition;
			}
示例#27
0
        public override void Resize(NSSplitView splitView, CoreGraphics.CGSize oldSize)
        {
            //Mvx.Trace(MvxTraceLevel.Diagnostic,oldSize.Width.ToString());

            splitView.AdjustSubviews();
        }