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: boolIf the dialog is currently open
init: boolIf 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: StringBuffer 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: boolIf we should scroll to the error in the next frame
request_focus: boolIf the text input should request focus in the next frame
file_system: Arc<dyn FileSystem + Send + Sync>Implementations§
Source§impl CreateDirectoryDialog
impl CreateDirectoryDialog
Sourcepub fn from_filesystem(file_system: Arc<dyn FileSystem + Send + Sync>) -> Self
pub fn from_filesystem(file_system: Arc<dyn FileSystem + Send + Sync>) -> Self
Creates a new dialog with default values
Sourcepub fn submit(&mut self) -> CreateDirectoryResponse
pub fn submit(&mut self) -> CreateDirectoryResponse
Tries to create the given folder.
Sourcepub fn update(
&mut self,
ui: &mut Ui,
config: &FileDialogConfig,
) -> CreateDirectoryResponse
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.
Sourcefn create_directory(&mut self) -> CreateDirectoryResponse
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.
Sourcefn validate_input(&mut self, labels: &FileDialogLabels) -> Option<String>
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.
Sourcefn create_error(&mut self, error: &str) -> String
fn create_error(&mut self, error: &str) -> String
Creates the specified error and sets to scroll to the error in the next frame.