Inheritance: Gtk.Container
Ejemplo n.º 1
0
        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}");
            }
        }
Ejemplo n.º 2
0
		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}");
			}
		}
Ejemplo n.º 3
0
 internal void Connect(NSViewContainer2 container)
 {
     this.container = container;
     cw             = new WidgetWithNativeWindow2(this);
     cw.Add(embeddedWidget);
     container.Add(cw);
     cw.Show();
 }
Ejemplo n.º 4
0
 public override void RemoveFromSuperview()
 {
     base.RemoveFromSuperview();
     if (container != null)
     {
         container.Remove(cw);
         container = null;
     }
 }
Ejemplo n.º 5
0
        public override void ViewDidMoveToSuperview()
        {
            base.ViewDidMoveToSuperview();
            var c = NSViewContainer2.GetContainer(Superview);

            if (c != null)
            {
                Connect(c);
            }
        }
Ejemplo n.º 6
0
		public override void RemoveFromSuperview()
		{
			base.RemoveFromSuperview();
			if (container != null)
			{
				container.Remove(cw);
				container = null;
			}
		}	}
Ejemplo n.º 7
0
		internal void Connect(NSViewContainer2 container)
		{
			this.container = container;
			cw = new WidgetWithNativeWindow2(this);
			cw.Add(embeddedWidget);
			container.Add(cw);
			cw.Show();
		}