Class Toplevel
Toplevel views can be modally executed. They are used for both an application's main view (filling the entire screeN and
for pop-up views such as
Dialog,
MessageBox, and
Wizard.
Inheritance
System.Object
Toplevel
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Terminal.Gui.dll
Syntax
public class Toplevel : View, IDisposable, ISupportInitializeNotification, ISupportInitialize
Constructors
|
Improve this Doc
View Source
Toplevel()
Initializes a new instance of the
Toplevel class with
Computed layout,
defaulting to full screen.
Declaration
|
Improve this Doc
View Source
Toplevel(Rect)
Initializes a new instance of the
Toplevel class with the specified
Absolute layout.
Declaration
public Toplevel(Rect frame)
Parameters
Type |
Name |
Description |
Rect |
frame |
A superview-relative rectangle specifying the location and size for the new Toplevel |
Properties
|
Improve this Doc
View Source
CanFocus
Gets or sets a value indicating whether this
Toplevel can focus.
Declaration
public override bool CanFocus { get; }
Property Value
Type |
Description |
System.Boolean |
true if can focus; otherwise, false . |
Overrides
|
Improve this Doc
View Source
IsMdiChild
Gets or sets if this Toplevel is a Mdi child.
Declaration
public bool IsMdiChild { get; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsMdiContainer
Gets or sets if this Toplevel is a Mdi container.
Declaration
public bool IsMdiContainer { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Gets or sets the menu for this Toplevel.
Declaration
public virtual MenuBar MenuBar { get; set; }
Property Value
|
Improve this Doc
View Source
Modal
Determines whether the
Toplevel is modal or not.
If set to
false
(the default):
- ProcessKey(KeyEvent) events will propagate keys upwards.
- The Toplevel will act as an embedded view (not a modal/pop-up).
If set to
true
:
Declaration
public bool Modal { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
Running
Declaration
public bool Running { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
StatusBar
Gets or sets the status bar for this Toplevel.
Declaration
public virtual StatusBar StatusBar { get; set; }
Property Value
Methods
|
Improve this Doc
View Source
Add(View)
Declaration
public override void Add(View view)
Parameters
Type |
Name |
Description |
View |
view |
|
Overrides
|
Improve this Doc
View Source
Create()
Convenience factory method that creates a new Toplevel with the current terminal dimensions.
Declaration
public static Toplevel Create()
Returns
Type |
Description |
Toplevel |
The created Toplevel. |
|
Improve this Doc
View Source
GetTopMdiChild(Type, String[])
Gets the current visible Toplevel Mdi child that matches the arguments pattern.
Declaration
public View GetTopMdiChild(Type type = null, string[] exclude = null)
Parameters
Type |
Name |
Description |
System.Type |
type |
The type. |
System.String[] |
exclude |
The strings to exclude. |
Returns
Type |
Description |
View |
The matched view. |
|
Improve this Doc
View Source
MouseEvent(MouseEvent)
Declaration
public override bool MouseEvent(MouseEvent mouseEvent)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
MoveNext()
Move to the next Mdi child from the
MdiTop.
Declaration
public virtual void MoveNext()
|
Improve this Doc
View Source
MovePrevious()
Move to the previous Mdi child from the
MdiTop.
Declaration
public virtual void MovePrevious()
|
Improve this Doc
View Source
OnAlternateBackwardKeyChanged(Key)
Declaration
public virtual void OnAlternateBackwardKeyChanged(Key oldKey)
Parameters
Type |
Name |
Description |
Key |
oldKey |
|
|
Improve this Doc
View Source
OnAlternateForwardKeyChanged(Key)
Declaration
public virtual void OnAlternateForwardKeyChanged(Key oldKey)
Parameters
Type |
Name |
Description |
Key |
oldKey |
|
|
Improve this Doc
View Source
OnKeyDown(KeyEvent)
Declaration
public override bool OnKeyDown(KeyEvent keyEvent)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
OnKeyUp(KeyEvent)
Declaration
public override bool OnKeyUp(KeyEvent keyEvent)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
OnLoaded()
Declaration
public virtual void OnLoaded()
|
Improve this Doc
View Source
OnQuitKeyChanged(Key)
Declaration
public virtual void OnQuitKeyChanged(Key oldKey)
Parameters
Type |
Name |
Description |
Key |
oldKey |
|
|
Improve this Doc
View Source
PositionCursor()
Declaration
public override void PositionCursor()
Overrides
|
Improve this Doc
View Source
PositionToplevel(Toplevel)
Virtual method enabling implementation of specific positions for inherited
Toplevel views.
Declaration
public virtual void PositionToplevel(Toplevel top)
Parameters
Type |
Name |
Description |
Toplevel |
top |
The toplevel. |
|
Improve this Doc
View Source
ProcessColdKey(KeyEvent)
Declaration
public override bool ProcessColdKey(KeyEvent keyEvent)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
ProcessKey(KeyEvent)
Declaration
public override bool ProcessKey(KeyEvent keyEvent)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Overrides
|
Improve this Doc
View Source
Redraw(Rect)
Declaration
public override void Redraw(Rect bounds)
Parameters
Type |
Name |
Description |
Rect |
bounds |
|
Overrides
|
Improve this Doc
View Source
Remove(View)
Declaration
public override void Remove(View view)
Parameters
Type |
Name |
Description |
View |
view |
|
Overrides
|
Improve this Doc
View Source
RemoveAll()
Declaration
public override void RemoveAll()
Overrides
|
Improve this Doc
View Source
RequestStop()
Stops and closes this
Toplevel. If this Toplevel is the top-most Toplevel,
RequestStop(Toplevel) will be called, causing the application to exit.
Declaration
public virtual void RequestStop()
|
Improve this Doc
View Source
RequestStop(Toplevel)
Stops and closes the
Toplevel specified by
top
. If
top
is the top-most Toplevel,
RequestStop(Toplevel) will be called, causing the application to exit.
Declaration
public virtual void RequestStop(Toplevel top)
Parameters
Type |
Name |
Description |
Toplevel |
top |
The toplevel to request stop. |
|
Improve this Doc
View Source
ShowChild(Toplevel)
Shows the Mdi child indicated by
top
, setting it as
Current.
Declaration
public virtual bool ShowChild(Toplevel top = null)
Parameters
Type |
Name |
Description |
Toplevel |
top |
The Toplevel. |
Returns
Type |
Description |
System.Boolean |
true if the toplevel can be shown or false if not. |
|
Improve this Doc
View Source
WillPresent()
Declaration
public virtual void WillPresent()
Events
|
Improve this Doc
View Source
Activate
Declaration
public event Action<Toplevel> Activate
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
AllChildClosed
Invoked when the last child of the Toplevel
Application.RunState is closed from
by
Terminal.Gui.Application.End(Terminal.Gui.View).
Declaration
public event Action AllChildClosed
Event Type
Type |
Description |
System.Action |
|
|
Improve this Doc
View Source
AlternateBackwardKeyChanged
Declaration
public event Action<Key> AlternateBackwardKeyChanged
Event Type
Type |
Description |
System.Action<Key> |
|
|
Improve this Doc
View Source
AlternateForwardKeyChanged
Declaration
public event Action<Key> AlternateForwardKeyChanged
Event Type
Type |
Description |
System.Action<Key> |
|
|
Improve this Doc
View Source
ChildClosed
Invoked when a child of the Toplevel
Application.RunState is closed by
Terminal.Gui.Application.End(Terminal.Gui.View).
Declaration
public event Action<Toplevel> ChildClosed
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
ChildLoaded
Declaration
public event Action<Toplevel> ChildLoaded
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
ChildUnloaded
Declaration
public event Action<Toplevel> ChildUnloaded
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
Closed
Invoked when the Toplevel's
Application.RunState is closed by
Terminal.Gui.Application.End(Terminal.Gui.View).
Declaration
public event Action<Toplevel> Closed
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
Closing
Declaration
public event Action<ToplevelClosingEventArgs> Closing
Event Type
|
Improve this Doc
View Source
Deactivate
Declaration
public event Action<Toplevel> Deactivate
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
Loaded
Declaration
public event Action Loaded
Event Type
Type |
Description |
System.Action |
|
|
Improve this Doc
View Source
QuitKeyChanged
Invoked when the
QuitKey is changed.
Declaration
public event Action<Key> QuitKeyChanged
Event Type
Type |
Description |
System.Action<Key> |
|
|
Improve this Doc
View Source
Ready
Invoked when the Toplevel
MainLoop has started it's first iteration.
Subscribe to this event to perform tasks when the
Toplevel has been laid out and focus has been set.
changes.
A Ready event handler is a good place to finalize initialization after calling
Run(Func<Exception, Boolean>) on this Toplevel.
Declaration
public event Action Ready
Event Type
Type |
Description |
System.Action |
|
|
Improve this Doc
View Source
Resized
Invoked when the terminal has been resized. The new
Size of the terminal is provided.
Declaration
public event Action<Size> Resized
Event Type
Type |
Description |
System.Action<Size> |
|
|
Improve this Doc
View Source
Unloaded
Declaration
public event Action Unloaded
Event Type
Type |
Description |
System.Action |
|
Implements
System.IDisposable
System.ComponentModel.ISupportInitializeNotification
System.ComponentModel.ISupportInitialize