mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
* Added Applicaton.Popover. Refactored FindDeepestView * Popover prototype * Testing highlight * Fixed click outside issue * Fixed DialogTests * Fixed click outside issue (agbain) * Enabled mouse wheel in Bar * Enabled mouse wheel in Bar * Progress. Broke arrangement * Added popover tests. Fixed a bunch more CM issues related ot unreliable unit tests. Updated config.json to include Glyphs. * Can't set ForceDriver to empty in Resources/config.json. * added BUGBUG * Made Position/ScreenPosition clear * Added View.IsInHierarchy tests * Added Contextmenuv2 scenario. * Implemented CM2 in TextView * Removed unneeded CM stuff from testhelpers * Shortcut API docs * Fixed keybinding unit tests * Fixed mouse handling * Fighting with CM related unit test failures * Unit tests pass. I think. * Shortcut code cleanup * TextView uses new CM2 * Starting on OnSelect etc... * Starting on OnSelect etc... * Fixed ContextMenuv2 * ContextMenu is working again. * Ugh. ANd fixed button api docs * Fixed DrawHorizontalShadowTransparent (vertical was already fixed). * Made Scenarios compatible with #nullable enable * Undid some keybinding stuff * Fixed stuff * Sped up unit tests * Sped up unit tests 2 * Sped up unit tests 3 * Messing with menus * merged latest v2_develop * Added more Popover unit tests * Added more Popover unit tests2 * Fixed positioning bug * Fixed mouse bug * Fixed Bar draw issue * WIP * merge v2_develop * CM2 sorta works * Enabled Bar subclasses to have IDesignable * Added ViewportSettings.Transparent * Region -> nullable enable * Added ViewportSettigs Editor * merged v2_develop part 2 * merged v2_develop part 3 * WIP: GetViewsUnderMouse * WIP: More GetViewsUnderMouse work * Bars works again * Added unit tests * CM now works * MenuItemv2 POC * SubMenu POC * CommandNotBound * More POC * Optimize Margin to not defer draw if there's no shadow * Logger cleanup * Reverted Generic * Cascading mostly working * fixed layout bug * API docs * API docs * Fixed cascade * Events basically work * code cleanup * Fixed IsDefault bug; * Enabled hotkey support * Made context-menu-like * Improved usability * Refactored ApplicationPopover again * Cleanup * Menuv2 POC basically complete * Code Cleanup * Made menu API simpler * Fixed Strings bugs * Got old ContextMenu scenario mostly working * ContextMenu scenario now works * ContextMenu fixes * ContextMenu fixes * Tons of menu cleanup * ContextMenu works in TextView * Fixed unit tes * Added unit tests * Fixed tests * code cleanup * More code cleanup * Deep dive * scenario * typos * Demo colorpicker in a Menu * Added Region tests proving Region is broken in some Union cases * fixed v2win/net
126 lines
3.1 KiB
C#
126 lines
3.1 KiB
C#
using System;
|
|
using Terminal.Gui;
|
|
|
|
namespace UICatalog.Scenarios;
|
|
|
|
[ScenarioMetadata ("View Experiments", "v2 View Experiments")]
|
|
[ScenarioCategory ("Controls")]
|
|
[ScenarioCategory ("Adornments")]
|
|
[ScenarioCategory ("Layout")]
|
|
[ScenarioCategory ("Proof of Concept")]
|
|
public class ViewExperiments : Scenario
|
|
{
|
|
public override void Main ()
|
|
{
|
|
Application.Init ();
|
|
|
|
Window app = new ()
|
|
{
|
|
Title = GetQuitKeyAndName (),
|
|
TabStop = TabBehavior.TabGroup
|
|
};
|
|
|
|
var editor = new AdornmentsEditor
|
|
{
|
|
X = 0,
|
|
Y = 0,
|
|
TabStop = TabBehavior.NoStop,
|
|
AutoSelectViewToEdit = true,
|
|
ShowViewIdentifier = true
|
|
};
|
|
app.Add (editor);
|
|
|
|
FrameView testFrame = new ()
|
|
{
|
|
Title = "_1 Test Frame",
|
|
X = Pos.Right (editor),
|
|
Width = Dim.Fill (),
|
|
Height = Dim.Fill (),
|
|
};
|
|
|
|
app.Add (testFrame);
|
|
|
|
Button button = new ()
|
|
{
|
|
X = 0,
|
|
Y = 0,
|
|
Title = $"TopButton _{GetNextHotKey ()}",
|
|
};
|
|
|
|
testFrame.Add (button);
|
|
|
|
button = new ()
|
|
{
|
|
X = Pos.AnchorEnd (),
|
|
Y = Pos.AnchorEnd (),
|
|
Title = $"TopButton _{GetNextHotKey ()}",
|
|
};
|
|
|
|
var popoverView = new View ()
|
|
{
|
|
X = Pos.Center (),
|
|
Y = Pos.Center (),
|
|
Width = 30,
|
|
Height = 10,
|
|
Title = "Popover",
|
|
Text = "This is a popover",
|
|
Visible = false,
|
|
CanFocus = true,
|
|
Arrangement = ViewArrangement.Resizable | ViewArrangement.Movable
|
|
};
|
|
popoverView.BorderStyle = LineStyle.RoundedDotted;
|
|
|
|
Button popoverButton = new ()
|
|
{
|
|
X = Pos.Center (),
|
|
Y = Pos.Center (),
|
|
Title = $"_Close",
|
|
};
|
|
//popoverButton.Accepting += (sender, e) => Application.Popover!.Visible = false;
|
|
popoverView.Add (popoverButton);
|
|
|
|
button.Accepting += ButtonAccepting;
|
|
|
|
void ButtonAccepting (object sender, CommandEventArgs e)
|
|
{
|
|
//Application.Popover = popoverView;
|
|
//Application.Popover!.Visible = true;
|
|
}
|
|
|
|
testFrame.MouseClick += TestFrameOnMouseClick;
|
|
|
|
void TestFrameOnMouseClick (object sender, MouseEventArgs e)
|
|
{
|
|
if (e.Flags == MouseFlags.Button3Clicked)
|
|
{
|
|
popoverView.X = e.ScreenPosition.X;
|
|
popoverView.Y = e.ScreenPosition.Y;
|
|
//Application.Popover = popoverView;
|
|
//Application.Popover!.Visible = true;
|
|
}
|
|
}
|
|
|
|
testFrame.Add (button);
|
|
|
|
editor.AutoSelectViewToEdit = true;
|
|
editor.AutoSelectSuperView = testFrame;
|
|
editor.AutoSelectAdornments = true;
|
|
|
|
Application.Run (app);
|
|
popoverView.Dispose ();
|
|
app.Dispose ();
|
|
|
|
Application.Shutdown ();
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
private int _hotkeyCount;
|
|
|
|
private char GetNextHotKey ()
|
|
{
|
|
return (char)((int)'A' + _hotkeyCount++);
|
|
}
|
|
}
|