A file open/save dialog box. More...
Inherits ResizableWindow, and FileBrowserListener.
Public Types | |
| enum | ColourIds { titleTextColourId = 0x1000850 } |
A set of colour IDs to use to change the colour of various aspects of the box. More... | |
Public Member Functions | |
| FileChooserDialogBox (const String &title, const String &instructions, FileBrowserComponent &browserComponent, bool warnAboutOverwritingExistingFiles, const Colour &backgroundColour) | |
| Creates a file chooser box. | |
| ~FileChooserDialogBox () | |
| Destructor. | |
| void | centreWithDefaultSize (Component *componentToCentreAround=0) |
| Sets the size of this dialog box to its default and positions it either in the centre of the screen, or centred around a component that is provided. | |
| void | buttonClicked (Button *button) |
| void | closeButtonPressed () |
| void | selectionChanged () |
| Callback when the user selects a different file in the browser. | |
| void | fileClicked (const File &file, const MouseEvent &e) |
| Callback when the user clicks on a file in the browser. | |
| void | fileDoubleClicked (const File &file) |
| Callback when the user double-clicks on a file in the browser. | |
A file open/save dialog box.
This is a Juce-based file dialog box; to use a native file chooser, see the FileChooser class.
To use one of these, create it and call its show() method. e.g.
{
WildcardFileFilter wildcardFilter ("*.foo", String::empty, "Foo files");
FileBrowserComponent browser (FileBrowserComponent::canSelectFiles,
File::nonexistent,
&wildcardFilter,
nullptr);
FileChooserDialogBox dialogBox ("Open some kind of file",
"Please choose some kind of file that you want to open...",
browser,
false,
Colours::lightgrey);
if (dialogBox.show())
{
File selectedFile = browser.getSelectedFile (0);
...etc..
}
}
A set of colour IDs to use to change the colour of various aspects of the box.
These constants can be used either via the Component::setColour(), or LookAndFeel::setColour() methods.
Reimplemented from ResizableWindow.
| FileChooserDialogBox::FileChooserDialogBox | ( | const String & | title, |
| const String & | instructions, | ||
| FileBrowserComponent & | browserComponent, | ||
| bool | warnAboutOverwritingExistingFiles, | ||
| const Colour & | backgroundColour | ||
| ) |
Creates a file chooser box.
| title | the main title to show at the top of the box |
| instructions | an optional longer piece of text to show below the title in a smaller font, describing in more detail what's required. |
| browserComponent | a FileBrowserComponent that will be shown inside this dialog box. Make sure you delete this after (but not before!) the dialog box has been deleted. |
| warnAboutOverwritingExistingFiles | if true, then the user will be asked to confirm if they try to select a file that already exists. (This flag is only used when saving files) |
| backgroundColour | the background colour for the top level window |
| FileChooserDialogBox::~FileChooserDialogBox | ( | ) |
Destructor.
| void FileChooserDialogBox::centreWithDefaultSize | ( | Component * | componentToCentreAround = 0 ) |
Sets the size of this dialog box to its default and positions it either in the centre of the screen, or centred around a component that is provided.
| void FileChooserDialogBox::buttonClicked | ( | Button * | button ) |
| void FileChooserDialogBox::closeButtonPressed | ( | ) |
| void FileChooserDialogBox::selectionChanged | ( | ) | [virtual] |
Callback when the user selects a different file in the browser.
Implements FileBrowserListener.
| void FileChooserDialogBox::fileClicked | ( | const File & | file, |
| const MouseEvent & | e | ||
| ) | [virtual] |
Callback when the user clicks on a file in the browser.
Implements FileBrowserListener.
| void FileChooserDialogBox::fileDoubleClicked | ( | const File & | file ) | [virtual] |
Callback when the user double-clicks on a file in the browser.
Implements FileBrowserListener.