Commit Graph

1201 Commits

Author SHA1 Message Date
Alexandre Bury
c8b2bc943d Minor fixes
And some doc
2015-05-31 16:58:55 -07:00
Alexandre Bury
323805b52f Add scrolling to SelectView
Scrolling functionalities are stored in ScrollBase. Both TextView and
SelectView use it.
Also add letter search to SelectView (currently case sensitive).
And made the cities example bigger with a long list of capitals.
2015-05-31 16:38:53 -07:00
Alexandre Bury
95ca27a1d0 Update readme 2015-05-31 13:11:50 -07:00
Alexandre Bury
db39069260 Fix focus for stack and text views.
And updated Lorem example with a Quit button under the scrollable text.
2015-05-30 21:54:06 -07:00
Alexandre Bury
6b781684ef Rename ListView -> SelectView
And added documentation.
2015-05-30 21:32:24 -07:00
Alexandre Bury
969650ab1a Add basic ListView
Show a selection among a list of items.
Maybe should be called SelectView?
TODO:
* Scrolling
* Error handling with empty list
* Action on Enter on an item
2015-05-30 21:05:34 -07:00
Alexandre Bury
23aa9e6da7 Update for latest ncurses-rs fix
Del and Ins are now correctly reported.
2015-05-29 20:44:53 -07:00
Alexandre Bury
00b75a98f6 Add input support for more keys
Shift and Ctrl Function keys
Shift-Del
2015-05-29 11:31:20 -07:00
Alexandre Bury
e07a0319f2 Add Home/End navigation to text views. 2015-05-28 17:48:21 -07:00
Alexandre Bury
8ee04c525f Escapes % when printing strings. 2015-05-28 17:37:00 -07:00
Alexandre Bury
6c6f929430 Better UTF-8 support in views
EditView, TextView, Dialog and Button should now properly display and
layout non-ascii text.
The lorem example now includes greek text to show this.
2015-05-28 17:32:28 -07:00
Alexandre Bury
ae93b68c05 Recognizes more modified keys
Shift-tab and a few others
2015-05-28 16:19:16 -07:00
Alexandre Bury
dd11d34206 Merged Fn keys into a single enum value 2015-05-28 14:57:21 -07:00
Alexandre Bury
3adb95c7ab Add support for Shift and Ctrl input
Careful: Ctrl-4 and ctrl-\ currently make ncurses crash.
Also some letters combine with Ctrl to make other codes. Run stty -a to
see some mappings.
Basically, you'll have issues with:
C,I,J,M,Q,S,Z
and non-letters.
2015-05-28 14:44:10 -07:00
Alexandre Bury
37e54b3598 Add input support for Esc 2015-05-28 13:49:13 -07:00
Alexandre Bury
6c69453639 Add Insert and Fn keys.
TODO: keys are apparently treated differently when shift is pressed.
Find a better representation.
2015-05-28 12:22:39 -07:00
Alexandre Bury
35c48e13d8 Fix backspace detection
Backspace is code 127 (so right inside utf-8 territory) but we want to
treat is as special key, like codes < 32.
2015-05-27 22:38:59 -07:00
Alexandre Bury
0bdb86181b Add Tab key to events 2015-05-27 22:21:23 -07:00
Alexandre Bury
3d1507c3cf Add UTF-8 input support
Didn't the proper methods in the standard lib, so I implemented a simple
utf-8 char reader.
2015-05-27 22:17:52 -07:00
Alexandre Bury
f9c9e56518 Transform ncurses i32 key into Event enum
Prepares support for unicode char input spanning multiple ncurses
characters.
2015-05-27 18:04:33 -07:00
Alexandre Bury
ca09885978 Add key_codes example
Prints the code on key press. Useful tool.
2015-05-27 16:55:49 -07:00
Alexandre Bury
9ab4848180 Better char selection in EditView 2015-05-27 00:15:19 -07:00
Alexandre Bury
c1ea3e7345 Update doc 2015-05-27 00:09:22 -07:00
Alexandre Bury
8d70338214 Prints cursor in EditView 2015-05-27 00:01:37 -07:00
Alexandre Bury
c3496c9870 Update edit example
Added top padding to dialog and a `!` to message.
2015-05-26 23:49:07 -07:00
Alexandre Bury
abb09cf4bb Split style and color
Color is a color-pair
Style is an attribute, like Bold or Reversed
2015-05-26 21:45:00 -07:00
Alexandre Bury
5407c53545 Dialog gives focus to its content first 2015-05-26 17:10:47 -07:00
Alexandre Bury
97d97afa8d Fix warnings 2015-05-26 17:08:27 -07:00
Alexandre Bury
44899bdcd6 Add/fix some doc 2015-05-26 16:48:27 -07:00
Alexandre Bury
3460f8123d EditView can now have a minimum size 2015-05-26 16:11:22 -07:00
Alexandre Bury
e8fcaabd6c Add EditView
TODO: proper visualization:
* Display cursor when focused (instead of color change)
* Do not use HIGHLIGHT, but something like INVERTED
2015-05-26 15:48:35 -07:00
Alexandre Bury
0dc079233a Unfocused view draw an inactive scrollbar 2015-05-25 22:38:11 -07:00
Alexandre Bury
dd4d0692b2 TextView now scrolls content if needed 2015-05-25 22:35:50 -07:00
Alexandre Bury
25e1ca6074 Rename Margins -> Vec4
And move it to the vec module
2015-05-25 14:56:51 -07:00
Alexandre Bury
dca9d7f662 Use usize for Vec2 instead of u32
Much less casts needed now.
2015-05-25 14:46:29 -07:00
Alexandre Bury
cb03f79e24 Update lorem example
Load text before initializing ncurses.
2015-05-25 11:37:28 -07:00
Alexandre Bury
222c4465d9 Fix bad TextView layout 2015-05-25 01:32:55 -07:00
Alexandre Bury
9ffcaef7ab Add some comments to TextView 2015-05-25 01:24:40 -07:00
Alexandre Bury
7fb1108ff8 Update readme example.
The example spelled "Hello world", but the image said "Hello Dialog".
2015-05-25 01:15:00 -07:00
Alexandre Bury
89221fae55 Updated style file format 2015-05-25 01:13:10 -07:00
Alexandre Bury
bfccae1b8e New TextView layout computation
Lines are now computed during layout. Draw is simpler.
This is in preparation to scrolling addition to TextView.
2015-05-25 01:10:43 -07:00
Alexandre Bury
1f3e17b591 Ignore last line in newline-terminated strings
Files for instance always end in a newline, but it doesn't mean we want
an empty line after the text.
2015-05-24 18:51:49 -07:00
Alexandre Bury
b3be2286dd Update Readme with image 2015-05-24 14:11:45 -07:00
Alexandre Bury
3518fdf390 Add demo image 2015-05-24 14:03:32 -07:00
Alexandre Bury
8780dd1dde Better printer cropping
Printer now also crops horizontally.
Also applies to hline and vline.
2015-05-24 01:49:50 -07:00
Alexandre Bury
5d9e8f760b Have child views take focus when added to StackView. 2015-05-24 01:22:27 -07:00
Alexandre Bury
eb6af9b981 Update mutation example
Don't show the popup at start, let the user read the text.
2015-05-23 20:28:03 -07:00
Alexandre Bury
e79207ac6e Fix TextView size computation
We weren't counting spaces.
2015-05-23 20:12:11 -07:00
Alexandre Bury
488443081d Update readme 2015-05-23 17:21:47 -07:00
Alexandre Bury
a2b4273589 Fix warnings 2015-05-23 17:11:58 -07:00