|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
Public Member Functions | |
| FileListTreeItem (FileTreeComponent &treeComp, const File &f, TimeSliceThread &t) | |
| void | update (const DirectoryContentsList::FileInfo &fileInfo) |
| bool | mightContainSubItems () override |
| Tells the tree whether this item can potentially be opened. | |
| String | getUniqueName () const override |
| Returns a string to uniquely identify this item. | |
| int | getItemHeight () const override |
| Must return the height required by this item. | |
| var | getDragSourceDescription () override |
| To allow items from your TreeView to be dragged-and-dropped, implement this method. | |
| void | itemOpennessChanged (bool isNowOpen) override |
| Called when an item is opened or closed. | |
| void | paintItem (Graphics &g, int width, int height) override |
| Draws the item's contents. | |
| String | getAccessibilityName () override |
| Use this to set the name for this item that will be read out by accessibility clients. | |
| void | itemClicked (const MouseEvent &e) override |
| Called when the user clicks on this item. | |
| void | itemDoubleClicked (const MouseEvent &e) override |
| Called when the user double-clicks on this item. | |
| void | itemSelectionChanged (bool) override |
| Called when the item is selected or deselected. | |
| int | useTimeSlice () override |
| Called back by a TimeSliceThread. | |
| void | handleAsyncUpdate () override |
| Called back to do whatever your class needs to do. | |
Public Member Functions inherited from juce::TreeViewItem | |
| TreeViewItem () | |
| Constructor. | |
| virtual | ~TreeViewItem () |
| Destructor. | |
| int | getNumSubItems () const noexcept |
| Returns the number of sub-items that have been added to this item. | |
| TreeViewItem * | getSubItem (int index) const noexcept |
| Returns one of the item's sub-items. | |
| void | clearSubItems () |
| Removes any sub-items. | |
| void | addSubItem (TreeViewItem *newItem, int insertPosition=-1) |
| Adds a sub-item. | |
| template<class ElementComparator > | |
| void | addSubItemSorted (ElementComparator &comparator, TreeViewItem *newItem) |
| Adds a sub-item with a sort-comparator, assuming that the existing items are already sorted. | |
| void | removeSubItem (int index, bool deleteItem=true) |
| Removes one of the sub-items. | |
| template<class ElementComparator > | |
| void | sortSubItems (ElementComparator &comparator) |
| Sorts the list of sub-items using a standard array comparator. | |
| TreeView * | getOwnerView () const noexcept |
| Returns the TreeView to which this item belongs. | |
| TreeViewItem * | getParentItem () const noexcept |
| Returns the item within which this item is contained. | |
| bool | isOpen () const noexcept |
| True if this item is currently open in the TreeView. | |
| void | setOpen (bool shouldBeOpen) |
| Opens or closes the item. | |
| Openness | getOpenness () const noexcept |
| Returns the openness state of this item. | |
| void | setOpenness (Openness newOpenness) |
| Opens or closes the item. | |
| bool | isSelected () const noexcept |
| True if this item is currently selected. | |
| void | setSelected (bool shouldBeSelected, bool deselectOtherItemsFirst, NotificationType shouldNotify=sendNotification) |
| Selects or deselects the item. | |
| Rectangle< int > | getItemPosition (bool relativeToTreeViewTopLeft) const noexcept |
| Returns the rectangle that this item occupies. | |
| void | treeHasChanged () const noexcept |
| Sends a signal to the TreeView to make it refresh itself. | |
| void | repaintItem () const |
| Sends a repaint message to redraw just this item. | |
| int | getRowNumberInTree () const noexcept |
| Returns the row number of this item in the tree. | |
| bool | areAllParentsOpen () const noexcept |
| Returns true if all the item's parent nodes are open. | |
| void | setLinesDrawnForSubItems (bool shouldDrawLines) noexcept |
| Changes whether lines are drawn to connect any sub-items to this item. | |
| virtual int | getItemWidth () const |
| Must return the width required by this item. | |
| virtual bool | canBeSelected () const |
| You can override this method to return false if you don't want to allow the user to select this item. | |
| virtual std::unique_ptr< Component > | createItemComponent () |
| Creates a component that will be used to represent this item. | |
| virtual void | paintOpenCloseButton (Graphics &, const Rectangle< float > &area, Colour backgroundColour, bool isMouseOver) |
| Draws the item's open/close button. | |
| virtual void | paintHorizontalConnectingLine (Graphics &, const Line< float > &line) |
| Draws the line that connects this item to the vertical line extending below its parent. | |
| virtual void | paintVerticalConnectingLine (Graphics &, const Line< float > &line) |
| Draws the line that extends vertically up towards one of its parents, or down to one of its children. | |
| virtual bool | customComponentUsesTreeViewMouseHandler () const |
| This should return true if you want to use a custom component, and also use the TreeView's built-in mouse handling support, enabling drag-and-drop, itemClicked() and itemDoubleClicked(); return false if the component should consume all mouse clicks. | |
| virtual void | ownerViewChanged (TreeView *newOwner) |
| Called when the owner view changes. | |
| virtual String | getTooltip () |
| The item can return a tool tip string here if it wants to. | |
| virtual bool | isInterestedInFileDrag (const StringArray &files) |
| If you want your item to be able to have files drag-and-dropped onto it, implement this method and return true. | |
| virtual void | filesDropped (const StringArray &files, int insertIndex) |
| When files are dropped into this item, this callback is invoked. | |
| virtual bool | isInterestedInDragSource (const DragAndDropTarget::SourceDetails &dragSourceDetails) |
| If you want your item to act as a DragAndDropTarget, implement this method and return true. | |
| virtual void | itemDropped (const DragAndDropTarget::SourceDetails &dragSourceDetails, int insertIndex) |
| When a things are dropped into this item, this callback is invoked. | |
| void | setDrawsInLeftMargin (bool canDrawInLeftMargin) noexcept |
| Sets a flag to indicate that the item wants to be allowed to draw all the way across to the left edge of the TreeView. | |
| void | setDrawsInRightMargin (bool canDrawInRightMargin) noexcept |
| Sets a flag to indicate that the item wants to be allowed to draw all the way across to the right edge of the TreeView. | |
| std::unique_ptr< XmlElement > | getOpennessState () const |
| Saves the current state of open/closed nodes so it can be restored later. | |
| void | restoreOpennessState (const XmlElement &xml) |
| Restores the openness of this item and all its sub-items from a saved state. | |
| int | getIndexInParent () const noexcept |
| Returns the index of this item in its parent's sub-items. | |
| bool | isLastOfSiblings () const noexcept |
| Returns true if this item is the last of its parent's sub-items. | |
| String | getItemIdentifierString () const |
| Creates a string that can be used to uniquely retrieve this item in the tree. | |
Public Attributes | |
| const File | file |
| std::function< void(const File &, bool)> | onOpennessChanged |
Additional Inherited Members | |
Public Types inherited from juce::TreeViewItem | |
| enum class | Openness { opennessDefault , opennessClosed , opennessOpen } |
| An enum of states to describe the explicit or implicit openness of an item. More... | |
Definition at line 80 of file juce_FileTreeComponent.cpp.
| juce::FileListTreeItem::FileListTreeItem | ( | FileTreeComponent & | treeComp, |
| const File & | f, | ||
| TimeSliceThread & | t | ||
| ) |
Definition at line 85 of file juce_FileTreeComponent.cpp.
|
override |
Definition at line 102 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
Use this to set the name for this item that will be read out by accessibility clients.
The default implementation will return the tooltip string from getTooltip() if it is not empty, otherwise it will return a description of the nested level and row number of the item.
Reimplemented from juce::TreeViewItem.
Definition at line 139 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Reimplemented from juce::TreeViewItem.
Definition at line 113 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Definition at line 111 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Definition at line 110 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Definition at line 167 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Reimplemented from juce::TreeViewItem.
Definition at line 144 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Reimplemented from juce::TreeViewItem.
Definition at line 149 of file juce_FileTreeComponent.cpp.
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.
Reimplemented from juce::TreeViewItem.
Definition at line 115 of file juce_FileTreeComponent.cpp.
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.
Definition at line 156 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Definition at line 109 of file juce_FileTreeComponent.cpp.
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.
| g | the graphics context to draw into |
| width | the width of the area available for drawing |
| height | the height of the area available for drawing |
Reimplemented from juce::TreeViewItem.
Definition at line 120 of file juce_FileTreeComponent.cpp.
| void juce::FileListTreeItem::update | ( | const DirectoryContentsList::FileInfo & | fileInfo | ) |
Definition at line 94 of file juce_FileTreeComponent.cpp.
|
overridevirtual |
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.
Implements juce::TimeSliceClient.
Definition at line 161 of file juce_FileTreeComponent.cpp.
Definition at line 172 of file juce_FileTreeComponent.cpp.
| std::function<void (const File&, bool)> juce::FileListTreeItem::onOpennessChanged |
Definition at line 173 of file juce_FileTreeComponent.cpp.