Alexandre Bury
4b095a0652
Apply rustfmt
2016-07-09 19:05:51 -07:00
Alexandre Bury
08ab18608b
Clear the screen only on window resize and layer removal
...
Should actually also be done if a layer shrinks.
Luckily, clear can be called anytime, as draw() is the last action
performed in the event loop - so it's safe to clear the screen in any
event callback, or even during layout.
2016-07-09 18:49:37 -07:00
Alexandre Bury
9b2dec2a7f
Use proper bounds for dialogs
...
Buttons height was not removed from the budget for get_min_size
2016-07-09 18:36:07 -07:00
Alexandre Bury
455a2a817c
Invalidate TextView cache on content change
2016-07-09 18:26:52 -07:00
Alexandre Bury
2860467f29
Cache layout in TextView
...
Calling either get_min_size or layout will cache the results, so the
next call with the same constraints will not re-compute everything.
2016-07-09 18:23:58 -07:00
Alexandre Bury
4498d206f5
Support wide characters in TextViews
...
Added some japanese paragraphs to the lorem example.
2016-07-04 21:30:13 -07:00
Alexandre Bury
cc72aa4ddc
Better wide char support
2016-07-04 16:04:32 -07:00
Alexandre Bury
d89c83f0ed
MenuPopup now supports PageUp/Down and Home/End
2016-07-02 20:53:13 -07:00
Alexandre Bury
692c310656
Better Menu API
...
Now offer non-chainable methods as well.
2016-07-02 20:44:27 -07:00
Alexandre Bury
e127392e8a
Add impl Default for Menubar
...
To make clippy happy
2016-07-02 19:47:11 -07:00
Alexandre Bury
0fd3bc113f
Fix layout bug in StackView
...
Only skip padding for non-centered views
2016-07-02 19:46:23 -07:00
Alexandre Bury
8220fe529e
Better menubar example
...
Added scrolling support, and left/right navigation
2016-07-02 19:37:38 -07:00
Alexandre Bury
1d54764cdb
Working menubar example
...
Also update callback: use Rc instead of Box
2016-07-02 15:02:42 -07:00
Alexandre Bury
1863e48b07
Add MenuPopup view
2016-07-02 01:01:09 -07:00
Alexandre Bury
1b1d7166a1
Replace SizeRequest with simple Vec2
...
We may go back to an enum though, to handle text views in LinearLayouts.
But the previous Fixed/AtMost/Unknown distinction was useless.
2016-07-02 00:47:38 -07:00
Alexandre Bury
c958093b74
Add TrackedView to cache the view size
2016-07-01 20:23:58 -07:00
Alexandre Bury
87cd1ce23f
Add position parameter to stack view layers
...
Can be centered, absolute or relative to the previous layer.
Can be set independently for each axis.
2016-07-01 19:19:43 -07:00
Alexandre Bury
985009e51c
More ncurses isolation
...
Also some renaming in the theme module
2016-06-30 23:38:01 -07:00
Alexandre Bury
4dcb2ea901
Remove debug println
2016-06-29 17:51:26 -07:00
Alexandre Bury
ba26ab965b
Don't run example on cargo test
...
Apparently it fails on travis (??)
2016-06-29 17:46:39 -07:00
Alexandre Bury
5751a293e5
Push most ncurses-specific code into separate trait
...
Prepare backend change.
Still not isolated is the color setup in `theme`.
2016-06-29 17:37:51 -07:00
Alexandre Bury
d0d4380d5a
Add menubar example
...
Not working yet, but at least it shows how the API should be used.
2016-06-28 01:13:44 -07:00
Alexandre Bury
d02c30ae9f
Fix clippy warnings
2016-06-27 22:40:11 -07:00
Alexandre Bury
80b219f34a
Apply rustfmt
2016-06-27 22:10:59 -07:00
Alexandre Bury
042e631d9f
Add base for menubar
...
Cursive now has a global menubar, with a `select_menubar()` method.
2016-06-27 21:59:42 -07:00
Alexandre Bury
43230534ff
Add menu tree
2016-06-27 21:55:46 -07:00
Alexandre Bury
34f235daf0
Use UTF-8 drawing characters for printer methods
...
Instead of ncurses chtype.
2016-06-26 15:03:12 -07:00
Alexandre Bury
ed785940dd
Fix typo in doc
2016-06-26 09:45:53 -07:00
Alexandre Bury
8dbb61830f
Added a Resize
event
...
For when the window is resized.
Not exactly a key event, but...
Also (very) partial support for Alt-FX keys.
Obviously most already have a mapping,
but Alt-F9, Alt-F11 and Alt-F12 seem to work.
2016-06-25 19:38:22 -07:00
Alexandre Bury
822ffa7a7b
Fix keyboard input
...
Shift/Ctrl/Alt + special keys (arrow, pageup/down, home/end, ins/del)
are better supported.
2016-06-25 19:28:42 -07:00
Alexandre Bury
58bd274df0
Update Readme & run rustfmt
2016-06-25 16:39:05 -07:00
Alexandre Bury
8d24df5f59
Experiment: use direct utf-8 VLINE char
2016-06-25 15:52:19 -07:00
Alexandre Bury
07c3c99e54
Update for new ncurses version
2016-03-15 15:39:08 -07:00
Alexandre Bury
af47abeaad
Edit view now support content larger than display
...
It then scrolls horizontally
2015-07-30 15:40:03 +02:00
Alexandre Bury
ac85a1f288
Fixed bug with dialog without buttons
2015-07-28 21:54:32 +02:00
Alexandre Bury
36fbc1ce5b
Add some convenient ID methods
2015-07-28 15:57:52 +02:00
Alexandre Bury
25a298a2eb
Fix dialog layout and input
2015-06-08 22:24:59 -07:00
Alexandre Bury
4fff7882aa
Fix focus state in linear layout
2015-06-08 15:47:09 -07:00
Alexandre Bury
df11b4f1f0
Update documentation
2015-06-08 15:38:10 -07:00
Alexandre Bury
daaff26e1c
Add input support to linear layouts
2015-06-08 15:11:44 -07:00
Alexandre Bury
d5a796a4cd
Fix dialog button alignment
2015-06-08 15:11:36 -07:00
Alexandre Bury
40af72a567
BugFix in LinearLayout
...
And add a simple linear example.
2015-06-08 12:23:36 -07:00
Alexandre Bury
df5ff808e3
Basic linear layout implementation
...
Not tested yet
2015-06-07 20:58:10 -07:00
Alexandre Bury
14a18ce760
Add some more input
2015-06-06 22:48:16 -07:00
Alexandre Bury
3a1e40ed49
Add some input support and updated readme
2015-06-06 15:05:01 -07:00
Alexandre Bury
6e4d00127b
Fix theme fallback
...
Now themes correctly use fallback values on TTY
2015-06-05 21:35:42 -07:00
Alexandre Bury
17e44652b8
Fix warning
...
Unused error reported.
2015-06-05 21:13:34 -07:00
Alexandre Bury
e5cb687990
Refactor themes and colors
...
And adds a theme example.
TODO: Shadow & Borders support
2015-06-05 18:26:40 -07:00
Alexandre Bury
cb523e88ae
Fix doc-tests
2015-06-04 11:40:35 -07:00
Alexandre Bury
a77a40558f
Add some doc.
2015-06-03 15:36:51 -07:00
Alexandre Bury
781d9c1a03
Can now change dialog button alignment
2015-06-02 19:36:22 -07:00
Alexandre Bury
7545d7170c
Add a background to the scrollbar
...
Currently use the pipe character: |
2015-06-02 17:44:31 -07:00
Alexandre Bury
0b159d6bf1
Add align support to SelectView
...
And moved some alignment offset computation to the align module.
2015-06-02 14:23:51 -07:00
Alexandre Bury
1656cdd8f6
Add Align property to TextView
...
Can change its horizontal and vertical alignment for when the allocated
size is bigger than the requirements.
2015-06-01 19:43:15 -07:00
Alexandre Bury
2a423b8408
Select views now highlight the entire line
...
And scrollviews have an extra padding column between the content and the
scrollbar.
2015-06-01 15:48:31 -07:00
Alexandre Bury
405cd1e961
Add support for some ctrl keys
...
Ctrl-{Ins,Del,Home,End} now work in some terminals.
Tested with xterm and konsole. May not work fot VTE-based ones
(gnome and xfce).
2015-06-01 10:49:43 -07:00
Alexandre Bury
b64a6b8c34
Add on_select callback for SelectView
...
And updated the select example to use that instead of an OK button.
This also removes the need for an ID selector.
2015-05-31 20:51:12 -07:00
Alexandre Bury
a30a77f39b
Letter-search in SelectView wraps back
2015-05-31 19:09:30 -07:00
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
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
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
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
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
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
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
e79207ac6e
Fix TextView size computation
...
We weren't counting spaces.
2015-05-23 20:12:11 -07:00
Alexandre Bury
a2b4273589
Fix warnings
2015-05-23 17:11:58 -07:00
Alexandre Bury
081b7545b9
Remove viewpath in callbacks
2015-05-23 17:07:22 -07:00
Alexandre Bury
5a4c34361c
Update mutation example
2015-05-23 16:46:38 -07:00
Alexandre Bury
7e823435cd
Stop using ncurses::WINDOW
...
Overlap is a mess. Let's do it ourselve.
2015-05-23 15:58:06 -07:00
Alexandre Bury
d9b56574d2
Add selector by ID
2015-05-23 10:33:29 -07:00
Alexandre Bury
77aae36836
Fix bad crate doc
2015-05-22 17:25:20 -07:00
Alexandre Bury
7e4873f5b7
Fix logs demo
2015-05-22 17:24:02 -07:00
Alexandre Bury
9fc946d6bd
Remove unused mpsc import.
2015-05-22 17:10:47 -07:00
Alexandre Bury
94e723d3f0
Add some doc
2015-05-22 16:57:29 -07:00
Alexandre Bury
d9652ac728
Add animated example.
2015-05-22 16:28:05 -07:00
Alexandre Bury
44cb27c594
Remove unused file
2015-05-22 00:48:14 -07:00
Alexandre Bury
b2e52dc702
Add some (non-doc) comments.
2015-05-22 00:43:58 -07:00
Alexandre Bury
3df17cc64b
Improved lorem example
...
TODO: add margins around the textview?
2015-05-22 00:06:33 -07:00
Alexandre Bury
25726140d8
Add colors and styles to printer
2015-05-21 23:29:49 -07:00
Alexandre Bury
9b998b0dd4
Add missing documentation.
2015-05-20 11:11:55 -07:00
Alexandre Bury
7cfdd8e9fe
Add doc to print_box
2015-05-20 10:36:35 -07:00
Alexandre Bury
919e60d4ce
Add lines and boxes to printer.
...
Dialog now draws its box.
2015-05-20 10:31:38 -07:00
Alexandre Bury
7d301e1980
Add documentation
2015-05-19 17:31:52 -07:00
Alexandre Bury
ecd3c96d20
Unify wrap_impl macros
...
Use a different pattern rather than different macro
2015-05-19 16:53:50 -07:00
Alexandre Bury
191c2899ea
Add non-boxed wrap_impl! macro
...
Although maybe sized_view should rather use a box internally.
2015-05-19 16:40:32 -07:00
Alexandre Bury
c8136c67e0
Add focus system
...
May need to add a direction to take_focus
2015-05-19 15:54:11 -07:00
Alexandre Bury
ca5c485847
Fix Button on_key_event
...
KEY_ENTER is actually almost never called. The return key sends the
ascii code for '\n' instead.
2015-05-19 10:58:42 -07:00
Alexandre Bury
04121414e1
Add proper draw and layout to Dialog
2015-05-18 19:41:35 -07:00
Alexandre Bury
68819c89bf
Fixed variable case warnings
2015-05-18 15:31:55 -07:00
Alexandre Bury
493ed1322c
Fix stack_view when screen is smaller than content
2015-05-18 12:24:08 -07:00
Alexandre Bury
1fcca9b3a9
Rename module vec2 -> vec
...
Margins may be moved to vec::Vec4 some day
2015-05-18 11:51:30 -07:00
Alexandre Bury
0302e74063
Fix text view size with multiline content
2015-05-18 11:18:04 -07:00
Alexandre Bury
74f0fee9b6
Add Dialog skeleton
2015-05-16 14:02:15 -07:00
Alexandre Bury
a8c8855831
Moved example to separate directory
...
And add it to Cargo.toml
2015-05-16 13:09:38 -07:00
Alexandre Bury
e17ca97136
Add ViewPath and Cursive::find
...
Callbacks now include a path to the triggering view.
The Cursive root can find the View corresponding to a ViewPath.
In the future, ViewPaths may be returned when creating the layout.
2015-05-15 17:56:38 -07:00
Alexandre Bury
6cd2a28966
StackView now centers its children
2015-05-15 16:06:48 -07:00
Alexandre Bury
90ea4af1ea
Implement TextView::draw
2015-05-15 15:00:20 -07:00
Alexandre Bury
6fad4aa36a
More documentation
2015-05-15 12:16:58 -07:00
Alexandre Bury
e5c623bb07
Add printer abstraction on ncurses::WINDOW
...
Also rename Size -> Vec2
2015-05-15 12:03:19 -07:00
Alexandre Bury
4ebb422611
Hide the cursor
2015-05-14 18:41:13 -07:00
Alexandre Bury
ec7b76c564
Add screens to Cursive
2015-05-14 18:38:58 -07:00
Alexandre Bury
506c41c0f8
Fix some warnings
2015-05-14 17:48:24 -07:00
Alexandre Bury
a387bf5f06
Add stack, box and text views
...
Also add some documentation
2015-05-14 17:41:17 -07:00
Alexandre Bury
13c4e86779
First commit
2015-05-09 12:18:31 -07:00