openshot-audio  0.1.2
Classes | Public Member Functions | List of all members
juce::FilenameComponent Class Reference

#include <juce_gui_basics.h>

Inheritance diagram for juce::FilenameComponent:
juce::Component juce::SettableTooltipClient juce::FileDragAndDropTarget juce::AsyncUpdater juce::Button::Listener juce::ComboBox::Listener juce::MouseListener juce::TooltipClient

Classes

struct  LookAndFeelMethods
 

Public Member Functions

 FilenameComponent (const String &name, const File &currentFile, bool canEditFilename, bool isDirectory, bool isForSaving, const String &fileBrowserWildcard, const String &enforcedSuffix, const String &textWhenNothingSelected)
 
 ~FilenameComponent ()
 
File getCurrentFile () const
 
String getCurrentFileText () const
 
void setCurrentFile (File newFile, bool addToRecentlyUsedList, NotificationType notification=sendNotificationAsync)
 
void setFilenameIsEditable (bool shouldBeEditable)
 
void setDefaultBrowseTarget (const File &newDefaultDirectory)
 
virtual File getLocationToBrowse ()
 
StringArray getRecentlyUsedFilenames () const
 
void setRecentlyUsedFilenames (const StringArray &filenames)
 
void addRecentlyUsedFile (const File &file)
 
void setMaxNumberOfRecentFiles (int newMaximum)
 
void setBrowseButtonText (const String &browseButtonText)
 
void addListener (FilenameComponentListener *listener)
 
void removeListener (FilenameComponentListener *listener)
 
void setTooltip (const String &newTooltip) override
 
void paintOverChildren (Graphics &) override
 
void resized () override
 
void lookAndFeelChanged () override
 
bool isInterestedInFileDrag (const StringArray &) override
 
void filesDropped (const StringArray &, int, int) override
 
void fileDragEnter (const StringArray &, int, int) override
 
void fileDragExit (const StringArray &) override
 
KeyboardFocusTraversercreateFocusTraverser () override
 
- Public Member Functions inherited from juce::Component
 Component () noexcept
 
virtual ~Component ()
 
 Component (const String &componentName) noexcept
 
const StringgetName () const noexcept
 
virtual void setName (const String &newName)
 
const StringgetComponentID () 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
 
ComponentPeergetPeer () 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< intgetPosition () const noexcept
 
int getBottom () const noexcept
 
const Rectangle< int > & getBounds () const noexcept
 
Rectangle< intgetLocalBounds () const noexcept
 
Rectangle< intgetBoundsInParent () const noexcept
 
int getScreenX () const
 
int getScreenY () const
 
Point< intgetScreenPosition () const
 
Rectangle< intgetScreenBounds () const
 
Point< intgetLocalPoint (const Component *sourceComponent, Point< int > pointRelativeToSourceComponent) const
 
Point< float > getLocalPoint (const Component *sourceComponent, Point< float > pointRelativeToSourceComponent) const
 
Rectangle< intgetLocalArea (const Component *sourceComponent, const Rectangle< int > &areaRelativeToSourceComponent) const
 
Point< intlocalPointToGlobal (Point< int > localPoint) const
 
Point< float > localPointToGlobal (Point< float > localPoint) const
 
Rectangle< intlocalAreaToGlobal (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< intgetParentMonitorArea () const
 
int getNumChildComponents () const noexcept
 
ComponentgetChildComponent (int index) const noexcept
 
int getIndexOfChildComponent (const Component *child) const noexcept
 
ComponentfindChildWithID (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)
 
ComponentremoveChildComponent (int childIndexToRemove)
 
void removeAllChildren ()
 
void deleteAllChildren ()
 
ComponentgetParentComponent () const noexcept
 
template<class TargetClass >
TargetClass * findParentComponentOfClass () const
 
ComponentgetTopLevelComponent () 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)
 
ComponentgetComponentAt (int x, int y)
 
ComponentgetComponentAt (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)
 
ImageEffectFiltergetComponentEffect () const noexcept
 
LookAndFeelgetLookAndFeel () const noexcept
 
void setLookAndFeel (LookAndFeel *newLookAndFeel)
 
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)
 
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 paint (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< intgetMouseXYRelative () 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)
 
int runModalLoop ()
 
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 ()
 
NamedValueSetgetProperties () noexcept
 
const NamedValueSetgetProperties () 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 MarkerListgetMarkers (bool xAxis)
 
void * getWindowHandle () const
 
PositionergetPositioner () const noexcept
 
void setPositioner (Positioner *newPositioner)
 
void setCachedComponentImage (CachedComponentImage *newCachedImage)
 
CachedComponentImagegetCachedComponentImage () 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)
 
- Public Member Functions inherited from juce::MouseListener
virtual ~MouseListener ()
 
- Public Member Functions inherited from juce::SettableTooltipClient
virtual ~SettableTooltipClient ()
 
virtual String getTooltip ()
 
- Public Member Functions inherited from juce::TooltipClient
virtual ~TooltipClient ()
 
- Public Member Functions inherited from juce::FileDragAndDropTarget
virtual ~FileDragAndDropTarget ()
 
virtual void fileDragMove (const StringArray &files, int x, int y)
 

Additional Inherited Members

- Public Types inherited from juce::Component
enum  FocusChangeType { focusChangedByMouseClick, focusChangedByTabKey, focusChangedDirectly }
 
- Static Public Member Functions inherited from juce::Component
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
 
- Protected Member Functions inherited from juce::Component
virtual ComponentPeercreateNewPeer (int styleFlags, void *nativeWindowToAttachTo)
 
- Protected Member Functions inherited from juce::SettableTooltipClient
 SettableTooltipClient ()
 

Detailed Description

Shows a filename as an editable text box, with a 'browse' button and a drop-down list for recently selected files.

A handy component for dialogue boxes where you want the user to be able to select a file or directory.

Attach an FilenameComponentListener using the addListener() method, and it will get called each time the user changes the filename, either by browsing for a file and clicking 'ok', or by typing a new filename into the box and pressing return.

See also
FileChooser, ComboBox

Constructor & Destructor Documentation

FilenameComponent::FilenameComponent ( const String name,
const File currentFile,
bool  canEditFilename,
bool  isDirectory,
bool  isForSaving,
const String fileBrowserWildcard,
const String enforcedSuffix,
const String textWhenNothingSelected 
)

Creates a FilenameComponent.

Parameters
namethe name for this component.
currentFilethe file to initially show in the box
canEditFilenameif true, the user can manually edit the filename; if false, they can only change it by browsing for a new file
isDirectoryif true, the file will be treated as a directory, and an appropriate directory browser used
isForSavingif true, the file browser will allow non-existent files to be picked, as the file is assumed to be used for saving rather than loading
fileBrowserWildcarda wildcard pattern to use in the file browser - e.g. "*.txt;*.foo". If an empty string is passed in, then the pattern is assumed to be "*"
enforcedSuffixif this is non-empty, it is treated as a suffix that will be added to any filenames that are entered or chosen
textWhenNothingSelectedthe message to display in the box before any filename is entered. (This will only appear if the initial file isn't valid)
FilenameComponent::~FilenameComponent ( )

Destructor.

Member Function Documentation

void FilenameComponent::addListener ( FilenameComponentListener listener)

Adds a listener that will be called when the selected file is changed.

void FilenameComponent::addRecentlyUsedFile ( const File file)

Adds an entry to the recently-used files dropdown list.

If the file is already in the list, it will be moved to the top. A limit is also placed on the number of items that are kept in the list.

See also
getRecentlyUsedFilenames, setRecentlyUsedFilenames, setMaxNumberOfRecentFiles
KeyboardFocusTraverser * FilenameComponent::createFocusTraverser ( )
overridevirtual

Creates a KeyboardFocusTraverser object to use to determine the logic by which focus should be passed from this component.

The default implementation of this method will return a default KeyboardFocusTraverser if this component is a focus container (as determined by the setFocusContainer() method). If the component isn't a focus container, then it will recursively ask its parents for a KeyboardFocusTraverser.

If you overrride this to return a custom KeyboardFocusTraverser, then this component and all its sub-components will use the new object to make their focusing decisions.

The method should return a new object, which the caller is required to delete when no longer needed.

Reimplemented from juce::Component.

void FilenameComponent::fileDragEnter ( const StringArray files,
int  x,
int  y 
)
overridevirtual

Callback to indicate that some files are being dragged over this component.

This gets called when the user moves the mouse into this component while dragging.

Use this callback as a trigger to make your component repaint itself to give the user feedback about whether the files can be dropped here or not.

Parameters
filesthe set of (absolute) pathnames of the files that the user is dragging
xthe mouse x position, relative to this component
ythe mouse y position, relative to this component

Reimplemented from juce::FileDragAndDropTarget.

void FilenameComponent::fileDragExit ( const StringArray files)
overridevirtual

Callback to indicate that the mouse has moved away from this component.

This gets called when the user moves the mouse out of this component while dragging the files.

If you've used fileDragEnter() to repaint your component and give feedback, use this as a signal to repaint it in its normal state.

Parameters
filesthe set of (absolute) pathnames of the files that the user is dragging

Reimplemented from juce::FileDragAndDropTarget.

void FilenameComponent::filesDropped ( const StringArray files,
int  x,
int  y 
)
overridevirtual

Callback to indicate that the user has dropped the files onto this component.

When the user drops the files, this get called, and you can use the files in whatever way is appropriate.

Note that after this is called, the fileDragExit method may not be called, so you should clean up in here if there's anything you need to do when the drag finishes.

Parameters
filesthe set of (absolute) pathnames of the files that the user is dragging
xthe mouse x position, relative to this component
ythe mouse y position, relative to this component

Implements juce::FileDragAndDropTarget.

File FilenameComponent::getCurrentFile ( ) const

Returns the currently displayed filename.

String FilenameComponent::getCurrentFileText ( ) const

Returns the raw text that the user has entered.

File FilenameComponent::getLocationToBrowse ( )
virtual

This can be overridden to return a custom location that you want the dialog box to show when the browse button is pushed. The default implementation of this method will return either the current file (if one has been chosen) or the location that was set by setDefaultBrowseTarget().

StringArray FilenameComponent::getRecentlyUsedFilenames ( ) const

Returns all the entries on the recent files list.

This can be used in conjunction with setRecentlyUsedFilenames() for saving the state of this list.

See also
setRecentlyUsedFilenames
bool FilenameComponent::isInterestedInFileDrag ( const StringArray files)
overridevirtual

Callback to check whether this target is interested in the set of files being offered.

Note that this will be called repeatedly when the user is dragging the mouse around over your component, so don't do anything time-consuming in here, like opening the files to have a look inside them!

Parameters
filesthe set of (absolute) pathnames of the files that the user is dragging
Returns
true if this component wants to receive the other callbacks regarging this type of object; if it returns false, no other callbacks will be made.

Implements juce::FileDragAndDropTarget.

void FilenameComponent::lookAndFeelChanged ( )
overridevirtual

Called to let the component react to a change in the look-and-feel setting.

When the look-and-feel is changed for a component, this will be called in all its child components, recursively.

It can also be triggered manually by the sendLookAndFeelChange() method, in case an application uses a LookAndFeel class that might have changed internally.

See also
sendLookAndFeelChange, getLookAndFeel

Reimplemented from juce::Component.

void FilenameComponent::paintOverChildren ( Graphics g)
overridevirtual

Components can override this method to draw over the top of their children.

For most drawing operations, it's better to use the normal paint() method, but if you need to overlay something on top of the children, this can be used.

See also
paint, Graphics

Reimplemented from juce::Component.

void FilenameComponent::removeListener ( FilenameComponentListener listener)

Removes a previously-registered listener.

void FilenameComponent::resized ( )
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.

See also
moved, setSize

Reimplemented from juce::Component.

void FilenameComponent::setBrowseButtonText ( const String browseButtonText)

Changes the text shown on the 'browse' button.

By default this button just says "..." but you can change it. The button itself can be changed using the look-and-feel classes, so it might not actually have any text on it.

void FilenameComponent::setCurrentFile ( File  newFile,
bool  addToRecentlyUsedList,
NotificationType  notification = sendNotificationAsync 
)

Changes the current filename.

Parameters
newFilethe new filename to use
addToRecentlyUsedListif true, the filename will also be added to the drop-down list of recent files.
notificationwhether to send a notification of the change to listeners
void FilenameComponent::setDefaultBrowseTarget ( const File newDefaultDirectory)

Sets a file or directory to be the default starting point for the browser to show.

This is only used if the current file hasn't been set.

void FilenameComponent::setFilenameIsEditable ( bool  shouldBeEditable)

Changes whether the use can type into the filename box.

void FilenameComponent::setMaxNumberOfRecentFiles ( int  newMaximum)

Changes the limit for the number of files that will be stored in the recent-file list.

void FilenameComponent::setRecentlyUsedFilenames ( const StringArray filenames)

Sets all the entries on the recent files list.

This can be used in conjunction with getRecentlyUsedFilenames() for saving the state of this list.

See also
getRecentlyUsedFilenames, addRecentlyUsedFile
void FilenameComponent::setTooltip ( const String newTooltip)
overridevirtual

Gives the component a tooltip.

Reimplemented from juce::SettableTooltipClient.


The documentation for this class was generated from the following files: