| 234 | } |
| 235 | |
| 236 | void SeparatePanel::moveSeparator(const MyGUI::IntPoint& _mousePosition) |
| 237 | { |
| 238 | MyGUI::IntPoint offset = _mousePosition - mMousePressedOffset - mMainWidget->getAbsolutePosition(); |
| 239 | |
| 240 | // сбрасываем дефолтный размер панели |
| 241 | mDefaultPanelSize.clear(); |
| 242 | |
| 243 | MyGUI::IntCoord firstPanel = mFirstPanel->getCoord(); |
| 244 | MyGUI::IntCoord separatorH = mSeparatorH->getCoord(); |
| 245 | MyGUI::IntCoord separatorV = mSeparatorV->getCoord(); |
| 246 | MyGUI::IntCoord secondPanel = mSecondPanel->getCoord(); |
| 247 | |
| 248 | if (mPanelAlign.isLeft()) |
| 249 | { |
| 250 | firstPanel.width = offset.left - firstPanel.left; |
| 251 | separatorH.left = offset.left; |
| 252 | secondPanel.width = secondPanel.right() - (offset.left + separatorH.width); |
| 253 | secondPanel.left = offset.left + separatorH.width; |
| 254 | } |
| 255 | else if (mPanelAlign.isRight()) |
| 256 | { |
| 257 | secondPanel.width = offset.left - secondPanel.left; |
| 258 | separatorH.left = offset.left; |
| 259 | firstPanel.width = firstPanel.right() - (offset.left + separatorH.width); |
| 260 | firstPanel.left = offset.left + separatorH.width; |
| 261 | } |
| 262 | else if (mPanelAlign.isTop()) |
| 263 | { |
| 264 | firstPanel.height = offset.top - firstPanel.top; |
| 265 | separatorV.top = offset.top; |
| 266 | secondPanel.height = secondPanel.bottom() - (offset.top + separatorV.height); |
| 267 | secondPanel.top = offset.top + separatorV.height; |
| 268 | } |
| 269 | else if (mPanelAlign.isBottom()) |
| 270 | { |
| 271 | secondPanel.height = offset.top - secondPanel.top; |
| 272 | separatorV.top = offset.top; |
| 273 | firstPanel.height = firstPanel.bottom() - (offset.top + separatorV.height); |
| 274 | firstPanel.top = offset.top + separatorV.height; |
| 275 | } |
| 276 | |
| 277 | invalidateSize(firstPanel, separatorH, separatorV, secondPanel); |
| 278 | |
| 279 | // запоминаем дефолтный размер панели |
| 280 | mDefaultPanelSize = mFirstPanel->getSize(); |
| 281 | } |
| 282 | |
| 283 | void SeparatePanel::loadDefaultSize() |
| 284 | { |