More Prototype scrollbuttons in Padding for CharMap

This commit is contained in:
Tig
2024-03-31 22:13:48 -06:00
parent a7079edf77
commit f65c49a858
3 changed files with 23 additions and 17 deletions

View File

@@ -524,12 +524,12 @@ public partial class View
_needsDisplayRect = new (x, y, w, h);
}
SuperView?.SetSubViewNeedsDisplay ();
Margin?.SetNeedsDisplay ();
Border?.SetNeedsDisplay ();
Padding?.SetNeedsDisplay ();
SuperView?.SetSubViewNeedsDisplay ();
foreach (View subview in Subviews)
{
if (subview.Frame.IntersectsWith (region))
@@ -550,6 +550,13 @@ public partial class View
if (SuperView is { SubViewNeedsDisplay: false })
{
SuperView.SetSubViewNeedsDisplay ();
return;
}
if (this is Adornment adornment)
{
adornment.Parent?.SetSubViewNeedsDisplay ();
}
}

View File

@@ -62,7 +62,8 @@ public class Button : View
//MouseClick += Button_MouseClick;
}
private Attribute _originalNormal;
[CanBeNull]
private ColorScheme _savedColorScheme;
private void Button_MouseEvent (object sender, MouseEventEventArgs e)
{
@@ -71,31 +72,29 @@ public class Button : View
if (Application.MouseGrabView == this)
{
e.Handled = InvokeCommand (Command.HotKey) == true;
return;
}
SetFocus();
Application.GrabMouse(this);
_originalNormal = ColorScheme.Normal;
var cs = new ColorScheme (ColorScheme)
{
Normal = ColorScheme.HotFocus
};
_savedColorScheme = ColorScheme;
var cs = new ColorScheme (new Attribute (ColorScheme.Normal.Background, ColorScheme.Normal.Foreground));
ColorScheme = cs;
}
if (e.MouseEvent.Flags == MouseFlags.Button1Released)
if (e.MouseEvent.Flags.HasFlag(MouseFlags.Button1Released))
{
Application.UngrabMouse ();
var cs = new ColorScheme (ColorScheme)
{
Normal = _originalNormal
};
ColorScheme = cs;
e.Handled = InvokeCommand (Command.HotKey) == true;
return;
if (_savedColorScheme is { })
{
ColorScheme = _savedColorScheme;
}
_savedColorScheme = null;
}
}

View File

@@ -301,7 +301,7 @@ public class Buttons : Scenario
Width = 1,
NoPadding = true,
NoDecorations = true,
Title = CM.Glyphs.UpArrow.ToString(),
Title = $"{CM.Glyphs.UpArrow}",
};
Win.Add (label, oneByOne);