CreateDirectoryDialog

Struct CreateDirectoryDialog 

Source
pub struct CreateDirectoryDialog {
    open: bool,
    init: bool,
    directory: Option<PathBuf>,
    input: String,
    error: Option<String>,
    scroll_to_error: bool,
    request_focus: bool,
    file_system: Arc<dyn FileSystem + Send + Sync>,
}
Expand description

A dialog to create new folder.

Fields§

§open: bool

If the dialog is currently open

§init: bool

If the update method is called for the first time. Used to initialize some stuff and scroll to the dialog.

§directory: Option<PathBuf>

The directory that is currently open and where the folder is created.

§input: String

Buffer to hold the data of the folder name input

§error: Option<String>

This contains the error message if the folder name is invalid

§scroll_to_error: bool

If we should scroll to the error in the next frame

§request_focus: bool

If the text input should request focus in the next frame

§file_system: Arc<dyn FileSystem + Send + Sync>

Implementations§

Source§

impl CreateDirectoryDialog

Source

pub fn from_filesystem(file_system: Arc<dyn FileSystem + Send + Sync>) -> Self

Creates a new dialog with default values

Source

pub fn open(&mut self, directory: PathBuf)

Resets the dialog and opens it.

Source

pub fn close(&mut self)

Closes and resets the dialog without creating the directory.

Source

pub fn submit(&mut self) -> CreateDirectoryResponse

Tries to create the given folder.

Source

pub fn update( &mut self, ui: &mut Ui, config: &FileDialogConfig, ) -> CreateDirectoryResponse

Main update function of the dialog. Should be called in every frame in which the dialog is to be displayed.

Source

pub const fn is_open(&self) -> bool

Returns if the dialog is currently open

Source

fn create_directory(&mut self) -> CreateDirectoryResponse

Creates a new folder in the current directory. The variable input is used as the folder name. Might change the error variable when an error occurred creating the new folder.

Source

fn validate_input(&mut self, labels: &FileDialogLabels) -> Option<String>

Validates the folder name input. Returns None if the name is valid. Otherwise returns the error message.

Source

fn create_error(&mut self, error: &str) -> String

Creates the specified error and sets to scroll to the error in the next frame.

Source

fn reset(&mut self)

Resets the dialog. Configuration variables are not changed.

Trait Implementations§

Source§

impl Debug for CreateDirectoryDialog

Source§

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

Formats the value using the given formatter. 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, 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.