| 68 | } |
| 69 | |
| 70 | void update (int newRow, bool isNowSelected) |
| 71 | { |
| 72 | jassert (newRow >= 0); |
| 73 | |
| 74 | if (newRow != row || isNowSelected != isSelected) |
| 75 | { |
| 76 | row = newRow; |
| 77 | isSelected = isNowSelected; |
| 78 | repaint(); |
| 79 | } |
| 80 | |
| 81 | auto* tableModel = owner.getModel(); |
| 82 | |
| 83 | if (tableModel != nullptr && row < owner.getNumRows()) |
| 84 | { |
| 85 | const Identifier columnProperty ("_tableColumnId"); |
| 86 | auto numColumns = owner.getHeader().getNumColumns (true); |
| 87 | |
| 88 | for (int i = 0; i < numColumns; ++i) |
| 89 | { |
| 90 | auto columnId = owner.getHeader().getColumnIdOfIndex (i, true); |
| 91 | auto* comp = columnComponents[i]; |
| 92 | |
| 93 | if (comp != nullptr && columnId != static_cast<int> (comp->getProperties() [columnProperty])) |
| 94 | { |
| 95 | columnComponents.set (i, nullptr); |
| 96 | comp = nullptr; |
| 97 | } |
| 98 | |
| 99 | comp = tableModel->refreshComponentForCell (row, columnId, isSelected, comp); |
| 100 | columnComponents.set (i, comp, false); |
| 101 | |
| 102 | if (comp != nullptr) |
| 103 | { |
| 104 | comp->getProperties().set (columnProperty, columnId); |
| 105 | |
| 106 | addAndMakeVisible (comp); |
| 107 | resizeCustomComp (i); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | columnComponents.removeRange (numColumns, columnComponents.size()); |
| 112 | } |
| 113 | else |
| 114 | { |
| 115 | columnComponents.clear(); |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | void resized() override |
| 120 | { |
nothing calls this directly
no test coverage detected