Exemple #1
0
        void AuthorIconFunc(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererPixbuf renderer = (CellRendererPixbuf)cell;
            var rev = (Revision)model.GetValue(iter, 0);

            if (string.IsNullOrEmpty(rev.Email))
            {
                return;
            }
            ImageLoader img = ImageService.GetUserIcon(rev.Email, 16);

            if (img.LoadOperation.IsCompleted)
            {
                renderer.Pixbuf = img.Pixbuf;
            }
            else
            {
                renderer.Pixbuf              = null;
                img.LoadOperation.Completed += delegate {
                    Gtk.Application.Invoke(delegate {
                        if (logstore.IterIsValid(iter))
                        {
                            model.EmitRowChanged(model.GetPath(iter), iter);
                        }
                    });
                };
            }
        }
Exemple #2
0
        private void RenderStatusDownload(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            DownloadItem downloadItem = (DownloadItem)model.GetValue(iter, 0);

            (cell as Gtk.CellRendererText).Text = downloadItem.Status;
            model.EmitRowChanged(model.GetPath(iter), iter);
        }
Exemple #3
0
        static void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            var rc       = (CellRendererDiff)cell;
            var diffMode = (bool)model.GetValue(iter, 0);
            var lines    = (string[])model.GetValue(iter, 1) ?? new string [] { "" };

            rc.InitCell(tree_column.TreeView, diffMode, lines, model.GetPath(iter));
        }
Exemple #4
0
        internal virtual void RenderListItem(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererCustom mycell = (CellRendererCustom)cell;

            mycell.ItemIndex = int.Parse(model.GetPath(iter).ToString());
            mycell.Iter      = iter;
            mycell.Text      = this.Items[mycell.ItemIndex].ToString();
        }
Exemple #5
0
            public TreeMapItem(Gtk.TreeModel m,
                               ref Gtk.TreeIter iter,
                               bool horiz,
                               int textColumn,
                               int weightColumn)
            {
                if (m == null)
                {
                    throw new ArgumentNullException("m");
                }

                if (iter.Equals(Gtk.TreeIter.Zero))
                {
                    throw new ArgumentException("iter");
                }

                if (textColumn < 0)
                {
                    throw new ArgumentException("textColumn");
                }

                if (weightColumn < 0)
                {
                    throw new ArgumentException("weightColumn");
                }

                Path     = m.GetPath(iter);
                Title    = (string)m.GetValue(iter, textColumn);
                Weight   = (double)m.GetValue(iter, weightColumn);
                X        = 0;
                Y        = 0;
                Width    = 0;
                Height   = 0;
                Children = null;
                Horiz    = horiz;

                Gtk.TreeIter citer;
                double       c_total = 0.0;

                if (m.IterChildren(out citer, iter))
                {
                    do
                    {
                        AddChild(new TreeMapItem(m, ref citer, !horiz, textColumn, weightColumn));
                    } while (m.IterNext(ref citer));

                    // Get total weight
                    Children.ForEach(delegate(TreeMapItem i) {
                        c_total += Math.Abs(i.Weight);
                    });

                    this.ChildrenWeight = c_total;
                }
            }
Exemple #6
0
        //checkbox cell function
        private void OnChkDataFunc(
            Gtk.TreeViewColumn col, Gtk.CellRenderer cell,
            Gtk.TreeModel model, Gtk.TreeIter iter
            )
        {
            CellRendererToggle c    = cell as CellRendererToggle;
            String             path = model.GetPath(iter).ToString();

            int item_index = int.Parse(path);

            c.Active = (checked_items.IndexOf(item_index) != -1);
        }
Exemple #7
0
        private void RenderProgressDownload(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            DownloadItem downloadItem = (DownloadItem)model.GetValue(iter, 0);
            string       progress     = downloadItem.Progress.ToString();

            if (progress.Length > 5)
            {
                progress = progress.Substring(0, 5);
            }

            (cell as Gtk.CellRendererProgress).Text = progress;
            (cell as CellRendererProgress).Value    = (int)downloadItem.Progress;
            model.EmitRowChanged(model.GetPath(iter), iter);
        }
Exemple #8
0
        static void AuthorIconFunc(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererImage renderer = (CellRendererImage)cell;
            var rev = (Revision)model.GetValue(iter, 0);

            if (string.IsNullOrEmpty(rev.Email))
            {
                return;
            }
            ImageLoader img = ImageService.GetUserIcon(rev.Email, 16);

            renderer.Image = img.Image;
            if (img.Downloading)
            {
                img.Completed += (sender, e) => {
                    renderer.Image = img.Image;
                    if (((ListStore)model).IterIsValid(iter))
                    {
                        model.EmitRowChanged(model.GetPath(iter), iter);
                    }
                };
            }
        }
Exemple #9
0
        static void SetDiffCellData(Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererDiff rc = (CellRendererDiff)cell;

            string[] lines = (string[])model.GetValue(iter, colDiff);
            if (lines == null)
            {
                lines = new string[] { (string)model.GetValue(iter, colOperation) }
            }
            ;

            rc.InitCell(tree_column.TreeView, ((TreeStore)model).IterDepth(iter) != 0, lines, model.GetPath(iter));
        }
 private void UpdateMaps(Gtk.TreeModel model, Gtk.TreeIter itr)
 {
     model.EmitRowChanged(model.GetPath(itr), itr);
 }
Exemple #11
0
        protected virtual void RenderTreeCell(Gtk.TreeViewColumn _column, Gtk.CellRenderer _cell, Gtk.TreeModel _model, Gtk.TreeIter _iter)
        {
            object o = _model.GetValue(_iter, 0);

            GuiComponents.TvEpisodeNodeItem node = o as GuiComponents.TvEpisodeNodeItem;
            Gdk.Color background = new Gdk.Color(255, 255, 255);
            if (node != null && (_model.GetPath(_iter).Indices[1] % 2) == 0)
            {
                background = new Gdk.Color(240, 240, 255);
            }
            if (_cell is Gtk.CellRendererText)
            {
                if (node != null)
                {
                    switch (_column.SortColumnId)
                    {
                    case 1: (_cell as Gtk.CellRendererText).Text = node.EpisodeNames; break;

                    case 3: (_cell as Gtk.CellRendererText).Text = node.Filename; break;
                    }
                }
                else if (o is KeyNode && _column.SortColumnId == 0)
                {
                    (_cell as Gtk.CellRendererText).Markup = ((KeyNode)o).Markup;
                }
                else
                {
                    (_cell as Gtk.CellRendererText).Text = "";
                }
                (_cell as Gtk.CellRendererText).BackgroundGdk = background;
            }
            else if (_cell is TreeItemCellRenderer)
            {
                TreeItemCellRenderer render = (TreeItemCellRenderer)_cell;
                render.CellBackgroundGdk = background;
                render.Pixbuf            = null;
                if (node != null)
                {
                    render.Text   = node.EpisodeNumbersString;
                    render.Pixbuf = node.StatusIcon;
                }
                else
                {
                    render.Text = ((KeyNode)o).Key;
                }
            }
            else
            {
                if (node != null)
                {
                    switch (_column.SortColumnId)
                    {
                    case 2: (_cell as Gtk.CellRendererPixbuf).Pixbuf = node.RatingIcon; break;
                    }
                }
                else
                {
                    (_cell as Gtk.CellRendererPixbuf).Pixbuf = Images.Empty;
                }
                (_cell as Gtk.CellRendererPixbuf).CellBackgroundGdk = background;
            }
        }
Exemple #12
0
        static void RenderIcon(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CodeTemplate template = (CodeTemplate)model.GetValue(iter, 0);

            var cri = (CellRendererImage)cell;

            if (template == null)
            {
                cri.Image = ImageService.GetIcon(((TreeView)column.TreeView).GetRowExpanded(model.GetPath(iter)) ? MonoDevelop.Ide.Gui.Stock.OpenFolder : MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
            }
            else
            {
                cri.Image = ImageService.GetIcon(template.Icon, IconSize.Menu);
            }
        }
 /// <summary>
 /// Scroll vertically to keep row in view when sorting is active and sorted column data changes.
 /// Otherwise would need to manually scroll in order bring it back into view.
 /// (TreePath usually changes, TreeIter does not.)
 /// </summary>
 /// <param name="iter">
 /// A <see cref="TreeIter"/>
 /// </param>
 protected void ScrollTo(TreeIter iter)
 {
     // ScrollToCell needs TreePath
     // If column is null, then no horizontal scrolling occurs.
     treeView.ScrollToCell(treeModel.GetPath(iter), null, false, 0, 0);
 }
Exemple #14
0
        private void RenderListItem(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
        {
            CellRendererCustom mycell = (CellRendererCustom)cell;

            mycell.ItemIndex = int.Parse(model.GetPath(iter).ToString());
        }