예제 #1
0
        public MovieListGui()
        {
            this.Build();
            store = new TreeStore(typeof(object));

            treeview.Model          = store;
            treeview.Selection.Mode = SelectionMode.Multiple;
            treeview.BorderWidth    = 0;
            treeview.RowActivated  += HandleTreeviewRowActivated;

            string[] titles = new string[] { "Title", "Year", "Set", "Rating", "Filename" };
            for (int i = 0; i < titles.Length; i++)
            {
                if (i == 0)
                {
                    TreeViewColumn       col  = new Gtk.TreeViewColumn();
                    TreeItemCellRenderer cell = new TreeItemCellRenderer();
                    col.PackStart(cell, true);
                    col.SortColumnId  = i;
                    col.Title         = titles[i];
                    col.MinWidth      = 300;
                    col.MaxWidth      = 400;
                    col.SortIndicator = false;
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else if (i == 3)
                {
                    TreeViewColumn     col  = new TreeViewColumn();
                    CellRendererPixbuf cell = new CellRendererPixbuf();
                    col.PackStart(cell, true);
                    col.SortColumnId  = i;
                    col.Title         = titles[i];
                    col.SortIndicator = false;
                    col.SetCellDataFunc(cell, new TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else
                {
                    TreeViewColumn   col  = new Gtk.TreeViewColumn();
                    CellRendererText cell = new Gtk.CellRendererText();
                    col.PackStart(cell, true);
                    col.SortColumnId  = i;
                    col.SortIndicator = false;
                    if (i == 1)
                    {
                        col.MinWidth = 80;
                    }
                    else if (i == 2)
                    {
                        col.MinWidth = 200;
                    }
                    col.Title = titles[i];
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
            }
        }
예제 #2
0
        public TvShowGui()
        {
            this.Build();

            store                = new TreeStore(typeof(object));
            treeview.Model       = store;
            treeview.BorderWidth = 0;

            string[] titles = new string[] { "Episodes", "Title", "Rating", "Filename" };
            for (int i = 0; i < titles.Length; i++)
            {
                if (i == 0)
                {
                    TreeViewColumn       col  = new Gtk.TreeViewColumn();
                    TreeItemCellRenderer cell = new TreeItemCellRenderer();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title        = titles[i];
                    col.MinWidth     = 85;
                    col.MaxWidth     = 85;
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else if (i == 2)
                {
                    TreeViewColumn     col  = new TreeViewColumn();
                    CellRendererPixbuf cell = new CellRendererPixbuf();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title        = titles[i];
                    col.SetCellDataFunc(cell, new TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else
                {
                    TreeViewColumn   col  = new Gtk.TreeViewColumn();
                    CellRendererText cell = new Gtk.CellRendererText();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;

                    /*
                     * if(i == 1)
                     *      col.MinWidth = 80;
                     * else if(i == 2)
                     *      col.MinWidth = 200;
                     */
                    col.Title = titles[i];
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
            }

            treeview.RowActivated += HandleNodeview1RowActivated;

            this.ExposeEvent += delegate(object o, ExposeEventArgs args) {
                //ExposeIt();
            };
        }
예제 #3
0
파일: TvShowGui.cs 프로젝트: revenz/iMeta
        public TvShowGui()
        {
            this.Build ();

            store = new TreeStore(typeof(object));
            treeview.Model = store;
            treeview.BorderWidth = 0;

            string[] titles = new string[] { "Episodes", "Title", "Rating", "Filename"};
            for(int i=0; i <titles.Length ; i++)
            {
                if( i == 0)
                {
                    TreeViewColumn col = new Gtk.TreeViewColumn ();
                    TreeItemCellRenderer cell = new TreeItemCellRenderer();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title = titles[i];
                    col.MinWidth = 85;
                    col.MaxWidth = 85;
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else if(i == 2)
                {
                    TreeViewColumn col = new TreeViewColumn();
                    CellRendererPixbuf cell = new CellRendererPixbuf();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title = titles[i];
                    col.SetCellDataFunc(cell, new TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else
                {
                    TreeViewColumn col = new Gtk.TreeViewColumn ();
                    CellRendererText cell = new Gtk.CellRendererText();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    /*
                    if(i == 1)
                        col.MinWidth = 80;
                    else if(i == 2)
                        col.MinWidth = 200;
                        */
                    col.Title = titles[i];
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
            }

            treeview.RowActivated += HandleNodeview1RowActivated;

            this.ExposeEvent += delegate(object o, ExposeEventArgs args) {
                //ExposeIt();
            };
        }
예제 #4
0
        public MovieListGui()
        {
            this.Build ();
            store = new TreeStore(typeof(object));

            treeview.Model = store;
            treeview.Selection.Mode = SelectionMode.Multiple;
            treeview.BorderWidth = 0;
            treeview.RowActivated += HandleTreeviewRowActivated;

            string[] titles = new string[] { "Title", "Year", "Set", "Rating", "Filename"};
            for(int i=0; i < titles.Length ; i++)
            {
                if(i == 0)
                {
                    TreeViewColumn col = new Gtk.TreeViewColumn ();
                    TreeItemCellRenderer cell = new TreeItemCellRenderer();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title = titles[i];
                    col.MinWidth = 300;
                    col.MaxWidth = 400;
                    col.SortIndicator = false;
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else if(i == 3)
                {
                    TreeViewColumn col = new TreeViewColumn();
                    CellRendererPixbuf cell = new CellRendererPixbuf();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.Title = titles[i];
                    col.SortIndicator = false;
                    col.SetCellDataFunc(cell, new TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
                else
                {
                    TreeViewColumn col = new Gtk.TreeViewColumn ();
                    CellRendererText cell = new Gtk.CellRendererText();
                    col.PackStart(cell, true);
                    col.SortColumnId = i;
                    col.SortIndicator = false;
                    if(i == 1)
                        col.MinWidth = 80;
                    else if(i == 2)
                        col.MinWidth = 200;
                    col.Title = titles[i];
                    col.SetCellDataFunc(cell, new Gtk.TreeCellDataFunc(RenderTreeCell));
                    treeview.AppendColumn(col);
                }
            }
        }
예제 #5
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;
            }
        }