Browse Source

Added a FileTreeComponent::refresh() method.

tags/2021-05-28
jules 14 years ago
parent
commit
74a727b42f
2 changed files with 16 additions and 6 deletions
  1. +13
    -6
      modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp
  2. +3
    -0
      modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.h

+ 13
- 6
modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.cpp View File

@@ -209,13 +209,8 @@ private:
FileTreeComponent::FileTreeComponent (DirectoryContentsList& listToShow)
: DirectoryContentsDisplayComponent (listToShow)
{
FileListTreeItem* const root
= new FileListTreeItem (*this, 0, 0, listToShow.getDirectory(),
listToShow.getTimeSliceThread());
root->setSubContentsList (&listToShow, false);
setRootItemVisible (false);
setRootItem (root);
refresh();
}
FileTreeComponent::~FileTreeComponent()
@@ -223,6 +218,18 @@ FileTreeComponent::~FileTreeComponent()
deleteRootItem();
}
void FileTreeComponent::refresh()
{
deleteRootItem();
FileListTreeItem* const root
= new FileListTreeItem (*this, nullptr, 0, fileList.getDirectory(),
fileList.getTimeSliceThread());
root->setSubContentsList (&fileList, false);
setRootItem (root);
}
//==============================================================================
File FileTreeComponent::getSelectedFile (const int index) const
{


+ 3
- 0
modules/juce_gui_basics/filebrowser/juce_FileTreeComponent.h View File

@@ -76,6 +76,9 @@ public:
(and if the file isn't in the list, all other items will be deselected). */
void setSelectedFile (const File&);
/** Updates the files in the list. */
void refresh();
/** Setting a name for this allows tree items to be dragged.
The string that you pass in here will be returned by the getDragSourceDescription()


Loading…
Cancel
Save