MCPcopy Create free account
hub / github.com/ShenCiao/CialloResearch / ShowLegendContextMenu

Function ShowLegendContextMenu

imgui/implot.cpp:1431–1455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1429}
1430
1431bool 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
1457void ShowSubplotsContextMenu(ImPlotSubplot& subplot) {
1458 if ((ImGui::BeginMenu("Linking"))) {

Callers 3

ShowPlotContextMenuFunction · 0.85
EndPlotFunction · 0.85
EndSubplotsFunction · 0.85

Calls 4

ImHasFlagFunction · 0.85
PushStyleVarFunction · 0.85
ImVec2Function · 0.85
PopStyleVarFunction · 0.85

Tested by

no test coverage detected