Skip to main content

DialogManager

Struct DialogManager 

Source
pub struct DialogManager { /* private fields */ }
Expand description

Manager for multiple in-UI file browser dialogs (IGFD-style open/display separation).

This is an incremental step toward IGFD-grade behavior:

  • Multiple dialogs can exist concurrently (each keyed by a DialogId).
  • The caller opens a dialog (open_browser*) and later drives rendering per-frame via show_* / draw_*.

Implementations§

Source§

impl DialogManager

Source

pub fn new() -> Self

Create a new manager.

Source

pub fn with_fs(fs: Box<dyn FileSystem>) -> Self

Create a new manager using a custom filesystem.

Source

pub fn set_fs(&mut self, fs: Box<dyn FileSystem>)

Replace the manager filesystem.

Source

pub fn fs(&self) -> &dyn FileSystem

Get a shared reference to the manager filesystem.

Source

pub fn open_browser(&mut self, mode: DialogMode) -> DialogId

Open a new in-UI file browser dialog with a default state.

Source

pub fn open_browser_with_state(&mut self, state: FileDialogState) -> DialogId

Open a new in-UI file browser dialog with a fully configured state.

Source

pub fn close(&mut self, id: DialogId) -> Option<FileDialogState>

Close an open dialog and return its state (if any).

Source

pub fn contains(&self, id: DialogId) -> bool

Returns true if the dialog exists in the manager.

Source

pub fn dialog_state(&self, id: DialogId) -> Option<&FileDialogState>

Get immutable access to a dialog state.

Source

pub fn dialog_state_mut(&mut self, id: DialogId) -> Option<&mut FileDialogState>

Get mutable access to a dialog state (to tweak filters/layout/etc).

Source

pub fn show_browser( &mut self, ui: &Ui, id: DialogId, ) -> Option<Result<Selection, FileDialogError>>

Draw a dialog hosted in its own ImGui window (default host config).

If a result is produced (confirm/cancel), the dialog is removed from the manager and the result is returned.

Source

pub fn show_browser_windowed( &mut self, ui: &Ui, id: DialogId, cfg: &WindowHostConfig, ) -> Option<Result<Selection, FileDialogError>>

Draw a dialog hosted in an ImGui window using custom window configuration.

If a result is produced (confirm/cancel), the dialog is removed from the manager and the result is returned.

Source

pub fn draw_browser_contents( &mut self, ui: &Ui, id: DialogId, ) -> Option<Result<Selection, FileDialogError>>

Draw only the dialog contents (no host window) for embedding.

If a result is produced (confirm/cancel), the dialog is removed from the manager and the result is returned.

Trait Implementations§

Source§

impl Debug for DialogManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DialogManager

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more