Esempio n. 1
0
        private void OnPixbufCellLayout(CellLayout layout, CellRenderer cell,
                                         TreeModel model, TreeIter iter)
        {
            CellRendererPixbuf pixbufCell = (cell as CellRendererPixbuf);

            IVirtualDevice device = (IVirtualDevice) model.GetValue (iter, 0);

            switch (device.DeviceType) {
            case VirtualDeviceType.HardDisk:
                pixbufCell.Pixbuf = hdPixbuf;
                break;
            case VirtualDeviceType.CdRom:
                pixbufCell.Pixbuf = cdromPixbuf;
                break;
            case VirtualDeviceType.Ethernet:
                pixbufCell.Pixbuf = ethernetPixbuf;
                break;
            case VirtualDeviceType.Floppy:
                pixbufCell.Pixbuf = floppyPixbuf;
                break;
            default:
                pixbufCell.Pixbuf = null;
                break;
            }
        }
Esempio n. 2
0
        public static void CellDataHandler (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            SourceRowRenderer renderer = cell as SourceRowRenderer;
            if (renderer == null) {
                return;
            }

            var type = model.GetValue (iter, (int)SourceModel.Columns.Type);
            if (type == null || (SourceModel.EntryType) type != SourceModel.EntryType.Source) {
                renderer.Visible = false;
                return;
            }

            Source source = model.GetValue (iter, 0) as Source;
            renderer.Source = source;
            renderer.Iter = iter;

            if (source == null) {
                return;
            }

            renderer.Visible = true;
            renderer.Text = source.Name;
            renderer.Sensitive = source.CanActivate;
        }
    private void TextDataFunc(CellLayout cell_layout, CellRenderer renderer, TreeModel model, TreeIter iter)
    {
        CellRendererText textRenderer = (CellRendererText) renderer;
        Tilegroup group = (Tilegroup) Model.GetValue(iter, 0);

        textRenderer.Text = group.Name;
    }
Esempio n. 4
0
		private void ContentDataFunc (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
		{
			object dataObject = model.GetValue (iter, columnIndex);
			if (dataObject == null)
				nullRenderer.SetContent (cell as CellRendererText, dataObject);
			else
				contentRenderer.SetContent (cell as CellRendererText, dataObject);
		}
        private void AlbumCellDataFunc(TreeViewColumn column,
						CellRenderer renderer,
						TreeModel model,
						TreeIter iter)
        {
            MusicStoreTrackInfo track = (MusicStoreTrackInfo) model.GetValue (iter, 0);
            ((CellRendererText)renderer).Text = track.Album;
        }
		static void ImageDataFunc (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
		{

			var isError = (bool)tree_model.GetValue (iter, 2);
			var crpixbuf = (CellRendererPixbuf)cell;
			crpixbuf.Visible = isError;
			crpixbuf.Pixbuf = isError ? errorPixbuf.Value : null;
		}
		public static void RenderCoverage (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
		{
			var txt = cell as CellRendererText;
			CodeRecord rc = (CodeRecord)model.GetValue (iter, 0);
			if (txt != null) {
				txt.Foreground = CellColor (rc.Coverage);
				txt.Text = String.Format ("{0:00.0}%", rc.Coverage * 100.0);
			}
		}
Esempio n. 8
0
        public TreeViewColumn AppendColumn(string title, CellRenderer cell, CellLayoutDataFunc cell_data)
        {
            Gtk.TreeViewColumn col = new Gtk.TreeViewColumn ();
            col.Title = title;
            col.PackStart (cell, true);
            col.SetCellDataFunc (cell, cell_data);

            AppendColumn (col);
            return col;
        }
Esempio n. 9
0
		public void SetAttributes (CellRenderer cell, params object[] attrs)
		{
			if (attrs.Length % 2 != 0)
				throw new ArgumentException ("attrs should contain pairs of attribute/col");

			ClearAttributes (cell);
			for (int i = 0; i < attrs.Length - 1; i += 2) {
				AddAttribute (cell, (string) attrs [i], (int) attrs [i + 1]);
			}
		}
Esempio n. 10
0
		private void RenderFont (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
		{
			string fontName = (string)model.GetValue (iter, 0);

			CellRendererText cell = renderer as CellRendererText;

			cell.Text = fontName;
			cell.Font = string.Format ("{0} 10", fontName);
			cell.Family = fontName;
		}
Esempio n. 11
0
		public void SetCellDataFunc (CellRenderer cell_renderer, NodeCellDataFunc func)
		{
			if (func == null) {
				gtk_tree_view_column_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, (GtkSharp.TreeCellDataFuncNative) null, IntPtr.Zero, null);
				return;
			}

			NodeCellDataFuncWrapper func_wrapper = new NodeCellDataFuncWrapper (func);
			GCHandle gch = GCHandle.Alloc (func_wrapper);
			gtk_cell_layout_set_cell_data_func (Handle, cell_renderer == null ? IntPtr.Zero : cell_renderer.Handle, func_wrapper.NativeDelegate, (IntPtr) gch, GLib.DestroyHelper.NotifyHandler);
		}
		public static void ProfileNameDataFunc (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
		{
			if (model.GetValue (iter, 0) != null) {
				Cms.Profile profile = (Cms.Profile) model.GetValue (iter, 0);
				if (profile.ProductName.Length < NameLenth)
					(renderer as Gtk.CellRendererText).Text = profile.ProductName;
				else
					(renderer as Gtk.CellRendererText).Text = profile.ProductName.Substring(0, NameLenth) + "...";
			}
			else
				(renderer as Gtk.CellRendererText).Text = "";
		}
Esempio n. 13
0
		protected override void OnDestroyed ()
		{
			if (cellRenderer != null) {
				cellRenderer.Destroy ();
				cellRenderer = null;
			}

			if (data != null) {
				data.Dispose ();
				data = null;
			}

			base.OnDestroyed ();
		}
        public LocalizationColumn(bool editable = false)
            : base()
        {
            CellRendererText textRenderer = new CellRendererText () { Editable = editable };

            textRenderer.Edited += (_, args) => this.Edited (this, new ResourceEditedEventArgs () {
                Path = args.Path,
                NextText = args.NewText
            });

            m_renderer = textRenderer;
            m_columnType = typeof(string);

            this.PackStart (m_renderer, true);
        }
Esempio n. 15
0
    public static TreeViewColumn CreateTreeViewColumn (string title, int width, CellRenderer cell, TreeCellDataFunc dataFunction) {
		cell.Xalign = 0.5f;
		cell.Yalign = 0;
		TreeViewColumn column = new TreeViewColumn();
		column.Alignment = 0.5f;
		column.Title = title;

		if (width != -1) {
			column.FixedWidth = width;
			column.Sizing = TreeViewColumnSizing.Fixed;
		}

		column.Resizable = true;
		column.PackStart(cell, true);
		column.SetCellDataFunc(cell, dataFunction);
		return column;
	}
        public static void CellDataHandler (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            SourceRowRenderer renderer = cell as SourceRowRenderer;
            Source source = model.GetValue (iter, 0) as Source;

            if (renderer == null) {
                return;
            }

            renderer.Source = source;
            renderer.Iter = iter;

            if (source == null) {
                return;
            }

            renderer.Text = source.Name;
            renderer.Sensitive = source.CanActivate;
        }
Esempio n. 17
0
        private void IconDataFunc(TreeViewColumn column, 
					   CellRenderer renderer,
					   TreeModel model,
					   TreeIter iter)
        {
            GLib.Value value = new GLib.Value ();
            Model.GetValue (iter, IdColumn, ref value);
            uint tag_id = (uint) value;
            Tag tag = TagStore.Get (tag_id) as Tag;

            if (tag.SizedIcon != null) {
                Cms.Profile screen_profile;
                if (FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) {

                    Gdk.Pixbuf temp = tag.SizedIcon.Copy();
                    FSpot.ColorManagement.ApplyProfile (temp, screen_profile);
                    (renderer as CellRendererPixbuf).Pixbuf = temp;
                } else
                    (renderer as CellRendererPixbuf).Pixbuf = tag.SizedIcon;
            } else
                (renderer as CellRendererPixbuf).Pixbuf = empty_pixbuf;
        }
        private void TrackCellPodcastFeedActivity(TreeViewColumn tree_column,
                CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            PodcastFeedInfo feed = model.IterPodcastFeedInfo(iter);
            CellRendererPixbuf renderer = cell as CellRendererPixbuf;

            renderer.Pixbuf = null;
            renderer.StockId = null;
            renderer.Sensitive = true;

            if (feed.IsUpdating)
            {
                renderer.StockId = Stock.Refresh;
            }
            else if (feed.ActiveDownloads > 0)
            {
                renderer.StockId = Stock.GoForward;
            }
            else if (feed.QueuedDownloads > 0)
            {
                renderer.Sensitive = false;
                renderer.StockId = Stock.GoForward;
            }
        }
		void ComboboxDataFunc (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) 
		{
			var cellRenderer = (CellRendererCombo)cell;
			var info = GetProperty (model, iter);
			if (info == null) {
				cellRenderer.Text = "<invalid>";
				return;
			}
			object value = info.GetValue (this.profile, null);
			
			cellRenderer.Text = value is Enum ? TranslateValue (value) : value.ToString ();
		}
Esempio n. 20
0
 // render the media file into the treeview
 private void renderMedia(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
 {
     Media media = (Media) model.GetValue (iter, 0);
     string text = System.IO.Path.GetFileNameWithoutExtension (media.Path);
     (cell as CellRendererText).Markup = Utils.ParseMarkup (text);
 }
Esempio n. 21
0
        private void CellDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter)
        {
            VolumeItem item = GetItem(iter);
            Gtk.CellRendererText txt = cell as Gtk.CellRendererText;

            if ((item != null) && ((item.Note.Length > 0) || (item.Keywords.Length > 0))) {
                txt.Style = Pango.Style.Italic;
                //txt.Foreground = "darkgreen";
                txt.Text = txt.Text + " *";
            } else {
                txt.Style = Pango.Style.Normal;
                //txt.Foreground = null;
            }
        }
		void SetTemplateCategoryCellData (TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter it)
		{
			categoryTextRenderer.Category = (TemplateCategory)model.GetValue (it, TemplateCategoryColumn);
			categoryTextRenderer.CategoryIcon = model.GetValue (it, TemplateCategoryIconColumn) as Xwt.Drawing.Image;
			categoryTextRenderer.CategoryName = model.GetValue (it, TemplateCategoryNameColumn) as string;
		}
Esempio n. 23
0
 protected virtual void OnAssemblyListTreeCellDescription(Gtk.TreeViewColumn aColumn, object aObject, Gtk.CellRenderer aCell)
 {
     if (aObject is System.Data.Bindings.AssemblyDescription)
     {
         AssemblyDevelopmentInformation ad = (aObject as System.Data.Bindings.AssemblyDescription).DevelopmentInformation;
         if ((ad.Count > 0) ||
             ((ad.DevelopmentDescriptions != null) &&
              (ad.DevelopmentDescriptions.Count > 0)))
         {
             if (aCell is CellRendererText)
             {
                 (aCell as CellRendererText).Font = "Bold";
             }
         }
         else
         if (aCell is CellRendererText)
         {
             (aCell as CellRendererText).Font = "Normal";
         }
     }
     else
     if (aCell is CellRendererText)
     {
         (aCell as CellRendererText).Font = "Normal";
     }
 }
Esempio n. 24
0
    private void RenderEncoder(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        ChronopicRegisterWindowTypes crwt = (ChronopicRegisterWindowTypes)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererToggle).Active = crwt.Encoder;
    }
        private void TrackCellPodcastFeedTitle(TreeViewColumn tree_column,
                                               CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            PodcastFeedInfo feed = model.IterPodcastFeedInfo(iter);
            CellRendererText renderer = cell as CellRendererText;

            if (feed == PodcastFeedInfo.All)
            {

                renderer.Text = String.Format(
                     Catalog.GetPluralString (
                    "{0} Feed", "{0} Feeds", PodcastCore.Library.FeedCount
                     ),
                                     PodcastCore.Library.FeedCount
                                );

                renderer.Weight = (int) Pango.Weight.Bold;
                renderer.Style = Pango.Style.Normal;

            }
            else if (feed != null)
            {
                string title = (feed.Title == null || feed.Title == String.Empty)
                               ? feed.Url.ToString () : feed.Title;

                if (feed.NewPodcasts > 0)
                {
                    string episode_str = Catalog.GetPluralString (
                                             "Episode", "Episodes", feed.NewPodcasts
                                         );

                    renderer.Text = String.Format (
                                        "{0} - {1} {2} {3}",
                                        title, feed.NewPodcasts, Catalog.GetString ("New"), episode_str
                                    );

                }
                else
                {
                    renderer.Text = title;
                }

                if (!feed.IsSubscribed)
                {
                    renderer.Style = Pango.Style.Italic;
                    renderer.Weight = (int) Pango.Weight.Normal;
                }
                else
                {
                    renderer.Style = Pango.Style.Normal;

                    if (feed.IsUpdating || feed.NewPodcasts > 0)
                    {
                        renderer.Weight = (int) Pango.Weight.Bold;
                    }
                    else
                    {
                        renderer.Weight = (int) Pango.Weight.Normal;
                    }
                }
            }
        }
Esempio n. 26
0
 public static void SetLabel(this Gtk.CellRenderer r, string label)
 {
 }
Esempio n. 27
0
 public static void SetDescription(this Gtk.CellRenderer r, string description)
 {
 }
Esempio n. 28
0
        private void RenderFilter(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            RssFilter filter = (RssFilter)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = filter.Name;
        }
Esempio n. 29
0
        private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Job job = (Job)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = job.Name;
        }
Esempio n. 30
0
 public void SetCellDataFunc(object target, Gtk.CellRenderer cr, Gtk.CellLayoutDataFunc dataFunc)
 {
     ((Gtk.TreeViewColumn)target).SetCellDataFunc(cr, dataFunc);
 }
Esempio n. 31
0
 public void AddAttribute(object target, Gtk.CellRenderer cr, string field, int col)
 {
     ((Gtk.TreeViewColumn)target).AddAttribute(cr, field, col);
 }
Esempio n. 32
0
 public void PackEnd(object target, Gtk.CellRenderer cr, bool expand)
 {
     ((Gtk.TreeViewColumn)target).PackEnd(cr, expand);
 }
Esempio n. 33
0
        public int InsertColumn(int pos, string title, CellRenderer cell, params object[] attrs)
        {
            TreeViewColumn col = new TreeViewColumn(title, cell, attrs);

            return(InsertColumn(col, pos));
        }
Esempio n. 34
0
 protected virtual void OnInfoTreeCellDescription(Gtk.TreeViewColumn aColumn, object aObject, Gtk.CellRenderer aCell)
 {
     if (aObject is DevelopmentInformationItem)
     {
         aCell.CellBackgroundGdk = new Gdk.Color(255, 255, 255);
         if (aCell is CellRendererText)
         {
             (aCell as CellRendererText).Font = "Normal";
         }
     }
     else
     {
         aCell.CellBackgroundGdk = new Gdk.Color(225, 225, 225);
         if (aCell is CellRendererText)
         {
             (aCell as CellRendererText).Font = "Bold";
         }
     }
 }
Esempio n. 35
0
    private void RenderPort(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
    {
        ChronopicRegisterWindowTypes crwt = (ChronopicRegisterWindowTypes)model.GetValue(iter, 0);

        (cell as Gtk.CellRendererText).Text = crwt.Port;
    }
Esempio n. 36
0
        private void RenderStartTime(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.Start.Seconds.ToString();
        }
			/// <value>
			/// Creates cell renderer based on parameters
			/// </value>
			/// <param name="aName">
			/// Name of created cell renderer <see cref="System.String"/>
			/// </param>
			/// <param name="aRenderer">
			/// Cell renderer used with this description <see cref="Gtk.CellRenderer"/>
			/// </param>
			/// <param name="aArg">
			/// Arguments passed with cell renderer <see cref="System.String"/>
			/// </param>
			public NamedCellRenderer(string aName, CellRenderer aRenderer, string aArg)
			{
				Name = aName;
				Renderer = aRenderer;
				Arg = aArg;
			}
Esempio n. 38
0
        private void RenderName(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.Name;
        }
		void SetTemplateTextCellData (TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter it)
		{
			var template = (SolutionTemplate)model.GetValue (it, TemplateColumn);
			templateTextRenderer.Template = template;
			templateTextRenderer.TemplateIcon = model.GetValue (it, TemplateIconColumn) as Xwt.Drawing.Image;
			templateTextRenderer.TemplateCategory = model.GetValue (it, TemplateNameColumn) as string;
		}
Esempio n. 40
0
        private void RenderSortMethod(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)Model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.SortMethodString;
        }
Esempio n. 41
0
        // feed Date column data to the text cell renderer
        protected void DateTimeCell(TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            if(backupsStore.GetValue(iter,1) == null)
                return;
            DateTime dt = (DateTime) backupsStore.GetValue(iter,1);

            CellRendererText crt = cell as CellRendererText;
            if(crt == null)
                return;
            crt.Text = dt.ToString();
            // it's possible to format the rendered text here... maybe it could show more info that way...
        }
Esempio n. 42
0
        private void RenderHotKey(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)Model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = tNode.HotKey.ToString();
        }
		void RenderIcon (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) 
		{
			var pixbufCellRenderer = (CellRendererPixbuf)cell;
			if (model.IterHasChild (iter)) {
				pixbufCellRenderer.Pixbuf = ImageService.GetPixbuf (((TreeView)col.TreeView).GetRowExpanded (model.GetPath (iter)) ? MonoDevelop.Ide.Gui.Stock.OpenFolder : MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
			} else {
				pixbufCellRenderer.Pixbuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Property, IconSize.Menu);
			}
		}
Esempio n. 44
0
 public void SetTooltipCell(Tooltip tooltip, ITreeNode node, TreeViewColumn column, CellRenderer renderer)
 {
     SetTooltipCell(tooltip, store.GetPath(node), column, renderer);
 }
		void ToggleDataFunc (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) 
		{
			var cellRenderer = (CellRendererToggle)cell;
			var info = GetProperty (model, iter);
			if (info == null || info.PropertyType != typeof(bool)) 
				return;
			bool value = (bool)info.GetValue (this.profile, null);
			cellRenderer.Active = value;
		}
Esempio n. 46
0
        private void RenderColor(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            Category tNode = (Category)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).CellBackgroundGdk = tNode.Color;
        }
        private void TrackCellPodcastFeedStatus(TreeViewColumn tree_column,
                                                CellRenderer cell, TreeModel tree_model, TreeIter iter)
        {
            PodcastFeedInfo feed = model.IterPodcastFeedInfo(iter);

            CellRendererText renderer = cell as CellRendererText;

            renderer.Style = Pango.Style.Normal;
            renderer.Weight = (int) Pango.Weight.Normal;

            if (feed == PodcastFeedInfo.All)
            {

                renderer.Text = Catalog.GetString ("All");
                renderer.Weight = (int) Pango.Weight.Bold;

            }
            else if (feed != null)
            {
                if (feed.IsSubscribed)
                {

                    renderer.Text = String.Format (
                                        "({0}/{1})",
                                        feed.DownloadedPodcasts, feed.TotalPodcasts
                                    );

                }
                else
                {
                    renderer.Text = String.Format (
                                        "({0})", feed.DownloadedPodcasts
                                    );
                }
            }
        }
Esempio n. 48
0
        private void RenderPixbuf(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            ProjectDescription project = (ProjectDescription)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererPixbuf).Pixbuf = project.File.Preview != null ? project.File.Preview.Value : null;
        }
Esempio n. 49
0
		void RuntimeRenderCell (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter)
		{
			var target = (ExecutionTarget) model.GetValue (iter, RuntimeExecutionTarget);
			var indent = (bool) model.GetValue (iter, RuntimeIsIndented);
			var renderer = (CellRendererText) cell;

			renderer.Sensitive = !(target is ExecutionTargetGroup);

			if (target == null) {
				renderer.Xpad = (uint) 0;
				return;
			}

			renderer.Xpad = indent ? (uint) 18 : (uint) 3;

			if (!runtimeCombo.PopupShown)
				renderer.Text = target.FullName;
			else
				renderer.Text = target.Name;
		}
Esempio n. 50
0
 private void RenderSubcat(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
 {
     (cell as Gtk.CellRendererText).Markup = (string)model.GetValue(iter, 0);
 }