2022-03-14 23:31:30 +01:00
|
|
|
#include "fiber_pool.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "gui/components/components.hpp"
|
2023-04-23 17:23:00 +02:00
|
|
|
#include "misc/cpp/imgui_stdlib.h"
|
2022-03-14 23:31:30 +01:00
|
|
|
#include "natives.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2023-07-26 22:22:40 +02:00
|
|
|
bool components::input_text_with_hint(const std::string_view label, const std::string_view hint, char* buf, size_t buf_size, ImGuiInputTextFlags_ flag, std::function<void()> cb)
|
2023-03-01 21:27:15 +00:00
|
|
|
{
|
2023-07-26 22:22:40 +02:00
|
|
|
bool returned = false;
|
|
|
|
if (returned = ImGui::InputTextWithHint(label.data(), hint.data(), buf, buf_size, flag); returned && cb)
|
|
|
|
g_fiber_pool->queue_job(std::move(cb));
|
2022-03-14 23:31:30 +01:00
|
|
|
|
|
|
|
if (ImGui::IsItemActive())
|
2023-09-17 16:23:26 -04:00
|
|
|
g.self.hud.typing = TYPING_TICKS;
|
2023-07-26 22:22:40 +02:00
|
|
|
return returned;
|
2022-03-14 23:31:30 +01:00
|
|
|
}
|
2023-04-23 17:23:00 +02:00
|
|
|
|
2023-07-26 22:22:40 +02:00
|
|
|
bool components::input_text_with_hint(const std::string_view label, const std::string_view hint, std::string& buf, ImGuiInputTextFlags_ flag, std::function<void()> cb)
|
2023-04-23 17:23:00 +02:00
|
|
|
{
|
2023-07-26 22:22:40 +02:00
|
|
|
bool returned = false;
|
|
|
|
if (returned = ImGui::InputTextWithHint(label.data(), hint.data(), &buf, flag); returned && cb)
|
|
|
|
g_fiber_pool->queue_job(std::move(cb));
|
2023-04-23 17:23:00 +02:00
|
|
|
|
|
|
|
if (ImGui::IsItemActive())
|
2023-09-17 16:23:26 -04:00
|
|
|
g.self.hud.typing = TYPING_TICKS;
|
2023-07-26 22:22:40 +02:00
|
|
|
return returned;
|
2023-04-23 17:23:00 +02:00
|
|
|
}
|
2022-03-14 23:31:30 +01:00
|
|
|
}
|