Class Application
A static, singleton class providing the main application driver for Terminal.Gui apps.
Inheritance
System.Object
Application
Examples
// A simple Terminal.Gui app that creates a window with a frame and title with
// 5 rows/columns of padding.
Application.Init();
var win = new Window ("Hello World - CTRL-Q to quit") {
X = 5,
Y = 5,
Width = Dim.Fill (5),
Height = Dim.Fill (5)
};
Application.Top.Add(win);
Application.Run();
Application.Shutdown();
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)
System.Object.ToString()
Assembly: Terminal.Gui.dll
Syntax
public static class Application
Fields
|
Improve this Doc
View Source
Driver
Declaration
public static ConsoleDriver Driver
Field Value
|
Improve this Doc
View Source
Iteration
This event is raised on each iteration of the
MainLoop.
Declaration
public static Action Iteration
Field Value
Type |
Description |
System.Action |
|
|
Improve this Doc
View Source
Resized
Invoked when the terminal was resized. The new size of the terminal is provided.
Declaration
public static Action<Application.ResizedEventArgs> Resized
Field Value
|
Improve this Doc
View Source
RootKeyEvent
Called for new KeyPress events before any processing is performed or
views evaluate. Use for global key handling and/or debugging.
Return true to suppress the KeyPress event
Declaration
public static Func<KeyEvent, bool> RootKeyEvent
Field Value
Type |
Description |
System.Func<KeyEvent, System.Boolean> |
|
|
Improve this Doc
View Source
RootMouseEvent
Merely a debugging aid to see the raw mouse events
Declaration
public static Action<MouseEvent> RootMouseEvent
Field Value
Properties
|
Improve this Doc
View Source
AlternateBackwardKey
Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.
Declaration
public static Key AlternateBackwardKey { get; set; }
Property Value
|
Improve this Doc
View Source
AlternateForwardKey
Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.
Declaration
public static Key AlternateForwardKey { get; set; }
Property Value
|
Improve this Doc
View Source
Current
Declaration
public static Toplevel Current { get; }
Property Value
|
Improve this Doc
View Source
Declaration
[Obsolete("This API is deprecated and has no impact when enabled.", false)]
public static bool EnableConsoleScrolling { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
ExitRunLoopAfterFirstIteration
Set to true to cause the RunLoop method to exit after the first iterations.
Set to false (the default) to cause the RunLoop to continue running until Application.RequestStop() is called.
Declaration
public static bool ExitRunLoopAfterFirstIteration { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
HeightAsBuffer
Declaration
[Obsolete("This API is deprecated and has no impact when enabled.", false)]
public static bool HeightAsBuffer { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
IsMouseDisabled
Disable or enable the mouse. The mouse is enabled by default.
Declaration
public static bool IsMouseDisabled { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
MainLoop
Declaration
public static MainLoop MainLoop { get; }
Property Value
Type |
Description |
MainLoop |
The main loop. |
|
Improve this Doc
View Source
MdiChildes
Gets all the Mdi childes which represent all the not modal
Toplevel from the
MdiTop.
Declaration
public static List<Toplevel> MdiChildes { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<Toplevel> |
|
|
Improve this Doc
View Source
MdiTop
Declaration
public static Toplevel MdiTop { get; }
Property Value
|
Improve this Doc
View Source
MouseGrabView
The view that grabbed the mouse, to where will be routed all the mouse events.
Declaration
public static View MouseGrabView { get; }
Property Value
|
Improve this Doc
View Source
QuitKey
Gets or sets the key to quit the application.
Declaration
public static Key QuitKey { get; set; }
Property Value
|
Improve this Doc
View Source
SupportedCultures
Gets all supported cultures by the application without the invariant language.
Declaration
public static List<CultureInfo> SupportedCultures { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<System.Globalization.CultureInfo> |
|
|
Improve this Doc
View Source
Top
The
Toplevel object used for the application on startup (
Top)
Declaration
public static Toplevel Top { get; }
Property Value
|
Improve this Doc
View Source
UseSystemConsole
If true, forces the use of the System.Console-based (see Terminal.Gui.NetDriver) driver. The default is false.
Declaration
public static bool UseSystemConsole { get; set; }
Property Value
Type |
Description |
System.Boolean |
|
|
Improve this Doc
View Source
The current
View object that wants continuous mouse button pressed events.
Declaration
public static View WantContinuousButtonPressedView { get; }
Property Value
Methods
|
Improve this Doc
View Source
Begin(Toplevel)
Building block API: Prepares the provided
Toplevel for execution.
Declaration
public static Application.RunState Begin(Toplevel toplevel)
Parameters
Returns
|
Improve this Doc
View Source
DoEvents()
Wakes up the mainloop that might be waiting on input, must be thread safe.
Declaration
public static void DoEvents()
|
Improve this Doc
View Source
End(Application.RunState)
Declaration
public static void End(Application.RunState runState)
Parameters
|
Improve this Doc
View Source
EnsuresTopOnFront()
Ensures that the superview of the most focused view is on front.
Declaration
public static void EnsuresTopOnFront()
|
Improve this Doc
View Source
GrabMouse(View)
Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse is called.
Declaration
public static void GrabMouse(View view)
Parameters
Type |
Name |
Description |
View |
view |
View that will receive all mouse events until UngrabMouse is invoked. |
|
Improve this Doc
View Source
Init(ConsoleDriver, IMainLoopDriver)
Declaration
public static void Init(ConsoleDriver driver = null, IMainLoopDriver mainLoopDriver = null)
Parameters
Type |
Name |
Description |
ConsoleDriver |
driver |
The ConsoleDriver to use. If not specified the default driver for the
platform will be used (see Terminal.Gui.WindowsDriver, Terminal.Gui.CursesDriver, and Terminal.Gui.NetDriver). |
IMainLoopDriver |
mainLoopDriver |
Specifies the MainLoop to use.
Must not be null if driver is not null.
|
|
Improve this Doc
View Source
MakeCenteredRect(Size)
Returns a rectangle that is centered in the screen for the provided size.
Declaration
public static Rect MakeCenteredRect(Size size)
Parameters
Type |
Name |
Description |
Size |
size |
Size for the rectangle. |
Returns
Type |
Description |
Rect |
The centered rect. |
|
Improve this Doc
View Source
MoveNext()
Move to the next Mdi child from the
MdiTop.
Declaration
public static void MoveNext()
|
Improve this Doc
View Source
MovePrevious()
Move to the previous Mdi child from the
MdiTop.
Declaration
public static void MovePrevious()
|
Improve this Doc
View Source
Refresh()
Triggers a refresh of the entire display.
Declaration
public static void Refresh()
|
Improve this Doc
View Source
RequestStop(Toplevel)
Stops running the most recent
Toplevel or the
top
if provided.
Declaration
public static void RequestStop(Toplevel top = null)
Parameters
Type |
Name |
Description |
Toplevel |
top |
The toplevel to request stop. |
|
Improve this Doc
View Source
Run(Func<Exception, Boolean>)
Declaration
public static void Run(Func<Exception, bool> errorHandler = null)
Parameters
Type |
Name |
Description |
System.Func<System.Exception, System.Boolean> |
errorHandler |
|
|
Improve this Doc
View Source
Run(Toplevel, Func<Exception, Boolean>)
Runs the main loop on the given
Toplevel container.
Declaration
public static void Run(Toplevel view, Func<Exception, bool> errorHandler = null)
Parameters
Type |
Name |
Description |
Toplevel |
view |
The Toplevel to run modally. |
System.Func<System.Exception, System.Boolean> |
errorHandler |
RELEASE builds only: Handler for any unhandled exceptions (resumes when returns true, rethrows when null). |
|
Improve this Doc
View Source
Run<T>(Func<Exception, Boolean>, ConsoleDriver, IMainLoopDriver)
Declaration
public static void Run<T>(Func<Exception, bool> errorHandler = null, ConsoleDriver driver = null, IMainLoopDriver mainLoopDriver = null)
where T : Toplevel, new()
Parameters
Type |
Name |
Description |
System.Func<System.Exception, System.Boolean> |
errorHandler |
|
ConsoleDriver |
driver |
The ConsoleDriver to use. If not specified the default driver for the
platform will be used (Terminal.Gui.WindowsDriver, Terminal.Gui.CursesDriver, or Terminal.Gui.NetDriver).
This parameteter must be null if Init(ConsoleDriver, IMainLoopDriver) has already been called.
|
IMainLoopDriver |
mainLoopDriver |
Specifies the MainLoop to use. |
Type Parameters
|
Improve this Doc
View Source
RunLoop(Application.RunState, Boolean)
Declaration
public static void RunLoop(Application.RunState state, bool wait = true)
Parameters
Type |
Name |
Description |
Application.RunState |
state |
The state returned by the Begin(Toplevel) method. |
System.Boolean |
wait |
By default this is true which will execute the runloop waiting for events,
if set to false, a single iteration will execute. |
|
Improve this Doc
View Source
RunMainLoopIteration(ref Application.RunState, Boolean, ref Boolean)
Declaration
public static void RunMainLoopIteration(ref Application.RunState state, bool wait, ref bool firstIteration)
Parameters
Type |
Name |
Description |
Application.RunState |
state |
The state returned by Begin(Toplevel). |
System.Boolean |
wait |
If true will execute the runloop waiting for events. If true
will return after a single iteration. |
System.Boolean |
firstIteration |
Set to true if this is the first run loop iteration. Upon return,
it will be set to false if at least one iteration happened. |
|
Improve this Doc
View Source
Shutdown()
Declaration
public static void Shutdown()
|
Improve this Doc
View Source
UngrabMouse()
Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.
Declaration
public static void UngrabMouse()
Events
|
Improve this Doc
View Source
GrabbedMouse
Event to be invoked when a view grab the mouse.
Declaration
public static event Action<View> GrabbedMouse
Event Type
Type |
Description |
System.Action<View> |
|
|
Improve this Doc
View Source
GrabbingMouse
Invoked when a view wants to grab the mouse; can be canceled.
Declaration
public static event Func<View, bool> GrabbingMouse
Event Type
Type |
Description |
System.Func<View, System.Boolean> |
|
|
Improve this Doc
View Source
NotifyNewRunState
Declaration
public static event Action<Application.RunState> NotifyNewRunState
Event Type
|
Improve this Doc
View Source
NotifyStopRunState
Declaration
public static event Action<Toplevel> NotifyStopRunState
Event Type
Type |
Description |
System.Action<Toplevel> |
|
|
Improve this Doc
View Source
UnGrabbedMouse
Event to be invoked when a view ungrab the mouse.
Declaration
public static event Action<View> UnGrabbedMouse
Event Type
Type |
Description |
System.Action<View> |
|
|
Improve this Doc
View Source
UnGrabbingMouse
Invoked when a view wants ungrab the mouse; can be canceled.
Declaration
public static event Func<View, bool> UnGrabbingMouse
Event Type
Type |
Description |
System.Func<View, System.Boolean> |
|