mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-04-01 21:17:44 -05:00
refactor: Move custom ImGui functions to ImGuiExt namespace (#1427)
Co-authored-by: Nik <werwolv98@gmail.com>
This commit is contained in:
@@ -67,7 +67,7 @@ enum ImGuiCustomStyle {
|
||||
ImGuiCustomStyle_COUNT
|
||||
};
|
||||
|
||||
namespace ImGui {
|
||||
namespace ImGuiExt {
|
||||
|
||||
class Texture {
|
||||
public:
|
||||
@@ -236,7 +236,9 @@ namespace ImGui {
|
||||
|
||||
ImGui::SetCursorPos(((availableSpace - textSize) / 2.0F));
|
||||
|
||||
ImGui::TextFormatted("{}", text);
|
||||
ImGui::PushTextWrapPos(availableSpace.x * 0.75F);
|
||||
ImGuiExt::TextFormattedWrapped("{}", text);
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
inline void TextFormattedCenteredHorizontal(const std::string &fmt, auto &&...args) {
|
||||
@@ -246,14 +248,12 @@ namespace ImGui {
|
||||
|
||||
ImGui::SetCursorPosX(((availableSpace - textSize) / 2.0F).x);
|
||||
|
||||
ImGui::TextFormattedWrapped("{}", text);
|
||||
ImGui::PushTextWrapPos(availableSpace.x * 0.75F);
|
||||
ImGuiExt::TextFormattedWrapped("{}", text);
|
||||
ImGui::PopTextWrapPos();
|
||||
}
|
||||
|
||||
bool InputText(const char* label, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputTextIcon(const char* label, const char *icon, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputTextMultiline(const char* label, std::string &buffer, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
|
||||
bool InputScalarCallback(const char* label, ImGuiDataType data_type, void* p_data, const char* format, ImGuiInputTextFlags flags, ImGuiInputTextCallback callback, void* user_data);
|
||||
|
||||
@@ -301,4 +301,13 @@ namespace ImGui {
|
||||
else static_assert(hex::always_false<T>::value, "Invalid data type!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// these functions are exception because they just allow conversion from string to char*, they do not really add anything
|
||||
namespace ImGui {
|
||||
bool InputText(const char* label, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputText(const char *label, std::u8string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputTextMultiline(const char* label, std::string &buffer, const ImVec2& size = ImVec2(0, 0), ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
bool InputTextWithHint(const char *label, const char *hint, std::string &buffer, ImGuiInputTextFlags flags = ImGuiInputTextFlags_None);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user