| 26 | } |
| 27 | |
| 28 | void MenuSeparator::construct() |
| 29 | { |
| 30 | _needsRefresh = false; |
| 31 | |
| 32 | if (_separator != nullptr) |
| 33 | { |
| 34 | MenuElement::constructChildren(); |
| 35 | return; |
| 36 | } |
| 37 | |
| 38 | if (isVisible()) |
| 39 | { |
| 40 | // Get the parent menu |
| 41 | MenuElementPtr parent = getParent(); |
| 42 | |
| 43 | if (!parent || !std::dynamic_pointer_cast<MenuFolder>(parent)) |
| 44 | { |
| 45 | rWarning() << "Cannot construct separator without a parent menu" << std::endl; |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | wxMenu* menu = std::static_pointer_cast<MenuFolder>(parent)->getMenu(); |
| 50 | |
| 51 | int pos = parent->getMenuPosition(shared_from_this()); |
| 52 | _separator = menu->InsertSeparator(pos); |
| 53 | } |
| 54 | |
| 55 | MenuElement::constructChildren(); |
| 56 | } |
| 57 | |
| 58 | void MenuSeparator::deconstruct() |
| 59 | { |
nothing calls this directly
no test coverage detected