| 1544 | } |
| 1545 | |
| 1546 | void GuiCanvas::popDialogControl(GuiControl *gui) |
| 1547 | { |
| 1548 | if (size() < 1) |
| 1549 | return; |
| 1550 | |
| 1551 | //first, find the dialog, and call the "onDialogPop()" method |
| 1552 | GuiControl *ctrl = NULL; |
| 1553 | if (gui) |
| 1554 | { |
| 1555 | //make sure the gui really exists on the stack |
| 1556 | iterator i; |
| 1557 | bool found = false; |
| 1558 | for(i = begin(); i != end(); i++) |
| 1559 | { |
| 1560 | GuiControl *check = static_cast<GuiControl *>(*i); |
| 1561 | if (check == gui) |
| 1562 | { |
| 1563 | ctrl = check; |
| 1564 | found = true; |
| 1565 | } |
| 1566 | } |
| 1567 | |
| 1568 | if (!found) |
| 1569 | return; |
| 1570 | } |
| 1571 | else |
| 1572 | ctrl = static_cast<GuiControl*>(last()); |
| 1573 | |
| 1574 | //call the "on pop" function |
| 1575 | ctrl->onDialogPop(); |
| 1576 | |
| 1577 | //now pop the last child (will sleep if awake) |
| 1578 | Sim::getGuiGroup()->addObject(ctrl); |
| 1579 | |
| 1580 | if (size() > 0) |
| 1581 | { |
| 1582 | GuiControl *lastCtrl = static_cast<GuiControl *>(last()); |
| 1583 | if(lastCtrl->getFirstResponder() ) |
| 1584 | lastCtrl->getFirstResponder()->setFirstResponder(); |
| 1585 | } |
| 1586 | else |
| 1587 | { |
| 1588 | setFirstResponder(NULL); |
| 1589 | } |
| 1590 | |
| 1591 | //refresh the entire gui |
| 1592 | resetUpdateRegions(); |
| 1593 | |
| 1594 | //rebuild the accelerator map |
| 1595 | mAcceleratorMap.clear(); |
| 1596 | |
| 1597 | if (size() > 0) |
| 1598 | { |
| 1599 | GuiControl *lastCtrl = static_cast<GuiControl*>(last()); |
| 1600 | lastCtrl->buildAcceleratorMap(); |
| 1601 | } |
| 1602 | refreshMouseControl(); |
| 1603 | } |
no test coverage detected