public EditorView(ViewContent content) { try { this.content = content; var editorWidget = content.Control.GetNativeWidget <Gtk.Widget> (); editorWidget.ShowAll(); MonoDevelop.Components.Control previewNative; if (Platform.Instance.IsMac) { var editor = new GtkEmbed2(editorWidget); var editorEto = editor.ToEto(); preview = new PreviewEditorView(editorEto, null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text); var nspreview = XamMac2Helpers.ToNative(preview, true); var nsviewContainer = new NSViewContainer2(nspreview); previewNative = nsviewContainer; } else { preview = new PreviewEditorView(editorWidget.ToEto(), null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text); previewNative = Gtk2Helpers.ToNative(preview, true); } var commandRouterContainer = new CommandRouterContainer(previewNative, content, true); commandRouterContainer.ShowAll(); control = commandRouterContainer; content.DirtyChanged += content_DirtyChanged; IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged; ContentName = content.ContentName; } catch (Exception ex) { Debug.WriteLine($"{ex}"); } }
public EditorView(ViewContent content) { try { this.content = content; var editorWidget = content.Control.GetNativeWidget<Gtk.Widget> (); editorWidget.ShowAll (); MonoDevelop.Components.Control previewNative; if (Platform.Instance.IsMac) { var editor = new GtkEmbed2(editorWidget); var editorEto = editor.ToEto(); preview = new PreviewEditorView(editorEto, null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text); var nspreview = XamMac2Helpers.ToNative(preview, true); var nsviewContainer = new NSViewContainer2(nspreview); previewNative = nsviewContainer; } else { preview = new PreviewEditorView(editorWidget.ToEto(), null, null, () => content?.WorkbenchWindow?.Document?.Editor?.Text); previewNative = Gtk2Helpers.ToNative(preview, true); } var commandRouterContainer = new CommandRouterContainer (previewNative, content, true); commandRouterContainer.ShowAll (); control = commandRouterContainer; content.DirtyChanged += content_DirtyChanged; IdeApp.Workbench.ActiveDocumentChanged += Workbench_ActiveDocumentChanged; ContentName = content.ContentName; } catch (Exception ex) { Debug.WriteLine ($"{ex}"); } }
internal void Connect(NSViewContainer2 container) { this.container = container; cw = new WidgetWithNativeWindow2(this); cw.Add(embeddedWidget); container.Add(cw); cw.Show(); }
public override void RemoveFromSuperview() { base.RemoveFromSuperview(); if (container != null) { container.Remove(cw); container = null; } }
public override void ViewDidMoveToSuperview() { base.ViewDidMoveToSuperview(); var c = NSViewContainer2.GetContainer(Superview); if (c != null) { Connect(c); } }
public override void RemoveFromSuperview() { base.RemoveFromSuperview(); if (container != null) { container.Remove(cw); container = null; } } }
internal void Connect(NSViewContainer2 container) { this.container = container; cw = new WidgetWithNativeWindow2(this); cw.Add(embeddedWidget); container.Add(cw); cw.Show(); }