|
C++ API Reference
|
Base Class for creating custom Maya File Dialogs. More...
#include <MPxFileDialog.h>
Public Member Functions | |
| MPxFileDialog () | |
| The class constructor. | |
| virtual | ~MPxFileDialog () |
| The class destructor. | |
| virtual void | init () |
| This method is called before the dialog opens. | |
| virtual void | reset () |
| This method is called after the dialog closes. | |
| MString | name () const |
| This routine is called to query the name of this file dialog. More... | |
| virtual void * | widget ()=0 |
| Custom file dialog must implement this method and return the UI of its browser as a QWidget. More... | |
| virtual bool | isAcceptOpenSupported () |
| Custom file dialog must implement this method and return true if it implements the File Open scenario. More... | |
| virtual bool | isAcceptSaveSupported () |
| Custom file dialog in must implement this method and return true if it implements the File Save scenario. More... | |
| virtual bool | isFileSuppored (const MString &filename) |
| This routine is called to query the ability of the custom dialog to browse for a given file path or URI. More... | |
| virtual MStringArray | selectedFiles () const =0 |
| The custom file dialog must return the browsing result (full path, URI, etc.) via this method. More... | |
| void | done (int result) |
| QFileDialog equivalent method that the custom file dialog can call to close itself with the desired result. More... | |
| void | accept () |
| QFileDialog equivalent method that the custom file dialog can call to close itself in accept mode. | |
| void | reject () |
| QFileDialog equivalent method that the custom file dialog can call to close itself in reject mode. | |
Static Public Member Functions | |
| static const char * | className () |
| Returns the name of this class. More... | |
Base Class for creating custom Maya File Dialogs.
This class provides a base class from which a custom file dialog can be derived. A custom file dialog allows the user to inject a custom file browser within the standard Maya file dialog. When one or more custom file dialogs are present, Maya's file browser UI will switch to a tabbed format with Maya's standard file browser occupying the main tab and separate tabs provided for each custom browser.
The derived class must override its widget() method to return a QWidget which Maya will then place into the appropriate tab. When active, the custom file dialog is responsible for terminating the dialog usage in accept(), done() or reject() mode via the user input of its choice and it must call the corresponding methods to do so. Additionally, the custom file dialog must return the results of file browsing via the selectedFiles() method. Results do not need to be locally existing files. A custom file dialog can return URI for example.
The MPxFileDialog class and architecture is strongly based on the QT QFileDialog class used by the standard Maya file dialog. As such, it provides most of the QFileDialog set methods as callbacks that are propagated from the main file dialog to all the custom file dialogs so they can implement the desired behavior when dialog properties are changed by Maya. The equivalent get methods are also available so that custom file dialogs can access the QFileDialog properties. Please refer to the QT documentation for details regarding those methods.
MPxFileDialogs are registered using the registerFileDialog() static method.
|
static |
Returns the name of this class.
| MString name | ( | ) | const |
This routine is called to query the name of this file dialog.
This name will be use for the corresponding dialog tab in the QTabWidget of the main Maya File Dialog. The file dialog name is specified when the file dialog is registered in the call to MPxFileDialog::registerFileDialog. Derived classes do not override this method.
|
pure virtual |
Custom file dialog must implement this method and return the UI of its browser as a QWidget.
|
virtual |
Custom file dialog must implement this method and return true if it implements the File Open scenario.
The default implementation returns false.
|
virtual |
Custom file dialog in must implement this method and return true if it implements the File Save scenario.
The default implementation returns false.
|
virtual |
This routine is called to query the ability of the custom dialog to browse for a given file path or URI.
For example, is a file dialog does allow to browse for the http scheme, it should return true. This information is used by Maya to determine which tab to select/display when the main file dialog opens when browsing is triggered from an existing path or URI. For instance, when the main file dialog opens, it loops though the registered custom file dialog and queries them using isFileSuppored() and the first one to return true will end-up being the displayed (the selected tab).
| [in] | filename | or directory to query for. |
|
pure virtual |
The custom file dialog must return the browsing result (full path, URI, etc.) via this method.
This is a QFileDialog equivalent method that will be called by Maya when the dialog is closed in accept() mode (Ex.: user selects valid files and double clicks or clicks OK).
| void done | ( | int | result | ) |
QFileDialog equivalent method that the custom file dialog can call to close itself with the desired result.
| [in] | result | see the QT corresponding documentation. |