pub struct ContentDialog {Show 15 fields
pub title: Option<WidgetRef>,
pub content: Option<WidgetRef>,
pub primary_button_text: String,
pub secondary_button_text: String,
pub close_button_text: String,
pub is_primary_button_enabled: bool,
pub is_secondary_button_enabled: bool,
pub default_button: ContentDialogButton,
pub full_size_desired: bool,
pub primary_button_click: Option<ContentDialogButtonClickHandler>,
pub secondary_button_click: Option<ContentDialogButtonClickHandler>,
pub close_button_click: Option<ContentDialogButtonClickHandler>,
pub opened: Option<Listener>,
pub closing: Option<ContentDialogClosingHandler>,
pub closed: Option<ContentDialogClosedHandler>,
/* private fields */
}Expand description
A persistent dialog object: set its properties, show it with show_async from a context
beneath a Navigator, and dispose it when its owner is disposed.
Fields§
§title: Option<WidgetRef>Title: shown above the content in the subtitle size, on at most two lines. Without one,
the title row and its margin collapse.
content: Option<WidgetRef>Content: shown below the title in the body size, wrapping.
PrimaryButtonText: the leftmost button’s label; empty hides the button.
SecondaryButtonText: the middle button’s label; empty hides the button.
CloseButtonText: the rightmost button’s label, which Escape also invokes; empty hides
the button.
IsPrimaryButtonEnabled.
IsSecondaryButtonEnabled.
DefaultButton: drawn in the accent style and invoked by Enter.
full_size_desired: boolFullSizeDesired: whether the dialog takes the window’s height, up to its maximum.
PrimaryButtonClick: can cancel the close the primary button asks for.
SecondaryButtonClick: can cancel the close the secondary button asks for.
CloseButtonClick: can cancel the close the close button or Escape asks for.
opened: Option<Listener>Opened: called after the dialog’s first frame and its initial focus.
closing: Option<ContentDialogClosingHandler>Closing: can cancel any close but one the dialog’s route was removed for.
closed: Option<ContentDialogClosedHandler>Closed: called after the close transition, before the result is delivered.
Implementations§
Source§impl ContentDialog
impl ContentDialog
Sourcepub fn new(app: &mut App) -> Ref<Self>
pub fn new(app: &mut App) -> Ref<Self>
Creates a dialog with no title, no content and no buttons.
Sourcepub fn title<K>(self: Handle<Self>, app: &mut App, title: impl IntoWidget<K>)
pub fn title<K>(self: Handle<Self>, app: &mut App, title: impl IntoWidget<K>)
Sets Title.
Sourcepub fn content<K>(
self: Handle<Self>,
app: &mut App,
content: impl IntoWidget<K>,
)
pub fn content<K>( self: Handle<Self>, app: &mut App, content: impl IntoWidget<K>, )
Sets Content.
Sets PrimaryButtonText.
Sets SecondaryButtonText.
Sets CloseButtonText.
Sets IsPrimaryButtonEnabled.
Sets IsSecondaryButtonEnabled.
Sets DefaultButton.
Sourcepub fn full_size_desired(self: Handle<Self>, app: &mut App, value: bool)
pub fn full_size_desired(self: Handle<Self>, app: &mut App, value: bool)
Sets FullSizeDesired.
Sets the PrimaryButtonClick handler.
Sets the SecondaryButtonClick handler.
Sets the CloseButtonClick handler.
Sourcepub fn closing(
self: Handle<Self>,
app: &mut App,
handler: impl Fn(&mut App, &Rc<ContentDialogClosingEventArgs>) + 'static,
)
pub fn closing( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, &Rc<ContentDialogClosingEventArgs>) + 'static, )
Sets the Closing handler.
Sourcepub fn closed(
self: Handle<Self>,
app: &mut App,
handler: impl Fn(&mut App, ContentDialogClosedEventArgs) + 'static,
)
pub fn closed( self: Handle<Self>, app: &mut App, handler: impl Fn(&mut App, ContentDialogClosedEventArgs) + 'static, )
Sets the Closed handler.
Sourcepub fn show_async(
self: Handle<Self>,
app: &mut App,
context: BuildContext,
) -> Result<CompleterFuture<ContentDialogResult>, ContentDialogError>
pub fn show_async( self: Handle<Self>, app: &mut App, context: BuildContext, ) -> Result<CompleterFuture<ContentDialogResult>, ContentDialogError>
ShowAsync: shows the dialog over the window of context’s root navigator. The future
completes with the result once the dialog has closed.
Trait Implementations§
Source§impl ChangeNotifier for ContentDialog
impl ChangeNotifier for ContentDialog
fn change_notifier_data(&self) -> &ChangeNotifierData
fn change_notifier_data_mut(&mut self) -> &mut ChangeNotifierData
Source§fn will_add_listener(self: Handle<Self>, app: &mut App)
fn will_add_listener(self: Handle<Self>, app: &mut App)
addListener that
work before super.addListener go here.Source§fn did_remove_listener(self: Handle<Self>, app: &mut App)
fn did_remove_listener(self: Handle<Self>, app: &mut App)
removeListener that
work after super.removeListener go here.