dlxjj/imradv3
0262
1// Generated with ImRAD 0.12// github.com/tpecholt/imrad3 4#include "ui_combo_dlg.h"5 6ComboDlg comboDlg;7 8 9void ComboDlg::Draw()10{11 /// @begin TopWindow12 std::string id = title + "###" + std::to_string((uint64_t)this);13 ImGui::SetNextWindowSize({ 320, 420 }, ImGuiCond_Appearing);14 if (requestOpen) {15 requestOpen = false;16 ImGui::OpenPopup(id.c_str());17 }18 ImVec2 center = ImGui::GetMainViewport()->GetCenter();19 ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));20 bool tmpOpen = true;21 if (ImGui::BeginPopupModal(id.c_str(), &tmpOpen, ImGuiWindowFlags_NoCollapse))22 {23 if (requestClose)24 ImGui::CloseCurrentPopup();25 /// @separator26 27 /// @begin Input28 if (ImGui::IsWindowAppearing())29 ImGui::SetKeyboardFocusHere();30 ImGui::PushFont(font);31 ImGui::InputTextMultiline("##value", &value, { -1, -44 }, ImGuiInputTextFlags_Multiline);32 ImGui::PopFont();33 /// @end Input34 35 /// @begin Table36 ImGui::Spacing();37 ImGui::Spacing();38 ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, { 1, 1 });39 if (ImGui::BeginTable("table2416128940960", 2, ImGuiTableFlags_None, { 0, 0 }))40 {41 ImGui::TableSetupColumn("A", ImGuiTableColumnFlags_WidthStretch, 0);42 ImGui::TableSetupColumn("B", ImGuiTableColumnFlags_WidthFixed, 0);43 ImGui::TableNextRow();44 ImGui::TableSetColumnIndex(0);45 /// @separator46 47 /// @begin Button48 ImGui::TableNextColumn();49 if (ImGui::Button("OK", { 100, 30 }))50 {51 ClosePopup();52 callback(ImRad::Ok);53 }54 /// @end Button55 56 /// @begin Button57 ImGui::SameLine(0, 1 * ImGui::GetStyle().ItemSpacing.x);58 if (ImGui::Button("Cancel", { 100, 30 }) ||59 ImGui::IsKeyPressed(ImGuiKey_Escape))60 {61 ClosePopup();62 }63 /// @end Button64 65 66 /// @separator67 ImGui::EndTable();68 }69 ImGui::PopStyleVar();70 /// @end Table71 72 /// @separator73 ImGui::EndPopup();74 }75 /// @end TopWindow76}77 78void ComboDlg::OpenPopup(std::function<void(ImRad::ModalResult)> clb)79{80 callback = clb;81 requestOpen = true;82 requestClose = false;83 84// Add your init code here85}86 87void ComboDlg::ClosePopup()88{89 requestClose = true;90}91 