Class Application | Terminal.Gui v1 (original) (raw)
Namespace
Assembly
Terminal.Gui.dll
A static, singleton class providing the main application driver for Terminal.Gui apps.
public static class Application
Inheritance
Application
Inherited Members
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();
Fields
The current ConsoleDriver in use.
This event is raised on each iteration of the MainLoop.
Invoked when the terminal was resized. The new size of the terminal is provided.
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
Merely a debugging aid to see the raw mouse events
Properties
Alternative key to navigate backwards through views. Shift+Ctrl+Tab is the primary key.
Alternative key to navigate forwards through views. Ctrl+Tab is the primary key.
The current Toplevel object. This is updated when Run(Func<Exception, bool>) enters and leaves to point to the current Toplevel .
The current EnableConsoleScrolling used in the terminal.
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.
This API is deprecated; use EnableConsoleScrolling instead.
Disable or enable the mouse. The mouse is enabled by default.
The MainLoop driver for the application
Gets all the Mdi childes which represent all the not modal Toplevel from the MdiTop.
The Toplevel object used for the application on startup which IsMdiContainer is true.
The view that grabbed the mouse, to where will be routed all the mouse events.
Gets or sets the key to quit the application.
Gets all supported cultures by the application without the invariant language.
The Toplevel object used for the application on startup (Top)
If true, forces the use of the System.Console-based (see NetDriver) driver. The default is false.
WantContinuousButtonPressedView
The current View object that wants continuous mouse button pressed events.
Methods
Building block API: Prepares the provided Toplevel for execution.
Wakes up the mainloop that might be waiting on input, must be thread safe.
Building block API: completes the execution of a Toplevel that was started with Begin(Toplevel) .
Ensures that the superview of the most focused view is on front.
Grabs the mouse, forcing all mouse events to be routed to the specified view until UngrabMouse is called.
Init(ConsoleDriver, IMainLoopDriver)
Initializes a new instance of Terminal.Gui Application.
Returns a rectangle that is centered in the screen for the provided size.
Move to the next Mdi child from the MdiTop.
Move to the previous Mdi child from the MdiTop.
Triggers a refresh of the entire display.
Stops running the most recent Toplevel or the top
if provided.
Runs the application by calling Run(Toplevel, Func<Exception, bool>) with the value of Top.
Run(Toplevel, Func<Exception, bool>)
Runs the main loop on the given Toplevel container.
Building block API: Runs the MainLoop for the created Toplevel.
RunMainLoopIteration(ref RunState, bool, ref bool)
Run one iteration of the MainLoop.
Run(Func<Exception, bool>, ConsoleDriver, IMainLoopDriver)
Runs the application by calling Run(Toplevel, Func<Exception, bool>)with a new instance of the specified Toplevel-derived class.
Calling Init(ConsoleDriver, IMainLoopDriver) first is not needed as this function will initialze the application.
Shutdown() must be called when the application is closing (typically after Run> has returned) to ensure resources are cleaned up and terminal settings restored.
Shutdown an application initialized with Init(ConsoleDriver, IMainLoopDriver).
Releases the mouse grab, so mouse events will be routed to the view on which the mouse is.
Events
Event to be invoked when a view grab the mouse.
Invoked when a view wants to grab the mouse; can be canceled.
Notify that a new Application.RunState was created (Begin(Toplevel) was called). The token is created inBegin(Toplevel) and this event will be fired before that function exits.
Notify that a existent Application.RunState is stopping (End(RunState) was called).
Event to be invoked when a view ungrab the mouse.
Invoked when a view wants ungrab the mouse; can be canceled.