mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Remove SetView1 and SetView2 methods and just mount tab views properly
This commit is contained in:
@@ -734,41 +734,6 @@ namespace Terminal.Gui {
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces <see cref="View1"/> with the provided <paramref name="view"/>.
|
||||
/// The new <paramref name="view"/> will be resized to fill available
|
||||
/// area and resized on <see cref="SplitterMoved"/>.
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
public void SetView1 (View view)
|
||||
{
|
||||
if(View1 != null) {
|
||||
Remove (View1);
|
||||
}
|
||||
|
||||
Add (view);
|
||||
View1 = view;
|
||||
LayoutSubviews ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces <see cref="View2"/> with the provided <paramref name="view"/>.
|
||||
/// The new <paramref name="view"/> will be resized to fill available
|
||||
/// area and resized on <see cref="SplitterMoved"/>.
|
||||
/// </summary>
|
||||
/// <param name="view"></param>
|
||||
public void SetView2 (View view)
|
||||
{
|
||||
if (View2 != null) {
|
||||
Remove (View2);
|
||||
}
|
||||
|
||||
Add (view);
|
||||
|
||||
View2 = view;
|
||||
LayoutSubviews ();
|
||||
}
|
||||
|
||||
private class ChildSplitterLine {
|
||||
|
||||
readonly SplitContainerLineView currentLine;
|
||||
|
||||
@@ -32,14 +32,7 @@ namespace UICatalog.Scenarios {
|
||||
});
|
||||
Application.Top.Add (menu);
|
||||
|
||||
tabView = new TabView () {
|
||||
X = 0,
|
||||
Y = 1,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill (1),
|
||||
};
|
||||
|
||||
tabView.TabClicked += TabView_TabClicked;
|
||||
tabView = CreateNewTabView ();
|
||||
|
||||
tabView.Style.ShowBorder = true;
|
||||
tabView.ApplyStyleChanges ();
|
||||
@@ -52,7 +45,7 @@ namespace UICatalog.Scenarios {
|
||||
Height = Dim.Fill (1),
|
||||
};
|
||||
split.View2.Visible = false;
|
||||
split.SetView1 (tabView);
|
||||
split.View1.Add (tabView);
|
||||
split.IntegratedBorder = BorderStyle.None;
|
||||
|
||||
Application.Top.Add (split);
|
||||
@@ -129,18 +122,13 @@ namespace UICatalog.Scenarios {
|
||||
}
|
||||
private void SplitRight (TabView sender, OpenedFile tab)
|
||||
{
|
||||
var split = (SplitView)sender.SuperView;
|
||||
|
||||
// TODO: How can SuperView sometimes be null?!
|
||||
if(split == null) {
|
||||
throw new NullReferenceException ("Much confusion, sender.SuperView is null");
|
||||
}
|
||||
var split = (SplitView)sender.SuperView.SuperView;
|
||||
|
||||
split.TrySplitView1 (out var sub);
|
||||
sub.Orientation = Terminal.Gui.Graphs.Orientation.Vertical;
|
||||
var newTabView = CreateNewTabView ();
|
||||
tab.CloneTo (newTabView);
|
||||
sub.SetView2 (newTabView);
|
||||
sub.View2.Add (newTabView);
|
||||
}
|
||||
|
||||
private TabView CreateNewTabView ()
|
||||
|
||||
Reference in New Issue
Block a user