pub unsafe trait NSOpenSavePanelDelegate: NSObjectProtocol + MainThreadOnly {
// Provided methods
unsafe fn panel_shouldEnableURL(
&self,
sender: &AnyObject,
url: &NSURL,
) -> bool
where Self: Sized + Message { ... }
unsafe fn panel_validateURL_error(
&self,
sender: &AnyObject,
url: &NSURL,
) -> Result<(), Retained<NSError>>
where Self: Sized + Message { ... }
unsafe fn panel_didChangeToDirectoryURL(
&self,
sender: &AnyObject,
url: Option<&NSURL>,
)
where Self: Sized + Message { ... }
unsafe fn panel_userEnteredFilename_confirmed(
&self,
sender: &AnyObject,
filename: &NSString,
ok_flag: bool,
) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
unsafe fn panel_willExpand(&self, sender: &AnyObject, expanding: bool)
where Self: Sized + Message { ... }
unsafe fn panelSelectionDidChange(&self, sender: Option<&AnyObject>)
where Self: Sized + Message { ... }
unsafe fn panel_displayNameForType(
&self,
sender: &AnyObject,
type: &UTType,
) -> Option<Retained<NSString>>
where Self: Sized + Message { ... }
unsafe fn panel_didSelectType(
&self,
sender: &AnyObject,
type: Option<&UTType>,
)
where Self: Sized + Message { ... }
}
NSSavePanel
only.Expand description
Provided Methods§
Sourceunsafe fn panel_shouldEnableURL(&self, sender: &AnyObject, url: &NSURL) -> bool
unsafe fn panel_shouldEnableURL(&self, sender: &AnyObject, url: &NSURL) -> bool
Optional — Enabling URLs.
NSSavePanel
: This method is not sent. All urls are always disabled.
NSOpenPanel
: Return YES
to allow the url
to be enabled in the panel. Delegate implementations should be fast to avoid stalling the UI. Applications linked on Mac OS 10.7 and later should be prepared to handle non-file URL schemes.
Sourceunsafe fn panel_validateURL_error(
&self,
sender: &AnyObject,
url: &NSURL,
) -> Result<(), Retained<NSError>>
unsafe fn panel_validateURL_error( &self, sender: &AnyObject, url: &NSURL, ) -> Result<(), Retained<NSError>>
Optional — URL validation for saving and opening files.
NSSavePanel
: Sent once by the save panel when the user clicks the Save button. The user is intending to save a file at url
. Return YES
if the url
is a valid location to save to. Return NO
and return by reference outError
with a user displayable error message for why the url
is not valid. If a recovery option is provided by the error, and recovery succeeded, the panel will attempt to close again.
- Note: An item at
url
may not physically exist yet, unless the user decided to overwrite an existing item.NSOpenPanel
: Sent once for each selected filename (or directory) when the user chooses the Open button. ReturnYES
if theurl
is acceptable to open. ReturnNO
and return by referenceoutError
with a user displayable message for why theurl
is not valid for opening. If a recovery option is provided by the error, and recovery succeeded, the panel will attempt to close again. - Note: Implement this delegate method instead of
panel:shouldEnableURL:
if the processing of the selected item takes a long time.
Sourceunsafe fn panel_didChangeToDirectoryURL(
&self,
sender: &AnyObject,
url: Option<&NSURL>,
)
unsafe fn panel_didChangeToDirectoryURL( &self, sender: &AnyObject, url: Option<&NSURL>, )
Optional — Sent when the user selected the directory located at url
. url
may be nil
. if the current directory can’t be represented by an NSURL object (ie: the media sidebar directory, or the “Computer”).
Sourceunsafe fn panel_userEnteredFilename_confirmed(
&self,
sender: &AnyObject,
filename: &NSString,
ok_flag: bool,
) -> Option<Retained<NSString>>
unsafe fn panel_userEnteredFilename_confirmed( &self, sender: &AnyObject, filename: &NSString, ok_flag: bool, ) -> Option<Retained<NSString>>
Optional — Filename customization for the NSSavePanel. Allows the delegate to customize the filename entered by the user, before the extension is appended, and before the user is potentially asked to replace a file.
Sourceunsafe fn panel_willExpand(&self, sender: &AnyObject, expanding: bool)
unsafe fn panel_willExpand(&self, sender: &AnyObject, expanding: bool)
Optional — Sent when the user clicks the disclosure triangle to expand or collapse the file browser while in NSOpenPanel.
Sourceunsafe fn panelSelectionDidChange(&self, sender: Option<&AnyObject>)
unsafe fn panelSelectionDidChange(&self, sender: Option<&AnyObject>)
Optional — Sent when the user has changed the selection.
Sourceunsafe fn panel_displayNameForType(
&self,
sender: &AnyObject,
type: &UTType,
) -> Option<Retained<NSString>>
Available on crate feature objc2-uniform-type-identifiers
and Apple only.
unsafe fn panel_displayNameForType( &self, sender: &AnyObject, type: &UTType, ) -> Option<Retained<NSString>>
objc2-uniform-type-identifiers
and Apple only.NSSavePanel
: Optional — Sent when the content type popup is displayed and the save panel needs the display name for a type. If nil
is returned, the save panel will display type’s localizedDescription
.
NSOpenPanel
: Not sent.
Trait Implementations§
Source§impl ProtocolType for dyn NSOpenSavePanelDelegate
impl ProtocolType for dyn NSOpenSavePanelDelegate
impl<T> ImplementedBy<T> for dyn NSOpenSavePanelDelegate
Implementations on Foreign Types§
impl<T> NSOpenSavePanelDelegate for ProtocolObject<T>where
T: ?Sized + NSOpenSavePanelDelegate,
Implementors§
impl NSOpenSavePanelDelegate for NSPathCell
NSPathCell
only.