2 ==============================================================================
4 This file is part of the JUCE library - "Jules' Utility Class Extensions"
5 Copyright 2004-10 by Raw Material Software Ltd.
7 ------------------------------------------------------------------------------
9 JUCE can be redistributed and/or modified under the terms of the GNU General
10 Public License (Version 2), as published by the Free Software Foundation.
11 A copy of the license is included in the JUCE distribution, or can be found
12 online at www.gnu.org/licenses.
14 JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
15 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 ------------------------------------------------------------------------------
20 To release a closed-source product which uses JUCE, commercial licenses are
21 available: visit www.rawmaterialsoftware.com/juce for more information.
23 ==============================================================================
26 #ifndef __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__
27 #define __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__
29 #include "../jucer_Headers.h"
30 #include "../Utility/jucer_JucerTreeViewBase.h"
31 #include "jucer_Project.h"
32 #include "jucer_ResourceFile.h"
33 #include "jucer_ProjectContentComponent.h"
36 //==============================================================================
37 class ProjectTreeViewBase
: public JucerTreeViewBase
,
38 public ValueTree::Listener
41 //==============================================================================
42 ProjectTreeViewBase (const Project::Item
& item
);
43 ~ProjectTreeViewBase();
46 //==============================================================================
47 virtual bool isRoot() const { return false; }
48 virtual bool acceptsFileDrop (const StringArray
& files
) const = 0;
49 virtual bool acceptsDragItems (const OwnedArray
<Project::Item
>& selectedNodes
) = 0;
51 //==============================================================================
52 virtual const String
getDisplayName() const;
53 virtual const String
getRenamingName() const { return getDisplayName(); }
54 virtual void setName (const String
& newName
);
55 virtual bool isMissing() { return isFileMissing
; }
56 virtual const File
getFile() const;
58 virtual void deleteItem();
59 virtual void deleteAllSelectedItems();
60 virtual void revealInFinder() const;
61 virtual void showDocument() = 0;
62 virtual void browseToAddExistingFiles();
63 virtual void checkFileStatus(); // (recursive)
65 virtual void addFiles (const StringArray
& files
, int insertIndex
);
66 virtual void moveSelectedItemsTo (OwnedArray
<Project::Item
>& selectedNodes
, int insertIndex
);
67 virtual void showMultiSelectionPopupMenu();
68 void invokeShowDocument();
70 virtual ProjectTreeViewBase
* findTreeViewItem (const Project::Item
& itemToFind
);
72 //==============================================================================
73 void valueTreePropertyChanged (ValueTree
& tree
, const Identifier
& property
);
74 void valueTreeChildAdded (ValueTree
& parentTree
, ValueTree
& childWhichHasBeenAdded
);
75 void valueTreeChildRemoved (ValueTree
& parentTree
, ValueTree
& childWhichHasBeenRemoved
);
76 void valueTreeChildOrderChanged (ValueTree
& parentTree
);
77 void valueTreeParentChanged (ValueTree
& tree
);
79 //==============================================================================
80 // TreeViewItem stuff..
81 bool mightContainSubItems();
82 const String
getUniqueName() const;
83 void itemOpennessChanged (bool isNowOpen
);
84 void refreshSubItems();
85 bool canBeSelected() const { return true; }
86 void itemDoubleClicked (const MouseEvent
& e
);
87 void itemSelectionChanged (bool isNowSelected
);
88 const String
getTooltip();
89 const var
getDragSourceDescription();
91 //==============================================================================
92 // Drag-and-drop stuff..
93 bool isInterestedInFileDrag (const StringArray
& files
);
94 void filesDropped (const StringArray
& files
, int insertIndex
);
95 bool isInterestedInDragSource (const DragAndDropTarget::SourceDetails
& dragSourceDetails
);
96 void itemDropped (const DragAndDropTarget::SourceDetails
& dragSourceDetails
, int insertIndex
);
98 static void getAllSelectedNodesInTree (Component
* componentInTree
, OwnedArray
<Project::Item
>& selectedNodes
);
100 //==============================================================================
105 ScopedPointer
<Timer
> delayedSelectionTimer
;
107 //==============================================================================
108 void treeChildrenChanged (const ValueTree
& parentTree
);
109 virtual void addSubItems();
110 virtual ProjectTreeViewBase
* createSubItem (const Project::Item
& node
) = 0;
111 const Drawable
* getIcon() const { return item
.getIcon(); }
113 //==============================================================================
114 void triggerAsyncRename (const Project::Item
& itemToRename
);
115 static void moveItems (OwnedArray
<Project::Item
>& selectedNodes
,
116 Project::Item destNode
, int insertIndex
);
118 ProjectContentComponent
* getProjectContentComponent() const;
119 ProjectTreeViewBase
* getParentProjectItem() const;
123 #endif // __JUCER_PROJECTTREEVIEWBASE_JUCEHEADER__