openshot-audio
0.1.2
|
#include <juce_MultiDocumentPanel.h>
Classes | |
class | TabbedComponentInternal |
Public Types | |
enum | LayoutMode { FloatingWindows, MaximisedWindowsWithTabs } |
![]() | |
enum | FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly } |
Public Member Functions | |
MultiDocumentPanel () | |
~MultiDocumentPanel () | |
bool | closeAllDocuments (bool checkItsOkToCloseFirst) |
bool | addDocument (Component *component, Colour backgroundColour, bool deleteWhenRemoved) |
bool | closeDocument (Component *component, bool checkItsOkToCloseFirst) |
int | getNumDocuments () const noexcept |
Component * | getDocument (int index) const noexcept |
Component * | getActiveDocument () const noexcept |
void | setActiveDocument (Component *component) |
virtual void | activeDocumentChanged () |
void | setMaximumNumDocuments (int maximumNumDocuments) |
void | useFullscreenWhenOneDocument (bool shouldUseTabs) |
bool | isFullscreenWhenOneDocument () const noexcept |
void | setLayoutMode (LayoutMode newLayoutMode) |
LayoutMode | getLayoutMode () const noexcept |
void | setBackgroundColour (Colour newBackgroundColour) |
Colour | getBackgroundColour () const noexcept |
TabbedComponent * | getCurrentTabbedComponent () const noexcept |
virtual bool | tryToCloseDocument (Component *component)=0 |
virtual MultiDocumentPanelWindow * | createNewDocumentWindow () |
void | paint (Graphics &) override |
void | resized () override |
void | componentNameChanged (Component &) override |
![]() | |
Component () noexcept | |
virtual | ~Component () |
Component (const String &componentName) noexcept | |
const String & | getName () const noexcept |
virtual void | setName (const String &newName) |
const String & | getComponentID () const noexcept |
void | setComponentID (const String &newID) |
virtual void | setVisible (bool shouldBeVisible) |
bool | isVisible () const noexcept |
virtual void | visibilityChanged () |
bool | isShowing () const |
virtual void | addToDesktop (int windowStyleFlags, void *nativeWindowToAttachTo=nullptr) |
void | removeFromDesktop () |
bool | isOnDesktop () const noexcept |
ComponentPeer * | getPeer () const |
virtual void | userTriedToCloseWindow () |
virtual void | minimisationStateChanged (bool isNowMinimised) |
virtual float | getDesktopScaleFactor () const |
void | toFront (bool shouldAlsoGainFocus) |
void | toBack () |
void | toBehind (Component *other) |
void | setAlwaysOnTop (bool shouldStayOnTop) |
bool | isAlwaysOnTop () const noexcept |
int | getX () const noexcept |
int | getY () const noexcept |
int | getWidth () const noexcept |
int | getHeight () const noexcept |
int | getRight () const noexcept |
Point< int > | getPosition () const noexcept |
int | getBottom () const noexcept |
const Rectangle< int > & | getBounds () const noexcept |
Rectangle< int > | getLocalBounds () const noexcept |
Rectangle< int > | getBoundsInParent () const noexcept |
int | getScreenX () const |
int | getScreenY () const |
Point< int > | getScreenPosition () const |
Rectangle< int > | getScreenBounds () const |
Point< int > | getLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const |
Point< float > | getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const |
Rectangle< int > | getLocalArea (const Component *sourceComponent, const Rectangle< int > &areaRelativeToSourceComponent) const |
Point< int > | localPointToGlobal (Point< int > localPoint) const |
Point< float > | localPointToGlobal (Point< float > localPoint) const |
Rectangle< int > | localAreaToGlobal (const Rectangle< int > &localArea) const |
void | setTopLeftPosition (int x, int y) |
void | setTopLeftPosition (Point< int > newTopLeftPosition) |
void | setTopRightPosition (int x, int y) |
void | setSize (int newWidth, int newHeight) |
void | setBounds (int x, int y, int width, int height) |
void | setBounds (const Rectangle< int > &newBounds) |
void | setBounds (const RelativeRectangle &newBounds) |
void | setBounds (const String &newBoundsExpression) |
void | setBoundsRelative (float proportionalX, float proportionalY, float proportionalWidth, float proportionalHeight) |
void | setBoundsInset (const BorderSize< int > &borders) |
void | setBoundsToFit (int x, int y, int width, int height, Justification justification, bool onlyReduceInSize) |
void | setCentrePosition (int x, int y) |
void | setCentreRelative (float x, float y) |
void | centreWithSize (int width, int height) |
void | setTransform (const AffineTransform &transform) |
AffineTransform | getTransform () const |
bool | isTransformed () const noexcept |
int | proportionOfWidth (float proportion) const noexcept |
int | proportionOfHeight (float proportion) const noexcept |
int | getParentWidth () const noexcept |
int | getParentHeight () const noexcept |
Rectangle< int > | getParentMonitorArea () const |
int | getNumChildComponents () const noexcept |
Component * | getChildComponent (int index) const noexcept |
int | getIndexOfChildComponent (const Component *child) const noexcept |
Component * | findChildWithID (StringRef componentID) const noexcept |
void | addChildComponent (Component *child, int zOrder=-1) |
void | addChildComponent (Component &child, int zOrder=-1) |
void | addAndMakeVisible (Component *child, int zOrder=-1) |
void | addAndMakeVisible (Component &child, int zOrder=-1) |
void | addChildAndSetID (Component *child, const String &componentID) |
void | removeChildComponent (Component *childToRemove) |
Component * | removeChildComponent (int childIndexToRemove) |
void | removeAllChildren () |
void | deleteAllChildren () |
Component * | getParentComponent () const noexcept |
template<class TargetClass > | |
TargetClass * | findParentComponentOfClass () const |
Component * | getTopLevelComponent () const noexcept |
bool | isParentOf (const Component *possibleChild) const noexcept |
virtual void | parentHierarchyChanged () |
virtual void | childrenChanged () |
virtual bool | hitTest (int x, int y) |
void | setInterceptsMouseClicks (bool allowClicksOnThisComponent, bool allowClicksOnChildComponents) noexcept |
void | getInterceptsMouseClicks (bool &allowsClicksOnThisComponent, bool &allowsClicksOnChildComponents) const noexcept |
bool | contains (Point< int > localPoint) |
bool | reallyContains (Point< int > localPoint, bool returnTrueIfWithinAChild) |
Component * | getComponentAt (int x, int y) |
Component * | getComponentAt (Point< int > position) |
void | repaint () |
void | repaint (int x, int y, int width, int height) |
void | repaint (const Rectangle< int > &area) |
void | setBufferedToImage (bool shouldBeBuffered) |
Image | createComponentSnapshot (const Rectangle< int > &areaToGrab, bool clipImageToComponentBounds=true, float scaleFactor=1.0f) |
void | paintEntireComponent (Graphics &context, bool ignoreAlphaLevel) |
void | setPaintingIsUnclipped (bool shouldPaintWithoutClipping) noexcept |
void | setComponentEffect (ImageEffectFilter *newEffect) |
ImageEffectFilter * | getComponentEffect () const noexcept |
LookAndFeel & | getLookAndFeel () const noexcept |
void | setLookAndFeel (LookAndFeel *newLookAndFeel) |
virtual void | lookAndFeelChanged () |
void | sendLookAndFeelChange () |
void | setOpaque (bool shouldBeOpaque) |
bool | isOpaque () const noexcept |
void | setBroughtToFrontOnMouseClick (bool shouldBeBroughtToFront) noexcept |
bool | isBroughtToFrontOnMouseClick () const noexcept |
void | setWantsKeyboardFocus (bool wantsFocus) noexcept |
bool | getWantsKeyboardFocus () const noexcept |
void | setMouseClickGrabsKeyboardFocus (bool shouldGrabFocus) |
bool | getMouseClickGrabsKeyboardFocus () const noexcept |
void | grabKeyboardFocus () |
bool | hasKeyboardFocus (bool trueIfChildIsFocused) const |
void | moveKeyboardFocusToSibling (bool moveToNext) |
virtual KeyboardFocusTraverser * | createFocusTraverser () |
int | getExplicitFocusOrder () const |
void | setExplicitFocusOrder (int newFocusOrderIndex) |
void | setFocusContainer (bool shouldBeFocusContainer) noexcept |
bool | isFocusContainer () const noexcept |
bool | isEnabled () const noexcept |
void | setEnabled (bool shouldBeEnabled) |
virtual void | enablementChanged () |
void | setAlpha (float newAlpha) |
float | getAlpha () const |
void | setMouseCursor (const MouseCursor &cursorType) |
virtual MouseCursor | getMouseCursor () |
void | updateMouseCursor () const |
virtual void | paintOverChildren (Graphics &g) |
virtual void | mouseMove (const MouseEvent &event) override |
virtual void | mouseEnter (const MouseEvent &event) override |
virtual void | mouseExit (const MouseEvent &event) override |
virtual void | mouseDown (const MouseEvent &event) override |
virtual void | mouseDrag (const MouseEvent &event) override |
virtual void | mouseUp (const MouseEvent &event) override |
virtual void | mouseDoubleClick (const MouseEvent &event) override |
virtual void | mouseWheelMove (const MouseEvent &event, const MouseWheelDetails &wheel) override |
virtual void | mouseMagnify (const MouseEvent &event, float scaleFactor) |
void | setRepaintsOnMouseActivity (bool shouldRepaint) noexcept |
void | addMouseListener (MouseListener *newListener, bool wantsEventsForAllNestedChildComponents) |
void | removeMouseListener (MouseListener *listenerToRemove) |
void | addKeyListener (KeyListener *newListener) |
void | removeKeyListener (KeyListener *listenerToRemove) |
virtual bool | keyPressed (const KeyPress &key) |
virtual bool | keyStateChanged (bool isKeyDown) |
virtual void | modifierKeysChanged (const ModifierKeys &modifiers) |
virtual void | focusGained (FocusChangeType cause) |
virtual void | focusLost (FocusChangeType cause) |
virtual void | focusOfChildComponentChanged (FocusChangeType cause) |
bool | isMouseOver (bool includeChildren=false) const |
bool | isMouseButtonDown () const |
bool | isMouseOverOrDragging () const |
Point< int > | getMouseXYRelative () const |
virtual void | moved () |
virtual void | childBoundsChanged (Component *child) |
virtual void | parentSizeChanged () |
virtual void | broughtToFront () |
void | addComponentListener (ComponentListener *newListener) |
void | removeComponentListener (ComponentListener *listenerToRemove) |
void | postCommandMessage (int commandId) |
virtual void | handleCommandMessage (int commandId) |
void | enterModalState (bool takeKeyboardFocus=true, ModalComponentManager::Callback *callback=nullptr, bool deleteWhenDismissed=false) |
void | exitModalState (int returnValue) |
bool | isCurrentlyModal () const noexcept |
bool | isCurrentlyBlockedByAnotherModalComponent () const |
virtual bool | canModalEventBeSentToComponent (const Component *targetComponent) |
virtual void | inputAttemptWhenModal () |
NamedValueSet & | getProperties () noexcept |
const NamedValueSet & | getProperties () const noexcept |
Colour | findColour (int colourId, bool inheritFromParent=false) const |
void | setColour (int colourId, Colour newColour) |
void | removeColour (int colourId) |
bool | isColourSpecified (int colourId) const |
void | copyAllExplicitColoursTo (Component &target) const |
virtual void | colourChanged () |
virtual MarkerList * | getMarkers (bool xAxis) |
void * | getWindowHandle () const |
Positioner * | getPositioner () const noexcept |
void | setPositioner (Positioner *newPositioner) |
void | setCachedComponentImage (CachedComponentImage *newCachedImage) |
CachedComponentImage * | getCachedComponentImage () const noexcept |
JUCE_DEPRECATED (Point< int > relativePositionToGlobal(Point< int >) const) | |
JUCE_DEPRECATED (Point< int > globalPositionToRelative(Point< int >) const) | |
JUCE_DEPRECATED (Point< int > relativePositionToOtherComponent(const Component *, Point< int >) const) | |
![]() | |
virtual | ~MouseListener () |
Friends | |
class | MultiDocumentPanelWindow |
class | TabbedComponentInternal |
Additional Inherited Members | |
![]() | |
static Component *JUCE_CALLTYPE | getCurrentlyFocusedComponent () noexcept |
static void JUCE_CALLTYPE | unfocusAllComponents () |
static void JUCE_CALLTYPE | beginDragAutoRepeat (int millisecondsBetweenCallbacks) |
static bool JUCE_CALLTYPE | isMouseButtonDownAnywhere () noexcept |
static int JUCE_CALLTYPE | getNumCurrentlyModalComponents () noexcept |
static Component *JUCE_CALLTYPE | getCurrentlyModalComponent (int index=0) noexcept |
![]() | |
virtual ComponentPeer * | createNewPeer (int styleFlags, void *nativeWindowToAttachTo) |
A component that contains a set of other components either in floating windows or tabs.
This acts as a panel that can be used to hold a set of open document windows, with different layout modes.
Use addDocument() and closeDocument() to add or remove components from the panel - never use any of the Component methods to access the panel's child components directly, as these are managed internally.
The different layout modes available.
Enumerator | |
---|---|
FloatingWindows | In this mode, there are overlapping DocumentWindow components for each document. |
MaximisedWindowsWithTabs | In this mode, a TabbedComponent is used to show one document at a time. |
MultiDocumentPanel::MultiDocumentPanel | ( | ) |
Creates an empty panel.
Use addDocument() and closeDocument() to add or remove components from the panel - never use any of the Component methods to access the panel's child components directly, as these are managed internally.
MultiDocumentPanel::~MultiDocumentPanel | ( | ) |
Destructor.
When deleted, this will call closeAllDocuments (false) to make sure all its components are deleted. If you need to make sure all documents are saved before closing, then you should call closeAllDocuments (true) and check that it returns true before deleting the panel.
|
virtual |
Callback which gets invoked when the currently-active document changes.
bool MultiDocumentPanel::addDocument | ( | Component * | component, |
Colour | backgroundColour, | ||
bool | deleteWhenRemoved | ||
) |
Adds a document component to the panel.
If the number of documents would exceed the limit set by setMaximumNumDocuments() then this will fail and return false. (If it does fail, the component passed-in will not be deleted, even if deleteWhenRemoved was set to true).
The MultiDocumentPanel will deal with creating a window border to go around your component, so just pass in the bare content component here, no need to give it a ResizableWindow or DocumentWindow.
component | the component to add |
backgroundColour | the background colour to use to fill the component's window or tab |
deleteWhenRemoved | if true, then when the component is removed by closeDocument() or closeAllDocuments(), then it will be deleted. If false, then the caller must handle the component's deletion |
bool MultiDocumentPanel::closeAllDocuments | ( | bool | checkItsOkToCloseFirst | ) |
Tries to close all the documents.
If checkItsOkToCloseFirst is true, then the tryToCloseDocument() method will be called for each open document, and any of these calls fails, this method will stop and return false, leaving some documents still open.
If checkItsOkToCloseFirst is false, then all documents will be closed unconditionally.
bool MultiDocumentPanel::closeDocument | ( | Component * | component, |
bool | checkItsOkToCloseFirst | ||
) |
Closes one of the documents.
If checkItsOkToCloseFirst is true, then the tryToCloseDocument() method will be called, and if it fails, this method will return false without closing the document.
If checkItsOkToCloseFirst is false, then the documents will be closed unconditionally.
The component will be deleted if the deleteWhenRemoved parameter was set to true when it was added with addDocument.
|
overridevirtual |
Called when the component's name is changed.
Reimplemented from ComponentListener.
|
virtual |
Creates a new window to be used for a document.
The default implementation of this just returns a basic MultiDocumentPanelWindow object, but you might want to override it to return a custom component.
|
noexcept |
Returns the document component that is currently focused or on top.
If currently using floating windows, then this will be the component in the currently active window, or the top component if none are active.
If it's currently in tabbed mode, then it'll return the component in the active tab.
|
inlinenoexcept |
Returns the current background colour.
|
inlinenoexcept |
If the panel is being used in tabbed mode, this returns the TabbedComponent that's involved.
|
noexcept |
Returns one of the open documents.
The order of the documents in this array may change when they are added, removed or moved around.
|
inlinenoexcept |
Returns the current layout mode.
|
noexcept |
Returns the number of open document windows.
|
noexcept |
Returns the result of the last time useFullscreenWhenOneDocument() was called.
|
overridevirtual |
Components can override this method to draw their content.
The paint() method gets called when a region of a component needs redrawing, either because the component's repaint() method has been called, or because something has happened on the screen that means a section of a window needs to be redrawn.
Any child components will draw themselves over whatever this method draws. If you need to paint over the top of your child components, you can also implement the paintOverChildren() method to do this.
If you want to cause a component to redraw itself, this is done asynchronously - calling the repaint() method marks a region of the component as "dirty", and the paint() method will automatically be called sometime later, by the message thread, to paint any bits that need refreshing. In Juce (and almost all modern UI frameworks), you never redraw something synchronously.
You should never need to call this method directly - to take a snapshot of the component you could use createComponentSnapshot() or paintEntireComponent().
g | the graphics context that must be used to do the drawing operations. |
Reimplemented from Component.
|
overridevirtual |
Called when this component's size has been changed.
A component can implement this method to do things such as laying out its child components when its width or height changes.
The method is called synchronously as a result of the setBounds or setSize methods, so repeatedly changing a components size will repeatedly call its resized method (unlike things like repainting, where multiple calls to repaint are coalesced together).
If the component is a top-level window on the desktop, its size could also be changed by operating-system factors beyond the application's control.
Reimplemented from Component.
void MultiDocumentPanel::setActiveDocument | ( | Component * | component | ) |
Makes one of the components active and brings it to the top.
void MultiDocumentPanel::setBackgroundColour | ( | Colour | newBackgroundColour | ) |
Sets the background colour for the whole panel.
Each document has its own background colour, but this is the one used to fill the areas behind them.
void MultiDocumentPanel::setLayoutMode | ( | LayoutMode | newLayoutMode | ) |
Changes the panel's mode.
void MultiDocumentPanel::setMaximumNumDocuments | ( | int | maximumNumDocuments | ) |
Sets a limit on how many windows can be open at once.
If this is zero or less there's no limit (the default). addDocument() will fail if this number is exceeded.
|
pure virtual |
A subclass must override this to say whether its currently ok for a document to be closed.
This method is called by closeDocument() and closeAllDocuments() to indicate that a document should be saved if possible, ready for it to be closed.
If this method returns true, then it means the document is ok and can be closed.
If it returns false, then it means that the closeDocument() method should stop and not close.
Normally, you'd use this method to ask the user if they want to save any changes, then return true if the save operation went ok. If the user cancelled the save operation you could return false here to abort the close operation.
If your component is based on the FileBasedDocument class, then you'd probably want to call FileBasedDocument::saveIfNeededAndUserAgrees() and return true if this returned FileBasedDocument::savedOk
void MultiDocumentPanel::useFullscreenWhenOneDocument | ( | bool | shouldUseTabs | ) |
Sets an option to make the document fullscreen if there's only one document open.
If set to true, then if there's only one document, it'll fill the whole of this component without tabs or a window border. If false, then tabs or a window will always be shown, even if there's only one document. If there's more than one document open, then this option makes no difference.
|
friend |
|
friend |