Пример #1
0
        public WidgetTreePopup(Stetic.IProject project) : base(WindowType.Popup)
        {
            this.project = project;
            Gtk.Frame frame = new Frame();
            frame.ShadowType = Gtk.ShadowType.Out;
            Add(frame);

            Gtk.ScrolledWindow sc = new ScrolledWindow();
            sc.VscrollbarPolicy = PolicyType.Automatic;
            sc.HscrollbarPolicy = PolicyType.Automatic;
            frame.Add(sc);

            tree                = new TreeView();
            store               = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), typeof(Widget));
            tree.Model          = store;
            tree.HeadersVisible = false;

            TreeViewColumn     col = new TreeViewColumn();
            CellRendererPixbuf cr  = new CellRendererPixbuf();

            col.PackStart(cr, false);
            col.AddAttribute(cr, "pixbuf", 0);

            CellRendererText tr = new CellRendererText();

            col.PackStart(tr, true);
            col.AddAttribute(tr, "markup", 1);

            tree.AppendColumn(col);

            tree.ButtonReleaseEvent += OnButtonRelease;
            tree.RowActivated       += OnButtonRelease;
            sc.Add(tree);
            tree.GrabFocus();
        }
Пример #2
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);
        }
Пример #3
0
		public EditIconFactoryDialog (Gtk.Window parent, Stetic.IProject project, ProjectIconFactory iconFactory)
		{
			this.iconFactory = iconFactory;
			this.parent = parent;
			this.project = project;
			
			Glade.XML xml = new Glade.XML (null, "stetic.glade", "EditIconFactoryDialog", null);
			xml.Autoconnect (this);
			
			customIconList = new ProjectIconList (project, iconFactory);
			iconListScrolledwindow.AddWithViewport (customIconList);
		}
Пример #4
0
        public EditIconFactoryDialog(Gtk.Window parent, Stetic.IProject project, ProjectIconFactory iconFactory)
        {
            this.iconFactory = iconFactory;
            this.parent      = parent;
            this.project     = project;

            Glade.XML xml = new Glade.XML(null, "stetic.glade", "EditIconFactoryDialog", null);
            xml.Autoconnect(this);

            customIconList = new ProjectIconList(project, iconFactory);
            iconListScrolledwindow.AddWithViewport(customIconList);
        }
Пример #5
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);
        }
        protected override void Initialize()
        {
            base.Initialize();
            string name = (string)Value;

            if (name != null)
            {
                Stetic.ObjectWrapper w       = Stetic.ObjectWrapper.Lookup(Instance);
                Stetic.IProject      project = w.Project;
                Gdk.Pixbuf           px      = project.IconFactory.RenderIcon(project, name, ImageSize);
                if (px != null)
                {
                    Image = px;
                    label = name;
                    return;
                }

                Gtk.StockItem item = Gtk.Stock.Lookup(name);
                label = item.Label != null && item.Label.Length > 0 ? item.Label : name;
                label = label.Replace("_", "");

                Gtk.IconSet iset = Gtk.IconFactory.LookupDefault(name);
                if (iset == null)
                {
                    Image = WidgetUtils.MissingIcon;
                }
                else
                {
                    Image = iset.RenderIcon(new Gtk.Style(), Gtk.TextDirection.Ltr, Gtk.StateType.Normal, Gtk.IconSize.Menu, null, "");
                }
            }
            else
            {
                Image = null;
                label = "";
            }
        }
Пример #7
0
        public SelectIconDialog(Gtk.Window parent, Stetic.IProject project)
        {
            this.parent = parent;
            this.project = project;

            Glade.XML xml = new Glade.XML (null, "stetic.glade", "SelectIconDialog", null);
            xml.Autoconnect (this);

            // Stock icon list

            iconList = new StockIconList ();
            iconList.SelectionChanged += new EventHandler (OnIconSelectionChanged);
            iconScrolledwindow.AddWithViewport (iconList);

            // Custom icon list

            customIconList = new ProjectIconList (project, project.IconFactory);
            customIconList.SelectionChanged += new EventHandler (OnCustomIconSelectionChanged);
            customIconScrolledwindow.AddWithViewport (customIconList);
            dialog.ShowAll ();

            UpdateIconSelection ();
            UpdateButtons ();
        }
Пример #8
0
        public SelectIconDialog(Gtk.Window parent, Stetic.IProject project)
        {
            this.parent  = parent;
            this.project = project;

            Glade.XML xml = new Glade.XML(null, "stetic.glade", "SelectIconDialog", null);
            xml.Autoconnect(this);

            // Stock icon list

            iconList = new StockIconList();
            iconList.SelectionChanged += new EventHandler(OnIconSelectionChanged);
            iconScrolledwindow.AddWithViewport(iconList);

            // Custom icon list

            customIconList = new ProjectIconList(project, project.IconFactory);
            customIconList.SelectionChanged += new EventHandler(OnCustomIconSelectionChanged);
            customIconScrolledwindow.AddWithViewport(customIconList);
            dialog.ShowAll();

            UpdateIconSelection();
            UpdateButtons();
        }
Пример #9
0
        public SelectImageDialog(Gtk.Window parent, Stetic.IProject project)
        {
            this.parent  = parent;
            this.project = project;
            Glade.XML xml = new Glade.XML(null, "stetic.glade", "SelectImageDialog", null);
            xml.Autoconnect(this);

            // Stock icon list

            iconList = new ThemedIconList();
            iconList.SelectionChanged += new EventHandler(OnIconSelectionChanged);
            iconScrolledwindow.AddWithViewport(iconList);

            // Icon Sizes

            foreach (IconSize s in Enum.GetValues(typeof(Gtk.IconSize)))
            {
                if (s != IconSize.Invalid)
                {
                    iconSizeCombo.AppendText(s.ToString());
                }
            }
            iconSizeCombo.Active = 0;

            // Resource list

            resourceListStore  = new Gtk.ListStore(typeof(Gdk.Pixbuf), typeof(string), typeof(string));
            resourceList.Model = resourceListStore;

            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn();

            Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf();
            pr.Xpad = 3;
            col.PackStart(pr, false);
            col.AddAttribute(pr, "pixbuf", 0);

            Gtk.CellRendererText crt = new Gtk.CellRendererText();
            col.PackStart(crt, true);
            col.AddAttribute(crt, "markup", 1);

            resourceList.AppendColumn(col);
            resourceProvider = project.ResourceProvider;
            if (resourceProvider == null)
            {
                buttonAdd.Sensitive    = false;
                buttonRemove.Sensitive = false;
            }
            FillResources();
            resourceList.Selection.Changed += OnResourceSelectionChanged;

            if (project.FolderName != null)
            {
                fileChooser.SetCurrentFolder(project.ImagesRootPath);
            }

            fileChooser.SelectionChanged += delegate(object s, EventArgs a) {
                UpdateButtons();
            };

            fileChooser.FileActivated += delegate(object s, EventArgs a) {
                if (Icon != null)
                {
                    if (Validate())
                    {
                        dialog.Respond(Gtk.ResponseType.Ok);
                    }
                }
            };

            okButton.Clicked += OnOkClicked;

            UpdateButtons();
        }
Пример #10
0
		public SelectImageDialog (Gtk.Window parent, Stetic.IProject project)
		{
			this.parent = parent;
			this.project = project;
			Glade.XML xml = new Glade.XML (null, "stetic.glade", "SelectImageDialog", null);
			xml.Autoconnect (this);
			
			// Stock icon list
			
			iconList = new ThemedIconList ();
			iconList.SelectionChanged += new EventHandler (OnIconSelectionChanged);
			iconScrolledwindow.AddWithViewport (iconList);
			
			// Icon Sizes
			
			foreach (IconSize s in Enum.GetValues (typeof(Gtk.IconSize))) {
				if (s != IconSize.Invalid)
					iconSizeCombo.AppendText (s.ToString ());
			}
			iconSizeCombo.Active = 0;
			
			// Resource list
			
			resourceListStore = new Gtk.ListStore (typeof(Gdk.Pixbuf), typeof(string), typeof(string));
			resourceList.Model = resourceListStore;
			
			Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
			
			Gtk.CellRendererPixbuf pr = new Gtk.CellRendererPixbuf ();
			pr.Xpad = 3;
			col.PackStart (pr, false);
			col.AddAttribute (pr, "pixbuf", 0);
			
			Gtk.CellRendererText crt = new Gtk.CellRendererText ();
			col.PackStart (crt, true);
			col.AddAttribute (crt, "markup", 1);
			
			resourceList.AppendColumn (col);
			resourceProvider = project.ResourceProvider;
			if (resourceProvider == null) {
				buttonAdd.Sensitive = false;
				buttonRemove.Sensitive = false;
			}
			FillResources ();
			resourceList.Selection.Changed += OnResourceSelectionChanged;
			
			if (project.FileName != null)
				fileChooser.SetCurrentFolder (project.ImagesRootPath);

			fileChooser.SelectionChanged += delegate (object s, EventArgs a) {
				UpdateButtons ();
			};

			fileChooser.FileActivated += delegate (object s, EventArgs a) {
				if (Icon != null) {
					if (Validate ())
						dialog.Respond (Gtk.ResponseType.Ok);
				}
			};
			
			okButton.Clicked += OnOkClicked;

			UpdateButtons ();
		}
Пример #11
0
		public WidgetTreePopup (Stetic.IProject project): base (WindowType.Popup)
		{
			this.project = project;
			Gtk.Frame frame = new Frame ();
			frame.ShadowType = Gtk.ShadowType.Out;
			Add (frame);
			
			Gtk.ScrolledWindow sc = new ScrolledWindow ();
			sc.VscrollbarPolicy = PolicyType.Automatic;
			sc.HscrollbarPolicy = PolicyType.Automatic;
			frame.Add (sc);
			
			tree = new TreeView ();
			store = new TreeStore (typeof(Gdk.Pixbuf), typeof(string), typeof(Widget));
			tree.Model = store;
			tree.HeadersVisible = false;
			
			TreeViewColumn col = new TreeViewColumn ();
			CellRendererPixbuf cr = new CellRendererPixbuf ();
			col.PackStart (cr, false);
			col.AddAttribute (cr, "pixbuf", 0);
			
			CellRendererText tr = new CellRendererText ();
			col.PackStart (tr, true);
			col.AddAttribute (tr, "markup", 1);
			
			tree.AppendColumn (col);
			
			tree.ButtonReleaseEvent += OnButtonRelease;
			tree.RowActivated += OnButtonRelease;
			sc.Add (tree);
			tree.GrabFocus ();
			
		}