MainGUI.cpp 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #include "MainGUI.h"
  2. #include "../utils/GuiUtils.h"
  3. #include "GuiDefinitions.h"
  4. #include "Sections.h"
  5. #include "../api/imgui/ImGuiNotify/imgui_notify.h"
  6. #include "../themes/Themes.h"
  7. //#include "../utils/image/ImageLoader.h"
  8. using namespace std;
  9. namespace gui {
  10. void FrameLoadGui() {
  11. ImGui::PushFont(ImGui::GetIO().Fonts->Fonts[fontindex_menu]);
  12. ImGui::SetNextWindowPos({ 480, 270 }, ImGuiCond_FirstUseEver);
  13. ImGui::SetNextWindowSize({ 800, 500 }, ImGuiCond_FirstUseEver);
  14. ImGui::Begin("Minty");
  15. ImGui::BeginGroup();
  16. static int SelectedSection = 0;
  17. if (ImGui::ListBoxHeader("##CategorySelect", ImVec2(175, -FLT_MIN))) {
  18. for (int i = 0; i < ModuleOrder.size(); i++) {
  19. bool is_selected = (i == SelectedSection);
  20. ImGui::PushStyleColor(ImGuiCol_Button, is_selected ? ImGui::GetStyle().Colors[ImGuiCol_ButtonHovered] : ImGui::GetStyle().Colors[ImGuiCol_Button]);
  21. ImGui::PushStyleColor(ImGuiCol_ButtonActive, is_selected ? ImGuiCol_ButtonActive : ImGuiCol_Button);
  22. if (ImGui::Button(ModuleOrder[i].c_str(), ImVec2(-1, 46)))
  23. SelectedSection = i;
  24. if (is_selected)
  25. ImGui::SetItemDefaultFocus();
  26. ImGui::PopStyleColor(2);
  27. }
  28. ImGui::ListBoxFooter();
  29. }
  30. ImGui::EndGroup();
  31. ImGui::SameLine();
  32. ImGui::BeginGroup();
  33. ImGuiWindowFlags window_flags = ImGuiWindowFlags_None;
  34. ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 5.0f);
  35. ImGui::BeginChild("ChildR", ImVec2(0, 0), true, window_flags);
  36. DrawSection(ModuleOrder[SelectedSection]);
  37. ImGui::EndChild();
  38. ImGui::RenderNotifications();
  39. ImGui::PopStyleVar();
  40. ImGui::EndGroup();
  41. ImGui::End();
  42. ImGui::PopFont();
  43. }
  44. }