Class Tab
- Namespace
- AlphaFramework.Editor
- Assembly
- AlphaFramework.Editor.dll
A base class for all editor windows that can be displayed as tabs
public abstract class Tab : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl
- Inheritance
-
Tab
- Implements
- Derived
- Inherited Members
- Extension Methods
Remarks
Call OnChange() after each change to make sure the save and undo buttons are enabled
Constructors
Tab()
Initializes a new instance of the UserControl class.
protected Tab()
Fields
Changed
True when unsaved changes to the content exist
protected bool Changed
Field Value
ToastProvider
Provides a surface for displaying toast messages to the user.
protected IToastProvider ToastProvider
Field Value
_fullPath
The complete (rooted) path to load and/or save the file from/to
protected string _fullPath
Field Value
_overwrite
true
if an existing file supposed to be overwritten when SaveFile() is called.
protected bool _overwrite
Field Value
Properties
FilePath
The path to the file in this editor
[Browsable(false)]
public string FilePath { get; protected set; }
Property Value
NameUI
The user-friendly name of this editor
public string NameUI { get; set; }
Property Value
Methods
Delete()
Delete the currently selected object in this tab
public void Delete()
FocusDefaultControl()
Set the focus back to the default control on the tab
protected void FocusDefaultControl()
ForceClose()
Forces the tab to close, displaying warnings about unsaved data, etc. but not allowing the user to cancel.
protected void ForceClose()
Hide()
Hides this tab (so that another can be brought to the foreground)
public void Hide()
OnChange()
Mark the content of this tab as changed (needs to be saved)
protected virtual void OnChange()
OnClose()
Called when the tab needs to shutdown and close
protected virtual void OnClose()
OnDelete()
Hook to delete the currently selected object in this tab
protected virtual void OnDelete()
OnInitialize()
Called on startup to load the content for this tab.
protected virtual void OnInitialize()
Exceptions
- NotSupportedException
An unsupported graphics card feature is used.
- FileNotFoundException
A file could not be located.
- IOException
There was a problem reading a file.
- UnauthorizedAccessException
Read access to a file was denied.
- InvalidOperationException
There was a problem inside the engine.
- InvalidDataException
A file contained invalid data.
OnSaveFile()
Called when the content of this tab is to be saved to a file.
protected virtual void OnSaveFile()
Exceptions
- ArgumentException
The file path is invalid.
- NotSupportedException
The file path is invalid.
- IOException
There was a problem writing a file.
- UnauthorizedAccessException
Write access to a file was denied.
OnUpdate()
Called on startup, content updates and tab switch to refresh any on-screen displays
protected virtual void OnUpdate()
Open(IToastProvider)
Opens the tab.
public void Open(IToastProvider toastProvider)
Parameters
toastProvider
IToastProviderProvides a surface for displaying toast messages to the user.
Exceptions
- OperationCanceledException
The user has been informed of an error and has confirmed the resulting cancellation.
Redo()
Hook to redo the last undone change
public virtual void Redo()
RequestClose()
Requests the tab to close, displaying warnings about unsaved data, etc. allowing the user to cancel.
public bool RequestClose()
Returns
- bool
true
if the tab was closed,false
if the user canceled the process
SaveFile()
Saves the content of this tab to a file - error-handling included!
public bool SaveFile()
Returns
- bool
true
if file was saved,false
if an error occurred
Undo()
Hook to undo the last change
public virtual void Undo()
Events
TabClosed
Occurs after the tab was closed
public event EventHandler TabClosed