#include "../Drive/Drive.h" #pragma once #define ComBoxMax 20 class ComboBox { public: ComboBox(); ComboBox(ComboBox&& Other); void AddItem(const char* str); int Length(); void Protract(); void SetItems(const char* str[ComBoxMax]); template bool Mouse_Hovered(Func&& fun, Args&&... args); template bool Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args); template void ValueChange(Func&& fun, Args && ...args); //----------------------------------------------- ImVec2 Pos = { 0,0 }; float Width = 100; ImVec2 SelectableTextAlign = { 0.5,0.5 }; ImVec2 Padding = { 0,3 }; int Index = 0; int Fontsize = 18; std::vector Item; float Round = 2; std::string Selected = ""; ImVec4 BGColor = { 0, 0, 0, 255 }; ImVec4 BGAColor = { 0, 0, 0, 255 }; ImVec4 BGHColor = { 0, 0, 0, 255 }; ImVec4 BtnColor = { 0, 0, 0, 255 }; ImVec4 BtnAColor = { 0, 0, 0, 255 }; ImVec4 BtnHColor = { 0, 0, 0, 255 }; ImVec4 TextColor = { 1,1,1,1 }; ImVec4 BGSelected = { 0.5,0.5,0.5,0.0 }; ImVec4 BGASelected = { 0.5,0.5,0.5,0.0 }; ImVec4 BGHSelected = { 0.5,0.5,0.5,0.0 }; ImVec4 TextHColor = { 1,0,1,1 }; private: void POR(); std::string RValue = Selected; bool num1 = true; char* items[ComBoxMax]; bool SelectedItems[ComBoxMax] = { false }; // ѡ��״̬������ int a = -1; std::string ID = "##" + UI_ID::UIIDSTR(); std::function task_Click_L; std::function task_Click_Mouse; std::function task_Click_R; std::function task_Click_M; std::function task_Click_Value; std::thread A; std::thread AB; std::thread ABC; std::thread ABCD; std::thread ABCDE; }; template inline bool ComboBox::Mouse_Hovered(Func&& fun, Args && ...args) { task_Click_Mouse = std::bind(std::forward(fun), std::forward(args)...); return true; } template inline bool ComboBox::Click(ImGuiMouseButton Mouse, Func&& fun, Args && ...args) { if (Mouse == IMBN::ImGuiMouseButton_Left) { task_Click_L = std::bind(std::forward(fun), std::forward(args)...); } else if (Mouse == IMBN::ImGuiMouseButton_Right) { task_Click_R = std::bind(std::forward(fun), std::forward(args)...); } else if (Mouse == IMBN::ImGuiMouseButton_Middle) { task_Click_M = std::bind(std::forward(fun), std::forward(args)...); } return true; } template inline void ComboBox::ValueChange(Func&& fun, Args && ...args) { task_Click_Value = std::bind(std::forward(fun), std::forward(args)...); }