Commit Graph

76 Commits

Author SHA1 Message Date
Ross Ferguson
acacd0c9e7 Accomodate upstream changes 2020-06-20 19:56:12 +01:00
Ross Ferguson
cfcf8efb59 ComboBox multiple fixes. Dim.Fill() incorrectly calculated. List height not resizing. SetSource() not immeadiately updating list. Double click not selecting item. Example now demo resizes with view 2020-06-20 18:28:58 +01:00
BDisp
9b695799ab Fixes #705 setting current Application.Top. 2020-06-18 16:34:12 +01:00
Charlie Kindel
634f214d6a fixed status bar resize on Windows; not in cmd.exe 2020-06-13 08:13:58 -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
Ross Ferguson
36a658d3e8 ComboBox. Color/Dim.Fill() issues when hosted inside a dialog 2020-06-11 08:16:08 +01:00
Ross Ferguson
6f94a776fd ComboBox: Refactor. Resize Width working 2020-06-08 10:05:16 +01:00
Ross Ferguson
4a3e1d0959 ComboBox. Adopt ListView interface pattern 2020-06-08 10:01:10 +01:00
Ross Ferguson
89e2790a1c ComboBox supports Dim.Fill() Dim.Percent() 2020-06-08 10:01:10 +01:00
Charlie Kindel
dc878b899c enabled better characters 2020-06-07 15:12:25 -06:00
BDisp
89a4bdeb03 Changed from Terminal.Gui all EventHandler to Action. 2020-06-06 19:02:37 +01:00
BDisp
d32c631dfd Changed from DateTime to TimeSpan. Changed from EventHandler to Action. 2020-06-06 15:35:07 +01:00
Charlie Kindel
da5bfd46f2 feature complete 2020-06-04 23:09:14 -06: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
BDisp
fa29269ade Added mouse support to the StatusBar. (#598) 2020-06-02 22:24:11 -04:00
BDisp
4fcb164f4b Added class KeyModifiers which improvements better control over the combinations keys. 2020-05-31 01:43:47 +01:00
Charlie Kindel
8e63b9fdf8 merged with master 2020-05-28 12:26:12 -06:00
Charlie Kindel
9abe84125d merged docs 2020-05-27 19:23:18 -06:00
Charlie Kindel
532285db8d Moved NetDriver's IMainLoopDriver impl to NetDriver.cs 2020-05-27 17:24:08 -06:00
Charlie Kindel
140bb276ee moved mainloop out of CursesDriver 2020-05-27 17:10:36 -06:00
Charlie Kindel
4d7ae9d2f2 refactored per #541 2020-05-24 22:23:35 -06:00
Fabian R
46b4c9025b Improved View Key event handling
+ Added Handled property of type bool to the KeyEventEventArgs class.
+ Added ability to stop further propagation for already handled events on Views for Keyboard related event subscribers (like KeyDown, KeyUp and KeyPress). The driver will check the Handled property of the KeyEventEventArgs passed to the subscribers and will stop any further invocations when its found true.
+ Updated Example project to expose the ability to programatically Open/Close a MenuBar from custom keystrokes.

This commit fixes an issue where the library would crash if the Subviews collection of the currently active View gets updated from inside any of the Keyboard event handlers, such as when the view is updated as a result of a custom Hotkey/Coldkey press.
2020-05-24 06:36:42 -05:00
Charlie Kindel
635b565097 merge 2020-05-23 23:06:31 -06:00
Ross Ferguson
6228bffcbf Merge branch 'master' of https://github.com/migueldeicaza/gui.cs into feature/TextFieldAutoComplete 2020-05-22 10:28:48 +01:00
Ross Ferguson
f0199f6e61 Rename TextViewAutoComplete to ComboBox 2020-05-22 07:03:05 +01:00
Ross Ferguson
360e0256b8 TextFieldAutoComplete demo works cross-platform. Fix list clearing issue. 2020-05-22 07:03:03 +01:00
Ross Ferguson
282cf64500 AutoHide option. List and text view synced. 2020-05-22 07:03:03 +01:00
Ross Ferguson
1dc0cc6fac Use LayoutStyle.Computed. Add Text setter 2020-05-22 07:03:01 +01:00
Ross Ferguson
e04cbf2b97 Feature/TextFieldAutoComplete 2020-05-22 07:03:01 +01:00
Charlie Kindel
693c2a232f Refactored onload/onresize events to use event vs. Action<T> 2020-05-21 22:08:59 +01:00
Charlie Kindel
342e7672c8 missed some renames 2020-05-21 22:08:58 +01:00
Charlie Kindel
ab72865b2c Refactored keydown/up/press events to use event vs. Action<T> 2020-05-21 22:08:57 +01:00
Charlie Kindel
5e4a13b24b 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 22:17:27 +01: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
Charlie Kindel
7e11fe2b19 upgraded Example to new .csproj format 2020-05-15 22:46:23 -06:00
Charlie Kindel
ae5750dd1d upgraded Example to new .csproj format 2020-05-15 22:32:59 -06:00
BDisp
e6c5b2599a Improved a better clipped screen. Fixes some bugs with ScrollView, Menu. Added some virtual methods. (#410)
* Improved a better clipped screen. Fixes some bugs with ScrollView, Menu. Added some virtual methods.

* Added some more key features, like shift. Cleaning and updating some stuffs .Added more features to TextField.

* Closes the menu even in a button pressed in another view than menu.

* Added a OnKeyPress action. Now all the keys events are properly mapped to the keys modifiers. Fixed a issue which keys like (ã, á, â) aren't correctly written.

* Fixed an issue with the shift flag for keys ControlA_Z.

* Ensures quiting the terminal if no other option is provided by pressing Ctrl-Q

* Ensures the exception is thrown before ordered.Reverse.

* Changed Button4 To Button3 for CursesDriver compatibility.

* Added support for word selection through keyboard and the mouse. With triple click all text is selected.

* Changed AllowNewLine to AllowWrap.

* Fix topological sort in view class (#413)

* AllowWrap removed and keys issues fixed.

* Removing ordered.Reverse (); Something went wrong.

* Fixes FrameView title.

* Reverted some MapKeyModifiers that prevented the display of some characters.

* Avoiding open the menu-bar every time we typing (€@£§). Alt key now only highlight the menu-bar without open it.

* Fixes hot-key issue preventing menu closing after opened.

* Curses now supports hot-keys and simulates AltMask with Alt+Space.  Also supports shift and ctrl combinations to use with text selection.

* Maintains the menu highlighted while focused.

* Removed the IsOutBounds method. This feature is for a future presentation.

Co-authored-by: En3Tho <37334640+En3Tho@users.noreply.github.com>
2020-05-13 12:28:35 -04:00
Charlie Kindel
8b26240741 Adds a better keyup/keydown demo to demo.cs (#395)
* Revert "Drop NuGet restore"

This reverts commit 5c7a0d05f0.

* Revert "Revert "Drop NuGet restore""

This reverts commit 2dc5fce865.

* merge

* better keyup/down demo
2020-04-29 11:09:34 -04:00
Charlie Kindel
427cf4784b Text alignment (#397)
* not sure why this keeps changing

* enhanced Show Text Alignments demo to better illustrate bugs in TextAlignment.Justified
2020-04-29 11:09:10 -04:00
Charlie Kindel
5df8500862 Status bar snap (#384)
* KeyDown/Up support

* updated demo

* defined styles

* Smarter StatusBar bottom tracking.

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

* Fixed StatusBar 'snap to bottom'
2020-04-20 16:08:34 -04:00
BDisp
df5bc9f0b8 Fixed a moving window issue. Added OnLoad Action because there are settings that need to be accessed only once. (#375)
* Fixed a moving window issue. Added OnLoad Action because there are settings that need to be accessed only once.

* Fixes a layout issue that does not updated the Pos outside the bounds.

* Fixes a issue with other top-levels.

Co-authored-by: Miguel de Icaza <miguel@gnome.org>
2020-04-18 13:37:50 -04:00
Charlie Kindel
c7ce619092 MenuItems on MenuBar (#388)
This PR enhances MenuBar with the ability to have top-level (on the MenuBar itself), clickable, actionable, MenuItems.

Along the way it fixes a few MenuBar bugs and...

alt activates/closes the menu just like on Windows (alt and f9 work the same).
Cursor shows consistently across the MenuBar as the focus changes
Top-level menu items show accelerator keys.
demo.cs has been enhanced to include an example top-level menuitems. I also tested top-level menuitem as the first menu item as well as in the middle. I didn't want to over complicate demo.cs with tons of examples, FWIW.
2020-04-18 13:21:06 -04:00
BDisp
ee7fc3022d Fixes #355 stack overflow with Pos based on the size of windows at startup. Added a OnResized action to set the Pos after the terminal are resized. (#367) 2020-04-14 21:50:17 -04:00
miguel
12cfbb8231 Fix the demo 2020-04-14 21:49:09 -04:00
Charlie Kindel
c51e4177fe made it so Ctrl-X on status bar actually quits (#362) 2020-04-14 09:34:28 -04:00
miguel
6d08364ad9 Move the text alignment demo elsewhere, so I can debug other things 2020-04-13 14:43:46 -04:00
miguel
f8548666ee Improve the UI of the ListView demo, and the demo; And add a crashing scenario that I will fix 2020-04-13 14:10:25 -04:00
miguel
ad8461d6af Prevent crash on Linux/Mac introduced in 0.80 2020-04-13 13:45:27 -04:00