| 946 | } |
| 947 | |
| 948 | std::vector<std::string> Gui::getFocusStrings(df::viewscreen* top) |
| 949 | { |
| 950 | std::vector<std::string> focusStrings; |
| 951 | |
| 952 | if (!top) |
| 953 | return focusStrings; |
| 954 | |
| 955 | if (dfhack_viewscreen::is_instance(top)) |
| 956 | { |
| 957 | dfhack_viewscreen *vs = static_cast<dfhack_viewscreen*>(top); |
| 958 | if (vs->isFocused()) |
| 959 | { |
| 960 | push_dfhack_focus_string(vs, focusStrings); |
| 961 | return focusStrings; |
| 962 | } |
| 963 | top = Gui::getDFViewscreen(top); |
| 964 | if (dfhack_viewscreen::is_instance(top)) |
| 965 | { |
| 966 | push_dfhack_focus_string(static_cast<dfhack_viewscreen*>(top), focusStrings); |
| 967 | return focusStrings; |
| 968 | } |
| 969 | } |
| 970 | |
| 971 | if (const virtual_identity *id = virtual_identity::get(top)) |
| 972 | { |
| 973 | std::string name = getNameChunk(id, 11, 2); |
| 974 | |
| 975 | auto handler = map_find(getFocusStringsHandlers, id); |
| 976 | if (handler) |
| 977 | handler(name, focusStrings, top); |
| 978 | } |
| 979 | |
| 980 | if (!focusStrings.size()) |
| 981 | { |
| 982 | Core &core = Core::getInstance(); |
| 983 | std::string name = core.p->readClassName(*(void**)top); |
| 984 | focusStrings.push_back(name.substr(11, name.size()-11-2)); |
| 985 | } |
| 986 | return focusStrings; |
| 987 | } |
| 988 | |
| 989 | // Predefined common guard functions |
| 990 |
nothing calls this directly
no test coverage detected