| 1460 | } |
| 1461 | |
| 1462 | bool ShowLegendContextMenu(ImPlotLegend& legend, bool visible) { |
| 1463 | const float s = ImGui::GetFrameHeight(); |
| 1464 | bool ret = false; |
| 1465 | if (ImGui::Checkbox("Show",&visible)) |
| 1466 | ret = true; |
| 1467 | if (legend.CanGoInside) |
| 1468 | ImGui::CheckboxFlags("Outside",(unsigned int*)&legend.Flags, ImPlotLegendFlags_Outside); |
| 1469 | if (ImGui::RadioButton("H", ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1470 | legend.Flags |= ImPlotLegendFlags_Horizontal; |
| 1471 | ImGui::SameLine(); |
| 1472 | if (ImGui::RadioButton("V", !ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1473 | legend.Flags &= ~ImPlotLegendFlags_Horizontal; |
| 1474 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2,2)); |
| 1475 | if (ImGui::Button("NW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthWest; } ImGui::SameLine(); |
| 1476 | if (ImGui::Button("N", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_North; } ImGui::SameLine(); |
| 1477 | if (ImGui::Button("NE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthEast; } |
| 1478 | if (ImGui::Button("W", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_West; } ImGui::SameLine(); |
| 1479 | if (ImGui::InvisibleButton("C", ImVec2(1.5f*s,s))) { } ImGui::SameLine(); |
| 1480 | if (ImGui::Button("E", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_East; } |
| 1481 | if (ImGui::Button("SW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthWest; } ImGui::SameLine(); |
| 1482 | if (ImGui::Button("S", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_South; } ImGui::SameLine(); |
| 1483 | if (ImGui::Button("SE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthEast; } |
| 1484 | ImGui::PopStyleVar(); |
| 1485 | return ret; |
| 1486 | } |
| 1487 | |
| 1488 | void ShowSubplotsContextMenu(ImPlotSubplot& subplot) { |
| 1489 | if ((ImGui::BeginMenu("Linking"))) { |
no test coverage detected