| 1465 | } |
| 1466 | |
| 1467 | void GuiCanvas::popDialogControl(GuiControl *gui) |
| 1468 | { |
| 1469 | if (size() < 1) |
| 1470 | return; |
| 1471 | |
| 1472 | //first, find the dialog, and call the "onDialogPop()" method |
| 1473 | GuiControl *ctrl = NULL; |
| 1474 | if (gui) |
| 1475 | { |
| 1476 | //make sure the gui really exists on the stack |
| 1477 | iterator i; |
| 1478 | bool found = false; |
| 1479 | for(i = begin(); i != end(); i++) |
| 1480 | { |
| 1481 | GuiControl *check = static_cast<GuiControl *>(*i); |
| 1482 | if (check == gui) |
| 1483 | { |
| 1484 | ctrl = check; |
| 1485 | found = true; |
| 1486 | } |
| 1487 | } |
| 1488 | |
| 1489 | if (!found) |
| 1490 | return; |
| 1491 | } |
| 1492 | else |
| 1493 | ctrl = static_cast<GuiControl*>(last()); |
| 1494 | |
| 1495 | //call the "on pop" function |
| 1496 | ctrl->onDialogPop(); |
| 1497 | |
| 1498 | //now pop the last child (will sleep if awake) |
| 1499 | Sim::getGuiGroup()->addObject(ctrl); |
| 1500 | |
| 1501 | if (size() > 0) |
| 1502 | { |
| 1503 | GuiControl *ctrl = static_cast<GuiControl *>(last()); |
| 1504 | if( ctrl->getFirstResponder() ) |
| 1505 | ctrl->getFirstResponder()->setFirstResponder(); |
| 1506 | } |
| 1507 | else |
| 1508 | { |
| 1509 | setFirstResponder(NULL); |
| 1510 | } |
| 1511 | |
| 1512 | //refresh the entire gui |
| 1513 | resetUpdateRegions(); |
| 1514 | |
| 1515 | //rebuild the accelerator map |
| 1516 | mAcceleratorMap.clear(); |
| 1517 | |
| 1518 | if (size() > 0) |
| 1519 | { |
| 1520 | GuiControl *ctrl = static_cast<GuiControl*>(last()); |
| 1521 | ctrl->buildAcceleratorMap(); |
| 1522 | } |
| 1523 | refreshMouseControl(); |
| 1524 | } |
no test coverage detected