pub struct ExportDialog { /* private fields */ }Expand description
Export dialog for configuring and executing chart exports
The dialog offers:
- Format selection (PNG, CSV, Clipboard)
- Image dimensions, title, timestamp and transparent background
- File save path entry
The dialog only collects the request; the host performs the export. Use
with_formats to offer only the formats the host
can produce. The dialog stays open after a request; report its result with
mark_success or mark_error.
§Example
use egui_charts::ui::export::{ExportDialog, ExportResponse};
let mut export_dialog = ExportDialog::new();
// Open the dialog
export_dialog.open();
// In your egui update loop
match export_dialog.show(ctx) {
ExportResponse::Export { config, save_path } => {
// Perform the actual export
println!("Exporting with config: {:?}", config);
}
ExportResponse::Closed => {
println!("Dialog closed");
}
ExportResponse::None => {}
}Implementations§
Source§impl ExportDialog
impl ExportDialog
Sourcepub fn with_formats(self, formats: &[ExportFormat]) -> Self
pub fn with_formats(self, formats: &[ExportFormat]) -> Self
Offers only formats, in the given order, for hosts that cannot
perform every export. Selects the first of them if the current format
is not offered.
Sourcepub fn open(&mut self)
pub fn open(&mut self)
Opens the export dialog
This resets the export status to idle and shows the dialog.
Sourcepub fn show(&mut self, ctx: &Context) -> ExportResponse
pub fn show(&mut self, ctx: &Context) -> ExportResponse
Shows the export dialog and returns the user’s action
This displays a dialog with export configuration options.
Returns ExportResponse indicating what action the user took.
§Example
let mut dialog = ExportDialog::new();
dialog.open();
match dialog.show(ctx) {
ExportResponse::Export { config, save_path } => {
// Perform export
}
ExportResponse::Closed => {}
ExportResponse::None => {}
}Sourcepub fn show_with(
&mut self,
ctx: &Context,
content: impl FnMut(&mut Ui, ExportFormat),
) -> ExportResponse
pub fn show_with( &mut self, ctx: &Context, content: impl FnMut(&mut Ui, ExportFormat), ) -> ExportResponse
Shows the dialog with host controls below its title, such as an image scope chooser.
content receives the currently selected format; the host keeps its own control state.
Sourcepub fn mark_success(&mut self)
pub fn mark_success(&mut self)
Marks the current export as successful
Call this after completing an export to show success status in the dialog.
Sourcepub fn mark_error(&mut self, error: String)
pub fn mark_error(&mut self, error: String)
Marks the current export as failed with an error message
Call this if an export fails to show the error in the dialog.
§Arguments
error- A description of what went wrong
Sourcepub fn reset_status(&mut self)
pub fn reset_status(&mut self)
Resets the export status to idle
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ExportDialog
impl RefUnwindSafe for ExportDialog
impl Send for ExportDialog
impl Sync for ExportDialog
impl Unpin for ExportDialog
impl UnsafeUnpin for ExportDialog
impl UnwindSafe for ExportDialog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more