Class ContentBaseControl
The base control used to render content.
Inheritance
Implements
Inherited Members
Namespace: Gorgon.Editor.UI.Views
Assembly: Gorgon.Editor.API.dll
Syntax
public class ContentBaseControl : EditorBaseControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, IRendererControl, IGorgonNamedObject
Constructors
| Edit this page View SourceContentBaseControl()
Initializes a new instance of the ContentBaseControl class.
Declaration
public ContentBaseControl()
Properties
| Edit this page View SourceCurrentHostedPanel
Property to return the currently hosted panel in the HostPanelControls.
Declaration
protected Control CurrentHostedPanel { get; }
Property Value
Type | Description |
---|---|
Control |
GraphicsContext
Property to return the graphics context.
Declaration
[Browsable(false)]
public IGraphicsContext GraphicsContext { get; }
Property Value
Type | Description |
---|---|
IGraphicsContext |
HostPanel
Property to return the panel that hosts the HostPanelControls.
Declaration
[Browsable(false)]
public Panel HostPanel { get; }
Property Value
Type | Description |
---|---|
Panel |
HostPanelControls
Property to return the panel that will be used for hosting panels for settings, parameters, etc...
Declaration
[Browsable(false)]
public Panel HostPanelControls { get; }
Property Value
Type | Description |
---|---|
Panel |
IdleMethod
Property to set or return the idle method for rendering on the control.
Declaration
protected Func<bool> IdleMethod { get; set; }
Property Value
Type | Description |
---|---|
Func<bool> |
Remarks
The Stop() method must be called prior to switching idle methods.
PresentationPanel
Property to return the panel that will be used for presentation of the content.
Declaration
[Browsable(false)]
public Panel PresentationPanel { get; }
Property Value
Type | Description |
---|---|
Panel |
RenderControl
Property to set or return the control that will be rendered into using a GorgonSwapChain.
Declaration
[Browsable(true)]
public Control RenderControl { get; set; }
Property Value
Type | Description |
---|---|
Control |
Remarks
Plug in developers should set this in the IDE designer to set up a swap chain for rendering when this control is created.
If this property is assigned after control creation, the SetupGraphics(IGraphicsContext) method must be called again for it to take effect.
If this value is set to null, then no swap chain will be created and the SwapChain property will be set to null.
Ribbon
Property to return the ribbon for the content view.
Declaration
[Browsable(false)]
public KryptonRibbon Ribbon { get; protected set; }
Property Value
Type | Description |
---|---|
KryptonRibbon |
SwapChain
Property to return the swap chain assigned to the control.
Declaration
[Browsable(false)]
public GorgonSwapChain SwapChain { get; }
Property Value
Type | Description |
---|---|
GorgonSwapChain |
Methods
| Edit this page View SourceAssignDataContextToHostedPanel(IViewModel, bool)
Function to assign a data context to the CurrentHostedPanel.
Declaration
protected void AssignDataContextToHostedPanel(IViewModel dataContext, bool overrideCurrentDc)
Parameters
Type | Name | Description |
---|---|---|
IViewModel | dataContext | The data context to assign. |
bool | overrideCurrentDc | true to replace any non-null data context if present, or false to leave the current data context in place. |
Remarks
This method is used to assign an instance of a data context to the hosted panel in the HostPanelControls. If the panel does not implement IDataContext<T>, or the type of data context does not match the type of data context the control was built for, an exception will be thrown.
Exceptions
Type | Condition |
---|---|
InvalidCastException | Thrown when the CurrentHostedPanel does not accept the type of data context represented by -or- Thrown if the CurrentHostedPanel does not implement IDataContext<T>. |
Dispose(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 SourceGetContentFileDragDropData<T>(DragEventArgs)
Function to retrieve content file data from a drag/drop operation.
Declaration
protected T GetContentFileDragDropData<T>(DragEventArgs e) where T : class, IContentFileDragData
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The event parameters for the drag/drop event. |
Returns
Type | Description |
---|---|
T | The data in the drag operation, or null if the data cannot be dragged and dropped onto this control. |
Type Parameters
Name | Description |
---|---|
T | The type of data to retrieve. Must implement IContentFileDragData and be a reference type. |
Remarks
This will return custom drag/drop data that implements the IContentFileDragData interface. Content editor developers should use this method to verify whether the data being dragged into the control is valid or not, and use the returned data to perform the final drop operation.
If the editor cannot support the data being dragged in, then the developer should call the OnBubbleDragEnter(DragEventArgs), OnBubbleDragOver(DragEventArgs),or the OnBubbleDragDrop(DragEventArgs) methods (depending on the event being fired on the control).
See Also
| Edit this page View SourceGetRegisteredPanel<T>(string)
Function to determine if a child panel is registered on this view or not.
Declaration
protected T GetRegisteredPanel<T>(string id) where T : Control
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the panel. |
Returns
Type | Description |
---|---|
T | The registered panel if found, or null if not. |
Type Parameters
Name | Description |
---|---|
T | The type of panel. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
HideHostedPanels()
Function to hide the host panel controls.
Declaration
protected void HideHostedPanels()
OnBubbleDragDrop(DragEventArgs)
Function to bubble up the drag drop event up to the main project window.
Declaration
protected virtual void OnBubbleDragDrop(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The drag event parameters. |
Remarks
Implementors can use this method to notify the parent of this control that a drag drop event is being passed on from this control.
OnBubbleDragEnter(DragEventArgs)
Function to bubble up the drag enter event up to the main project window.
Declaration
protected virtual void OnBubbleDragEnter(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The drag event parameters. |
Remarks
Implementors can use this method to notify the parent of this control that a drag enter event is being passed on from this control.
OnBubbleDragOver(DragEventArgs)
Function to bubble up the drag drop event up to the main project window.
Declaration
protected virtual void OnBubbleDragOver(DragEventArgs e)
Parameters
Type | Name | Description |
---|---|---|
DragEventArgs | e | The drag event parameters. |
OnPropertyChanged(string)
Function called when a property is changed on the data context.
Declaration
protected virtual void OnPropertyChanged(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the property that is updated. |
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 virtual void OnPropertyChanging(string propertyName)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the property that is updating. |
Remarks
Implementors should override this method in order to handle a property change notification from their data context.
OnSetDataContext(IEditorContent)
Function to assign the data context to this object.
Declaration
protected void OnSetDataContext(IEditorContent dataContext)
Parameters
Type | Name | Description |
---|---|---|
IEditorContent | dataContext | The data context to assign. |
Remarks
Applications must call this method when setting their own data context. Otherwise, some functionality will not work.
OnSetupGraphics(IGraphicsContext, GorgonSwapChain)
Function to allow user defined setup of the graphics context with this control.
Declaration
protected virtual 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. |
OnShutdown()
Function called to shut down the view and perform any clean up required (including user defined graphics objects).
Declaration
protected virtual void OnShutdown()
RegisterChildPanel(string, Control)
Function to register a child panel with this content control.
Declaration
protected void RegisterChildPanel(string id, Control control)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID for the panel, this should be the view model fully qualified type name. |
Control | control | The control representing the child panel. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
ArgumentException | Thrown when the |
ResetDataContext()
Function called when the view should be reset by a null data context.
Declaration
protected virtual void ResetDataContext()
SetupGraphics(IGraphicsContext)
Function to initialize the graphics context for the control.
Declaration
public void SetupGraphics(IGraphicsContext context)
Parameters
Type | Name | Description |
---|---|---|
IGraphicsContext | context | The graphics context to use. |
Remarks
If the RenderControl property is assigned on control creation, then a primary swap chain will be created for that control and provided via the SwapChain property.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ShowFocusState(bool)
Function to show the control keyboard focus state.
Declaration
protected void ShowFocusState(bool isFocused)
Parameters
Type | Name | Description |
---|---|---|
bool | isFocused | true if focused, false if not. |
ShowHostedPanel(Control)
Function to show a hosted panel.
Declaration
protected void ShowHostedPanel(Control control)
Parameters
Type | Name | Description |
---|---|---|
Control | control | The control to show. |
Remarks
Only a single control can be active in the host at a time. Adding another control will hide the previous control.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
Start()
Function to begin rendering on the control.
Declaration
public void Start()
Stop()
Function to cease rendering on the control.
Declaration
public void Stop()
UnassignEvents()
Function to unassign events for the data context.
Declaration
protected virtual void UnassignEvents()
UnregisterChildPanel(string)
Function to register a child panel with this content control.
Declaration
protected void UnregisterChildPanel(string id)
Parameters
Type | Name | Description |
---|---|---|
string | id | The ID of the panel. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown when the |
ArgumentEmptyException | Thrown when the |
KeyNotFoundException | Thrown when the |
Events
| Edit this page View SourceBubbleDragDrop
Event triggered when a drop operation is to be bubbled up to its parent.
Declaration
public event EventHandler<DragEventArgs> BubbleDragDrop
Event Type
Type | Description |
---|---|
EventHandler<DragEventArgs> |
BubbleDragEnter
Event triggered when a drag enter operation is to be bubbled up to its parent.
Declaration
public event EventHandler<DragEventArgs> BubbleDragEnter
Event Type
Type | Description |
---|---|
EventHandler<DragEventArgs> |
BubbleDragOver
Event triggered when a drop operation is to be bubbled up to its parent.
Declaration
public event EventHandler<DragEventArgs> BubbleDragOver
Event Type
Type | Description |
---|---|
EventHandler<DragEventArgs> |
ContentClosed
Event triggered when the content is closed.
Declaration
public event EventHandler ContentClosed
Event Type
Type | Description |
---|---|
EventHandler |