Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Border to use subviews for title, lines, and close button #3407

Open
tig opened this issue Apr 15, 2024 · 0 comments
Open

Refactor Border to use subviews for title, lines, and close button #3407

tig opened this issue Apr 15, 2024 · 0 comments
Assignees
Milestone

Comments

@tig
Copy link
Collaborator

tig commented Apr 15, 2024

Related:

Requires

Will enable

Design

Subviews

public Label TitleLabel { get; set; };
public Button CloseButton { get ; set; }
public Line Top { get; set; }
public Line Left { get; set; }
public Line Right{ get; set; }
public Line Bottom{ get; set; }

Layout

This also indicates the order the views should be added; The label & button must be added after the lines so that they occlude them.

Top.X = Pos.Function (Thickness.Left/ 2);
Top.Y = Pos.Function (Thickness.Top / 2);
Top.Width = Dim.Fill () - Dim.Function (Thickness.Right / 2);

Left.X = Pos.Left (Top);
Left.Y = Pos.Top (Top);
Left.Height = Dim.Fill () - Dim.Function (Thickness.Bottom / 2);

Right.X = Pos.Right (Top);
Right.Y = Pos.Top (Top);
Right.Height = Dim.Fill () - Dim.Function (Thickness.Bottom / 2);

Bottom.X = Pos.Left (Top);
Bottom.Y= Pos.Bottom (Left);
Bottom.Width = Dim.Fill () - Dim.Function (Thickness.Right / 2);

TitleLabel.X = Pos.Right (Left) + 1;
TitleLabelY = Pos.Top (Top);

CloseButton .X = Pos.Left (Right) - 1;
CloseButton .Y = Pos.Top (Top);

Example usage:

view.Border.TitleLabel.X = Pos.Center (); // centers title (default is X = 1)
view.Border.TitleLabel.Visible = false; // Turn off the Title.
@tig tig self-assigned this Apr 15, 2024
@tig tig added this to the V2 Beta milestone May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗 Approved - In progress
Development

No branches or pull requests

1 participant