Removed Frame overrides

This commit is contained in:
Tig Kindel
2024-01-07 21:29:47 -07:00
parent 169f34d573
commit baf66ef704
4 changed files with 14 additions and 28 deletions

View File

@@ -23,17 +23,6 @@ namespace Terminal.Gui {
WantMousePositionReports = true;
}
public override Rect Frame {
get => base.Frame;
set {
base.Frame = value;
X = value.X;
Y = value.Y;
Width = value.Width;
Height = value.Height;
}
}
public override void OnDrawContent (Rect contentArea)
{
if (autocomplete.LastPopupPos == null) {

View File

@@ -58,7 +58,7 @@ namespace Terminal.Gui {
/// <inheritdoc/>
public override Rect FrameToScreen ()
{
// Frames are *Children* of a View, not SubViews. Thus View.FramToScreen will not work.
// Frames are *Children* of a View, not SubViews. Thus View.FrameToScreen will not work.
// To get the screen-relative coordinates of a Frame, we need to know who
// the Parent is
var ret = Parent?.Frame ?? Frame;

View File

@@ -52,8 +52,7 @@ public partial class View {
/// </para>
/// <para>
/// Altering the Frame will eventually (when the view is next drawn) cause the
/// <see cref="LayoutSubview(View, Rect)"/>
/// and <see cref="OnDrawContent(Rect)"/> methods to be called.
/// <see cref="LayoutSubview(View, Rect)"/> and <see cref="OnDrawContent(Rect)"/> methods to be called.
/// </para>
/// </remarks>
public virtual Rect Frame {

View File

@@ -110,6 +110,8 @@ namespace Terminal.Gui {
Initialized += TextField_Initialized;
LayoutComplete += TextField_LayoutComplete;
// Things this view knows how to do
AddCommand (Command.DeleteCharRight, () => { DeleteCharRight (); return true; });
AddCommand (Command.DeleteCharLeft, () => { DeleteCharLeft (false); return true; });
@@ -219,6 +221,16 @@ namespace Terminal.Gui {
KeyBindings.Add (ContextMenu.Key.KeyCode, KeyBindingScope.HotKey, Command.ShowContextMenu);
}
private void TextField_LayoutComplete (object sender, LayoutEventArgs e)
{
// Don't let height > 1
if (Frame.Height > 1) {
Height = 1;
}
Adjust ();
}
private MenuBarItem BuildContextMenuBarItem ()
{
return new MenuBarItem (new MenuItem [] {
@@ -280,20 +292,6 @@ namespace Terminal.Gui {
/// </summary>
public IAutocomplete Autocomplete { get; set; } = new TextFieldAutocomplete ();
///<inheritdoc/>
public override Rect Frame {
get => base.Frame;
set {
if (value.Height > 1) {
base.Frame = new Rect (value.X, value.Y, value.Width, 1);
Height = 1;
} else {
base.Frame = value;
}
Adjust ();
}
}
/// <summary>
/// Sets or gets the text held by the view.
/// </summary>