Class VisualContentBaseControl
A base content editor view that is used to display renderable content.
Inheritance
Implements
Inherited Members
Namespace: Gorgon.Editor.UI.Views
Assembly: Gorgon.Editor.API.dll
Syntax
public class VisualContentBaseControl : ContentBaseControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IRendererControl, IGorgonNamedObject
Remarks
This base editor view is used to render custom content and provide controls/functionality for zooming, and panning that content. This content editor view takes a view model that implements the IVisualEditorContent interface.
Content plug in developers should inherit from this control to provide standardized functionality for viewing content via the GorgonGraphics, and Gorgon2D interfaces. This should help simplify plug in UI development and allow developers to focus on creating UIs for editing their content without having to worry about developing boilerplate code for view manipulation.
By default this control will render a background using a checkerboard texture to illustrate opacity. This can be overridden by the developer on the view model.
Constructors
| Edit this page View SourceVisualContentBaseControl()
Initializes a new instance of the VisualContentBaseControl class.
Declaration
public VisualContentBaseControl()
Properties
| Edit this page View SourceRenderWindow
Property to return the panel that will be used to receive content rendering.
Declaration
[Browsable(false)]
public Panel RenderWindow { get; }
Property Value
Type | Description |
---|---|
Panel |
Renderer
Property to return the current renderer.
Declaration
[Browsable(false)]
protected IContentRenderer Renderer { get; }
Property Value
Type | Description |
---|---|
IContentRenderer |
ShowHorizontalScrollBar
Property to set or return whether horizontal scrolling is supported.
Declaration
[Browsable(true)]
public bool ShowHorizontalScrollBar { get; set; }
Property Value
Type | Description |
---|---|
bool |
ShowVerticalScrollBar
Property to set or return whether vertical scrolling is supported.
Declaration
[Browsable(true)]
public bool ShowVerticalScrollBar { get; set; }
Property Value
Type | Description |
---|---|
bool |
StatusPanel
Property to return the panel that will be used for presentation of the content.
Declaration
[Browsable(false)]
public Panel StatusPanel { get; }
Property Value
Type | Description |
---|---|
Panel |
Methods
| Edit this page View SourceAddRenderer(string, IContentRenderer)
Function to register a new renderer with the view.
Declaration
protected void AddRenderer(string name, IContentRenderer renderer)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the renderer. |
IContentRenderer | renderer | The renderer to register. |
Remarks
Some content plug ins will require the rendered view to change depending on state. For example, a specific tool is selected and the view needs to switch to a portion of the content. In such cases it is not practical to have a single renderer performing all manner of state changes, so this method provides a means of passing different renderer instances to the view.
Developers of the content editing view should register these renderers in the OnSetupGraphics(IGraphicsContext, GorgonSwapChain) method so that the renderers are available right away. Failure to do so can lead to broken rendering.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
ArgumentException | Thrown if a renderer is already registered with the same |
See Also
| Edit this page View SourceDispose(bool)
Clean up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true if managed resources should be disposed; otherwise, false. |
Overrides
| Edit this page View SourceHasRenderer(string)
Function to determine if a renderer with the specified name is registered.
Declaration
protected bool HasRenderer(string name)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the renderer to evaluate. |
Returns
Type | Description |
---|---|
bool | true if the renderer is registered, false if not. |
OnAfterRender()
Function called after rendering ends.
Declaration
protected virtual void OnAfterRender()
Remarks
Developers can use this method to perform operations immediately after rendering the content.
OnBeforeRender()
Function called before rendering begins.
Declaration
protected virtual void OnBeforeRender()
Remarks
Developers can use this method to perform last minute updates prior to rendering the content.
OnLoad(EventArgs)
Raises the Load event.
Declaration
protected override void OnLoad(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
| Edit this page View SourceOnPropertyChanged(string)
Function called when a property is changed on the data context.
Declaration
protected override void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the property that is updated. |
Overrides
Remarks
Implementors should override this method in order to handle a property change notification from their data context.
OnPropertyChanging(string)
Function called when a property is changing on the data context.
Declaration
protected override void OnPropertyChanging(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the property that is updating. |
Overrides
Remarks
Implementors should override this method in order to handle a property change notification from their data context.
OnRenderWindowDragDrop(DragEventArgs)
Function to handle a drag drop event on the render control.
Declaration
protected virtual void OnRenderWindowDragDrop(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The event arguments. |
Remarks
Content editor developers can override this method to handle a drop event when an item is dropped into the rendering area on the view.
OnRenderWindowDragEnter(DragEventArgs)
Function to handle a drag enter event on the render control.
Declaration
protected virtual void OnRenderWindowDragEnter(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The event arguments. |
Remarks
Content editor developers can override this method to handle a drag enter event when an item is dragged into the rendering area on the view.
OnRenderWindowDragOver(DragEventArgs)
Function to handle a drag over event on the render control.
Declaration
protected virtual void OnRenderWindowDragOver(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The event arguments. |
Remarks
Content editor developers can override this method to handle a drag over event when an item is dragged over the rendering area on the view.
OnResize(EventArgs)
Raises the Resize event.
Declaration
protected override void OnResize(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
EventArgs | e | An EventArgs that contains the event data. |
Overrides
| Edit this page View SourceOnSetDataContext(IVisualEditorContent)
Function to assign the data context to this object.
Declaration
protected void OnSetDataContext(IVisualEditorContent dataContext)
Parameters
Type | Name | Description |
---|---|---|
IVisualEditorContent | dataContext | The data context to assign. |
Remarks
Applications must call this method when setting their own data context. Otherwise, some functionality will not work.
OnSetupContentRenderer(IGraphicsContext, GorgonSwapChain)
Function to allow applications to set up rendering for their specific use cases.
Declaration
protected virtual void OnSetupContentRenderer(IGraphicsContext context, GorgonSwapChain swapChain)
Parameters
Type | Name | Description |
---|---|---|
IGraphicsContext | context | The graphics context from the host application. |
GorgonSwapChain | swapChain | The current swap chain for the rendering panel. |
OnSetupGraphics(IGraphicsContext, GorgonSwapChain)
Function to allow user defined setup of the graphics context with this control.
Declaration
protected override sealed void OnSetupGraphics(IGraphicsContext context, GorgonSwapChain swapChain)
Parameters
Type | Name | Description |
---|---|---|
IGraphicsContext | context | The context being assigned. |
GorgonSwapChain | swapChain | The swap chain assigned to the RenderControl. |
Overrides
| Edit this page View SourceOnShutdown()
Function called to shut down the view and perform any clean up required (including user defined graphics objects).
Declaration
protected override void OnShutdown()
Overrides
| Edit this page View SourceOnSwitchRenderer(IContentRenderer, bool)
Function called when the renderer is switched.
Declaration
protected virtual void OnSwitchRenderer(IContentRenderer renderer, bool resetZoom)
Parameters
Type | Name | Description |
---|---|---|
IContentRenderer | renderer | The current renderer. |
bool | resetZoom | true if the zoom should be reset, false if not. |
SetupScrollBars()
Function to set up the scroll bars.
Declaration
protected void SetupScrollBars()
ShowCurrentPanel()
Function to show the current panel assigned to the CurrentPanel property.
Declaration
protected void ShowCurrentPanel()
SwitchRenderer(string, bool)
Function to switch to another registered renderer.
Declaration
protected void SwitchRenderer(string name, bool resetZoom)
Parameters
Type | Name | Description |
---|---|---|
string | name | The name of the renderer to switch to. |
bool | resetZoom | true to reset the zoom back to the default, false to leave as-is. |
Remarks
Developers will this method to switch between renderer types (if multiple renderers are used) to denote editor state.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
ArgumentException | Thrown if no renderer with the specified |