public override void Initialize(IPadWindow window)
        {
            base.Initialize(window);

            // Call ctors
            inputEditor = new TextEditor() { Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80 };
            editor = new TextEditor() { Name = "output", Events = Gdk.EventMask.AllEventsMask };
            vpaned = new Gtk.VPaned();
            var scr1 = new Gtk.ScrolledWindow();
            var scr2 = new Gtk.ScrolledWindow();

            // Init layout
            scr1.ShadowType = Gtk.ShadowType.In;
            scr1.Child = inputEditor;
            vpaned.Add1(scr1);
            scr1.ShowAll();
            inputEditor.ShowAll();

            scr2.ShadowType = Gtk.ShadowType.In;
            scr2.Child = editor;
            vpaned.Add2(scr2);
            scr2.ShowAll();
            editor.ShowAll();

            vpaned.ShowAll();

            // Init editors
            var o = editor.Options;
            inputEditor.Options = o;
            o.ShowLineNumberMargin = false;
            o.ShowFoldMargin = false;
            o.ShowIconMargin = false;

            editor.Document.ReadOnly = true;
            inputEditor.Text = PropertyService.Get(lastInputStringPropId, string.Empty);
            editor.Text = string.Empty;
            editor.Document.SyntaxMode = new Highlighting.DSyntaxMode();
            inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode();
            editor.Document.MimeType = Formatting.DCodeFormatter.MimeType;
            inputEditor.Document.MimeType = Formatting.DCodeFormatter.MimeType;

            // Init toolbar
            var tb = window.GetToolbar(Gtk.PositionType.Top);

            executeButton = new Gtk.Button();
            executeButton.Image = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu);
            executeButton.TooltipText = "Evaluates the expression typed in the upper input editor.";
            executeButton.Clicked += Execute;
            tb.Add(executeButton);

            abortButton = new Gtk.Button();
            abortButton.Sensitive = false;
            abortButton.Image = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu);
            abortButton.TooltipText = "Stops the evaluation.";
            abortButton.Clicked += (object sender, EventArgs e) => AbortExecution();
            tb.Add(abortButton);

            tb.ShowAll();
        }
Esempio n. 2
0
        Gtk.Widget CreateFakeWidget(string typeName)
        {
            Stetic.Custom c = new Stetic.Custom();
            // Give it some default size
            c.WidthRequest  = 20;
            c.HeightRequest = 20;

            Gtk.Container box = null;

            switch (typeClassDescriptor.Name)
            {
            case "Gtk.Alignment":
                box = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
                break;

            case "Gtk.Fixed":
                box = new Gtk.Alignment(0.5f, 0.5f, 1f, 1f);
                break;

            case "Gtk.Frame":
                box = new Gtk.Frame();
                break;

            case "Gtk.Box":
            case "Gtk.HBox":
            {
                Gtk.HBox cc = new Gtk.HBox();
                cc.PackStart(c, true, true, 0);
                return(cc);
            }

            case "Gtk.VBox":
            {
                Gtk.VBox cc = new Gtk.VBox();
                cc.PackStart(c, true, true, 0);
                return(cc);
            }

            case "Gtk.Paned":
            case "Gtk.VPaned":
            {
                Gtk.VPaned cc = new Gtk.VPaned();
                cc.Add1(c);
                return(cc);
            }

            case "Gtk.HPaned":
            {
                Gtk.HPaned cc = new Gtk.HPaned();
                cc.Add1(c);
                return(cc);
            }

            case "Gtk.Notebook":
            {
                Gtk.Notebook nb = new Gtk.Notebook();
                nb.ShowTabs = false;
                nb.AppendPage(c, null);
                return(nb);
            }

            case "Gtk.ScrolledWindow":
            {
                Gtk.ScrolledWindow cc = new Gtk.ScrolledWindow();
                cc.VscrollbarPolicy = Gtk.PolicyType.Never;
                cc.HscrollbarPolicy = Gtk.PolicyType.Never;
                cc.AddWithViewport(c);
                return(cc);
            }

            case "Gtk.Table":
            {
                Gtk.Table t = new Gtk.Table(1, 1, false);
                t.Attach(c, 0, 1, 0, 1);
                return(t);
            }

            case "Gtk.ButtonBox":
                return(new Gtk.HButtonBox());
            }
            if (box != null)
            {
                box.Add(c);
                return(box);
            }
            else
            {
                Stetic.CustomWidget custom = new Stetic.CustomWidget();
                if (custom.Child != null)
                {
                    custom.Remove(custom.Child);
                }
                custom.Add(c);
                return(custom);
            }
        }
        public override void Initialize(IPadWindow window)
        {
            base.Initialize(window);

            // Call ctors
            inputEditor = new TextEditor()
            {
                Name = "input", Events = Gdk.EventMask.AllEventsMask, HeightRequest = 80
            };
            editor = new TextEditor()
            {
                Name = "output", Events = Gdk.EventMask.AllEventsMask
            };
            vpaned = new Gtk.VPaned();
            var scr1 = new Gtk.ScrolledWindow();
            var scr2 = new Gtk.ScrolledWindow();

            // Init layout
            scr1.ShadowType = Gtk.ShadowType.In;
            scr1.Child      = inputEditor;
            vpaned.Add1(scr1);
            scr1.ShowAll();
            inputEditor.ShowAll();

            scr2.ShadowType = Gtk.ShadowType.In;
            scr2.Child      = editor;
            vpaned.Add2(scr2);
            scr2.ShowAll();
            editor.ShowAll();

            vpaned.ShowAll();

            // Init editors
            var o = editor.Options;

            inputEditor.Options    = o;
            o.ShowLineNumberMargin = false;
            o.ShowFoldMargin       = false;
            o.ShowIconMargin       = false;

            editor.Document.ReadOnly = true;
            inputEditor.Text         = PropertyService.Get(lastInputStringPropId, string.Empty);
            editor.Text = string.Empty;
            editor.Document.SyntaxMode      = new Highlighting.DSyntaxMode();
            inputEditor.Document.SyntaxMode = new Highlighting.DSyntaxMode();
            editor.Document.MimeType        = Formatting.DCodeFormatter.MimeType;
            inputEditor.Document.MimeType   = Formatting.DCodeFormatter.MimeType;

            // Init toolbar
            var tb = window.GetToolbar(Gtk.PositionType.Top);

            executeButton             = new Gtk.Button();
            executeButton.Image       = new Gtk.Image(Gtk.Stock.Execute, Gtk.IconSize.Menu);
            executeButton.TooltipText = "Evaluates the expression typed in the upper input editor.";
            executeButton.Clicked    += Execute;
            tb.Add(executeButton);

            abortButton             = new Gtk.Button();
            abortButton.Sensitive   = false;
            abortButton.Image       = new Gtk.Image(Gtk.Stock.Stop, Gtk.IconSize.Menu);
            abortButton.TooltipText = "Stops the evaluation.";
            abortButton.Clicked    += (object sender, EventArgs e) => AbortExecution();
            tb.Add(abortButton);

            tb.ShowAll();
        }
Esempio n. 4
0
		Gtk.Widget CreateFakeWidget (string typeName)
		{
			Stetic.Custom c = new Stetic.Custom ();
			// Give it some default size
			c.WidthRequest = 20;
			c.HeightRequest = 20;
			
			Gtk.Container box = null;
			
			switch (typeClassDescriptor.Name) {
				case "Gtk.Alignment":
					box = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
					break;
				case "Gtk.Fixed":
					box = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
					break;
				case "Gtk.Frame":
					box = new Gtk.Frame ();
					break;
				case "Gtk.Box":
				case "Gtk.HBox": {
					Gtk.HBox cc = new Gtk.HBox ();
					cc.PackStart (c, true, true, 0);
					return cc;
				}
				case "Gtk.VBox": {
					Gtk.VBox cc = new Gtk.VBox ();
					cc.PackStart (c, true, true, 0);
					return cc;
				}
				case "Gtk.Paned":
				case "Gtk.VPaned": {
					Gtk.VPaned cc = new Gtk.VPaned ();
					cc.Add1 (c);
					return cc;
				}
				case "Gtk.HPaned": {
					Gtk.HPaned cc = new Gtk.HPaned ();
					cc.Add1 (c);
					return cc;
				}
				case "Gtk.Notebook": {
					Gtk.Notebook nb = new Gtk.Notebook ();
					nb.ShowTabs = false;
					nb.AppendPage (c, null);
					return nb;
				}
				case "Gtk.ScrolledWindow": {
					Gtk.ScrolledWindow cc = new Gtk.ScrolledWindow ();
					cc.VscrollbarPolicy = Gtk.PolicyType.Never;
					cc.HscrollbarPolicy = Gtk.PolicyType.Never;
					cc.AddWithViewport (c);
					return cc;
				}
				case "Gtk.Table": {
					Gtk.Table t = new Gtk.Table (1, 1, false);
					t.Attach (c, 0, 1, 0, 1);
					return t;
				}
				case "Gtk.ButtonBox":
					return new Gtk.HButtonBox ();
			}
			if (box != null) {
				box.Add (c);
				return box;
			} else {
				Stetic.CustomWidget custom = new Stetic.CustomWidget ();
				if (custom.Child != null)
					custom.Remove (custom.Child);
				custom.Add (c);
				return custom;
			}
		}