mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-27 19:26:09 +00:00
Add Dialog.get_content
This commit is contained in:
parent
1551fbb543
commit
c119f957eb
@ -103,6 +103,18 @@ impl Dialog {
|
|||||||
self.with(|s| s.set_content(view))
|
self.with(|s| s.set_content(view))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Gets the content of this dialog.
|
||||||
|
///
|
||||||
|
/// ```
|
||||||
|
/// use cursive::views::{Dialog, TextView};
|
||||||
|
/// let dialog = Dialog::around(TextView::new("Hello!"));
|
||||||
|
/// let text_view: &TextView = dialog.get_content().as_any().downcast_ref::<TextView>().unwrap();
|
||||||
|
/// assert_eq!(text_view.get_content().source(), "Hello!");
|
||||||
|
/// ```
|
||||||
|
pub fn get_content(&self) -> &View {
|
||||||
|
&*self.content.view
|
||||||
|
}
|
||||||
|
|
||||||
/// Sets the content for this dialog.
|
/// Sets the content for this dialog.
|
||||||
///
|
///
|
||||||
/// Previous content will be dropped.
|
/// Previous content will be dropped.
|
||||||
|
Loading…
Reference in New Issue
Block a user