mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-29 01:07:58 +01:00
Prototype scrollbuttons in Padding for CharMap
This commit is contained in:
@@ -31,8 +31,14 @@ public partial class View
|
||||
|
||||
/// <summary>Adds a subview (child) to this view.</summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The Views that have been added to this view can be retrieved via the <see cref="Subviews"/> property. See also
|
||||
/// <seealso cref="Remove(View)"/> <seealso cref="RemoveAll"/>
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Subviews will be disposed when this View is disposed. In other-words, calling this method causes
|
||||
/// the lifecycle of the subviews to be transferred to this View.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public virtual void Add (View view)
|
||||
{
|
||||
@@ -92,8 +98,14 @@ public partial class View
|
||||
/// <summary>Adds the specified views (children) to the view.</summary>
|
||||
/// <param name="views">Array of one or more views (can be optional parameter).</param>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// The Views that have been added to this view can be retrieved via the <see cref="Subviews"/> property. See also
|
||||
/// <seealso cref="Remove(View)"/> <seealso cref="RemoveAll"/>
|
||||
/// <seealso cref="Remove(View)"/> and <seealso cref="RemoveAll"/>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Subviews will be disposed when this View is disposed. In other-words, calling this method causes
|
||||
/// the lifecycle of the subviews to be transferred to this View.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public void Add (params View [] views)
|
||||
{
|
||||
@@ -185,7 +197,12 @@ public partial class View
|
||||
}
|
||||
|
||||
/// <summary>Removes a subview added via <see cref="Add(View)"/> or <see cref="Add(View[])"/> from this View.</summary>
|
||||
/// <remarks></remarks>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// Normally Subviews will be disposed when this View is disposed. Removing a Subview causes ownership of the Subview's
|
||||
/// lifecycle to be transferred to the caller; the caller muse call <see cref="Dispose"/>.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public virtual void Remove (View view)
|
||||
{
|
||||
if (view is null || _subviews is null)
|
||||
|
||||
@@ -58,7 +58,52 @@ public class Button : View
|
||||
KeyBindings.Add (Key.Enter, Command.HotKey);
|
||||
|
||||
TitleChanged += Button_TitleChanged;
|
||||
MouseClick += Button_MouseClick;
|
||||
MouseEvent += Button_MouseEvent;
|
||||
//MouseClick += Button_MouseClick;
|
||||
}
|
||||
|
||||
private Attribute _originalNormal;
|
||||
|
||||
private void Button_MouseEvent (object sender, MouseEventEventArgs e)
|
||||
{
|
||||
if (e.MouseEvent.Flags == MouseFlags.Button1Pressed)
|
||||
{
|
||||
if (Application.MouseGrabView == this)
|
||||
{
|
||||
e.Handled = InvokeCommand (Command.HotKey) == true;
|
||||
|
||||
return;
|
||||
}
|
||||
Application.GrabMouse(this);
|
||||
|
||||
_originalNormal = ColorScheme.Normal;
|
||||
var cs = new ColorScheme (ColorScheme)
|
||||
{
|
||||
Normal = ColorScheme.HotFocus
|
||||
};
|
||||
ColorScheme = cs;
|
||||
}
|
||||
|
||||
if (e.MouseEvent.Flags == MouseFlags.Button1Released)
|
||||
{
|
||||
Application.UngrabMouse ();
|
||||
var cs = new ColorScheme (ColorScheme)
|
||||
{
|
||||
Normal = _originalNormal
|
||||
};
|
||||
ColorScheme = cs;
|
||||
|
||||
e.Handled = InvokeCommand (Command.HotKey) == true;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool OnLeave (View view)
|
||||
{
|
||||
//Application.UngrabMouse();
|
||||
return base.OnLeave (view);
|
||||
}
|
||||
|
||||
private void Button_MouseClick (object sender, MouseEventEventArgs e)
|
||||
|
||||
@@ -286,6 +286,25 @@ public class Buttons : Scenario
|
||||
moveUnicodeHotKeyBtn.Accept += (s, e) => { moveUnicodeHotKeyBtn.Text = MoveHotkey (moveUnicodeHotKeyBtn.Text); };
|
||||
Win.Add (moveUnicodeHotKeyBtn);
|
||||
|
||||
label = new Label ()
|
||||
{
|
||||
X = 0,
|
||||
Y = Pos.Bottom (moveUnicodeHotKeyBtn) + 1,
|
||||
Title = "_1x1 Button:",
|
||||
};
|
||||
var oneByOne = new Button ()
|
||||
{
|
||||
AutoSize = false,
|
||||
X = Pos.Right(label)+1,
|
||||
Y = Pos.Top (label),
|
||||
Height = 1,
|
||||
Width = 1,
|
||||
NoPadding = true,
|
||||
NoDecorations = true,
|
||||
Title = CM.Glyphs.UpArrow.ToString(),
|
||||
};
|
||||
Win.Add (label, oneByOne);
|
||||
|
||||
radioGroup.SelectedItemChanged += (s, args) =>
|
||||
{
|
||||
switch (args.SelectedItem)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define DRAW_CONTENT
|
||||
#define DRAW_CONTENT
|
||||
|
||||
//#define BASE_DRAW_CONTENT
|
||||
using System;
|
||||
|
||||
Reference in New Issue
Block a user