mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
progress
This commit is contained in:
@@ -102,7 +102,7 @@ namespace Terminal.Gui {
|
||||
var prevClip = SetClip (Frame);
|
||||
|
||||
var screenBounds = ViewToScreen (Frame);
|
||||
Thickness.Draw (screenBounds, (string)Data);
|
||||
Thickness.Draw (screenBounds, (string)(Data != null ? Data : string.Empty));
|
||||
|
||||
//OnDrawContent (bounds);
|
||||
|
||||
|
||||
@@ -620,7 +620,6 @@ namespace Terminal.Gui {
|
||||
return new Rect (default, frameRelativeBounds.Size);
|
||||
}
|
||||
set {
|
||||
throw new InvalidOperationException ("It makes no sense to explicitly set Bounds.");
|
||||
Frame = new Rect (Frame.Location, value.Size
|
||||
+ new Size (Margin.Thickness.Right, Margin.Thickness.Bottom)
|
||||
+ new Size (BorderFrame.Thickness.Right, BorderFrame.Thickness.Bottom)
|
||||
@@ -792,7 +791,7 @@ namespace Terminal.Gui {
|
||||
/// will not fit.</returns>
|
||||
public bool SetMinWidthHeight ()
|
||||
{
|
||||
if (GetMinimumBounds (out Size size)) {
|
||||
if (IsInitialized && GetMinimumBounds (out Size size)) {
|
||||
Bounds = new Rect (Bounds.Location, size);
|
||||
return true;
|
||||
}
|
||||
@@ -932,7 +931,6 @@ namespace Terminal.Gui {
|
||||
TabIndex = -1;
|
||||
TabStop = false;
|
||||
LayoutStyle = layoutStyle;
|
||||
// BUGBUG: CalcRect doesn't account for line wrapping
|
||||
|
||||
Border = border;
|
||||
Text = text;
|
||||
@@ -3259,6 +3257,7 @@ namespace Terminal.Gui {
|
||||
// TODO: Figure out why ScrollView and other tests fail if this call is put here
|
||||
// instead of the constructor.
|
||||
// OnSizeChanged ();
|
||||
InitializeFrames ();
|
||||
|
||||
} else {
|
||||
//throw new InvalidOperationException ("The view is already initialized.");
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Terminal.Gui {
|
||||
/// </remarks>
|
||||
public Window (Rect frame, ustring title = null, int padding = 0, Border border = null) : base (frame)
|
||||
{
|
||||
Initialize (title, frame, padding, border);
|
||||
SetInitialProperties (title, frame, padding, border);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -86,7 +86,7 @@ namespace Terminal.Gui {
|
||||
/// </remarks>
|
||||
public Window (ustring title = null, int padding = 0, Border border = null) : base ()
|
||||
{
|
||||
Initialize (title, Rect.Empty, padding, border);
|
||||
SetInitialProperties (title, Rect.Empty, padding, border);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -98,23 +98,35 @@ namespace Terminal.Gui {
|
||||
///[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
|
||||
public static BorderStyle DefaultBorderStyle { get; set; } = BorderStyle.Single;
|
||||
|
||||
void Initialize (ustring title, Rect frame, int padding = 0, Border border = null)
|
||||
void SetInitialProperties (ustring title, Rect frame, int padding = 0, Border border = null)
|
||||
{
|
||||
CanFocus = true;
|
||||
ColorScheme = Colors.Base;
|
||||
if (title == null) title = ustring.Empty;
|
||||
Title = title;
|
||||
|
||||
if (border == null) {
|
||||
// TODO: v2 this is a hack until Border gets refactored
|
||||
Border = new Border () {
|
||||
BorderStyle = DefaultBorderStyle,
|
||||
Padding = new Thickness (padding),
|
||||
//Title = title
|
||||
};
|
||||
} else {
|
||||
Border = border;
|
||||
}
|
||||
}
|
||||
|
||||
public override void BeginInit ()
|
||||
{
|
||||
base.BeginInit ();
|
||||
BorderFrame.Thickness = new Thickness (2);
|
||||
BorderFrame.BorderStyle = Border.BorderStyle;
|
||||
BorderFrame.ColorScheme = ColorScheme;
|
||||
BorderFrame.Data = "BorderFrame";
|
||||
|
||||
Padding.Thickness = Border.Padding;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Add (View view)
|
||||
{
|
||||
@@ -139,77 +151,6 @@ namespace Terminal.Gui {
|
||||
|
||||
}
|
||||
|
||||
///// <inheritdoc/>
|
||||
//public override void RemoveAll ()
|
||||
//{
|
||||
// contentView.RemoveAll ();
|
||||
//}
|
||||
|
||||
/////<inheritdoc/>
|
||||
//public override void Redraw (Rect bounds)
|
||||
//{
|
||||
// var padding = Border.GetSumThickness ();
|
||||
// var scrRect = ViewToScreen (new Rect (0, 0, Frame.Width, Frame.Height));
|
||||
|
||||
// if (!NeedDisplay.IsEmpty || ChildNeedsDisplay || LayoutNeeded) {
|
||||
// Driver.SetAttribute (GetNormalColor ());
|
||||
// Clear ();
|
||||
// contentView.SetNeedsDisplay ();
|
||||
// }
|
||||
// var savedClip = contentView.ClipToBounds ();
|
||||
|
||||
// // Redraw our contentView
|
||||
// // DONE: smartly constrict contentView.Bounds to just be what intersects with the 'bounds' we were passed
|
||||
// contentView.Redraw (!NeedDisplay.IsEmpty || ChildNeedsDisplay || LayoutNeeded ? contentView.Bounds : bounds);
|
||||
// Driver.Clip = savedClip;
|
||||
|
||||
// ClearLayoutNeeded ();
|
||||
// ClearNeedsDisplay ();
|
||||
|
||||
// Driver.SetAttribute (GetNormalColor ());
|
||||
// //Driver.DrawWindowFrame (scrRect, padding.Left + borderLength, padding.Top + borderLength, padding.Right + borderLength, padding.Bottom + borderLength,
|
||||
// // Border.BorderStyle != BorderStyle.None, fill: true, Border.BorderStyle);
|
||||
// Border.DrawContent (this, false);
|
||||
// if (HasFocus)
|
||||
// Driver.SetAttribute (ColorScheme.HotNormal);
|
||||
// if (Border.DrawMarginFrame)
|
||||
// Driver.DrawWindowTitle (scrRect, Title, padding.Left, padding.Top, padding.Right, padding.Bottom);
|
||||
// Driver.SetAttribute (GetNormalColor ());
|
||||
//}
|
||||
|
||||
///// <inheritdoc/>
|
||||
//public override void OnCanFocusChanged ()
|
||||
//{
|
||||
// if (contentView != null) {
|
||||
// contentView.CanFocus = CanFocus;
|
||||
// }
|
||||
// base.OnCanFocusChanged ();
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// The text displayed by the <see cref="Label"/>.
|
||||
///// </summary>
|
||||
//public override ustring Text {
|
||||
// get => contentView?.Text;
|
||||
// set {
|
||||
// base.Text = value;
|
||||
// if (contentView != null) {
|
||||
// contentView.Text = value;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
///// <summary>
|
||||
///// Controls the text-alignment property of the label, changing it will redisplay the <see cref="Label"/>.
|
||||
///// </summary>
|
||||
///// <value>The text alignment.</value>
|
||||
//public override TextAlignment TextAlignment {
|
||||
// get => contentView.TextAlignment;
|
||||
// set {
|
||||
// base.TextAlignment = contentView.TextAlignment = value;
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Event arguments for <see cref="View.Title"/> change events.
|
||||
/// </summary>
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Terminal.Gui {
|
||||
/// <param name="border">The <see cref="Border"/>.</param>
|
||||
public FrameView (Rect frame, ustring title = null, View [] views = null, Border border = null) : base (frame)
|
||||
{
|
||||
Initialize (frame, title, views, border);
|
||||
SetInitialProperties (frame, title, views, border);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,7 +66,7 @@ namespace Terminal.Gui {
|
||||
/// <param name="border">The <see cref="Border"/>.</param>
|
||||
public FrameView (ustring title, Border border = null)
|
||||
{
|
||||
Initialize (Rect.Empty, title, null, border);
|
||||
SetInitialProperties (Rect.Empty, title, null, border);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -83,7 +83,7 @@ namespace Terminal.Gui {
|
||||
[SerializableConfigurationProperty (Scope = typeof (ThemeScope)), JsonConverter (typeof (JsonStringEnumConverter))]
|
||||
public static BorderStyle DefaultBorderStyle { get; set; } = BorderStyle.Single;
|
||||
|
||||
void Initialize (Rect frame, ustring title, View [] views = null, Border border = null)
|
||||
void SetInitialProperties (Rect frame, ustring title, View [] views = null, Border border = null)
|
||||
{
|
||||
this.Title = title;
|
||||
if (border == null) {
|
||||
@@ -99,13 +99,15 @@ namespace Terminal.Gui {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void DrawFrame ()
|
||||
public override void BeginInit ()
|
||||
{
|
||||
DrawFrame (new Rect (0, 0, Frame.Width, Frame.Height), 0, fill: true);
|
||||
}
|
||||
base.BeginInit ();
|
||||
BorderFrame.Thickness = new Thickness (2);
|
||||
BorderFrame.BorderStyle = Border.BorderStyle;
|
||||
BorderFrame.ColorScheme = ColorScheme;
|
||||
BorderFrame.Data = "BorderFrame";
|
||||
|
||||
}
|
||||
|
||||
///<inheritdoc/>
|
||||
public override bool OnEnter (View view)
|
||||
|
||||
Reference in New Issue
Block a user