Public Types | Public Member Functions

FileSearchPathListComponent Class Reference

Shows a set of file paths in a list, allowing them to be added, removed or re-ordered. More...

Inherits Component, SettableTooltipClient, FileDragAndDropTarget, and ListBoxModel.

List of all members.

Public Types

enum  ColourIds { backgroundColourId = 0x1004100 }
 

A set of colour IDs to use to change the colour of various aspects of the label.

More...

Public Member Functions

 FileSearchPathListComponent ()
 Creates an empty FileSearchPathListComponent.
 ~FileSearchPathListComponent ()
 Destructor.
const FileSearchPathgetPath () const noexcept
 Returns the path as it is currently shown.
void setPath (const FileSearchPath &newPath)
 Changes the current path.
void setDefaultBrowseTarget (const File &newDefaultDirectory)
 Sets a file or directory to be the default starting point for the browser to show.
int getNumRows ()
 This has to return the number of items in the list.
void paintListBoxItem (int rowNumber, Graphics &g, int width, int height, bool rowIsSelected)
 This method must be implemented to draw a row of the list.
void deleteKeyPressed (int lastRowSelected)
 Override this to be informed when the delete key is pressed.
void returnKeyPressed (int lastRowSelected)
 Override this to be informed when the return key is pressed.
void listBoxItemDoubleClicked (int row, const MouseEvent &)
 This can be overridden to react to the user double-clicking on a row.
void selectedRowsChanged (int lastRowSelected)
 Override this to be informed when rows are selected or deselected.
void resized ()
 Called when this component's size has been changed.
void paint (Graphics &g)
 Components can override this method to draw their content.
bool isInterestedInFileDrag (const StringArray &files)
 Callback to check whether this target is interested in the set of files being offered.
void filesDropped (const StringArray &files, int, int)
 Callback to indicate that the user has dropped the files onto this component.
void buttonClicked (Button *button)

Detailed Description

Shows a set of file paths in a list, allowing them to be added, removed or re-ordered.

See also:
FileSearchPath

Member Enumeration Documentation

A set of colour IDs to use to change the colour of various aspects of the label.

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:
backgroundColourId 

The background colour to fill the component with.

Make this transparent if you don't want the background to be filled.


Constructor & Destructor Documentation

FileSearchPathListComponent::FileSearchPathListComponent (  )

Creates an empty FileSearchPathListComponent.

FileSearchPathListComponent::~FileSearchPathListComponent (  )

Destructor.


Member Function Documentation

const FileSearchPath& FileSearchPathListComponent::getPath (  ) const

Returns the path as it is currently shown.

void FileSearchPathListComponent::setPath ( const FileSearchPath newPath )

Changes the current path.

void FileSearchPathListComponent::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.

int FileSearchPathListComponent::getNumRows (  ) [virtual]

This has to return the number of items in the list.

See also:
ListBox::getNumRows()

Implements ListBoxModel.

void FileSearchPathListComponent::paintListBoxItem ( int  rowNumber,
Graphics g,
int  width,
int  height,
bool  rowIsSelected 
) [virtual]

This method must be implemented to draw a row of the list.

Implements ListBoxModel.

void FileSearchPathListComponent::deleteKeyPressed ( int  lastRowSelected ) [virtual]

Override this to be informed when the delete key is pressed.

If no rows are selected when they press the key, this won't be called.

Parameters:
lastRowSelectedthe last row that had been selected when they pressed the key - if there are multiple selections, this might not be very useful

Reimplemented from ListBoxModel.

void FileSearchPathListComponent::returnKeyPressed ( int  lastRowSelected ) [virtual]

Override this to be informed when the return key is pressed.

If no rows are selected when they press the key, this won't be called.

Parameters:
lastRowSelectedthe last row that had been selected when they pressed the key - if there are multiple selections, this might not be very useful

Reimplemented from ListBoxModel.

void FileSearchPathListComponent::listBoxItemDoubleClicked ( int  row,
const MouseEvent e 
) [virtual]

This can be overridden to react to the user double-clicking on a row.

See also:
listBoxItemClicked

Reimplemented from ListBoxModel.

void FileSearchPathListComponent::selectedRowsChanged ( int  lastRowSelected ) [virtual]

Override this to be informed when rows are selected or deselected.

This will be called whenever a row is selected or deselected. If a range of rows is selected all at once, this will just be called once for that event.

Parameters:
lastRowSelectedthe last row that the user selected. If no rows are currently selected, this may be -1.

Reimplemented from ListBoxModel.

void FileSearchPathListComponent::resized (  ) [virtual]

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 Component.

void FileSearchPathListComponent::paint ( Graphics g ) [virtual]

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().

Parameters:
gthe graphics context that must be used to do the drawing operations.
See also:
repaint, paintOverChildren, Graphics

Reimplemented from Component.

bool FileSearchPathListComponent::isInterestedInFileDrag ( const StringArray files ) [virtual]

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 FileDragAndDropTarget.

void FileSearchPathListComponent::filesDropped ( const StringArray files,
int  x,
int  y 
) [virtual]

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 FileDragAndDropTarget.

void FileSearchPathListComponent::buttonClicked ( Button button )

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