| 93 | } |
| 94 | |
| 95 | void PartSashContainer::DropObject(const QList<PartPane::Pointer>& toDrop, |
| 96 | LayoutPart::Pointer visiblePart, Object::Pointer targetPart, int side) |
| 97 | { |
| 98 | //getControl().setRedraw(false); |
| 99 | |
| 100 | // Targetpart is null if there isn't a part under the cursor (all the parts are |
| 101 | // hidden or the container is empty). In this case, the actual side doesn't really |
| 102 | // since we'll be the only visible container and will fill the entire space. However, |
| 103 | // we can't leave it as Constants::CENTER since we can't stack if we don't have something |
| 104 | // to stack on. In this case, we pick Constants::BOTTOM -- this will insert the new pane |
| 105 | // below any currently-hidden parts. |
| 106 | if (targetPart == 0 && side == Constants::CENTER) |
| 107 | { |
| 108 | side = Constants::BOTTOM; |
| 109 | } |
| 110 | |
| 111 | PartStack::Pointer targetStack = targetPart.Cast<PartStack> (); |
| 112 | if (targetStack == 0 && targetPart.Cast<PartPane>() != 0) |
| 113 | { |
| 114 | targetStack = targetPart.Cast<PartPane> ()->GetStack(); |
| 115 | } |
| 116 | LayoutPart::Pointer targetLayoutPart = targetStack; |
| 117 | |
| 118 | // if targetLayoutPart == 0 then we normally got a EditorSashContainer |
| 119 | if (targetLayoutPart == 0) |
| 120 | targetLayoutPart = targetPart.Cast<LayoutPart>(); |
| 121 | |
| 122 | if (side == Constants::CENTER) |
| 123 | { |
| 124 | |
| 125 | if (this->IsStackType(targetStack)) |
| 126 | { |
| 127 | |
| 128 | for (int idx = 0; idx < toDrop.size(); idx++) |
| 129 | { |
| 130 | LayoutPart::Pointer next = toDrop[idx]; |
| 131 | this->Stack(next, targetStack); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | else |
| 136 | { |
| 137 | PartStack::Pointer newPart = this->CreateStack(); |
| 138 | |
| 139 | // if the toDrop array has 1 item propagate the stack |
| 140 | // appearance |
| 141 | if (toDrop.size() == 1 && toDrop[0]->GetStack() != 0) |
| 142 | { |
| 143 | toDrop[0]->GetStack()->CopyAppearanceProperties(newPart); |
| 144 | } |
| 145 | |
| 146 | for (int idx = 0; idx < toDrop.size(); idx++) |
| 147 | { |
| 148 | LayoutPart::Pointer next = toDrop[idx]; |
| 149 | this->Stack(next, newPart); |
| 150 | } |
| 151 | |
| 152 | this->AddEnhanced(newPart, side, this->GetDockingRatio(newPart, targetStack), |
no test coverage detected