| 1498 | } |
| 1499 | |
| 1500 | bool ShowLegendContextMenu(ImPlotLegend& legend, bool visible) { |
| 1501 | const float s = ImGui::GetFrameHeight(); |
| 1502 | bool ret = false; |
| 1503 | if (ImGui::Checkbox("Show",&visible)) |
| 1504 | ret = true; |
| 1505 | if (legend.CanGoInside) |
| 1506 | ImGui::CheckboxFlags("Outside",(unsigned int*)&legend.Flags, ImPlotLegendFlags_Outside); |
| 1507 | if (ImGui::RadioButton("H", ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1508 | legend.Flags |= ImPlotLegendFlags_Horizontal; |
| 1509 | ImGui::SameLine(); |
| 1510 | if (ImGui::RadioButton("V", !ImHasFlag(legend.Flags, ImPlotLegendFlags_Horizontal))) |
| 1511 | legend.Flags &= ~ImPlotLegendFlags_Horizontal; |
| 1512 | ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2,2)); |
| 1513 | if (ImGui::Button("NW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthWest; } ImGui::SameLine(); |
| 1514 | if (ImGui::Button("N", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_North; } ImGui::SameLine(); |
| 1515 | if (ImGui::Button("NE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_NorthEast; } |
| 1516 | if (ImGui::Button("W", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_West; } ImGui::SameLine(); |
| 1517 | if (ImGui::InvisibleButton("C", ImVec2(1.5f*s,s))) { } ImGui::SameLine(); |
| 1518 | if (ImGui::Button("E", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_East; } |
| 1519 | if (ImGui::Button("SW",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthWest; } ImGui::SameLine(); |
| 1520 | if (ImGui::Button("S", ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_South; } ImGui::SameLine(); |
| 1521 | if (ImGui::Button("SE",ImVec2(1.5f*s,s))) { legend.Location = ImPlotLocation_SouthEast; } |
| 1522 | ImGui::PopStyleVar(); |
| 1523 | return ret; |
| 1524 | } |
| 1525 | |
| 1526 | void ShowSubplotsContextMenu(ImPlotSubplot& subplot) { |
| 1527 | if ((ImGui::BeginMenu("Linking"))) { |
no test coverage detected