MCPcopy Create free account
hub / github.com/Sven-vh/ImReflect / string_test

Function string_test

examples/include/imgui_app.cpp:933–1021  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

931// ========================================
932template<typename T>
933static void string_test() {
934 ImGui::SeparatorText("String Test");
935 ImGui::PushID("string_test");
936 ImGui::Indent();
937
938 static T my_string = "Hello World";
939
940 ImGui::Text("Default");
941 HelpMarker("Default settings, no extra settings given");
942 {
943 ImGui::PushID("default");
944 ImReflect::Input("my_string", my_string);
945 ImGui::PopID();
946 }
947
948 ImGui::NewLine();
949
950 ImGui::Text("Multiline default");
951 HelpMarker("Multiline input, default settings");
952 {
953 ImGui::PushID("multiline default");
954
955 ImSettings config;
956 config.push<T>()
957 .as_multiline()
958 .pop();
959
960 const std::string code = R"(ImSettings config;
961config.push<std::string>()
962 .as_multiline()
963.pop();)";
964
965 IMGUI_SAMPLE_MULTI_CODE(code);
966 ImGui::Text("Output:");
967 ImReflect::Input("my_string##multiline", my_string, config);
968
969 ImGui::PopID();
970 }
971
972 ImGui::NewLine();
973 ImGui::Text("Multiline specify height");
974 HelpMarker("Multiline input, specify height in lines");
975 {
976 ImGui::PushID("multiline height");
977
978 ImSettings config;
979 config.push<T>()
980 .as_multiline()
981 .line_count(5) // 5 lines height
982 .pop();
983
984 const std::string code = R"(ImSettings config;
985config.push<std::string>()
986 .as_multiline()
987 .line_count(5) // 5 lines height
988.pop();)";
989
990 IMGUI_SAMPLE_MULTI_CODE(code);

Callers

nothing calls this directly

Calls 2

HelpMarkerFunction · 0.85
InputFunction · 0.85

Tested by

no test coverage detected