Ejemplo n.º 1
0
        public ThemedIconBrowser(Gtk.Window parent) :
            base("Select a Themed Icon", parent, Gtk.DialogFlags.Modal,
                 Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                 Gtk.Stock.Ok, Gtk.ResponseType.Ok)
        {
            HasSeparator     = false;
            BorderWidth      = 12;
            VBox.Spacing     = 18;
            VBox.BorderWidth = 0;

            DefaultResponse = Gtk.ResponseType.Ok;

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            VBox.PackStart(hbox, false, false, 0);

            entry            = new Gtk.Entry();
            entry.Activated += DoFind;
            hbox.PackStart(entry);

            Gtk.Button button = new Gtk.Button(Gtk.Stock.Find);
            button.Clicked += DoFind;
            hbox.PackStart(button, false, false, 0);

            ScrolledWindow scwin = new Gtk.ScrolledWindow();

            scwin.SizeRequested += ScrolledWindowSizeRequested;
            VBox.PackStart(scwin, true, true, 0);
            scwin.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
            scwin.ShadowType = Gtk.ShadowType.In;

            list = new ThemedIconList();
            scwin.Add(list);
            list.SelectionChanged += ListSelectionChanged;
            list.Activated        += ListActivated;
            SetResponseSensitive(Gtk.ResponseType.Ok, false);

            VBox.ShowAll();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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 ();
		}
Ejemplo n.º 4
0
        public ThemedIconBrowser(Gtk.Window parent)
            : base("Select a Themed Icon", parent, Gtk.DialogFlags.Modal,
			      Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
			      Gtk.Stock.Ok, Gtk.ResponseType.Ok)
        {
            HasSeparator = false;
            BorderWidth = 12;
            VBox.Spacing = 18;
            VBox.BorderWidth = 0;

            DefaultResponse = Gtk.ResponseType.Ok;

            Gtk.HBox hbox = new Gtk.HBox (false, 12);
            VBox.PackStart (hbox, false, false, 0);

            entry = new Gtk.Entry ();
            entry.Activated += DoFind;
            hbox.PackStart (entry);

            Gtk.Button button = new Gtk.Button (Gtk.Stock.Find);
            button.Clicked += DoFind;
            hbox.PackStart (button, false, false, 0);

            ScrolledWindow scwin = new Gtk.ScrolledWindow ();
            scwin.SizeRequested += ScrolledWindowSizeRequested;
            VBox.PackStart (scwin, true, true, 0);
            scwin.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
            scwin.ShadowType = Gtk.ShadowType.In;

            list = new ThemedIconList ();
            scwin.Add (list);
            list.SelectionChanged += ListSelectionChanged;
            list.Activated += ListActivated;
            SetResponseSensitive (Gtk.ResponseType.Ok, false);

            VBox.ShowAll ();
        }