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:
Artie Fuffkin 2021-03-20 06:15:06 +01:00 committed by GitHub
parent 85f6372c68
commit e417a8be0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -54,6 +54,13 @@ impl<V> HideableView<V> {
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.
pub fn is_visible(&self) -> bool {
self.visible