using System; using System.Drawing; namespace DevComponents.Tree.Display { /// /// Represents abstract renderer class for node objects. /// public abstract class NodeRenderer { #region Events /// /// Occurs when node background is being drawn. /// public event NodeRendererEventHandler RenderNodeBackground; /// /// Occurs when node expand part is being drawn. /// public event NodeExpandPartRendererEventHandler RenderNodeExpandPart; /// /// Occurs when node command part is being drawn. /// public event NodeCommandPartRendererEventHandler RenderNodeCommandPart; /// /// Occurs when cell bacgkround is being drawn. /// public event NodeCellRendererEventHandler RenderCellBackground; /// /// Occurs when cell check-box is being drawn. /// public event NodeCellRendererEventHandler RenderCellCheckBox; /// /// Occurs when cell image is being drawn. /// public event NodeCellRendererEventHandler RenderCellImage; /// /// Occurs when cell text is being drawn. /// public event NodeCellRendererEventHandler RenderCellText; /// /// Occurs when cell text is being drawn. /// public event SelectionRendererEventHandler RenderSelection; /// /// Occurs when node connector is being drawn. /// public event ConnectorRendererEventHandler RenderConnector; /// /// Occurs when tree background is rendered. /// public event TreeBackgroundRendererEventHandler RenderTreeBackground; #endregion #region Private Variables #endregion #region Constructor public NodeRenderer() { } #endregion #region Internal Implementation /// /// Draws node background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeBackground method so events can occur. /// /// Information provided for rendering. public virtual void DrawNodeBackground(NodeRendererEventArgs e) { OnRenderNodeBackground(e); } /// /// Raises RenderNodeBackground event. /// /// Event arguments. protected virtual void OnRenderNodeBackground(NodeRendererEventArgs e) { if(RenderNodeBackground!=null) RenderNodeBackground(this,e); } /// /// Draws node expand part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeExpandPart method so events can occur. /// /// Information provided for rendering. public virtual void DrawNodeExpandPart(NodeExpandPartRendererEventArgs e) { OnRenderNodeExpandPart(e); } /// /// Raises RenderNodeExpandPart event. /// /// protected virtual void OnRenderNodeExpandPart(NodeExpandPartRendererEventArgs e) { if(RenderNodeExpandPart!=null) RenderNodeExpandPart(this,e); } /// /// Draws node command part. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderNodeCommandPart method so events can occur. /// /// Information provided for rendering. public virtual void DrawNodeCommandPart(NodeCommandPartRendererEventArgs e) { OnRenderNodeCommandPart(e); } /// /// Raises RenderNodeCommandPart event. /// /// Event arguments. protected virtual void OnRenderNodeCommandPart(NodeCommandPartRendererEventArgs e) { if(RenderNodeCommandPart!=null) RenderNodeCommandPart(this,e); } /// /// Draws cell background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellBackground method so events can occur. /// /// Information provided for rendering. public virtual void DrawCellBackground(NodeCellRendererEventArgs e) { OnRenderCellBackground(e); } /// /// Raises RenderCellBackground event. /// /// Event arguments protected virtual void OnRenderCellBackground(NodeCellRendererEventArgs e) { if(RenderCellBackground!=null) RenderCellBackground(this, e); } /// /// Draws cell check box. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellCheckBox method so events can occur. /// /// Information provided for rendering. public virtual void DrawCellCheckBox(NodeCellRendererEventArgs e) { OnRenderCellCheckBox(e); } /// /// Raises RenderCellCheckBox event. /// /// Event arguments protected virtual void OnRenderCellCheckBox(NodeCellRendererEventArgs e) { if(RenderCellCheckBox!=null) RenderCellCheckBox(this, e); } /// /// Draws cell image. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellImage method so events can occur. /// /// Information provided for rendering. public virtual void DrawCellImage(NodeCellRendererEventArgs e) { OnRenderCellImage(e); } /// /// Raises RenderCellImage event. /// /// Event arguments protected virtual void OnRenderCellImage(NodeCellRendererEventArgs e) { if(RenderCellImage!=null) RenderCellImage(this, e); } /// /// Draws cell text. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderCellText method so events can occur. /// /// Information provided for rendering. public virtual void DrawCellText(NodeCellRendererEventArgs e) { OnRenderCellText(e); } /// /// Raises RenderCellImage event. /// /// Event arguments protected virtual void OnRenderCellText(NodeCellRendererEventArgs e) { if(RenderCellText!=null) RenderCellText(this, e); } /// /// Draws selection for SelectedNode. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderSelection method so events can occur. /// /// Information provided for rendering. public virtual void DrawSelection(SelectionRendererEventArgs e) { OnRenderSelection(e); } /// /// Raises RenderSelection event. /// /// Event data. protected virtual void OnRenderSelection(SelectionRendererEventArgs e) { if(RenderSelection!=null) RenderSelection(this, e); } /// /// Draws connector between nodes. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderConnector method so events can occur. /// /// Information provided for rendering. public virtual void DrawConnector(ConnectorRendererEventArgs e) { OnRenderConnector(e); } /// /// Raises RenderConnector event. /// /// Event data. protected virtual void OnRenderConnector(ConnectorRendererEventArgs e) { if(RenderConnector!=null) RenderConnector(this, e); } /// /// Draws the tree background. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you /// do not want default rendering to occur do not call the base implementation. You can call OnRenderTreeBackground method so events can occur. /// /// Information provided for rendering. public virtual void DrawTreeBackground(TreeBackgroundRendererEventArgs e) { OnRenderTreeBackground(e); } /// /// Raises RenderTreeBackground event. /// /// Event data. protected virtual void OnRenderTreeBackground(TreeBackgroundRendererEventArgs e) { if(RenderTreeBackground!=null) RenderTreeBackground(this, e); } #endregion } }