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

Function enum_test

examples/include/imgui_app.cpp:313–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312template<typename E>
313static void enum_test() {
314 const bool is_const = std::is_const_v<E>;
315 const std::string name = is_const ? std::string("const_") + typeid(E).name() : typeid(E).name();
316 ImGui::SeparatorText(name.c_str());
317 ImGui::PushID(name.c_str());
318 ImGui::Indent();
319
320 static E my_enum;
321
322 ImGui::Text("Default - as_dropdown()");
323 HelpMarker("Default settings");
324 {
325 auto config = ImSettings();
326 config.push<E>()
327 .as_dropdown()
328 .pop();
329 ImReflect::Input("my_enum", my_enum, config);
330 }
331
332 ImGui::NewLine();
333
334 ImGui::Text("Radio - as_radio()");
335 HelpMarker("Radio button style");
336 {
337 auto config = ImSettings();
338 config.push<E>()
339 .as_radio()
340 .pop();
341 ImReflect::Input("my_enum##radio", my_enum, config);
342 }
343
344 ImGui::NewLine();
345
346 ImGui::Text("Slider - as_slider()");
347 HelpMarker("Slider style");
348 {
349 auto config = ImSettings();
350 config.push<E>()
351 .as_slider()
352 .pop();
353 ImReflect::Input("my_enum##slider", my_enum, config);
354 }
355
356 ImGui::NewLine();
357
358 ImGui::Text("Drag - as_drag()");
359 HelpMarker("Drag style");
360 {
361 auto config = ImSettings();
362 config.push<E>()
363 .as_drag()
364 .pop();
365 ImReflect::Input("my_enum##drag", my_enum, config);
366 }
367
368 ImGui::Unindent();
369 ImGui::PopID();
370}

Callers

nothing calls this directly

Calls 2

HelpMarkerFunction · 0.85
InputFunction · 0.85

Tested by

no test coverage detected