-
Notifications
You must be signed in to change notification settings - Fork 703
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
Adornments: Enable SubViews in Margin
, Border
, and Padding
#2563
Comments
How you think on handling the |
Yes, I think that's right. This reminds me of something else I was thinking about:
E.g. which is more true, given
Note, I do NOT mean Regardless, here's how I think we'd lay out a Padding.Thickness = new Thickness (
_menuBar.Visible ? 1 : 0, // Top
0, // Left
_verticalScrollBar.Visible ? 1: 0, // Right
(_statusBar.Visible ? 1 : 0) + (_horizontalScrollBar.Visible ? 1 :0)); // Bottom
// These have all been `Padding.Add()`ed
_menuBar.X = 0;
_menuBar.Y = 0;
_menuBar.Width = Dim.Fill();
_menuBar.Height = 1;
_statusBar.X = 0;
_statusBar.Y = Pos.AnchorEnd (1);
_statusBar.Width = Dim.Fill();
_statusBar.Height = 1;
_verticalScrollbar.X = Pos.AnchorEnd(1);
_verticalScrollbar.Y = _menuBar.Visible ? Pos.Bottom (_menuBar) : 0;
_verticalScrollbar.Width = 1;
_verticalScrollbar.Height = Dim.Fill ((_menuBar.Visible ? 1 : 0) + (_statusBar.Visible ? 1 : 0) + (_horizontalScrollBar.Visible ? 1 : 0));
_horizontalScrollbar.X = 0;
_horizontalcrollbar.Y = Pos.AnchorEnd (_statusBar.Visible ? 2 : 1);
_horizontalScrollbar.Width = Dim.Fill ();
_horizontalScrollbar.Height = 1; |
And in the cases where we want buttons arbitrary on others locations, that possible, right? Added to |
Correct. On the same note, for Padding.Thickness = new Thickness (Padding.Thickness.Top, Padding.Thickness.Left, Padding.Thickness.Right, 1);
_helpText.X = Pos.AnchorEnd (1);
_helpText.Y = 0;
_helpText.Width = 15;
_helpText.Height = Dim.Fill (2); // +1 for buttons on Bottom
Padding.Add (_helpText); |
A key part of addressing this issue will be:
Less important (and highly debatlve), but interesting. Including this just to make sure we are intentional:
|
Just to remember that you may want to join |
If I understand you correctly, this is what |
Margin
, Border
, and Padding
Margin
, Border
, and Padding
This is a sub-issue of:
Todo
Adornment.Add
is called? Fixed in Fixes #3273. UpdatesFindDeepestView
to supportAdornment
#3278MouseEvent
s work? Fixed in Fixes #3273. UpdatesFindDeepestView
to supportAdornment
#3278Focus
work? BecausePadding
is in a different view hierarchy from the dialog,Tab
etc... doesn't tab into the buttons.Padding
- Any views added toPadding
are included inPadding.Parent
's focus chain. IfView.Subviews[^1].HasFocus
and the user pressesTab
Padding.SubViews[0]
will get focus. Etc...Border
-Ctrl-F10
is used to set focus onBorder.Subviews[0]
. SubsequentTab
presses cycle throughBorder.Subviews
.Ctrl-F10
again returns focus toBorder.Parent
.Margin
- No default behavior. If someone adds views toMargin
they are on their own to figure out a focus model (I can't think of any use case where it makes sense to add a subview toMargin
.Background
Examples of SubViews in Adornments:
TitleBar
renders the View'sTitle
and a horizontal line defining the top of the View. Added toBorder
.LineView
s that render the View's 'Border`Vertical Scrollbar
adds thickness toPadding.Right
(or.Left
when right-to-left language support is added).Horizontal Scrollbar
adds thickness toPadding.Bottom
when enabled.MenuBar
adds thickness toPadding.Top
(NOTE: This is a change from v1 wheresubview.Y = 1
is required).StatusBar
adds thickness otPadding.Bottom
and is rendered at the bottom ofPadding
.Dialog
(and derived classes), the buttons can be added toPadding
(Y = Pos.AnchorEnd(1)
).Should expanding of, e.g.
Padding.Thickness
be automatic whenPadding.Add
is called? IfDim.Auto
is implemented, it might be possible for this to happen. For now: I suggest devs adding adornments manually expand thickness as appropriate. In my Dialog prototype, I did this:The text was updated successfully, but these errors were encountered: