Trait NSOpenSavePanelDelegate

Source
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 { ... }
}
Available on crate feature NSSavePanel only.
Expand description

Provided Methods§

Source

unsafe fn panel_shouldEnableURL(&self, sender: &AnyObject, url: &NSURL) -> bool
where Self: Sized + Message,

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.

Source

unsafe fn panel_validateURL_error( &self, sender: &AnyObject, url: &NSURL, ) -> Result<(), Retained<NSError>>
where Self: Sized + Message,

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. Return YES if the url is acceptable to open. Return NO and return by reference outError with a user displayable message for why the url 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.
Source

unsafe fn panel_didChangeToDirectoryURL( &self, sender: &AnyObject, url: Option<&NSURL>, )
where Self: Sized + Message,

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”).

Source

unsafe fn panel_userEnteredFilename_confirmed( &self, sender: &AnyObject, filename: &NSString, ok_flag: bool, ) -> Option<Retained<NSString>>
where Self: Sized + Message,

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.

Source

unsafe fn panel_willExpand(&self, sender: &AnyObject, expanding: bool)
where Self: Sized + Message,

Optional — Sent when the user clicks the disclosure triangle to expand or collapse the file browser while in NSOpenPanel.

Source

unsafe fn panelSelectionDidChange(&self, sender: Option<&AnyObject>)
where Self: Sized + Message,

Optional — Sent when the user has changed the selection.

Source

unsafe fn panel_displayNameForType( &self, sender: &AnyObject, type: &UTType, ) -> Option<Retained<NSString>>
where Self: Sized + Message,

Available on crate feature 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.

Source

unsafe fn panel_didSelectType(&self, sender: &AnyObject, type: Option<&UTType>)
where Self: Sized + Message,

Available on crate feature objc2-uniform-type-identifiers and Apple only.

NSSavePanel: Optional — Sent when the user changes the current type. NSOpenPanel: Not sent.

Trait Implementations§

Source§

impl ProtocolType for dyn NSOpenSavePanelDelegate

Source§

const NAME: &'static str = "NSOpenSavePanelDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn NSOpenSavePanelDelegate

Implementations on Foreign Types§

Source§

impl<T> NSOpenSavePanelDelegate for ProtocolObject<T>

Implementors§

Source§

impl NSOpenSavePanelDelegate for NSPathCell

Available on crate feature NSPathCell only.