Exemplo n.º 1
0
        public override object CreateInstance(Stetic.IProject proj)
        {
            CustomWidget custom = new CustomWidget();

            Stetic.Custom c = new Stetic.Custom();
            // Give it some default size
            c.WidthRequest  = 20;
            c.HeightRequest = 20;
            custom.Add(c);
            return(c);
        }
Exemplo n.º 2
0
        public override object CreateInstance(Stetic.IProject proj)
        {
            Gtk.Widget res;

            if (useCustomWidgetBox)
            {
                res = CreateFakeWidget(wrapperClassDescriptor.Name);
                res.ShowAll();
            }
            else if (steticDefinition != null)
            {
                Gtk.Container w = Stetic.WidgetUtils.ImportWidget(proj, steticDefinition) as Gtk.Container;
                MakeChildrenUnselectable(w);
                res = w;
            }
            else
            {
                res = (Gtk.Widget)typeClassDescriptor.CreateInstance(proj);

                // If it is a custom widget and there is no stetic project for it, just
                // show it as a regular custom widget.
                Stetic.CustomWidget custom = res as Stetic.CustomWidget;
                if (custom != null)
                {
                    Stetic.Custom c = new Stetic.Custom();
                    // Give it some default size
                    c.WidthRequest  = 20;
                    c.HeightRequest = 20;
                    custom.Add(c);
                    custom.ShowAll();
                    res = custom;
                }
            }

            res.Name = widgetId;
            return(res);
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
		public override object CreateInstance (Stetic.IProject proj)
		{
			Gtk.Widget res;
			
			if (useCustomWidgetBox) {
				res = CreateFakeWidget (wrapperClassDescriptor.Name);
				res.ShowAll ();
			}
			else if (steticDefinition != null) {
				Gtk.Container w = Stetic.WidgetUtils.ImportWidget (proj, steticDefinition) as Gtk.Container;
				MakeChildrenUnselectable (w);
				res = w;
			}
			else {
				res = (Gtk.Widget) typeClassDescriptor.CreateInstance (proj);
				
				// If it is a custom widget and there is no stetic project for it, just
				// show it as a regular custom widget.
				Stetic.CustomWidget custom = res as Stetic.CustomWidget;
				if (custom != null) {
					Stetic.Custom c = new Stetic.Custom ();
					// Give it some default size
					c.WidthRequest = 20;
					c.HeightRequest = 20;
					custom.Add (c);
					custom.ShowAll ();
					res = custom;
				}
			}
			
			res.Name = widgetId;
			return res;
		}
Exemplo n.º 5
0
		public override object CreateInstance (Stetic.IProject proj)
		{
			CustomWidget custom = new CustomWidget ();
			Stetic.Custom c = new Stetic.Custom ();
			// Give it some default size
			c.WidthRequest = 20;
			c.HeightRequest = 20;
			custom.Add (c);
			return c;
		}
Exemplo n.º 6
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;
			}
		}