Class Window
Inherited Members
Namespace: Terminal.Gui
Assembly: Terminal.Gui.dll
Syntax
public class Window : Toplevel, IDisposable, ISupportInitializeNotification, ISupportInitialize
Remarks
The 'client area' of a Window is a rectangle deflated by one or more rows/columns from Bounds. A this time there is no
API to determine this rectangle.
Constructors
| Edit this page View SourceWindow()
Declaration
public Window()
Window(ustring)
Declaration
public Window(ustring title = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ustring | title | Title. |
Remarks
This constructor initializes a View with a LayoutStyle of Computed.
Use X, Y, Width, and Height properties to dynamically control the size and location of the view.
|
Edit this page
View Source
Window(ustring, int, Border)
Declaration
public Window(ustring title = null, int padding = 0, Border border = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ustring | title | Title. |
| int | padding | Number of characters to use for padding of the drawn frame. |
| Border | border | The Border. |
Remarks
This constructor initializes a View with a LayoutStyle of Computed.
Use X, Y, Width, and Height properties to dynamically control the size and location of the view.
|
Edit this page
View Source
Window(Rect, ustring)
Declaration
public Window(Rect frame, ustring title = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | frame | Superview-relative rectangle specifying the location and size |
| ustring | title | Title |
Remarks
This constructor initializes a Window with a LayoutStyle of Absolute. Use constructors
that do not take
|
Edit this page
View Source
Rect parameters to initialize a Window with Computed.Window(Rect, ustring, int, Border)
Initializes a new instance of the Window using Absolute positioning with the specified frame for its location, with the specified frame padding,
and an optional title.
Declaration
public Window(Rect frame, ustring title = null, int padding = 0, Border border = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | frame | Superview-relative rectangle specifying the location and size |
| ustring | title | Title |
| int | padding | Number of characters to use for padding of the drawn frame. |
| Border | border | The Border. |
Remarks
This constructor initializes a Window with a LayoutStyle of Absolute. Use constructors
that do not take
Rect parameters to initialize a Window with LayoutStyle of ComputedProperties
| Edit this page View SourceBorder
Declaration
public override Border Border { get; set; }
Property Value
| Type | Description |
|---|---|
| Border |
Overrides
| Edit this page View SourceText
The text displayed by the Label.
Declaration
public override ustring Text { get; set; }
Property Value
| Type | Description |
|---|---|
| ustring |
Overrides
| Edit this page View SourceTextAlignment
Controls the text-alignment property of the label, changing it will redisplay the Label.
Declaration
public override TextAlignment TextAlignment { get; set; }
Property Value
| Type | Description |
|---|---|
| TextAlignment | The text alignment. |
Overrides
| Edit this page View SourceTitle
The title to be displayed for this window.
Declaration
public ustring Title { get; set; }
Property Value
| Type | Description |
|---|---|
| ustring | The title |
Methods
| Edit this page View SourceAdd(View)
Adds a subview (child) to this view.
Declaration
public override void Add(View view)
Parameters
| Type | Name | Description |
|---|---|---|
| View | view |
Overrides
Remarks
The Views that have been added to this view can be retrieved via the Subviews property.
See also Remove(View)RemoveAll()
|
Edit this page
View Source
OnCanFocusChanged()
Method invoked when the CanFocus property from a view is changed.
Declaration
public override void OnCanFocusChanged()
Overrides
| Edit this page View SourceOnTitleChanged(ustring, ustring)
Called when the Title has been changed. Invokes the TitleChanged event.
Declaration
public virtual void OnTitleChanged(ustring oldTitle, ustring newTitle)
Parameters
| Type | Name | Description |
|---|---|---|
| ustring | oldTitle | The Title that is/has been replaced. |
| ustring | newTitle | The new Title to be replaced. |
OnTitleChanging(ustring, ustring)
Called before the Title changes. Invokes the TitleChanging event, which can be cancelled.
Declaration
public virtual bool OnTitleChanging(ustring oldTitle, ustring newTitle)
Parameters
| Type | Name | Description |
|---|---|---|
| ustring | oldTitle | The Title that is/has been replaced. |
| ustring | newTitle | The new Title to be replaced. |
Returns
| Type | Description |
|---|---|
| bool | `true` if an event handler cancelled the Title change. |
Redraw(Rect)
Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
Declaration
public override void Redraw(Rect bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| Rect | bounds | The bounds (view-relative region) to redraw. |
Overrides
Remarks
Always use Bounds (view-relative) when calling Redraw(Rect), NOT Frame (superview-relative).
Views should set the color that they want to use on entry, as otherwise this will inherit the last color that was set globally on the driver.
Overrides of Redraw(Rect) must ensure they do not set Driver.Clip to a clip region
larger than the parameter, as this will cause the driver to clip the entire region.
Remove(View)
Removes a subview added via Add(View) or Add(params View[]) from this View.
Declaration
public override void Remove(View view)
Parameters
| Type | Name | Description |
|---|---|---|
| View | view |
Overrides
| Edit this page View SourceRemoveAll()
Removes all subviews (children) added via Add(View) or Add(params View[]) from this View.
Declaration
public override void RemoveAll()
Overrides
Events
| Edit this page View SourceTitleChanged
Event fired after the Title has been changed.
Declaration
public event Action<Window.TitleEventArgs> TitleChanged
Event Type
| Type | Description |
|---|---|
| Action<Window.TitleEventArgs> |
TitleChanging
Declaration
public event Action<Window.TitleEventArgs> TitleChanging
Event Type
| Type | Description |
|---|---|
| Action<Window.TitleEventArgs> |