MCPcopy Create free account
hub / github.com/SatDump/SatDump / ShowLegendContextMenu

Function ShowLegendContextMenu

src-core/imgui/implot/implot.cpp:1462–1486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1460}
1461
1462bool 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
1488void ShowSubplotsContextMenu(ImPlotSubplot& subplot) {
1489 if ((ImGui::BeginMenu("Linking"))) {

Callers 3

ShowPlotContextMenuFunction · 0.85
EndPlotFunction · 0.85
EndSubplotsFunction · 0.85

Calls 8

ImHasFlagFunction · 0.85
PushStyleVarFunction · 0.85
ImVec2Function · 0.85
PopStyleVarFunction · 0.85
CheckboxFunction · 0.50
RadioButtonFunction · 0.50
SameLineFunction · 0.50
ButtonFunction · 0.50

Tested by

no test coverage detected