Commit Graph

391 Commits

Author SHA1 Message Date
Alexandre Bury
13a63684f2 Fix ScrollView offset after change of focus 2020-01-14 09:56:03 -08:00
Alexandre Bury
d499bab941 Remove From implementations for Margins 2020-01-10 10:51:48 -08:00
Alexandre Bury
4c00dd3b72 Directly use crate::Vec2 2020-01-06 15:51:38 -08:00
Alexandre Bury
cd26e40fcb Rename id to name: phase 3 2020-01-06 15:41:51 -08:00
Alexandre Bury
6824cc4299 Rename id to name: phase 2 2020-01-06 15:39:30 -08:00
Alexandre Bury
ddac91373c Rename id to name: phase 1 2020-01-06 12:10:24 -08:00
Alexandre Bury
9aee7d374c Rename some types
BoxView => ResizedView
SizedView => LastSizeView
ViewBox => BoxedView
Boxable => Resizable
Boxable::box => Resizable::resize

Old names are still re-exported, but deprecated.
2020-01-06 11:55:16 -08:00
Alexandre Bury
b3f913391a Add color option to Layer 2019-11-17 00:12:04 -08:00
Alexandre Bury
bf0fb488a1 Use IntoBoxedView as bound for LinearLayout 2019-11-04 13:45:15 -08:00
Alexandre Bury
0e4d4c5fbb Fix out-of-bounds access in MenuPopup 2019-11-03 10:40:10 -08:00
Alexandre Bury
6244d6e28c Add doc for focus and important_area 2019-10-30 09:04:49 -07:00
Alexandre Bury
a708e99ba6 Add missing get_inner to EnableableView 2019-10-25 19:53:43 -07:00
Alexandre Bury
884796fb02 Add PaddedView::get_inner(_mut) and fix clippy warnings 2019-10-25 19:46:49 -07:00
Alexandre Bury
f15f36cc1b Add ScrollView::scroll_to_important_area 2019-10-22 13:58:59 -07:00
Alexandre Bury
aa74e691e1 Add LinearLayout::set_focus_index 2019-10-14 10:03:02 -07:00
Alexandre Bury
22886859dd Make view::scroll public 2019-10-08 15:33:33 -07:00
Alexandre Bury
5bf6f952d1 Add more examples 2019-10-07 16:14:38 -07:00
Alexandre Bury
149beee7b4 Add examples to SelectView 2019-10-04 13:12:00 -07:00
Alexandre Bury
e6b44d62df Update SelectView::item to take Into<StyledString> 2019-10-04 12:25:04 -07:00
panicbit
ae7a0090ff Allow SelectView::with_all to accept StyledString (#385) 2019-10-04 12:22:04 -07:00
Alexandre Bury
769ab8bf9b Replace event::AnyCb with non-boxed &dyn FnMut 2019-09-06 16:10:02 -07:00
Alexandre Bury
b3fed80939 Remove BoxView::squishable
No-one knew what it was doing.
2019-08-27 13:31:55 -07:00
Alexandre Bury
0a81454e7d Fix BoxView 2019-08-27 13:13:06 -07:00
Johannes Wünsche
e47dd87e0c BoxView Fixed, AtLeast, AtMost SizeConstraints (#368)
* Add wrap_draw implementation for BoxView

This implementation was required because the restriction of fixed &
at least sized BoxView was not fulfilled with the default. The new
implementation takes this into consideration.
2019-08-19 15:16:40 -07:00
Alexandre Bury
63302bf01b Cleanup text_view 2019-08-16 10:15:00 -07:00
Leonardo Lang
dc10fd8c44 Fix out-of-bounds access on TextView
Frequent updates to `TextContent` while the screen is being refreshed can
trigger an out-of-bounds access: an update with a smaller string being
performed between calls to `compute_rows()` and `draw()` on TextView will
cause an out-of-bounds access when slicing the string at `Segment::resolve`.

This change fixes the issue by caching the content value when performing
size calculations and using this cached content when drawing the view.

Some additional changes were also made to reuse `TextContent` invalidation
code on `TextView` and wrap content data with `RefCell<Arc<..>>` to enable
sharing the inner string between `content_value` and `content_cache`.
2019-08-01 20:29:50 -04:00
Alexandre Bury
b7d71e8381 Rustfmt
Moves to "Tall" fn_args_layout
2019-07-30 16:08:40 -07:00
Timon
bddb1a9dde Crossterm Performance Update (#361) 2019-07-30 09:48:50 -07:00
Alexandre Bury
ef60cd0a76 Add ListView::remove_child 2019-07-26 15:36:19 -07:00
Danil Berestov
976cb99bdb Remove extra check (#357) 2019-06-27 16:19:07 -07:00
Alexandre Bury
ad23dfe59b Add ScrollView::{inner_size, is_at_{bottom, top, left, right}} 2019-06-23 21:53:11 -04:00
Alexandre Bury
0c8a7b2708 Rename repo name to use lowercase 2019-06-19 14:39:11 -04:00
Alexandre Bury
269f2ab521 Add dyn to trait objects 2019-06-18 11:44:47 -07:00
Mark LeMoine
39e14d8c93 Add getters for current and max value in SliderView (#353) 2019-06-07 09:47:48 -07:00
Alexandre Bury
23d65aa9dc Update examples and tutorials to Rust 2018 2019-05-20 15:53:22 -07:00
Alexandre Bury
51c6450688 Rustfmt 2019-04-11 17:08:55 -07:00
Chris Vest
88037717e6 Add a sort method to SelectView, to easily sort all contained items lexicographically by their label. (#329)
* Add a sort method to SelectView, to easily sort all contained items lexicographically by their label.

* Add more sort methods to SelectView, bringing the API up to parity with Vec (except SelectView does not expose _unstable_ sorting).

* Rename SelectView::sort to sort_by_label to make it clear that it does not sort by the ordering of the items.

* The Ord implementation for select_view::Item is not necessary.

* Implement a SelectView::sort method for when the item values are orderable.
2019-03-30 10:22:08 -07:00
Alexandre Bury
038294339d Fix clippy warning 2019-03-20 17:05:18 -07:00
Alexandre Bury
4b5a7867e3 Refactor scroll::Core mechanism.
Moved most View-trait-performing-functions outside of `scroll::Core`
into `scroll::raw`.
Added a `Scroller` trait and convenience methods like `scroll::layout` to
weave the borrows appropriately.
2019-03-12 14:31:56 -07:00
Alexandre Bury
12ad66badd Migrate MenuPopup to new scrollbase 2019-03-08 13:57:05 -08:00
Alexandre Bury
6f28569dae Move logic from ScrollView to ScrollCore 2019-03-04 20:08:40 -08:00
mukund
bfbdf5c26b
Fix a typo in text-view.rs (content -> view) 2019-03-04 12:10:35 -08:00
Alexandre Bury
242a3c68a7 Fix clippy warnings 2019-03-04 10:31:36 -08:00
Alexandre Bury
bcf5840c52 Add LinearLayout::{insert_child, swap_children, set_weight} 2019-03-03 10:55:43 -08:00
Chris Vest
7564a5d1db Reduce the title drawing cut-off point by 2 characters.
Panels and dialogs have borders with corners.
Previously, the title would draw over the border corner, including its own end-points.
Now the cut-off point is such that we do not draw the title if the right-hand end point and the border-corner do not also fit.
2019-03-03 10:37:53 +01:00
Alexandre Bury
40adcffbf5 Revert "use ... as _" to stay compatible with rust 1.31 2019-03-01 09:29:56 -08:00
Alexandre Bury
06b02e4665 Remove "extern crate" and rustfmt 2019-02-28 16:04:14 -08:00
Alexandre Bury
e096dc9740 Run cargo fix --edition-idioms 2019-02-28 15:55:10 -08:00
Alexandre Bury
e51be07e5d Update to Rust 2018
Run `cargo fix --edition` and update Cargo.toml
2019-02-28 15:54:12 -08:00
Alexandre Bury
d7e57fd280 Rename toggle_debug_view -> toggle_debug_console 2019-02-22 15:02:34 -08:00