mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Remove TileView; use View.Arrangement instead (#4271)
* Initial plan * Remove TileView and refactor to use View.Arrangement Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fix FileDialog container focus behavior - all tests passing Co-authored-by: tig <585482+tig@users.noreply.github.com> * Remove obsolete TileView comment from View.Hierarchy.cs Co-authored-by: tig <585482+tig@users.noreply.github.com> * Add resizable splitter example to View.Arrangement docs Co-authored-by: tig <585482+tig@users.noreply.github.com> * Refactored `TreeView` and `TableView` containersto use View.Arrangment. Removed unused `_btnToggleSplitterCollapse` and related logic due to the new splitter design. Simplified collection initialization and feedback/state handling. Improved code readability by replacing magic strings and redundant null checks. Refactor FileDialog for null safety and UI improvements Enabled nullable reference types to improve null safety across the codebase. Refactored constants to follow uppercase naming conventions. Introduced nullable annotations for fields and method parameters. Updated test cases to reflect the removal of deprecated features. Skipped tests related to the removed splitter button. Made miscellaneous improvements, including adding comments and suppressing warnings. * Add "_Find:" label to FileDialog search field Co-authored-by: tig <585482+tig@users.noreply.github.com> * Fixes Parallel unit test intermittent failure case. Removed the initialization of the `Navigation` object in the `ResetState` method of the `Application` class, indicating a potential shift in its lifecycle management. Enhanced comments to clarify the role of `Shutdown` as a counterpart to `Init`, emphasizing resource cleanup and defensive coding for multithreaded scenarios. Referenced Issue #537 for additional context. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: tig <585482+tig@users.noreply.github.com> Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
@@ -50,6 +50,49 @@ A form of layout where SubViews of a View are visually arranged such that their
|
||||
|
||||
In most use-cases, subviews do not overlap with each other (the exception being when it's done intentionally to create some visual effect). As a result, the default layout for most TUI apps is "tiled", and by default @Terminal.Gui.ViewBase.View.Arrangement is set to @Terminal.Gui.ViewBase.ViewArrangement.Fixed.
|
||||
|
||||
### Creating a Resizable Splitter
|
||||
|
||||
A common pattern in tiled layouts is to create a resizable splitter between two views. This can be achieved using the @Terminal.Gui.ViewBase.ViewArrangement.LeftResizable, @Terminal.Gui.ViewBase.ViewArrangement.RightResizable, @Terminal.Gui.ViewBase.ViewArrangement.TopResizable, or @Terminal.Gui.ViewBase.ViewArrangement.BottomResizable flags.
|
||||
|
||||
Here's an example of creating a horizontal resizable splitter between two views:
|
||||
|
||||
```csharp
|
||||
// Create left pane that fills remaining space
|
||||
View leftPane = new ()
|
||||
{
|
||||
X = 0,
|
||||
Y = 0,
|
||||
Width = Dim.Fill (Dim.Func (_ => rightPane.Frame.Width)),
|
||||
Height = Dim.Fill (),
|
||||
CanFocus = true
|
||||
};
|
||||
|
||||
// Create right pane with resizable left border (acts as splitter)
|
||||
View rightPane = new ()
|
||||
{
|
||||
X = Pos.Right (leftPane) - 1,
|
||||
Y = 0,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill (),
|
||||
Arrangement = ViewArrangement.LeftResizable,
|
||||
BorderStyle = LineStyle.Single,
|
||||
SuperViewRendersLineCanvas = true,
|
||||
CanFocus = true
|
||||
};
|
||||
rightPane.Border!.Thickness = new (1, 0, 0, 0); // Only left border
|
||||
|
||||
container.Add (leftPane, rightPane);
|
||||
```
|
||||
|
||||
In this example:
|
||||
- The `rightPane` has `ViewArrangement.LeftResizable` which makes its left border draggable
|
||||
- The left border acts as a splitter that users can drag to resize both panes
|
||||
- The `leftPane` uses `Dim.Fill` with a function that subtracts the `rightPane`'s width to automatically fill the remaining space
|
||||
- The `rightPane` has `SuperViewRendersLineCanvas = true` to ensure the border is rendered properly
|
||||
- Only the left border is shown by setting `Border.Thickness` to `(1, 0, 0, 0)`
|
||||
|
||||
For a vertical splitter (top and bottom panes), use `ViewArrangement.TopResizable` or `ViewArrangement.BottomResizable` instead.
|
||||
|
||||
## Runnable
|
||||
|
||||
Today, Overlapped and Runnable are intrinsically linked. A runnable view is one where `Application.Run(Toplevel)` is called. Each *Runnable* view where (`Modal == false`) has it's own `RunState` and is, effectively, a self-contained "application".
|
||||
|
||||
@@ -628,33 +628,6 @@ TextView provides a fully featured multi-line text
|
||||
It supports word wrap and history for undo.
|
||||
```
|
||||
|
||||
## [TileView](~/api/Terminal.Gui.Views.TileView.yml)
|
||||
|
||||
A [View](~/api/Terminal.Gui.ViewBase.View.yml) consisting of a moveable bar that divides the display area into resizeable [TileView.Tiles](~/api/Terminal.Gui.Views.TileView.Tiles.yml).
|
||||
|
||||
```text
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
│
|
||||
```
|
||||
|
||||
## [TimeField](~/api/Terminal.Gui.Views.TimeField.yml)
|
||||
|
||||
Provides time editing functionality with mouse support
|
||||
|
||||
Reference in New Issue
Block a user