A dialog-box style window. More...
Inherits DocumentWindow.
Public Member Functions | |
| DialogWindow (const String &name, const Colour &backgroundColour, bool escapeKeyTriggersCloseButton, bool addToDesktop=true) | |
| Creates a DialogWindow. | |
| ~DialogWindow () | |
| Destructor. | |
Static Public Member Functions | |
| static void | showDialog (const String &dialogTitle, Component *contentComponent, Component *componentToCentreAround, const Colour &backgroundColour, bool escapeKeyTriggersCloseButton, bool shouldBeResizable=false, bool useBottomRightCornerResizer=false) |
| Easy way of quickly showing a dialog box containing a given component. | |
| static int | showModalDialog (const String &dialogTitle, Component *contentComponent, Component *componentToCentreAround, const Colour &backgroundColour, bool escapeKeyTriggersCloseButton, bool shouldBeResizable=false, bool useBottomRightCornerResizer=false) |
| Easy way of quickly showing a dialog box containing a given component. | |
Protected Member Functions | |
| void | resized () |
A dialog-box style window.
This class is a convenient way of creating a DocumentWindow with a close button that can be triggered by pressing the escape key.
Any of the methods available to a DocumentWindow or ResizableWindow are also available to this, so it can be made resizable, have a menu bar, etc.
To add items to the box, see the ResizableWindow::setContentOwned() or ResizableWindow::setContentNonOwned() methods. Don't add components directly to this class - always put them in a content component!
You'll need to override the DocumentWindow::closeButtonPressed() method to handle the user clicking the close button - for more info, see the DocumentWindow help.
| DialogWindow::DialogWindow | ( | const String & | name, |
| const Colour & | backgroundColour, | ||
| bool | escapeKeyTriggersCloseButton, | ||
| bool | addToDesktop = true |
||
| ) |
Creates a DialogWindow.
| name | the name to give the component - this is also the title shown at the top of the window. To change this later, use setName() |
| backgroundColour | the colour to use for filling the window's background. |
| escapeKeyTriggersCloseButton | if true, then pressing the escape key will cause the close button to be triggered |
| addToDesktop | if true, the window will be automatically added to the desktop; if false, you can use it as a child component |
Destructor.
If a content component has been set with setContentOwned(), it will be deleted.
| static void DialogWindow::showDialog | ( | const String & | dialogTitle, |
| Component * | contentComponent, | ||
| Component * | componentToCentreAround, | ||
| const Colour & | backgroundColour, | ||
| bool | escapeKeyTriggersCloseButton, | ||
| bool | shouldBeResizable = false, |
||
| bool | useBottomRightCornerResizer = false |
||
| ) | [static] |
Easy way of quickly showing a dialog box containing a given component.
This will open and display a DialogWindow containing a given component, making it modal, but returning immediately to allow the dialog to finish in its own time. If you want to block and run a modal loop until the dialog is dismissed, use showModalDialog() instead.
To close the dialog programatically, you should call exitModalState (returnValue) on the DialogWindow that is created. To find a pointer to this window from your contentComponent, you can do something like this:
Dialogwindow* dw = contentComponent->findParentComponentOfClass<DialogWindow>(); if (dw != nullptr) dw->exitModalState (1234);
| dialogTitle | the dialog box's title |
| contentComponent | the content component for the dialog box. Make sure that this has been set to the size you want it to be before calling this method. The component won't be deleted by this call, so you can re-use it or delete it afterwards |
| componentToCentreAround | if this is non-zero, it indicates a component that you'd like to show this dialog box in front of. See the DocumentWindow::centreAroundComponent() method for more info on this parameter |
| backgroundColour | a colour to use for the dialog box's background colour |
| escapeKeyTriggersCloseButton | if true, then pressing the escape key will cause the close button to be triggered |
| shouldBeResizable | if true, the dialog window has either a resizable border, or a corner resizer |
| useBottomRightCornerResizer | if shouldBeResizable is true, this indicates whether to use a border or corner resizer component. See ResizableWindow::setResizable() |
| static int DialogWindow::showModalDialog | ( | const String & | dialogTitle, |
| Component * | contentComponent, | ||
| Component * | componentToCentreAround, | ||
| const Colour & | backgroundColour, | ||
| bool | escapeKeyTriggersCloseButton, | ||
| bool | shouldBeResizable = false, |
||
| bool | useBottomRightCornerResizer = false |
||
| ) | [static] |
Easy way of quickly showing a dialog box containing a given component.
This will open and display a DialogWindow containing a given component, returning when the user clicks its close button.
It returns the value that was returned by the dialog box's runModalLoop() call.
To close the dialog programatically, you should call exitModalState (returnValue) on the DialogWindow that is created. To find a pointer to this window from your contentComponent, you can do something like this:
Dialogwindow* dw = contentComponent->findParentComponentOfClass<DialogWindow>(); if (dw != nullptr) dw->exitModalState (1234);
| dialogTitle | the dialog box's title |
| contentComponent | the content component for the dialog box. Make sure that this has been set to the size you want it to be before calling this method. The component won't be deleted by this call, so you can re-use it or delete it afterwards |
| componentToCentreAround | if this is non-zero, it indicates a component that you'd like to show this dialog box in front of. See the DocumentWindow::centreAroundComponent() method for more info on this parameter |
| backgroundColour | a colour to use for the dialog box's background colour |
| escapeKeyTriggersCloseButton | if true, then pressing the escape key will cause the close button to be triggered |
| shouldBeResizable | if true, the dialog window has either a resizable border, or a corner resizer |
| useBottomRightCornerResizer | if shouldBeResizable is true, this indicates whether to use a border or corner resizer component. See ResizableWindow::setResizable() |
Referenced by StandaloneFilterWindow::showAudioSettingsDialog().
| void DialogWindow::resized | ( | ) | [protected, virtual] |
Reimplemented from ResizableWindow.