Exemplo n.º 1
0
        /// <summary>
        /// Renders the icon of a file reference in the export queue.
        /// </summary>
        /// <param name="column">The column which the cell is in.</param>
        /// <param name="cell">The cell which the icon is in.</param>
        /// <param name="model">The model of the treeview.</param>
        /// <param name="iter">The <see cref="TreeIter"/> pointing to the row the icon is in.</param>
        public static void RenderExportQueueReferenceIcon(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter)
        {
            CellRendererPixbuf cellIcon  = cell as CellRendererPixbuf;
            FileReference      reference = (FileReference)model.GetValue(iter, 0);

            if (reference == null || cellIcon == null)
            {
                return;
            }

            if (reference.Node.Type.HasFlag(NodeType.Directory))
            {
                cellIcon.Pixbuf = IconManager.GetIconForFiletype(WarcraftFileType.Directory);
                return;
            }

            cellIcon.Pixbuf = IconManager.GetIconForFiletype(reference.Node.FileType);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handles rendering of the icon of a node in the tree.
        /// </summary>
        /// <param name="column">The column which the icon is in.</param>
        /// <param name="cell">The cell which the reference is in.</param>
        /// <param name="model">The model of the treeview.</param>
        /// <param name="iter">The <see cref="TreeIter"/> pointing to the row the icon is in.</param>
        private void RenderNodeIcon(TreeViewColumn column, CellRenderer cell, ITreeModel model, TreeIter iter)
        {
            var cellIcon = cell as CellRendererPixbuf;
            var node     = (SerializedNode)model.GetValue(iter, 0);

            if (node == null || cellIcon == null)
            {
                return;
            }

            if (node.Type.HasFlag(NodeType.Directory))
            {
                cellIcon.Pixbuf = IconManager.GetIconForFiletype(WarcraftFileType.Directory);
                return;
            }

            if (node.Type.HasFlag(NodeType.Deleted))
            {
                cellIcon.Pixbuf = IconManager.GetIcon("package-broken");
                return;
            }

            if (node.Type.HasFlag(NodeType.Meta) && _treeModel.GetNodeName(node) == "Packages")
            {
                cellIcon.Pixbuf = IconManager.GetIcon("applications-other");
                return;
            }

            if (node.Type.HasFlag(NodeType.Package))
            {
                cellIcon.Pixbuf = IconManager.GetIcon("package-x-generic");
                return;
            }

            cellIcon.Pixbuf = IconManager.GetIconForFiletype(node.FileType);
        }