Alexandre Bury
c300e0628d
Rename find
-> call_on
...
And update tutorials
2017-03-26 20:50:50 -07:00
Alexandre Bury
c3c69e7892
Merge IdView and RefCellView
...
And remove `with_id_mut`
2017-03-25 21:56:31 -07:00
Alexandre Bury
146ebd8931
Rename find_id -> call_on_id, find_id_mut -> find_id
2017-03-25 18:22:14 -07:00
Alexandre Bury
cdb3df7fc8
Merge branch 'master' into refview
2017-03-25 15:01:57 -07:00
Alexandre Bury
017bb21710
Add View::focus_view
2017-03-25 14:50:52 -07:00
Alexandre Bury
2cd2787119
Event::Unknown now carries the unknown bytes rather than a i32
...
And termion has been updated to use termion::Event::Unsupported
2017-03-25 11:01:25 -07:00
Alexandre Bury
77433e80ee
fix: add Panel::wrap_layout
...
Fixes #119
2017-03-15 16:35:20 -07:00
Alexandre Bury
0bbc10706e
EditVIew: Add mutable and non-mutable callback methods
...
mutable callbacks disable recursive calls
2017-03-08 16:29:24 -08:00
Alexandre Bury
cbe237624f
Update toml to 0.3
2017-03-06 22:49:56 -08:00
Alexandre Bury
4f82e87d0d
Merge pull request #115 from hacksaar/master
...
use Iterator::sum() for summing instead of fold
2017-03-06 14:58:17 -08:00
Alexandre Bury
87676295a0
fix: Check for insufficient space in Panel::required_size
2017-03-06 14:53:10 -08:00
Constantin Berhard
36d5aa016a
use Iterator::sum() for summing instead of fold
2017-03-06 22:46:16 +01:00
Alexandre Bury
5f5fb4e502
Add comments
2017-03-06 10:38:18 -08:00
Alexandre Bury
30cac851e7
Fix utils::prefix
...
And add a few tests
2017-03-06 10:34:58 -08:00
Constantin Berhard
dc7754d38f
fix #113
2017-03-06 15:32:03 +01:00
Alexandre Bury
e0b279d9df
Fix clippy warnings
2017-03-05 15:18:15 -08:00
Alexandre Bury
6f129ac83d
Only include chan dependancy with termion backend.
...
We may want to use channels for all backend some day, but not today.
2017-03-05 14:45:21 -08:00
Alexandre Bury
7d9cb03ffb
More checks against small viewports
...
Prevents panics when the terminal is resized.
2017-03-05 11:35:20 -08:00
Ilkka Halila
ea053640fe
Use new Attributes and ColorPairs
...
Pancurses now has an Attribute and ColorPair type, making for a more strongly typed way of handling them when compared to using chtypes.
Also window now has an .attrget() function so pan::Concrete does not need to track the current color any longer.
2017-03-05 13:53:50 +02:00
Alexandre Bury
cb3adc5baf
feat: find_id
can now find views declared with with_id_mut
2017-02-26 15:52:42 -08:00
Alexandre Bury
34c7462877
fix: protect scroll operations when non-scrollable
...
Fixes #109
2017-02-26 14:53:50 -08:00
Alexandre Bury
b50d2f077f
Make RefCellView re-entrant safe
...
Don't crash if the view is already borrowed.
2017-02-08 15:33:43 -08:00
Alexandre Bury
1b8d109e94
Add with_id_mut
and find_id_mut
convenient methods.
2017-02-08 15:20:41 -08:00
Alexandre Bury
b0193b0ebc
Add RefCellView
...
Wraps a view and provide interior mutability
2017-02-08 12:13:14 -08:00
Alexandre Bury
b63762d441
View::find_any now takes a closure instead of returning reference
...
Also updated Finder::find and find_id.
2017-02-07 15:49:06 -08:00
Robin Stumm
99fa86bec9
return length and width from utils::prefix() (renamed from utils::prefix_length()) as per df835d1
2017-02-01 20:47:33 +01:00
Alexandre Bury
df835d1a10
utils::prefix_length: move current_width
out of the scan loop
...
To prepare returning both length and width.
2017-01-31 16:31:34 -08:00
Alexandre Bury
8b88bf9ba2
Add Menubar::is_empty(&self)
...
And fix another clippy warning
2017-01-27 14:51:46 -08:00
Alexandre Bury
afc681bcf4
Add Canvas::state_mut(&mut self)
...
And missing Canvas::needs_relayout closure.
2017-01-24 10:48:00 -08:00
Alexandre Bury
d7eaa5a086
Rename View::get_min_size
-> required_size
2017-01-23 22:53:03 -08:00
Alexandre Bury
451d27b58e
Fix Canvas doc comment
2017-01-23 22:03:39 -08:00
Alexandre Bury
26e6f4ff97
Add Canvas view
2017-01-23 22:01:25 -08:00
Alexandre Bury
c970712c3b
Add TextView::append_content
...
Also don't strip the newline anymore when setting content.
Instead, just ignore trailing newline when computing rows.
2017-01-23 20:22:43 -08:00
Alexandre Bury
f504ad8f0e
Add fullscreen layers to StackView
...
Fixes #87
2017-01-23 18:54:52 -08:00
Alexandre Bury
053544d192
Fix inverted outset color
...
Update the `theme` screenshot
2017-01-23 17:53:53 -08:00
Alexandre Bury
fa82690c10
Fix docs for Cursive::menubar()
...
... again
2017-01-23 16:54:27 -08:00
Alexandre Bury
0977daa12d
Unify method names on Menubar and MenuTree
2017-01-23 16:51:48 -08:00
Alexandre Bury
24b342ced8
Fix doc for Cursive::menubar()
2017-01-23 15:58:38 -08:00
Alexandre Bury
ed841825f2
Add methods to edit menubar and menutrees
...
Fixes #101
2017-01-23 15:50:56 -08:00
Alexandre Bury
0849ae6efa
Add comments
2017-01-21 15:06:31 -08:00
Alexandre Bury
3ecae579e8
Adjust the scroll after setting the scroll strategy
2017-01-21 11:46:56 -08:00
Alexandre Bury
924c74afbe
Add ScrollStrategy to TextView
2017-01-21 11:44:40 -08:00
Alexandre Bury
dccce56f6e
Fix off-by-1 errors on termion
...
Termion's Goto is 1-based, Cursive's print_at is 0-based
2017-01-19 13:44:49 -08:00
Alexandre Bury
06ce7b570f
Fix clippy warnings
2017-01-19 11:12:12 -08:00
Alexandre Bury
97287a0b0b
Remove unused imports
2017-01-10 17:48:47 -08:00
Alexandre Bury
14f971e2bc
Allow negative relative offset in Position
...
Was causing crashes when popup-SelectViews were larger than their
parent.
Made some methods on Vec2 more generic to XY<T: ...>
2017-01-10 17:47:31 -08:00
Alexandre Bury
ddff15b6cf
Merge pull request #96 from Ameobea/termion-clearing
...
Fixed issue with resetting background color for Termion backend
2017-01-10 17:45:39 -08:00
Casey Primozic
7ca9821145
Fixed issue with resetting background color for Termion backend
...
- Background color was being set back to the theme's background color rather than the terminal's background color when the backend was `finish()`ed. This resets the background color to the default instead.
2017-01-10 19:22:05 -06:00
Casey Primozic
9894dd9715
Added functions to register callbacks for ListView
...
- Added `on_selected()` and `set_on_selected()` funtions that are called when the focus is changed
- Added `focused()` to return the index of the currently focused item.
2017-01-10 19:20:06 -06:00
Alexandre Bury
8c366389a7
Fix type cast in pancurses backend
2017-01-06 21:25:10 -08:00
Alexandre Bury
2bacfcb11e
Add manual-loop methods
...
is_running() and step()
2016-12-15 20:39:50 +01:00
Alexandre Bury
858067ef6b
Detect terminal resize in termion backend
...
Using the chan_signal crate
2016-12-13 22:10:00 -08:00
Alexandre Bury
ea3dde33ec
Use async input for termion backend
...
This enables async refresh, fixing the `logs` and `progress` examples.
2016-12-13 20:54:18 -08:00
Alexandre Bury
89ec140f41
Update doc comments
2016-12-12 10:20:19 -08:00
Alexandre Bury
0ab2c6db07
Update pancurses backend
2016-11-24 23:42:31 -08:00
Alexandre Bury
508c9833e3
Add Esc support to termion backend
2016-11-04 16:24:52 -07:00
Alexandre Bury
ce009d0e5f
Back to upstream termion
...
Just figured I could implement Color for a custom wrapper struct.
2016-11-04 10:30:06 -07:00
Alexandre Bury
949b1e9632
Add tab support to pancurses
2016-10-28 17:13:53 -07:00
Alexandre Bury
60bddf7e8d
Better input support in termion backend
...
Still many key combinations unsupported.
2016-10-24 11:16:56 -07:00
Alexandre Bury
965b32bd9b
Bring colors to termion backend
...
Currently require termion fork for color storage support.
2016-10-21 17:18:26 -07:00
nabijaczleweli
13d84970d3
Correctly handle backspace in pancurses backend on Windows
...
Closes #81
2016-10-15 17:48:31 +02:00
Craig M. Brandenburg
df0d93ae74
Documentation spell fix
2016-10-15 06:24:24 -07:00
Alexandre Bury
bfb422067a
Doc fixes
2016-10-14 18:18:19 -07:00
Alexandre Bury
fde1091051
Fix focus in ListView
2016-10-13 11:57:24 -07:00
Alexandre Bury
e81a569e31
Add From<((left,right), (top, bottom))> to Vec4
2016-10-12 15:37:55 -07:00
Alexandre Bury
7e382593a8
Remember current color style in pancurses backend
2016-10-12 14:14:32 -07:00
nabijaczleweli
e33474dd74
Fix back-end warnings
2016-10-12 20:06:04 +02:00
Alexandre Bury
2dc75c2ec0
Make window resizeable in BLT backend
2016-10-12 09:35:03 -07:00
Alexandre Bury
65d86f3638
Add Event::Exit
...
Currently only sent by the bear lib terminal.
2016-10-11 17:48:37 -07:00
Alexandre Bury
4aaee06d9e
Fix screen clear on layer removal
...
Fixes #78 .
2016-10-11 17:29:13 -07:00
nabijaczleweli
c4baa0f570
Add BearLibTerminal backend
2016-10-12 01:48:22 +02:00
Alexandre Bury
821d9f1783
Parse utf8 chars in pancurses backend
...
Closes #76
2016-10-11 16:08:44 -07:00
Alexandre Bury
072c1d9b5c
Fix some input in pancurses backend
2016-10-11 12:31:31 -07:00
nabijaczleweli
8a6a49fbc3
Fix Enter being Character('\n') in pancurses backend
...
Closes #73
2016-10-11 20:59:28 +02:00
nabijaczleweli
5eccc2f518
Fix inverted screen size in pancurses backend
...
Closes #71
2016-10-11 20:53:54 +02:00
Alexandre Bury
04f528e2de
Fix clippy warnings
2016-10-11 11:04:01 -07:00
nabijaczleweli
c81579a20a
Disable failing doctests
2016-10-11 19:11:40 +02:00
nabijaczleweli
9fb8309d3a
Hello yes this is typo man
2016-10-10 23:12:42 +02:00
nabijaczleweli
c69db62844
Fix backend tests
2016-10-10 23:08:07 +02:00
nabijaczleweli
51af4350fc
Apply key mappings as they are so far
2016-10-10 23:06:55 +02:00
nabijaczleweli
80e3e4f536
Hide backend
2016-10-10 22:02:07 +02:00
nabijaczleweli
bd93f450df
Handle F[14;15]
2016-10-10 21:55:25 +02:00
nabijaczleweli
c84cafb4fd
Update pancurses to 0.4.0
2016-10-10 20:51:32 +02:00
nabijaczleweli
af0c97749d
Fix doctests using ::B
2016-10-10 20:23:00 +02:00
nabijaczleweli
4c9c4b5568
Move back-end selection to backend::Concrete instead of ::B
2016-10-10 10:34:33 +02:00
nabijaczleweli
2c009f694b
Add PauseBreak and F0 keys. Properly handle Tab
2016-10-10 10:34:33 +02:00
nabijaczleweli
79c4bf29c2
Don't explicitly list features
2016-10-10 10:34:33 +02:00
nabijaczleweli
01951aa213
Mostly add pancurses support. Test pancurses support on Travis
2016-10-10 10:34:33 +02:00
Alexandre Bury
9871e12734
Update for latest ncurses-rs
2016-10-09 17:48:31 -07:00
Alexandre Bury
651c7d619b
Remove debug artifacts
...
And bring back the shadows!
2016-10-09 17:43:24 -07:00
Alexandre Bury
686de0831c
Take &self
in TermionBackend::clear()
2016-10-09 16:03:49 -07:00
Alexandre Bury
ad7606ca55
Switch backend with cargo features
...
Use `termion` feature and disable default features to use the termion
backend.
2016-10-09 16:02:26 -07:00
Alexandre Bury
df4397a174
Add stub termion backend
...
Not supported: input, colors, effects, async
2016-10-09 16:02:26 -07:00
Alexandre Bury
90c9d51a6c
Add comments to menubar example
2016-10-09 15:59:29 -07:00
Alexandre Bury
44dbd5826e
Make Backend::clear
take &self
2016-10-09 15:47:06 -07:00
Alexandre Bury
bb62452149
EditView: Prevent overflow error with no available space
2016-10-04 17:51:18 -07:00
Alexandre Bury
8fded82434
Fix clippy warnings
2016-10-02 16:03:31 -07:00
Alexandre Bury
9cf89c37de
Clear screen if a layer is shrinked
2016-10-02 15:33:55 -07:00
Alexandre Bury
3b3f403f7a
Apply rustfmt
2016-10-02 15:22:29 -07:00
Alexandre Bury
8fa704bcfa
Rename Dialog::new
-> Dialog::around
...
And `Dialog::empty` -> `Dialog::new`
2016-10-02 15:15:30 -07:00
Alexandre Bury
53aea8e91c
Derive Clone
for RadioGroup
...
Also remove broken example.
2016-10-02 15:03:03 -07:00
Alexandre Bury
bf3888e275
Add RadioButton & RadioGroup
2016-10-02 14:57:09 -07:00
Alexandre Bury
d684a5bc1e
Remove prelude
module
...
Add `traits` module instead
2016-09-28 22:45:27 -07:00
Alexandre Bury
f4f2759df2
Make SelectView::on_submit callback take a Borrow<T>
...
Instead of a `T` directly.
2016-09-28 15:06:16 -07:00
Alexandre Bury
af803a4587
Add debuggin mention to doc
2016-09-24 17:19:09 -07:00
Alexandre Bury
b53e2a42bd
Use better type for new_default
macro
...
Again, `ty` is a better fit
2016-09-24 17:06:33 -07:00
Alexandre Bury
0401b3ab53
Use better type for wrap_impl!
macro
...
`ty` is better than `path`
2016-09-24 16:56:42 -07:00
Alexandre Bury
fa2ad3261b
Make Backend
methods not static anymore
2016-09-24 16:51:42 -07:00
Alexandre Bury
2e06dd70cb
Apply rustfmt
2016-09-22 22:11:13 -07:00
Alexandre Bury
d29f80869d
Don't inline doc in prelude
2016-09-22 22:04:55 -07:00
Alexandre Bury
829dd77deb
Add &Backend
to Printer struct
...
Makes `::B` public but undocumented.
Backend is currently an immutable ref, may need to become
mutable to be more useful (will need to change the View trait)
2016-09-22 22:00:58 -07:00
Alexandre Bury
05a862d98b
Remove unused import in test module
2016-09-22 17:12:53 -07:00
Alexandre Bury
a5135a7aff
Better documentation for view::Finder
...
Also adds `Finder::find_id`
2016-09-21 14:57:03 -07:00
Alexandre Bury
f879305d7f
Adds SelectView::is_empty
...
Fix clippy warning
2016-09-21 11:57:38 -07:00
Alexandre Bury
a064400b6f
Add unsafe block around ncurses::stdscr
...
One more reason to avoid ncurses
2016-09-21 11:57:19 -07:00
Alexandre Bury
93980a7d0c
Rename View::find
-> View::find_any
...
And add the `Finder` trait on Views to provide a true `find`.
2016-09-21 11:33:44 -07:00
Alexandre Bury
7d16f70d67
Add some tests to view::position
2016-09-20 18:32:31 -07:00
Alexandre Bury
e3ac2a0482
Added some size tests to BoxView
2016-09-20 11:50:34 -07:00
Alexandre Bury
08d1c1e5b0
Use an associated type in ViewWrapper
...
This removes the need for dynamic dispatching
2016-09-19 17:20:20 -07:00
Alexandre Bury
3701c85ffd
Add clear
methods to SelectView
and ListView
2016-09-05 15:33:52 -07:00
Alexandre Bury
53402a0063
Add link wrap_impl!
doc
2016-09-01 11:56:11 -07:00
Alexandre Bury
24511ae5f1
Accept Into<String>
in EditView::set_content
2016-09-01 11:49:47 -07:00
Alexandre Bury
d51772f714
EditView: move cursor on content change
...
To the end of the content.
2016-09-01 11:42:16 -07:00
Alexandre Bury
9142c545f7
Fix crash when removing the first item in a SelectView
2016-09-01 11:28:30 -07:00
Alexandre Bury
0364f577b2
Add EditView::set_cursor
...
And fix a crash with `set_content` (it wasn't updating the cursor).
2016-09-01 11:10:12 -07:00
Alexandre Bury
77abb5729e
Add DummyView to prelude
2016-08-31 17:19:22 -07:00
Alexandre Bury
6dd81faa57
Fix offset in SelectView::remove_item
2016-08-31 17:14:37 -07:00
Alexandre Bury
484f81861a
Replace SelectView::focus
with selected_id
...
Returns None if the list is empty.
Also add `SelectView::len`
2016-08-31 17:05:58 -07:00
Alexandre Bury
0e08d7d058
Add remove_item
to SelectView
...
And made `focus` public.
2016-08-31 17:00:48 -07:00
Alexandre Bury
ce6992a8c5
Add SliderView
2016-08-13 01:03:40 -07:00
Alexandre Bury
921e4a451e
Add outset border functions to Printer
2016-08-05 10:49:16 -07:00
Alexandre Bury
e79cc61e08
Remove FullView
2016-08-04 20:03:48 -07:00
Alexandre Bury
2ee5c6f4e9
Don't run the print_box example
...
It was messing with travis?
2016-08-04 18:01:46 -07:00
Alexandre Bury
cadb585948
Fix Printer::print_box
documentation
2016-08-04 17:38:26 -07:00
Alexandre Bury
f7a3d821d1
Actually use Theme::{shadow,borders}
when drawing
...
Also add the 8 light base colors
2016-08-04 17:27:04 -07:00
Alexandre Bury
db09930fe2
Fix clippy warning
2016-08-04 09:58:13 -07:00
Alexandre Bury
9db3c87851
Add Cursive::set_theme
method
...
Allow setting a theme without having to load a toml file.
2016-08-04 00:11:16 -07:00
Alexandre Bury
1052c0b74c
Remove EditView::min_length
...
Uses `.fixed_width()` from `Boxable` or something like that.
2016-08-03 21:58:00 -07:00
Alexandre Bury
b38995b906
Refactor BoxView
...
Add `Boxable` trait.
2016-08-03 21:55:41 -07:00
Alexandre Bury
6827d2ed59
Update scrollbase on any row computation
2016-08-03 00:01:18 -07:00
Alexandre Bury
095367166b
TextArea: starts with no rows.
...
The first `layout()` will build what's required.
2016-08-02 23:33:07 -07:00
Alexandre Bury
d3d86a2f45
Fix clippy warning
2016-08-02 23:26:59 -07:00
Alexandre Bury
fab05b8b9f
Fix layout bugs in TextArea
2016-08-02 23:24:47 -07:00
Alexandre Bury
5d124e452e
TextArea: cache layout computations
2016-08-02 21:48:12 -07:00
Alexandre Bury
e4bc129f4b
Smarter TextArea row computation
...
Only re-compute damaged areas.
2016-08-02 21:22:23 -07:00
Alexandre Bury
bd78418083
Add scrollbar_padding
to ScrollBase
...
And use it in TextArea
2016-08-02 00:49:59 -07:00
Alexandre Bury
93ceb17c21
Rename scrollbar_padding
-> scrollbar_offset
in ScrollBase
2016-08-02 00:36:27 -07:00
Alexandre Bury
75c365451f
Add initial TextArea
2016-08-02 00:32:16 -07:00
Alexandre Bury
ede5c616f6
Update EditView
doc
...
With updated `examples/edit.rs` content
2016-07-31 17:53:00 -07:00
Alexandre Bury
3410150ed5
Fix clippy warning
...
Use `for` loop instead of discarding `collect` result.
2016-07-31 11:29:55 -07:00
Alexandre Bury
191cfcecfd
Fix typo
2016-07-30 15:58:52 -07:00
Alexandre Bury
be7f2184e9
Unify prefix_length and suffix_length signatures
2016-07-30 15:56:39 -07:00
Alexandre Bury
d12622b56a
Fix examples and tests
2016-07-30 13:30:56 -07:00
Alexandre Bury
40f9a91a7a
Replace some &str
-> S: Into<String>
...
Add back the "Ok" button to `examples/edit.rs`
2016-07-30 12:58:25 -07:00
Alexandre Bury
ca6e16311f
Add secret mode to EditView
...
Only prints `*`. Prints `**` with wide chars.
2016-07-30 12:26:41 -07:00
Alexandre Bury
3726df46b7
Add on_submit
to EditView
...
It simplifies the Edit example
2016-07-30 02:34:47 -07:00
Alexandre Bury
42a377d92b
SelectView: add methods to add items from iterators
2016-07-30 01:52:34 -07:00
Alexandre Bury
1165e70e15
Add on_select
to SelectView
...
And renamed existing `on_select` to `on_submit`
2016-07-30 01:27:34 -07:00
Alexandre Bury
2e05a0825a
Add on_edit
callback to EditView
...
Also fix <Del>/<Backspace> handling with precomposed characters
2016-07-30 01:18:12 -07:00
Alexandre Bury
db9df3dfc9
Add deconstruct
method to ProgressReader
2016-07-29 23:51:41 -07:00
Alexandre Bury
6e247efc1c
Add ProgressReader
to the utils
module
...
Should allow to monitor a file download in a progress bar
2016-07-29 23:48:19 -07:00
Alexandre Bury
24e4e41a85
Move DummyView to views
module
2016-07-29 23:36:40 -07:00
Alexandre Bury
fb10e58188
Move LinesIterator
to utils
module
2016-07-28 23:05:33 -07:00
Alexandre Bury
f87d0e7c5b
Move views to new views
module
2016-07-28 16:36:01 -07:00
Alexandre Bury
51a1a19f92
Fix progressbar doc
2016-07-28 00:29:11 -07:00
Alexandre Bury
2597c9a566
Add a center()
convenient method to TextView
...
Avoids having to import HAlign
2016-07-27 23:58:57 -07:00
Alexandre Bury
261d2aac48
Remove Ticker
alias
...
The `Counter` NewType can fill this role.
2016-07-27 23:55:34 -07:00
Alexandre Bury
c689a3ba7e
Add non-chainable add_child
to LinearLayout
2016-07-27 23:52:21 -07:00
Alexandre Bury
bea7240271
Wrap Arc<AtomicUsize>
around NewType Counter
...
And offers a simpler API
2016-07-26 23:29:13 -07:00
Alexandre Bury
8290c3f62a
Make progressbar more robust to invalid min/max values
2016-07-26 23:05:18 -07:00
Alexandre Bury
2cedc8ae76
Add comments to progress bar
2016-07-26 21:48:26 -07:00
Alexandre Bury
8eb61e0239
Add start
and with_task
to ProgressBar
2016-07-26 12:25:06 -07:00
Alexandre Bury
eb6b5d5728
Fix LinearLayout children width
...
Now properly gives the full width to every children.
2016-07-26 10:49:37 -07:00
Alexandre Bury
0643c50bd5
Add async-callback channel to Cursive
...
And remove it from ProgressBar
2016-07-26 10:13:36 -07:00
Alexandre Bury
04f961657f
ProgressBar takes all given width
2016-07-26 09:55:22 -07:00
Alexandre Bury
2e5262096a
Don't compile internal doc example
...
Won't compile anyway since it's not public
2016-07-26 00:00:45 -07:00
Alexandre Bury
6e021867ab
ProgressBar now shows a percentage status
...
The label can be customized though `ProgressBar::with_label`.
2016-07-25 23:54:33 -07:00
Alexandre Bury
5dd20db676
Add Dialog::empty
and Dialog::content
...
Allows to set the content after the title, for when it's more
readable.
2016-07-25 20:43:01 -07:00
Alexandre Bury
7283e7f3af
Rustfmt
2016-07-25 13:39:10 -07:00
Alexandre Bury
5e6222bf23
Use intermediate type for the callback promise
...
Using actual promises would still be better
2016-07-25 13:38:13 -07:00
Alexandre Bury
c1c9322319
Add panel view
2016-07-25 13:35:46 -07:00
Alexandre Bury
6c71ac14b0
More linear progress bar progression
...
Each cell should receive the same number of ticks
2016-07-25 12:18:05 -07:00
Alexandre Bury
47acf1667d
Remove brackets from progress bar
...
It was ugly, really.
Put a Panel (doesn't exist yet) around it if you want.
2016-07-24 23:03:59 -07:00
Alexandre Bury
e29511e757
Add ProgressBar
...
Also make Callback its own NewType to add comversion methods.
2016-07-24 23:01:09 -07:00
Alexandre Bury
10e072c140
Allow loading themes from content.
...
Made `load_theme` thake a `&str` and Added `load_theme_file`.
2016-07-24 16:56:22 -07:00
Alexandre Bury
0a8228d073
Add examples to documentation
2016-07-20 22:08:06 -07:00
Alexandre Bury
536321ebda
Add Button to prelude.
2016-07-20 22:02:45 -07:00
Alexandre Bury
2a4742f67b
Use prelude in docs
2016-07-20 21:43:20 -07:00
Alexandre Bury
f28ac264f1
Add prelude import module
...
Update examples to use it.
2016-07-20 21:25:14 -07:00
Alexandre Bury
64d176ffa5
Add proper select popup placement
...
Added a popup select to the `list_view` example
2016-07-20 00:30:00 -07:00
Alexandre Bury
8b6022a398
Add popup mode to SelectView
...
Single-line, opens a popup on selection.
2016-07-19 23:47:27 -07:00
Alexandre Bury
783fa0f1e2
Fix typo in docs
2016-07-19 20:50:21 -07:00
Alexandre Bury
a1d0231e2c
Make Menubar
a proper View
2016-07-19 20:44:50 -07:00
Alexandre Bury
2065be3e88
Add some doc to the menu
module
2016-07-19 20:28:34 -07:00
Alexandre Bury
4120203844
More fixes for insufficient space.
2016-07-17 01:20:41 -07:00
Alexandre Bury
8750185f8c
Don't crash on insufficient space
2016-07-16 22:06:28 -07:00
Alexandre Bury
ab3a55abaf
Add enabled state to Button
2016-07-16 18:49:17 -07:00
Alexandre Bury
58a04bbb13
Add enabled state to SelectView
2016-07-16 18:46:18 -07:00
Alexandre Bury
02b6b6601f
Add enabled state to Checkbox
2016-07-16 18:36:54 -07:00
Alexandre Bury
77a623674a
Add on_change callback to CheckBox
2016-07-16 18:18:33 -07:00
Alexandre Bury
05f66b8e1b
Add macro'd Default implementations
2016-07-16 17:28:42 -07:00
Alexandre Bury
d4afdf024f
Add checkbox view
2016-07-16 17:22:24 -07:00
Alexandre Bury
5ee8706582
Add scrollable
flag to TextViews
2016-07-16 17:08:17 -07:00
Alexandre Bury
5b25893496
Rustfmt
2016-07-16 13:52:28 -07:00
Alexandre Bury
a22c92a1a1
Add ListView
...
Also added `examples/list_view.rs`.
2016-07-16 13:25:21 -07:00
Alexandre Bury
99993ab1ec
Clear screen when hiding menubar
...
Otherwise it's visible but inactive
2016-07-16 01:07:37 -07:00
Alexandre Bury
2b54d6df28
Make View::draw
take a &self (instead of a &mut self)
...
TrackedView, the only user of the mutability, now uses internal
mutability with a Cell.
2016-07-15 23:44:38 -07:00
Alexandre Bury
ef6f83751c
Remove unused file
2016-07-15 11:17:09 -07:00
Alexandre Bury
1010c825ae
Added doc for event module
2016-07-14 23:25:32 -07:00
Alexandre Bury
2ed8552e4b
More doc fixes
2016-07-14 22:53:16 -07:00
Alexandre Bury
b4fafbec83
Fix some documentation
2016-07-14 22:50:35 -07:00
Alexandre Bury
bd5c45ac0e
Fix clippy warnings
2016-07-14 22:32:43 -07:00
Alexandre Bury
91fdf96066
Add Direction
enum
...
And add a Direction argument to take_focus
2016-07-14 22:23:06 -07:00
Alexandre Bury
1b34934df7
Fix printer::Printer
imports
2016-07-13 23:25:54 -07:00
Alexandre Bury
7f17a4ff74
Don't expose single-item modules
...
Instead, pub-use it from the root.
2016-07-13 23:18:59 -07:00
Alexandre Bury
d9e4512752
Fix linear layout focus switch
2016-07-13 22:16:55 -07:00
Alexandre Bury
5059e21cb1
Fix focus in LinearLayout
...
Focus now at least works. #42 is still open though.
2016-07-13 22:11:03 -07:00
Alexandre Bury
9390504290
Add documentation to BoxView
2016-07-13 21:30:30 -07:00
Alexandre Bury
e166869c51
Add some documentation to view
module
2016-07-13 20:52:24 -07:00
Alexandre Bury
03c400ad44
Fix linear layout in constrained space
2016-07-13 01:19:05 -07:00
Alexandre Bury
12593c8ea8
Rustfmt on xy.rs
2016-07-12 21:33:50 -07:00
Alexandre Bury
4fe7df220a
Add basic test to Vec2
2016-07-12 21:33:24 -07:00
Alexandre Bury
7f530e34b7
Add XY generic struct
2016-07-12 21:03:17 -07:00
Alexandre Bury
309c471a63
Add #![deny(missing_docs)]
...
And fill the appropriate missing ones
2016-07-11 20:26:33 -07:00
Alexandre Bury
c597c262fe
Add single-orientation FullView
...
full_width and full_height
2016-07-11 19:35:18 -07:00
Alexandre Bury
b7a270f258
Split width
and height
in BoxView
...
They are now both optional
2016-07-11 19:24:50 -07:00
Alexandre Bury
c07e8b6aee
Rustfmt
2016-07-10 19:11:21 -07:00
Alexandre Bury
6e0819f723
Simplify Event enum
...
Now properly unify Alt/Ctrl/Shift handling
2016-07-10 18:27:26 -07:00
Alexandre Bury
99bf28dfd6
Add needs_relayout
method to View
trait.
...
Purely optimization-focused trait (it is safe to ignore it entirely).
Allows view groups to take shortcuts if they know their children didn't
change since last time.
2016-07-10 17:41:49 -07:00
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