mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 17:57:57 +01:00
Removed Frame overrides
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user