mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added method FileTreeComponent::setItemHeight().
This commit is contained in:
parent
9f97ff341b
commit
b075af5e6c
3 changed files with 25 additions and 9 deletions
|
|
@ -22,7 +22,7 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
Image juce_createIconForFile (const File& file);
|
||||
Image juce_createIconForFile (const File&);
|
||||
|
||||
//==============================================================================
|
||||
class FileListTreeItem : public TreeViewItem,
|
||||
|
|
@ -68,7 +68,7 @@ public:
|
|||
//==============================================================================
|
||||
bool mightContainSubItems() override { return isDirectory; }
|
||||
String getUniqueName() const override { return file.getFullPathName(); }
|
||||
int getItemHeight() const override { return 22; }
|
||||
int getItemHeight() const override { return owner.getItemHeight(); }
|
||||
|
||||
var getDragSourceDescription() override { return owner.getDragAndDropDescription(); }
|
||||
|
||||
|
|
@ -252,7 +252,8 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
FileTreeComponent::FileTreeComponent (DirectoryContentsList& listToShow)
|
||||
: DirectoryContentsDisplayComponent (listToShow)
|
||||
: DirectoryContentsDisplayComponent (listToShow),
|
||||
itemHeight (22)
|
||||
{
|
||||
setRootItemVisible (false);
|
||||
refresh();
|
||||
|
|
@ -305,3 +306,14 @@ void FileTreeComponent::setSelectedFile (const File& target)
|
|||
if (! t->selectFile (target))
|
||||
clearSelectedItems();
|
||||
}
|
||||
|
||||
void FileTreeComponent::setItemHeight (int newHeight)
|
||||
{
|
||||
if (itemHeight != newHeight)
|
||||
{
|
||||
itemHeight = newHeight;
|
||||
|
||||
if (TreeViewItem* root = getRootItem())
|
||||
root->treeHasChanged();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,11 +87,18 @@ public:
|
|||
|
||||
/** Returns the last value that was set by setDragAndDropDescription().
|
||||
*/
|
||||
const String& getDragAndDropDescription() const noexcept { return dragAndDropDescription; }
|
||||
const String& getDragAndDropDescription() const noexcept { return dragAndDropDescription; }
|
||||
|
||||
/** Changes the height of the treeview items. */
|
||||
void setItemHeight (int newHeight);
|
||||
|
||||
/** Returns the height of the treeview items. */
|
||||
int getItemHeight() const noexcept { return itemHeight; }
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
String dragAndDropDescription;
|
||||
int itemHeight;
|
||||
|
||||
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (FileTreeComponent)
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue