Public Types | Public Member Functions

FileChooserDialogBox Class Reference

A file open/save dialog box. More...

Inherits ResizableWindow, and FileBrowserListener.

List of all members.

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.

Detailed Description

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..
        }
    }
See also:
FileChooser

Member Enumeration Documentation

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.

See also:
Component::setColour, Component::findColour, LookAndFeel::setColour, LookAndFeel::findColour
Enumerator:
titleTextColourId 

The colour to use to draw the box's title.

Reimplemented from ResizableWindow.


Constructor & Destructor Documentation

FileChooserDialogBox::FileChooserDialogBox ( const String title,
const String instructions,
FileBrowserComponent browserComponent,
bool  warnAboutOverwritingExistingFiles,
const Colour backgroundColour 
)

Creates a file chooser box.

Parameters:
titlethe main title to show at the top of the box
instructionsan optional longer piece of text to show below the title in a smaller font, describing in more detail what's required.
browserComponenta FileBrowserComponent that will be shown inside this dialog box. Make sure you delete this after (but not before!) the dialog box has been deleted.
warnAboutOverwritingExistingFilesif 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)
backgroundColourthe background colour for the top level window
See also:
FileBrowserComponent, FilePreviewComponent
FileChooserDialogBox::~FileChooserDialogBox (  )

Destructor.


Member Function Documentation

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.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines