mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
123 lines
5.6 KiB
C++
123 lines
5.6 KiB
C++
/*
|
|
==============================================================================
|
|
|
|
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
|
Copyright 2004-11 by Raw Material Software Ltd.
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
JUCE can be redistributed and/or modified under the terms of the GNU General
|
|
Public License (Version 2), as published by the Free Software Foundation.
|
|
A copy of the license is included in the JUCE distribution, or can be found
|
|
online at www.gnu.org/licenses.
|
|
|
|
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
To release a closed-source product which uses JUCE, commercial licenses are
|
|
available: visit www.rawmaterialsoftware.com/juce for more information.
|
|
|
|
==============================================================================
|
|
*/
|
|
|
|
#ifndef __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__
|
|
#define __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__
|
|
|
|
#include "../jucer_Headers.h"
|
|
#include "../Utility/jucer_JucerTreeViewBase.h"
|
|
#include "jucer_Project.h"
|
|
#include "jucer_ResourceFile.h"
|
|
#include "jucer_ProjectContentComponent.h"
|
|
|
|
|
|
//==============================================================================
|
|
class ProjectTreeViewBase : public JucerTreeViewBase,
|
|
public ValueTree::Listener
|
|
{
|
|
protected:
|
|
//==============================================================================
|
|
ProjectTreeViewBase (const Project::Item& item);
|
|
~ProjectTreeViewBase();
|
|
|
|
public:
|
|
//==============================================================================
|
|
virtual bool isRoot() const { return false; }
|
|
virtual bool acceptsFileDrop (const StringArray& files) const = 0;
|
|
virtual bool acceptsDragItems (const OwnedArray <Project::Item>& selectedNodes) = 0;
|
|
|
|
//==============================================================================
|
|
virtual String getDisplayName() const;
|
|
virtual String getRenamingName() const { return getDisplayName(); }
|
|
virtual void setName (const String& newName);
|
|
virtual bool isMissing() { return isFileMissing; }
|
|
virtual File getFile() const;
|
|
|
|
virtual void deleteItem();
|
|
virtual void deleteAllSelectedItems();
|
|
virtual void revealInFinder() const;
|
|
virtual void showDocument() = 0;
|
|
virtual void browseToAddExistingFiles();
|
|
virtual void checkFileStatus(); // (recursive)
|
|
|
|
virtual void addFiles (const StringArray& files, int insertIndex);
|
|
virtual void moveSelectedItemsTo (OwnedArray <Project::Item>& selectedNodes, int insertIndex);
|
|
virtual void showMultiSelectionPopupMenu();
|
|
void invokeShowDocument();
|
|
|
|
virtual ProjectTreeViewBase* findTreeViewItem (const Project::Item& itemToFind);
|
|
|
|
//==============================================================================
|
|
void valueTreePropertyChanged (ValueTree& tree, const Identifier& property);
|
|
void valueTreeChildAdded (ValueTree& parentTree, ValueTree& childWhichHasBeenAdded);
|
|
void valueTreeChildRemoved (ValueTree& parentTree, ValueTree& childWhichHasBeenRemoved);
|
|
void valueTreeChildOrderChanged (ValueTree& parentTree);
|
|
void valueTreeParentChanged (ValueTree& tree);
|
|
|
|
//==============================================================================
|
|
// TreeViewItem stuff..
|
|
bool mightContainSubItems();
|
|
const String getUniqueName() const;
|
|
void itemOpennessChanged (bool isNowOpen);
|
|
void refreshSubItems();
|
|
bool canBeSelected() const { return true; }
|
|
void itemDoubleClicked (const MouseEvent& e);
|
|
void itemSelectionChanged (bool isNowSelected);
|
|
const String getTooltip();
|
|
const var getDragSourceDescription();
|
|
|
|
//==============================================================================
|
|
// Drag-and-drop stuff..
|
|
bool isInterestedInFileDrag (const StringArray& files);
|
|
void filesDropped (const StringArray& files, int insertIndex);
|
|
bool isInterestedInDragSource (const DragAndDropTarget::SourceDetails& dragSourceDetails);
|
|
void itemDropped (const DragAndDropTarget::SourceDetails& dragSourceDetails, int insertIndex);
|
|
|
|
static void getAllSelectedNodesInTree (Component* componentInTree, OwnedArray <Project::Item>& selectedNodes);
|
|
|
|
//==============================================================================
|
|
Project::Item item;
|
|
|
|
protected:
|
|
bool isFileMissing;
|
|
ScopedPointer<Timer> delayedSelectionTimer;
|
|
|
|
//==============================================================================
|
|
void treeChildrenChanged (const ValueTree& parentTree);
|
|
virtual void addSubItems();
|
|
virtual ProjectTreeViewBase* createSubItem (const Project::Item& node) = 0;
|
|
const Drawable* getIcon() const { return item.getIcon(); }
|
|
|
|
//==============================================================================
|
|
void triggerAsyncRename (const Project::Item& itemToRename);
|
|
static void moveItems (OwnedArray <Project::Item>& selectedNodes,
|
|
Project::Item destNode, int insertIndex);
|
|
|
|
ProjectContentComponent* getProjectContentComponent() const;
|
|
ProjectTreeViewBase* getParentProjectItem() const;
|
|
};
|
|
|
|
|
|
#endif // __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__
|