openshot-audio  0.1.2
Public Member Functions | Public Attributes | List of all members
juce::FileListTreeItem Class Reference
Inheritance diagram for juce::FileListTreeItem:
juce::TreeViewItem juce::TimeSliceClient juce::AsyncUpdater juce::ChangeListener

Public Member Functions

 FileListTreeItem (FileTreeComponent &treeComp, DirectoryContentsList *const parentContents, const int indexInContents, const File &f, TimeSliceThread &t)
 
 ~FileListTreeItem ()
 
bool mightContainSubItems () override
 
String getUniqueName () const override
 
int getItemHeight () const override
 
var getDragSourceDescription () override
 
void itemOpennessChanged (bool isNowOpen) override
 
void removeSubContentsList ()
 
void setSubContentsList (DirectoryContentsList *newList, const bool canDeleteList)
 
bool selectFile (const File &target)
 
void changeListenerCallback (ChangeBroadcaster *) override
 
void rebuildItemsFromContentList ()
 
void paintItem (Graphics &g, int width, int height) override
 
void itemClicked (const MouseEvent &e) override
 
void itemDoubleClicked (const MouseEvent &e) override
 
void itemSelectionChanged (bool) override
 
int useTimeSlice () override
 
void handleAsyncUpdate () override
 
- Public Member Functions inherited from juce::TreeViewItem
 TreeViewItem ()
 
virtual ~TreeViewItem ()
 
int getNumSubItems () const noexcept
 
TreeViewItemgetSubItem (int index) const noexcept
 
void clearSubItems ()
 
void addSubItem (TreeViewItem *newItem, int insertPosition=-1)
 
template<class ElementComparator >
void addSubItemSorted (ElementComparator &comparator, TreeViewItem *newItem)
 
void removeSubItem (int index, bool deleteItem=true)
 
template<class ElementComparator >
void sortSubItems (ElementComparator &comparator)
 
TreeViewgetOwnerView () const noexcept
 
TreeViewItemgetParentItem () const noexcept
 
bool isOpen () const noexcept
 
void setOpen (bool shouldBeOpen)
 
bool isSelected () const noexcept
 
void setSelected (bool shouldBeSelected, bool deselectOtherItemsFirst, NotificationType shouldNotify=sendNotification)
 
Rectangle< intgetItemPosition (bool relativeToTreeViewTopLeft) const noexcept
 
void treeHasChanged () const noexcept
 
void repaintItem () const
 
int getRowNumberInTree () const noexcept
 
bool areAllParentsOpen () const noexcept
 
void setLinesDrawnForSubItems (bool shouldDrawLines) noexcept
 
virtual int getItemWidth () const
 
virtual bool canBeSelected () const
 
virtual ComponentcreateItemComponent ()
 
virtual void paintOpenCloseButton (Graphics &, const Rectangle< float > &area, Colour backgroundColour, bool isMouseOver)
 
virtual void paintHorizontalConnectingLine (Graphics &, const Line< float > &line)
 
virtual void paintVerticalConnectingLine (Graphics &, const Line< float > &line)
 
virtual String getTooltip ()
 
virtual bool isInterestedInFileDrag (const StringArray &files)
 
virtual void filesDropped (const StringArray &files, int insertIndex)
 
virtual bool isInterestedInDragSource (const DragAndDropTarget::SourceDetails &dragSourceDetails)
 
virtual void itemDropped (const DragAndDropTarget::SourceDetails &dragSourceDetails, int insertIndex)
 
void setDrawsInLeftMargin (bool canDrawInLeftMargin) noexcept
 
void setDrawsInRightMargin (bool canDrawInRightMargin) noexcept
 
XmlElementgetOpennessState () const
 
void restoreOpennessState (const XmlElement &xml)
 
int getIndexInParent () const noexcept
 
bool isLastOfSiblings () const noexcept
 
String getItemIdentifierString () const
 

Public Attributes

const File file
 

Constructor & Destructor Documentation

juce::FileListTreeItem::FileListTreeItem ( FileTreeComponent treeComp,
DirectoryContentsList *const  parentContents,
const int  indexInContents,
const File f,
TimeSliceThread t 
)
inline
juce::FileListTreeItem::~FileListTreeItem ( )
inline

Member Function Documentation

void juce::FileListTreeItem::changeListenerCallback ( ChangeBroadcaster source)
inlineoverridevirtual

Your subclass should implement this method to receive the callback.

Parameters
sourcethe ChangeBroadcaster that triggered the callback.

Implements juce::ChangeListener.

var juce::FileListTreeItem::getDragSourceDescription ( )
inlineoverridevirtual

To allow items from your treeview to be dragged-and-dropped, implement this method.

If this returns a non-null variant then when the user drags an item, the treeview will try to find a DragAndDropContainer in its parent hierarchy, and will use it to trigger a drag-and-drop operation, using this string as the source description, with the treeview itself as the source component.

If you need more complex drag-and-drop behaviour, you can use custom components for the items, and use those to trigger the drag.

To accept drag-and-drop in your tree, see isInterestedInDragSource(), isInterestedInFileDrag(), etc.

See also
DragAndDropContainer::startDragging

Reimplemented from juce::TreeViewItem.

int juce::FileListTreeItem::getItemHeight ( ) const
inlineoverridevirtual

Must return the height required by this item.

This is the height in pixels that the item will take up. Items in the tree can be different heights, but if they change height, you should call treeHasChanged() to update the tree.

Reimplemented from juce::TreeViewItem.

String juce::FileListTreeItem::getUniqueName ( ) const
inlineoverridevirtual

Returns a string to uniquely identify this item.

If you're planning on using the TreeView::getOpennessState() method, then these strings will be used to identify which nodes are open. The string should be unique amongst the item's sibling items, but it's ok for there to be duplicates at other levels of the tree.

If you're not going to store the state, then it's ok not to bother implementing this method.

Reimplemented from juce::TreeViewItem.

void juce::FileListTreeItem::handleAsyncUpdate ( )
inlineoverridevirtual

Called back to do whatever your class needs to do.

This method is called by the message thread at the next convenient time after the triggerAsyncUpdate() method has been called.

Implements juce::AsyncUpdater.

void juce::FileListTreeItem::itemClicked ( const MouseEvent e)
inlineoverridevirtual

Called when the user clicks on this item.

If you're using createItemComponent() to create a custom component for the item, the mouse-clicks might not make it through to the treeview, but this is how you find out about clicks when just drawing each item individually.

The associated mouse-event details are passed in, so you can find out about which button, where it was, etc.

See also
itemDoubleClicked

Reimplemented from juce::TreeViewItem.

void juce::FileListTreeItem::itemDoubleClicked ( const MouseEvent e)
inlineoverridevirtual

Called when the user double-clicks on this item.

If you're using createItemComponent() to create a custom component for the item, the mouse-clicks might not make it through to the treeview, but this is how you find out about clicks when just drawing each item individually.

The associated mouse-event details are passed in, so you can find out about which button, where it was, etc.

If not overridden, the base class method here will open or close the item as if the 'plus' button had been clicked.

See also
itemClicked

Reimplemented from juce::TreeViewItem.

void juce::FileListTreeItem::itemOpennessChanged ( bool  isNowOpen)
inlineoverridevirtual

Called when an item is opened or closed.

When setOpen() is called and the item has specified that it might have sub-items with the mightContainSubItems() method, this method is called to let the item create or manage its sub-items.

So when this is called with isNowOpen set to true (i.e. when the item is being opened), a subclass might choose to use clearSubItems() and addSubItem() to refresh its sub-item list.

When this is called with isNowOpen set to false, the subclass might want to use clearSubItems() to save on space, or it might choose to leave them, depending on the nature of the tree.

You could also use this callback as a trigger to start a background process which asynchronously creates sub-items and adds them, if that's more appropriate for the task in hand.

See also
mightContainSubItems

Reimplemented from juce::TreeViewItem.

void juce::FileListTreeItem::itemSelectionChanged ( bool  isNowSelected)
inlineoverridevirtual

Called when the item is selected or deselected.

Use this if you want to do something special when the item's selectedness changes. By default it'll get repainted when this happens.

Reimplemented from juce::TreeViewItem.

bool juce::FileListTreeItem::mightContainSubItems ( )
inlineoverridevirtual

Tells the tree whether this item can potentially be opened.

If your item could contain sub-items, this should return true; if it returns false then the tree will not try to open the item. This determines whether or not the item will be drawn with a 'plus' button next to it.

Implements juce::TreeViewItem.

void juce::FileListTreeItem::paintItem ( Graphics g,
int  width,
int  height 
)
inlineoverridevirtual

Draws the item's contents.

You can choose to either implement this method and draw each item, or you can use createItemComponent() to create a component that will represent the item.

If all you need in your tree is to be able to draw the items and detect when the user selects or double-clicks one of them, it's probably enough to use paintItem(), itemClicked() and itemDoubleClicked(). If you need more complicated interactions, you may need to use createItemComponent() instead.

Parameters
gthe graphics context to draw into
widththe width of the area available for drawing
heightthe height of the area available for drawing

Reimplemented from juce::TreeViewItem.

void juce::FileListTreeItem::rebuildItemsFromContentList ( )
inline
void juce::FileListTreeItem::removeSubContentsList ( )
inline
bool juce::FileListTreeItem::selectFile ( const File target)
inline
void juce::FileListTreeItem::setSubContentsList ( DirectoryContentsList newList,
const bool  canDeleteList 
)
inline
int juce::FileListTreeItem::useTimeSlice ( )
inlineoverridevirtual

Called back by a TimeSliceThread.

When you register this class with it, a TimeSliceThread will repeatedly call this method.

The implementation of this method should use its time-slice to do something that's quick - never block for longer than absolutely necessary.

Returns
Your method should return the number of milliseconds which it would like to wait before being called again. Returning 0 will make the thread call again as soon as possible (after possibly servicing other busy clients). If you return a value below zero, your client will be removed from the list of clients, and won't be called again. The value you specify isn't a guaranteee, and is only used as a hint by the thread - the actual time before the next callback may be more or less than specified. You can force the TimeSliceThread to wake up and poll again immediately by calling its notify() method.

Implements juce::TimeSliceClient.

Member Data Documentation

const File juce::FileListTreeItem::file

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