| 1429 | } |
| 1430 | |
| 1431 | bool ShowLegendContextMenu(ImPlotLegend& legend, bool visible) { |
| 1432 | const float s = ImGui::GetFrameHeight(); |
| 1433 | bool ret = false; |
| 1434 | if (ImGui::Checkbox("Show",&visible)) |
| 1435 | ret = true; |
| 1436 | if (legend.CanGoInside) |
| 1437 | ImGui::CheckboxFlags("Outside",(unsigned int*)&legend.Flags, ImPlotLegendFlags_Outside); |
| 1438 | if (ImGui::RadioButton("H", ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1439 | legend.Flags |= ImPlotLegendFlags_Horizontal; |
| 1440 | ImGui::SameLine(); |
| 1441 | if (ImGui::RadioButton("V", !ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1442 | legend.Flags &= ~ImPlotLegendFlags_Horizontal; |
| 1443 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2,2)); |
| 1444 | if (ImGui::Button("NW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthWest; } ImGui::SameLine(); |
| 1445 | if (ImGui::Button("N", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_North; } ImGui::SameLine(); |
| 1446 | if (ImGui::Button("NE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthEast; } |
| 1447 | if (ImGui::Button("W", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_West; } ImGui::SameLine(); |
| 1448 | if (ImGui::InvisibleButton("C", ImVec2(1.5f*s,s))) { } ImGui::SameLine(); |
| 1449 | if (ImGui::Button("E", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_East; } |
| 1450 | if (ImGui::Button("SW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthWest; } ImGui::SameLine(); |
| 1451 | if (ImGui::Button("S", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_South; } ImGui::SameLine(); |
| 1452 | if (ImGui::Button("SE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthEast; } |
| 1453 | ImGui::PopStyleVar(); |
| 1454 | return ret; |
| 1455 | } |
| 1456 | |
| 1457 | void ShowSubplotsContextMenu(ImPlotSubplot& subplot) { |
| 1458 | if ((ImGui::BeginMenu("Linking"))) { |
no test coverage detected