Commit Graph

28 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
BDisp
250ebd3f97 Added some more improvements. 2022-10-26 00:28:18 +01:00
BDisp
b4fc85bfd6 Fixes #2122. Weird visual artifacts on clearing. 2022-10-21 15:10:57 +01:00
BDisp
e02df8c043 Added some more features and bug fixes. 2022-07-04 11:22:27 -04:00
Charlie Kindel
32ae3cb62f Cleaned up Categories and Scenario descripitons. 2022-04-17 15:48:48 -07:00
Charlie Kindel
83f70cbf39 Revert "Revert "Reorganizing scenarios categories as per #1648""
This reverts commit 359ba385c8.
2022-04-17 14:17:40 -07:00
Charlie Kindel
359ba385c8 Revert "Reorganizing scenarios categories as per #1648"
This reverts commit 3362ca849d.
2022-04-17 14:14:44 -07:00
BDisp
3362ca849d Reorganizing scenarios categories as per #1648 2022-03-17 16:39:15 +00: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
8dabd16975 Fixes #1276. Added TextDirection constructor to View and Label and improving AutoSize. (#1277)
* Added AutoSize. CalcRect calculates vertical. Fixes Draw bug.

* Added TextDirection constructor. Ensuring set frame on Pos/Dim absolute. Improves AutoSize.

* Added a scenario for the AutoSize and TextDirection.

* Added more unit tests.

* Fixing some broken scenarios.

* Fixes others TextDirection that was not working.
2021-05-02 11:21:08 -07:00
BDisp
7febb7ac5c Fixes #1068. The ResizeView doesn't handle the AutoSize properly. 2020-12-29 15:21:25 +00:00
BDisp
e102a34897 Fixes #1050. ScrollView take to long to scroll enormous content size. 2020-12-24 01:19:34 +00:00
BDisp
fc4796cc61 Preventing the Progress Bar view to continuous pulsing after quit the Scrolling scenario. 2020-11-17 15:42:32 +00:00
BDisp
06a001d5ea horizontalRuler.Text and verticalRuler.Text of the Scrolling scenario only need setted once, avoiding continuous redrawing. 2020-11-17 14:49:42 +00:00
BDisp
1cd80ab3a4 Fixes #992. TextFormatter class now respect the view dimensions. Some typo fixing too. 2020-11-07 15:03:03 +00:00
Artyom
64fdcea6b5 Define View actions as events 2020-09-23 01:26:46 +03:00
Artyom
6aef632633 Button.Clicked as a C# event 2020-09-23 01:01:53 +03:00
BDisp
cb16ea8a3f If KeepContentAlwaysInViewport is true ensures that the scrollbars is at least a wide equal to one. 2020-08-15 21:19:16 +01:00
Gerasimos (Makis) Maropoulos
83047b4232 various misspell fixes 2020-08-08 21:14:15 +03:00
BDisp
255aba973f Fixes #758. Adding AutoHideScrollBars CheckBox. 2020-07-08 01:58:04 +01:00
Charlie Kindel
49bfe6a6c2 progress...rabbit hole 2020-06-17 08:50:38 -07:00
BDisp
554202f5e7 Removing the unnecessary force from the View. 2020-06-11 21:37:06 +01:00
BDisp
2766af8afe Allowing negative coordinates for scrolling purpose. 2020-06-11 18:55:15 +01:00
BDisp
3b793fc8d1 ScrollView enhancements. 2020-06-09 21:35:28 +01:00
BDisp
89a4bdeb03 Changed from Terminal.Gui all EventHandler to Action. 2020-06-06 19:02:37 +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