BrightIdeasSoftware.ObjectListView.DrawAllDecorations C# (CSharp) Method

DrawAllDecorations() protected method

Draw all the decorations
protected DrawAllDecorations ( Graphics g, List drawnItems ) : void
g Graphics A Graphics
drawnItems List The items that were redrawn and whose decorations should also be redrawn
return void
        protected virtual void DrawAllDecorations(Graphics g, List<OLVListItem> drawnItems)
        {
            g.TextRenderingHint = ObjectListView.TextRenderingHint;
            g.SmoothingMode = ObjectListView.SmoothingMode;

            Rectangle contentRectangle = this.ContentRectangle;

            if (this.HasEmptyListMsg && this.GetItemCount() == 0) {
                this.EmptyListMsgOverlay.Draw(this, g, contentRectangle);
            }

            // Let the drop sink draw whatever feedback it likes
            if (this.DropSink != null) {
                this.DropSink.DrawFeedback(g, contentRectangle);
            }

            // Draw our item and subitem decorations
            foreach (OLVListItem olvi in drawnItems) {
                if (olvi.HasDecoration) {
                    foreach (IDecoration d in olvi.Decorations) {
                        d.ListItem = olvi;
                        d.SubItem = null;
                        d.Draw(this, g, contentRectangle);
                    }
                }
                foreach (OLVListSubItem subItem in olvi.SubItems) {
                    if (subItem.HasDecoration) {
                        foreach (IDecoration d in subItem.Decorations) {
                            d.ListItem = olvi;
                            d.SubItem = subItem;
                            d.Draw(this, g, contentRectangle);
                        }
                    }
                }
                if (this.SelectedRowDecoration != null && olvi.Selected) {
                    this.SelectedRowDecoration.ListItem = olvi;
                    this.SelectedRowDecoration.SubItem = null;
                    this.SelectedRowDecoration.Draw(this, g, contentRectangle);
                }
            }

            // Now draw the specifically registered decorations
            foreach (IDecoration decoration in this.Decorations) {
                decoration.ListItem = null;
                decoration.SubItem = null;
                decoration.Draw(this, g, contentRectangle);
            }

            // Finally, draw any hot item decoration
            if (this.UseHotItem && this.HotItemStyle != null && this.HotItemStyle.Decoration != null) {
                IDecoration hotItemDecoration = this.HotItemStyle.Decoration;
                hotItemDecoration.ListItem = this.GetItem(this.HotRowIndex);
                if (hotItemDecoration.ListItem == null)
                    hotItemDecoration.SubItem = null;
                else
                    hotItemDecoration.SubItem = hotItemDecoration.ListItem.GetSubItem(this.HotColumnIndex);
                hotItemDecoration.Draw(this, g, contentRectangle);
            }

            // If we are in design mode, we don't want to use the glass panels,
            // so we draw the background overlays here
            if (this.DesignMode) {
                foreach (IOverlay overlay in this.Overlays) {
                    overlay.Draw(this, g, contentRectangle);
                }
            }
        }
ObjectListView