Commit Graph

29 Commits

Author SHA1 Message Date
Charlie Kindel
bf1ed31281 Refactored UI Catalog and added tons of unit tests 2022-11-03 15:58:15 -06:00
Charlie Kindel
32ae3cb62f Cleaned up Categories and Scenario descripitons. 2022-04-17 15:48:48 -07:00
BDisp
239191cde0 Fixes #1434. Regenerating the docs. (#1528)
* Fixes #1434. Regenerating the docs.

* Fixing warnings on docs regeneration and improving.
2021-12-18 05:33:40 -08:00
BDisp
8d6c2e0aa8 Some changes in the UICatalog and Scenarios. 2021-07-11 00:16:40 +01:00
BDisp
4073019554 Fixes #959. PositionCursor with hotkeys. 2020-10-19 04:12:21 +01:00
Artyom
6aef632633 Button.Clicked as a C# event 2020-09-23 01:01:53 +03:00
Charlie Kindel
120991ec5b ready for pr 2020-06-18 01:29:25 -07:00
Charlie Kindel
535f7e63f9 merge with master 2020-06-17 08:55:41 -07:00
Charlie Kindel
49bfe6a6c2 progress...rabbit hole 2020-06-17 08:50:38 -07:00
BDisp
ec73e0f2b6 Fixes #623 Dim.Percent with an extra behavior. (#696) 2020-06-15 22:01:53 -04:00
BDisp
48240b6b62 Fixed some layout and alignment issues in the Button. 2020-06-09 13:01:03 +01:00
BDisp
86423c52a2 Keep the master's. 2020-06-08 23:52:21 +01:00
BDisp
15e38550c5 Fixed a layout bug that preventing the redrawing on Pos and Dim changes. Now the TextAlignment is working well. I move them to the view for a generic uses to others views. 2020-06-08 23:39:31 +01:00
Charlie Kindel
1b8abd1421 RadioGroup event fix 2020-06-08 08:46:20 +01:00
Charlie Kindel
157255bc1b enabled better characters 2020-06-08 08:46:17 +01:00
BDisp
43c958842e Resolves Button Text Alignment with Unicode chars. 2020-06-08 01:50:33 +01:00
Charlie Kindel
f00cdb0258 RadioGroup event fix 2020-06-07 16:00:39 -06:00
Charlie Kindel
dc878b899c enabled better characters 2020-06-07 15:12:25 -06:00
Charlie Kindel
aedacd17a4 updated button scenario and tweaked button.cs 2020-06-06 17:15:22 -06:00
BDisp
6eeb3149b9 Change some Action and Class names. 2020-06-06 23:01:35 +01:00
Charlie Kindel
05a1944913 layout 2020-06-06 14:24:37 -06:00
Charlie Kindel
8feab947fd POC 2020-06-06 13:58:02 -06:00
BDisp
89a4bdeb03 Changed from Terminal.Gui all EventHandler to Action. 2020-06-06 19:02:37 +01:00
BDisp
db4fe3bc0f Added Text Alignment to the Button view. 2020-06-06 17:40:03 +01:00
Charlie Kindel
7a0c522a20 Upgraded ScrollView + Charmap (#601)
Note this PR should not be merged until after #600 is in. 

I went on a rampage tonight. It all started with wanting to use more/better characters for frame and other UI elements like the round corners:

![image](https://user-images.githubusercontent.com/585482/83601742-659ba800-a52e-11ea-9ee9-c888a7db5444.png)

I decided I needed a character map app that would let me test which fonts had which Unicode sets in them.

As a result we have this PR

- Fixes `ScrollView` in several key ways:
   - It now supports Computed layout and has constructors that don't require parameters.
   - `ScrollBarViews` are now positioned using Computed layout versus error prone absoulte
   - `ScrollBarViews` now correctly position themselves when one, either, or both are on/off.
   - `IsVertical` is now a public property that does the expected thing when changed
   - Mouse handling is better; there's still a bug where the mouse doesn't get grabbed by the `ScrollView` initially but I think this is a broader problem. I need @BDisp's help on this.

- The `Scrolling` Scenario was enhanced to demo dynamically adding/removing horizontal/vertical scrollbars (and to prove it was working right).

- I Enabled easy "infinite scroll capability" - CharMap literally lets you scroll over `int.MaxValue / 16` rows of data. Filling a `ContentView` with all of this and panning it around won't work. So I needed a way of having `Redraw` give me virtual coordinates. I did this by defining `OnDrawContent(Rect viewport)` and it's associated `event`:

```csharp
/// <summary>
/// Event invoked when the content area of the View is to be drawn.
/// </summary>
/// <remarks>
/// <para>
/// Will be invoked before any subviews added with <see cref="Add(View)"/> have been drawn.
/// </para>
/// <para>
/// Rect provides the view-relative rectangle describing the currently visible viewport into the <see cref="View"/>.
/// </para>
/// </remarks>
public event EventHandler<Rect> DrawContent;

/// <summary>
/// Enables overrides to draw infinitely scrolled content and/or a background behind added controls. 
/// </summary>
/// <param name="viewport">The view-relative rectangle describing the currently visible viewport into the <see cref="View"/></param>
/// <remarks>
/// This method will be called before any subviews added with <see cref="Add(View)"/> have been drawn. 
/// </remarks>
public virtual void OnDrawContent (Rect viewport)
{
	DrawContent?.Invoke (this, viewport);
}

```

I originally just implemented this pattern in `ScrollView`. Then I realized I wanted the same thing out of ALL `Views`. Namely: the ability to do drawing on an event, particularly to be able to paint something in the background. So I added it to `View`.

Note, that these changes mean we are about 3 small steps away from moving the scollbars from `ScrollView` into ALL views. Which makes a lot of sense to me because I don't think we want to implement duplicative logic in, say `ListView` and `TextView` as well. Why not just do it once?

Along the way I fixed some other things:

- The `Checkbox.Toggled` event now passes state. 

Here's some gifs. 
![](https://i.imgur.com/o5nP5Lo.gif)

Note:

- Scrollbars appear dynamically.
- Fast scrolling of huge data (using no memory).
- Static header
- Dynamic scrollbars on/off
- Note the bottom/right corner now draw correctly in all situations
2020-06-03 13:16:35 -04:00
Charlie Kindel
fddfcf8802 Charlie's Mondo Patch (#600)
This PR includes:

#586 - Fixed Clipping
#587 - LayoutComplete
#591 - Sys Console Scenario
#590 - Significantly improves MessageBox, Dialog, Frame drawning and more
See the PRs above for all the details.

Here are the issues this closes:

Closes #299 - MessageBox now auto sizes
Closes #557 - MessageBoxes on small screens
Closes #432 - MessageBox does not deal with long text; width/height params are goofy
Closes #521 - MessageBox should take ustrings (BREAKING CHANGE)
Closes #35 - Dialog should have 1 char padding around edges
Closes #570 - Dialog should use computed layout for buttons
Closes #470 - UI Catalog: Add Dialogs Scenario
Closes #569 - LayoutComplete event
Plus probably more.
2020-06-03 11:33:06 -04:00
Charlie Kindel
1024f073b2 Fixing many clipping issues (#580)
* almost got clip rect working

* fixes many bugs related to clipping incl #399

* Merge tweaks.
2020-05-29 17:41:49 -06:00
Charlie Kindel
9b0fd2625f updated scenarios 2020-05-22 17:23:05 -06:00
Charlie Kindel
5b845307a2 UI catalog (#387)
* key down/up support

* line endings?

* line endings

* KeyDown/Up support

* line endings

* line endings

* Revert "Drop NuGet restore"

This reverts commit 5c7a0d05f0.

* Revert "Revert "Drop NuGet restore""

This reverts commit 2dc5fce865.

* updated demo

* defined styles

* Smarter StatusBar bottom tracking.

* Prepping for https://github.com/migueldeicaza/gui.cs/issues/376

* Oops.

* Fixed StatusBar 'snap to bottom'

* line endings

* Revert "Fixed StatusBar 'snap to bottom'"

This reverts commit 9a91c957e2.

* started UICatalog project

* Initial working POC.

* Fix newlines

* merge

* textalignment demo tweaks

* textalignment demo tweaks

* Unicode Menu Scenario

* not sure why this keeps changing

* re-added project to .sln file

* re-enabled status bar

* moved scenarios to dir

* building a dim and pos demo

* terminal.sln

* progress...barely

* fixed exit

* progress with some underlying fixes to Label

* added readme

* fixes build issue

* launch

* made default colors readable on Windows

* major UI Catalog upgrade

* added more demos and updated readme

* refactored and added more tests

* added ref to Issue #437

* added OnKeyUp support to Curses and Net drivers

* more tweaks - grab PR #438 first

* Added a OpenSelectedItem event to the ListView #429

* updates

* moved KeyUpHandler out of special ESC stuff

* more tweaks & improvements

* testing top window bug

* supported OpenSelectedItem

* lots of updates

* fixed regression, fixed #444

* better button scenario

* tweaks

* add Ready event to Toplevel

* dotfx .gitignroe

* ready for ready

* updated colors based on feedback; consolodated config code

* tweaked readme

* readme

* Added Editor demonstrating TextView

* Added Editor demonstrating TextView

* added hexeditor scenario

Co-authored-by: Miguel de Icaza <miguel@gnome.org>
Co-authored-by: BDisp <bd.bdisp@gmail.com>
2020-05-20 13:37:12 -04:00