tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
tracktion_SelectableClass.h
Go to the documentation of this file.
1 /*
2 ,--. ,--. ,--. ,--.
3 ,-' '-.,--.--.,--,--.,---.| |,-.,-' '-.`--' ,---. ,--,--, Copyright 2024
4 '-. .-'| .--' ,-. | .--'| /'-. .-',--.| .-. || \ Tracktion Software
5 | | | | \ '-' \ `--.| \ \ | | | |' '-' '| || | Corporation
6 `---' `--' `--`--'`---'`--'`--' `---' `--' `---' `--''--' www.tracktion.com
7
8 Tracktion Engine uses a GPL/commercial licence - see LICENCE.md for details.
9*/
10
11namespace tracktion { inline namespace engine
12{
13
21{
22public:
23 //==============================================================================
25 virtual ~SelectableClass();
26
27 static SelectableClass* findClassFor (const Selectable&);
28 static SelectableClass* findClassFor (const Selectable*);
29
30 template<typename SelectableType>
31 static SelectableClass* findClassFor();
32
33 //==============================================================================
38
42 virtual bool canBeSelected (const Selectable& object);
43
48 virtual bool canClassesBeSelectedAtTheSameTime (SelectableClass* otherClass);
49
53 virtual bool canObjectsBeSelectedAtTheSameTime (Selectable& object1, Selectable& object2);
54
55 //==============================================================================
57 {
58 AddClipboardEntryParams (Clipboard& c) : clipboard (c) {}
59
60 SelectableList items;
61 Edit* edit = nullptr;
62 int editViewID = -1;
63 Clipboard& clipboard;
64 };
65
68
70 {
71 SelectionManager* selectionManager = nullptr;
72 SelectableList items;
73 bool partOfCutOperation;
74 };
75
79 virtual void deleteSelected (const DeleteSelectedParams& params);
80
85 virtual bool pasteClipboard (const SelectableList& currentlySelectedItems, int editViewID);
86
87 virtual bool canCutSelected (const SelectableList& selectedObjects);
88
89 //==============================================================================
90 enum class Relationship
91 {
92 moveUp, moveDown, moveLeft, moveRight,
93 moveToHome, moveToEnd,
94 selectAll
95 };
96
98 {
99 SelectionManager& selectionManager;
100 SelectableList currentlySelectedItems;
101 Relationship relationship;
102 bool keepExistingItemsSelected = false;
103 int editViewID = -1;
104 };
105
107 virtual void selectOtherObjects (const SelectOtherObjectsParams&);
108
112 virtual void keepSelectedObjectOnScreen (const SelectableList& currentlySelectedObjects);
113
114 static bool areAllObjectsOfUniformType (const SelectableList& selectedObjects);
115
116 //==============================================================================
118 {
120 virtual ~ClassInstanceBase();
121 virtual SelectableClass* getClassForObject (const Selectable*) = 0;
122 };
123
124 template <typename ClassType, typename ObjectType>
126 {
127 SelectableClass* getClassForObject (const Selectable* s) override { return dynamic_cast<const ObjectType*> (s) != nullptr ? &cls : nullptr; }
128 ClassType cls;
129 };
130
131 #define DECLARE_SELECTABLE_OBJECT_AND_CLASS(ObjectType, ClassType) \
132 static SelectableClass::ClassInstance<ClassType, ObjectType> JUCE_JOIN_MACRO (selectableClass ## ClassType, __LINE__);
133
134 #define DECLARE_SELECTABLE_CLASS(ObjectType) \
135 DECLARE_SELECTABLE_OBJECT_AND_CLASS (ObjectType, ObjectType ## SelectableClass)
136
137private:
139};
140
141
142//==============================================================================
144{
145public:
146 virtual ~SelectableClassWithVolume() {}
147
148 virtual void setVolumeDB (const SelectableList&, float dB, SelectionManager*) = 0;
149 virtual float getVolumeDB (const SelectableList&) = 0;
150 virtual void resetVolume (const SelectableList&) = 0;
151};
152
153//==============================================================================
155{
156public:
157 virtual ~SelectableClassWithPan() {}
158
159 virtual void setPan (const SelectableList&, float pan, SelectionManager*) = 0;
160 virtual float getPan (const SelectableList&) = 0;
161 virtual void resetPan (const SelectableList&) = 0;
162};
163
164}} // namespace tracktion { inline namespace engine
The Tracktion Edit class!
Represents a type of object that can be selected.
virtual bool pasteClipboard(const SelectableList &currentlySelectedItems, int editViewID)
This gives the selected items a first chance to paste the clipboard contents when the user presses ct...
virtual bool canObjectsBeSelectedAtTheSameTime(Selectable &object1, Selectable &object2)
This is only called if canClassesBeSelectedAtTheSameTime() has already returned true for the other ob...
virtual void addClipboardEntriesFor(AddClipboardEntryParams &)
A class should use this to create XML clipboard entries for the given set of items.
virtual void keepSelectedObjectOnScreen(const SelectableList &currentlySelectedObjects)
if implemented, this should do whatever is appropriate to make these objects visible - e....
virtual void selectOtherObjects(const SelectOtherObjectsParams &)
Must try to find and select objects that are related to these ones in the specified way.
virtual bool canBeSelected(const Selectable &object)
If it's possible for an object to be selected.
virtual bool canClassesBeSelectedAtTheSameTime(SelectableClass *otherClass)
if it's possible for an object of this class to be selected at the same time as an object of the clas...
virtual juce::String getDescriptionOfSelectedGroup(const SelectableList &)
Must return a description of this particular group of objects.
virtual void deleteSelected(const DeleteSelectedParams &params)
Deletes this set of objects.
Base class for things that can be selected, and whose properties can appear in the properties panel.
Manages a list of items that are currently selected.
#define JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(className)
A list of Selectables, similar to a juce::Array but contains a cached list of the SelectableClasses f...