public DrawNodeEventArgs(Graphics graphics, Rectangle bounds, FileSystemNode node, bool enabled, bool selected, bool hovered, bool controlHasFocus)
 {
     Graphics        = graphics;
     Bounds          = bounds;
     Node            = node;
     Enabled         = enabled;
     Selected        = selected;
     Hovered         = hovered;
     ControlHasFocus = controlHasFocus;
     Handled         = false;
 }
        /// <summary>
        /// Renders a list item.
        /// </summary>
        /// <param name="graphics">The graphics object to draw on.</param>
        /// <param name="bounds">Bounds of the item.</param>
        /// <param name="node">The node to draw.</param>
        /// <param name="enabled">Whether the item is enabled.</param>
        /// <param name="selected">Whether the item is selected.</param>
        /// <param name="hovered">Whether the mouse cursor is over the item.</param>
        /// <param name="controlHasFocus">Whether the control has input focus.</param>
        public void DrawItem(Graphics graphics, Rectangle bounds, FileSystemNode node, bool enabled, bool selected, bool hovered, bool controlHasFocus)
        {
            DrawNodeEventArgs e = new DrawNodeEventArgs(graphics, bounds, node, enabled, selected, hovered, controlHasFocus);

            OnDrawBackground(e);
            OnDrawBorder(e);

            if (e.Node.IsPathValid)
            {
                OnDrawContents(e);
            }
            else
            {
                OnDrawErrorMessage(e);
            }
        }
        /// <summary>
        /// Gets the minimum height of an item.
        /// </summary>
        /// <param name="node">The node to measure.</param>
        /// <returns>Minimum item height.</returns>
        public int GetTextHeight(FileSystemNode node)
        {
            var e = new GetLineCountEventArgs(node);

            OnGetLineCount(e);

            float textHeight = 0;

            for (int i = 0; i < e.LineCount; i++)
            {
                var eh = new GetLineHeightEventArgs(node, i);
                textHeight += eh.LineHeight > 0 ? eh.LineHeight : Font.Height;
            }

            textHeight += (e.LineCount - 1) * Font.Height * LineSpacing;

            return((int)textHeight);
        }
        /// <summary>
        /// Gets the minimum height of an item.
        /// </summary>
        /// <param name="node">The node to measure.</param>
        /// <returns>Minimum item height.</returns>
        public int GetItemHeight(FileSystemNode node)
        {
            var e = new GetLineCountEventArgs(node);

            OnGetLineCount(e);

            float textHeight = 0;

            for (int i = 0; i < e.LineCount; i++)
            {
                var eh = new GetLineHeightEventArgs(node, i);
                textHeight += eh.LineHeight > 0 ? eh.LineHeight : Font.Height;
            }

            textHeight += (e.LineCount - 1) * Font.Height * LineSpacing;
            float maxHeight = Math.Max(textHeight, ThumbnailSize.Height);

            return((int)(maxHeight + 2 * ContentPadding.Height));
        }
 public GetLineHeightEventArgs(FileSystemNode node, int lineIndex)
 {
     Node       = node;
     LineIndex  = lineIndex;
     LineHeight = -1;
 }
 public GetLineCountEventArgs(FileSystemNode node)
 {
     Node      = node;
     LineCount = 0;
 }
 public DrawNodeLineEventArgs(Graphics graphics, Rectangle bounds, FileSystemNode node, bool enabled, bool selected, bool hovered, bool controlHasFocus, int lineIndex)
     : base(graphics, bounds, node, enabled, selected, hovered, controlHasFocus)
 {
     LineIndex = lineIndex;
 }