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