HierarchyMappingTable.h (2626B)
1 /*---------------------------------------------------------------------------------------- 2 3 Copyright (c) 2023 AUDIOKINETIC Inc. 4 5 This file is licensed to use under the license available at: 6 https://github.com/audiokinetic/ReaWwise/blob/main/License.txt (the "License"). 7 You may not use this file except in compliance with the License. 8 9 Unless required by applicable law or agreed to in writing, software distributed 10 under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 11 CONDITIONS OF ANY KIND, either express or implied. See the License for the 12 specific language governing permissions and limitations under the License. 13 14 ----------------------------------------------------------------------------------------*/ 15 16 #pragma once 17 18 #include "Model/Import.h" 19 20 #include <juce_gui_basics/juce_gui_basics.h> 21 22 namespace AK::WwiseTransfer 23 { 24 class HierarchyMappingTable 25 : public juce::TableListBox 26 , public juce::ValueTree::Listener 27 { 28 public: 29 HierarchyMappingTable(juce::ValueTree appState); 30 ~HierarchyMappingTable() override; 31 32 enum ColourIds 33 { 34 errorOutlineColor = 0x00000001, 35 }; 36 37 private: 38 struct HierarchyMappingTableModel 39 : public juce::TableListBoxModel 40 { 41 HierarchyMappingTableModel(juce::ValueTree appState); 42 43 int getNumRows() override; 44 void paintRowBackground(juce::Graphics&, int rowNumber, int width, int height, bool rowIsSelected) override; 45 void paintCell(juce::Graphics&, int rowNumber, int columnId, int width, int height, bool rowIsSelected) override; 46 juce::String getCellTooltip(int rowNumber, int columnId) override; 47 48 private: 49 juce::ValueTree hierarchyMapping; 50 juce::CachedValue<int> selectedRow; 51 juce::CachedValue<bool> applyTemplateFeatureEnabled; 52 }; 53 54 HierarchyMappingTableModel model; 55 juce::ValueTree applicationState; 56 juce::ValueTree hierarchyMapping; 57 juce::CachedValue<int> selectedRow; 58 juce::CachedValue<bool> applyTemplateFeatureEnabled; 59 60 void valueTreePropertyChanged(juce::ValueTree& treeWhosePropertyHasChanged, const juce::Identifier& property) override; 61 void valueTreeChildAdded(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenAdded) override; 62 void valueTreeChildRemoved(juce::ValueTree& parentTree, juce::ValueTree& childWhichHasBeenRemoved, int indexFromWhichChildWasRemoved) override; 63 void valueTreeChildOrderChanged(juce::ValueTree& parentTreeWhoseChildrenHaveMoved, int oldIndex, int newIndex) override; 64 65 void selectedRowsChanged(int row) override; 66 67 private: 68 void refreshHeader(); 69 70 JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(HierarchyMappingTable) 71 }; 72 } // namespace AK::WwiseTransfer