Class View | Terminal.Gui v1 (original) (raw)
Namespace
Assembly
Terminal.Gui.dll
View is the base class for all views on the screen and represents a visible element that can render itself and contains zero or more nested views.
public class View : Responder, IDisposable, ISupportInitializeNotification, ISupportInitialize
Inheritance
View
Implements
Derived
Inherited Members
Constructors
Initializes a new instance of View using Computed layout.
View(ustring, TextDirection, Border)
Initializes a new instance of View using Computed layout.
Initializes a new instance of View using Absolute layout.
Initializes a new instance of a AbsoluteView class with the absolute dimensions specified in the frame
parameter.
Initializes a new instance of View using Absolute layout.
Properties
Gets or sets a flag that determines whether the View will be automatically resized to fit the Text. The default is false. Set to true to turn on AutoSize. If AutoSize is true the Widthand Height will always be used if the text size is lower. If the text size is higher the bounds will be resized to fit it. In addition, if ForceValidatePosDim is true the new values of Width andHeight must be of the same types of the existing one to avoid breaking the Dim settings.
The bounds represent the View-relative rectangle used for this view; the area inside of the view.
Gets or sets a value indicating whether this Responder can focus.
Gets or sets whether a view is cleared if the Visible property is false.
The color scheme for this view, if it is not defined, it returns the SuperView's color scheme.
Gets or sets arbitrary data for the view.
Points to the current driver in use by the view, it is a convenience property for simplifying the development of new views.
Gets or sets a value indicating whether this Responder can respond to user interaction.
Returns the currently focused view inside this view, or null if nothing is focused.
Forces validation with Computed layout to avoid breaking the Pos and Dim settings.
Gets or sets the frame for the view. The frame is relative to the view's container (SuperView).
Gets or sets a value indicating whether this Responder has focus.
Gets or sets the height of the view. Only used the LayoutStyle is Computed.
Gets or sets the HotKey defined for this view. A user pressing HotKey on the keyboard while this view has focus will cause the Clicked event to fire.
Gets or sets the specifier character for the hotkey (e.g. '_'). Set to '\xffff' to disable hotkey support for this View instance. The default is '\xffff'.
Gets or sets an identifier for the view;
Get or sets whether the view will use Border (if Border is set) to draw a border. If false (the default),Redraw(Rect) will call DrawContent(View, bool)to draw the view's border. If true no border is drawn (and the view is expected to draw the border itself).
Gets information if the view was already added to the SuperView.
Returns a value indicating if this View is currently on Top (Active)
Get or sets if the View was already initialized. This derived from ISupportInitializeNotification to allow notify all the views that are being initialized.
Controls how the View's Frame is computed during the LayoutSubviews method, if the style is set toAbsolute, LayoutSubviews does not change the Frame. If the style is Computedthe Frame is updated using the X, Y, Width, and Height properties.
Returns the most focused view in the chain of subviews (the leaf view that has the focus).
Gets or sets a flag that determines whether Text will have trailing spaces preserved or not when WordWrap(ustring, int, bool, int, TextDirection) is enabled. If trueany trailing spaces will be trimmed when either the Text property is changed or when WordWrap(ustring, int, bool, int, TextDirection) is set to true. The default is false.
This is the global setting that can be used as a global shortcut to invoke an action if provided.
The action to run if the Shortcut is defined.
The keystroke combination used in the Shortcut as string.
This returns a list of the subviews contained by this view.
Returns the container for this view, or null if this view has not been added to a container.
Indicates the index of the current View from the TabIndexes list.
This returns a tab index list of the subviews contained by this view.
This only be true if the CanFocus is also trueand the focus can be avoided by setting this to false
The text displayed by the View.
Gets or sets how the View's Text is aligned horizontally when drawn. Changing this property will redisplay the View.
Gets or sets the direction of the View's Text. Changing this property will redisplay the View.
Gets or sets the TextFormatter which can be handled differently by any derived class.
Gets or sets how the View's Text is aligned vertically when drawn. Changing this property will redisplay the View.
Gets or sets a value indicating whether this Responder and all its child controls are displayed.
Gets or sets a value indicating whether this View want continuous button pressed event.
Gets or sets a value indicating whether this View wants mouse position reports.
Gets or sets the width of the view. Only used the LayoutStyle is Computed.
Gets or sets the X position for the view (the column). Only used if the LayoutStyle is Computed.
Gets or sets the Y position for the view (the row). Only used if the LayoutStyle is Computed.
Methods
Adds a subview (child) to this view.
Adds the specified views (children) to the view.
AddCommand(Command, Func<bool?>)
States that the given View supports a given command
and what f
to perform to make that command happen
If the command
already has an implementation the f
will replace the old one
AddKeyBinding(Key, params Command[])
Adds a new key combination that will trigger the given command
(if supported by the View - see GetSupportedCommands())
If the key is already bound to a different Command it will be rebound to this one
Commands are only ever applied to the current View(i.e. this feature cannot be used to switch focus to another view and perform multiple commands there)
Displays the specified character in the specified column and row of the View.
This derived from ISupportInitializeNotification to allow notify all the views that are beginning initialized.
Moves the subview backwards in the hierarchy, only one step
Brings the specified subview to the front so it is drawn on top of any other views.
Clears the view region with the current color.
Clears the specified region with the current color.
ClearKeybinding(params Command[])
Removes all key bindings that trigger the given command. Views can have multiple different keys bound to the same command and this method will clear all of them.
Clears the existing keybinding (if any) for the given key
.
Removes all bound keys from the View and resets the default bindings.
Removes the SetNeedsLayout() setting on this view.
Removes the SetNeedsDisplay() and the ChildNeedsDisplay setting on this view.
Sets the ConsoleDriver's clip region to the current View's Bounds.
Checks if the key binding already exists.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Draws a frame in the current view, clipped by the boundary of this view
DrawHotString(ustring, bool, ColorScheme)
Utility function to draw strings that contains a hotkey using a ColorScheme and the "focused" state.
DrawHotString(ustring, Attribute, Attribute)
Utility function to draw strings that contain a hotkey.
This derived from ISupportInitializeNotification to allow notify all the views that are ending initialized.
Finds the first view in the hierarchy that wants to get the focus if nothing is currently focused, otherwise, does nothing.
Focuses the first focusable subview if one exists.
Focuses the last focusable subview if one exists.
Focuses the next view.
Focuses the previous view.
Gets the size to fit all text if AutoSize is true.
Gets the text formatter size from a Bounds size.
Calculate the height based on the Height settings.
Gets the current width based on the Width settings.
Determines the current ColorScheme based on the Enabled value.
GetHotKeySpecifierLength(bool)
Get the width or height of the HotKeySpecifier length.
Determines the current ColorScheme based on the Enabled value.
GetKeyFromCommand(params Command[])
Gets the key used by a command.
Verifies if the minimum width or height can be sets in the view.
Determines the current ColorScheme based on the Enabled value.
Returns all commands that are supported by this View.
Gets the bounds size from a Size.
Get the top superview of a given View.
Invokes any binding that is registered on this Viewand matches the keyEvent
Invoked when a view starts executing or when the dimensions of the view have changed, for example in response to the container view or terminal resizing.
This moves the cursor to the specified column and row in the view.
Method invoked when a subview is being added to this view.
Method invoked when the CanFocus property from a view is changed.
Enables overrides to draw infinitely scrolled content and/or a background behind added controls.
Enables overrides after completed drawing infinitely scrolled content and/or a background behind removed controls.
Method invoked when the Enabled property from a view is changed.
Method invoked when a view gets focus.
Method invoked when a key is pressed.
Method invoked when a key is released.
Method invoked when a view loses focus.
Invokes the MouseClick event.
Method invoked when a mouse event is generated for the first time.
Method invoked when a mouse event is generated
Method invoked when a mouse event is generated for the last time.
Method invoked when a subview is being removed from this view.
Method invoked when the Visible property from a view is changed.
Positions the cursor in the right position based on the currently focused view in the chain.
This method can be overwritten by views that want to provide accelerator functionality (Alt-key for example), but without interefering with normal ProcessKey behavior.
This method can be overwritten by view that want to provide accelerator functionality (Alt-key for example).
If the view is focused, gives the view a chance to process the keystroke.
Can be overridden if the view resize behavior is different than the default.
Redraws this view and its subviews; only redraws the views that have been flagged for a re-display.
Removes a subview added via Add(View) or Add(params View[]) from this View.
Removes all subviews (children) added via Add(View) or Add(params View[]) from this View.
Replaces a key combination already bound to Command.
Converts a point from screen-relative coordinates to view-relative coordinates.
Moves the subview backwards in the hierarchy, only one step
Sends the specified subview to the front so it is the first view drawn
Indicates that any child views (in the Subviews list) need to be repainted.
Sets the clip region to the specified view-relative region.
Causes the specified view and the entire parent hierarchy to have the focused order updated.
Calculate the height based on the Height settings.
Sets the minimum width or height if the view can be resized.
Sets a flag indicating this view needs to be redisplayed because its state has changed.
Flags the view-relative region on this View as needing to be repainted.
Calculate the width based on the Width settings.
Pretty prints the View
Can be overridden if the Text has different format than the default.
Events
Event fired when a subview is being added to this view.
Event fired when the CanFocus value is being changed.
Event invoked when the content area of the View is to be drawn.
Event invoked when the content area of the View is completed drawing.
Event fired when the Enabled value is being changed.
Event fired when the view gets focus.
Event invoked when the HotKey is changed.
Event called only once when the View is being initialized for the first time. Allows configurations and assignments to be performed before the View being shown. This derived from ISupportInitializeNotification to allow notify all the views that are being initialized.
Invoked when a key is pressed.
Invoked when a character key is pressed and occurs after the key up event.
Invoked when a key is released.
Fired after the View's LayoutSubviews() method has completed.
Fired after the View's LayoutSubviews() method has completed.
Event fired when the view looses focus.
Event fired when a mouse event is generated.
Event fired when the view receives the mouse event for the first time.
Event fired when the view receives a mouse event for the last time.
Event fired when a subview is being removed from this view.
Event fired when the Visible value is being changed.