mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Added possibility to change based on flag during creation of a HideableView if it is hidden or not (#554)
* HideableView description added + formatting * HideableView: changed method name and got rid of branching
This commit is contained in:
parent
85f6372c68
commit
e417a8be0b
@ -54,6 +54,13 @@ impl<V> HideableView<V> {
|
|||||||
self.with(Self::hide)
|
self.with(Self::hide)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Sets the visibility for this view to flag value.
|
||||||
|
/// Useful when creating views needs to be decided at runtime.
|
||||||
|
/// Chainable variant.
|
||||||
|
pub fn visible(self, flag: bool) -> Self {
|
||||||
|
self.with(|s| s.set_visible(flag))
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns `true` if the wrapped view is going to be visible.
|
/// Returns `true` if the wrapped view is going to be visible.
|
||||||
pub fn is_visible(&self) -> bool {
|
pub fn is_visible(&self) -> bool {
|
||||||
self.visible
|
self.visible
|
||||||
|
Loading…
Reference in New Issue
Block a user