4 requests of FileTreeComponent and TreeView


#1
  • Add a new argument in TreeView::setRootItemVisible():
    /** ... Arg 2 'rootName' will diaplay some text(description) of the root if arg 1 is true*/
    void setRootItemVisible (bool shouldBeVisible,
                             const String& rootDescription = String());

    // Also...
    const String& getRootDescription() const;
  • Add 2 similar new methods in FileTreeComponent:
    /** For exmple: 

        // set all txt-file's icon which will be displayed in the tree
        setIconOfFileType ("txt", myTxtIcon); 

        // All other file types will display the default icon...
   */
    void setIconOfFileType (const String& fileExtension, 
                            const Image& icon);

//============================================================
    /** Just like the above...

        // set the icon of a special dir 'myCustomDir'
        setIconOfSpecifiedDir ("myCustomDir", myCustomDirIcon); 

        // All other dirs will display the default icon...
   */
    void setIconOfSpecifiedDir (const String& dirName, 
                                const Image& iconOfTheDir);

    void setIconOfSpecifiedDir (const File& dir, 
                                const Image& iconOfTheDir);
  • Add a new method in FileTreeComponent:
    /** The tree will display all files extension by default, but you can call this to...  */
    void setDisplayFileExtension (const bool displayExtension);

#2

Can you be more specific what the description parameter should do? The rootItem can already have name and this will be displayed when visible.


#3

Thanks for your attention, fabian. That’s where I got very confused when:

    fileTreeComponent->setRootItemVisible (true);

the root item just showed an icon without any text… Perhaps I missed something important. I’m considering to use TreeView, ValueTree and a custom TreeviewItem class to replace the solution at the present, hopefully they will satisfied our need…


#4

That’s strange. Look at the ValueTrees and XML&JSON demos (which use TreeViews internally). Both of them have a root item and both display text. I guess you are trying to do this with a FileTreeView?


#5

Yes. i think what I need is a special-featured file browser/manager inside the app’s main interface. it’s more complex than I thought before when the class FileTreeComponent isn’t overall enough.

And yes, I’ve seriously studied nearly all JUCE demos/exmples, commented all the code almost line by line… It’s a huge hard work (took me almost 2 years and a lot of code I still can’t understand fully) . All my knowledge about JUCE (include code style and JAVA-like naming custom) totally from them…