mirror of
https://github.com/ocornut/imgui.git
synced 2024-12-18 10:35:59 +01:00
ImStrv: moved double char* function signatures under #ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS blocks.
This commit is contained in:
parent
ede8912724
commit
2e0aa8299d
17
imgui.cpp
17
imgui.cpp
@ -8815,14 +8815,6 @@ void ImGui::PushID(ImStrv str_id)
|
|||||||
window->IDStack.push_back(id);
|
window->IDStack.push_back(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::PushID(const char* str_id_begin, const char* str_id_end)
|
|
||||||
{
|
|
||||||
ImGuiContext& g = *GImGui;
|
|
||||||
ImGuiWindow* window = g.CurrentWindow;
|
|
||||||
ImGuiID id = window->GetID(ImStrv(str_id_begin, str_id_end));
|
|
||||||
window->IDStack.push_back(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ImGui::PushID(const void* ptr_id)
|
void ImGui::PushID(const void* ptr_id)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
@ -8893,12 +8885,6 @@ ImGuiID ImGui::GetID(ImStrv str_id)
|
|||||||
return window->GetID(str_id);
|
return window->GetID(str_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiID ImGui::GetID(const char* str_id_begin, const char* str_id_end)
|
|
||||||
{
|
|
||||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
|
||||||
return window->GetID(ImStrv(str_id_begin, str_id_end));
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGuiID ImGui::GetID(const void* ptr_id)
|
ImGuiID ImGui::GetID(const void* ptr_id)
|
||||||
{
|
{
|
||||||
ImGuiWindow* window = GImGui->CurrentWindow;
|
ImGuiWindow* window = GImGui->CurrentWindow;
|
||||||
@ -15140,7 +15126,8 @@ void ImGui::DebugRenderViewportThumbnail(ImDrawList* draw_list, ImGuiViewportP*
|
|||||||
window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));
|
window->DrawList->AddRectFilled(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_WindowBg, alpha_mul));
|
||||||
window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));
|
window->DrawList->AddRectFilled(title_r.Min, title_r.Max, GetColorU32(window_is_focused ? ImGuiCol_TitleBgActive : ImGuiCol_TitleBg, alpha_mul));
|
||||||
window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
|
window->DrawList->AddRect(thumb_r.Min, thumb_r.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
|
||||||
window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));
|
ImStrv label(thumb_window->Name, FindRenderedTextEnd(thumb_window->Name));
|
||||||
|
window->DrawList->AddText(g.Font, g.FontSize * 1.0f, title_r.Min, GetColorU32(ImGuiCol_Text, alpha_mul), label);
|
||||||
}
|
}
|
||||||
draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
|
draw_list->AddRect(bb.Min, bb.Max, GetColorU32(ImGuiCol_Border, alpha_mul));
|
||||||
if (viewport->ID == g.DebugMetricsConfig.HighlightViewportID)
|
if (viewport->ID == g.DebugMetricsConfig.HighlightViewportID)
|
||||||
|
56
imgui.h
56
imgui.h
@ -540,19 +540,16 @@ namespace ImGui
|
|||||||
// - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID,
|
// - In this header file we use the "label"/"name" terminology to denote a string that will be displayed + used as an ID,
|
||||||
// whereas "str_id" denote a string that is only used as an ID and not normally displayed.
|
// whereas "str_id" denote a string that is only used as an ID and not normally displayed.
|
||||||
IMGUI_API void PushID(ImStrv str_id); // push string into the ID stack (will hash string).
|
IMGUI_API void PushID(ImStrv str_id); // push string into the ID stack (will hash string).
|
||||||
IMGUI_API void PushID(const char* str_id_begin, const char* str_id_end = NULL);// push string into the ID stack (will hash string).
|
|
||||||
IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer).
|
IMGUI_API void PushID(const void* ptr_id); // push pointer into the ID stack (will hash pointer).
|
||||||
IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer).
|
IMGUI_API void PushID(int int_id); // push integer into the ID stack (will hash integer).
|
||||||
IMGUI_API void PopID(); // pop from the ID stack.
|
IMGUI_API void PopID(); // pop from the ID stack.
|
||||||
IMGUI_API ImGuiID GetID(ImStrv str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself
|
IMGUI_API ImGuiID GetID(ImStrv str_id); // calculate unique ID (hash of whole ID stack + given parameter). e.g. if you want to query into ImGuiStorage yourself
|
||||||
IMGUI_API ImGuiID GetID(const char* str_id_begin, const char* str_id_end = NULL);
|
|
||||||
IMGUI_API ImGuiID GetID(const void* ptr_id);
|
IMGUI_API ImGuiID GetID(const void* ptr_id);
|
||||||
IMGUI_API ImGuiID GetID(int int_id);
|
IMGUI_API ImGuiID GetID(int int_id);
|
||||||
|
|
||||||
// Widgets: Text
|
// Widgets: Text
|
||||||
// FIXME-IMSTR: Functions taking format should use ImStrv. It breaks IM_FMTARGS() macro however.
|
// FIXME-IMSTR: Functions taking format should use ImStrv. It breaks IM_FMTARGS() macro however.
|
||||||
IMGUI_API void TextUnformatted(ImStrv text); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
|
IMGUI_API void TextUnformatted(ImStrv text); // raw text without formatting. Roughly equivalent to Text("%s", text) but: A) doesn't require null terminated string if 'text_end' is specified, B) it's faster, no memory copy is done, no buffer size limits, recommended for long chunks of text.
|
||||||
inline void TextUnformatted(const char* text, const char* text_end) { TextUnformatted(ImStrv(text, text_end)); }
|
|
||||||
IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // formatted text
|
IMGUI_API void Text(const char* fmt, ...) IM_FMTARGS(1); // formatted text
|
||||||
IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
IMGUI_API void TextV(const char* fmt, va_list args) IM_FMTLIST(1);
|
||||||
IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
IMGUI_API void TextColored(const ImVec4& col, const char* fmt, ...) IM_FMTARGS(2); // shortcut for PushStyleColor(ImGuiCol_Text, col); Text(fmt, ...); PopStyleColor();
|
||||||
@ -979,7 +976,6 @@ namespace ImGui
|
|||||||
|
|
||||||
// Text Utilities
|
// Text Utilities
|
||||||
IMGUI_API ImVec2 CalcTextSize(ImStrv text, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
IMGUI_API ImVec2 CalcTextSize(ImStrv text, bool hide_text_after_double_hash = false, float wrap_width = -1.0f);
|
||||||
inline ImVec2 CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash = false, float wrap_width = -1.0f) { return CalcTextSize(ImStrv(text, text_end), hide_text_after_double_hash, wrap_width); }
|
|
||||||
|
|
||||||
// Color Utilities
|
// Color Utilities
|
||||||
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in);
|
IMGUI_API ImVec4 ColorConvertU32ToFloat4(ImU32 in);
|
||||||
@ -2497,10 +2493,12 @@ struct ImGuiInputTextCallbackData
|
|||||||
IMGUI_API ImGuiInputTextCallbackData();
|
IMGUI_API ImGuiInputTextCallbackData();
|
||||||
IMGUI_API void DeleteChars(int pos, int bytes_count);
|
IMGUI_API void DeleteChars(int pos, int bytes_count);
|
||||||
IMGUI_API void InsertChars(int pos, ImStrv text);
|
IMGUI_API void InsertChars(int pos, ImStrv text);
|
||||||
inline void InsertChars(int pos, const char* text, const char* text_end) { InsertChars(pos, ImStrv(text, text_end)); }
|
|
||||||
void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; }
|
void SelectAll() { SelectionStart = 0; SelectionEnd = BufTextLen; }
|
||||||
void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; }
|
void ClearSelection() { SelectionStart = SelectionEnd = BufTextLen; }
|
||||||
bool HasSelection() const { return SelectionStart != SelectionEnd; }
|
bool HasSelection() const { return SelectionStart != SelectionEnd; }
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void InsertChars(int pos, const char* text, const char* text_end) { InsertChars(pos, ImStrv(text, text_end)); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin().
|
// Resizing callback data to apply custom constraint. As enabled by SetNextWindowSizeConstraints(). Callback is called during the next Begin().
|
||||||
@ -2559,17 +2557,23 @@ struct ImGuiOnceUponAFrame
|
|||||||
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
// Helper: Parse and apply text filters. In format "aaaaa[,bbbb][,ccccc]"
|
||||||
struct ImGuiTextFilter
|
struct ImGuiTextFilter
|
||||||
{
|
{
|
||||||
|
// Private members
|
||||||
|
char InputBuf[256];
|
||||||
|
ImVector<ImStrv> Filters;
|
||||||
|
int CountGrep;
|
||||||
|
|
||||||
|
// Functions
|
||||||
IMGUI_API ImGuiTextFilter(ImStrv default_filter = "");
|
IMGUI_API ImGuiTextFilter(ImStrv default_filter = "");
|
||||||
IMGUI_API bool Draw(ImStrv label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build
|
IMGUI_API bool Draw(ImStrv label = "Filter (inc,-exc)", float width = 0.0f); // Helper calling InputText+Build
|
||||||
IMGUI_API bool PassFilter(ImStrv text) const;
|
IMGUI_API bool PassFilter(ImStrv text) const;
|
||||||
inline bool PassFilter(const char* text, const char* text_end = NULL) const { return PassFilter(ImStrv(text, text_end)); }
|
|
||||||
IMGUI_API void Build();
|
IMGUI_API void Build();
|
||||||
void Clear() { InputBuf[0] = 0; Build(); }
|
void Clear() { InputBuf[0] = 0; Build(); }
|
||||||
bool IsActive() const { return !Filters.empty(); }
|
bool IsActive() const { return !Filters.empty(); }
|
||||||
|
|
||||||
char InputBuf[256];
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
ImVector<ImStrv> Filters;
|
inline bool PassFilter(const char* text, const char* text_end = NULL) const { return PassFilter(ImStrv(text, text_end)); }
|
||||||
int CountGrep;
|
#endif
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Helper: Growable text buffer for logging/accumulating text
|
// Helper: Growable text buffer for logging/accumulating text
|
||||||
@ -2589,9 +2593,11 @@ struct ImGuiTextBuffer
|
|||||||
void reserve(int capacity) { Buf.reserve(capacity); }
|
void reserve(int capacity) { Buf.reserve(capacity); }
|
||||||
const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; }
|
const char* c_str() const { return Buf.Data ? Buf.Data : EmptyString; }
|
||||||
IMGUI_API void append(ImStrv str);
|
IMGUI_API void append(ImStrv str);
|
||||||
inline void append(const char* str, const char* str_end) { append(ImStrv(str, str_end)); }
|
|
||||||
IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2);
|
IMGUI_API void appendf(const char* fmt, ...) IM_FMTARGS(2);
|
||||||
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
|
IMGUI_API void appendfv(const char* fmt, va_list args) IM_FMTLIST(2);
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void append(const char* str, const char* str_end) { append(ImStrv(str, str_end)); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// [Internal] Key+Value for ImGuiStorage
|
// [Internal] Key+Value for ImGuiStorage
|
||||||
@ -3123,9 +3129,7 @@ struct ImDrawList
|
|||||||
IMGUI_API void AddEllipse(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot = 0.0f, int num_segments = 0, float thickness = 1.0f);
|
IMGUI_API void AddEllipse(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot = 0.0f, int num_segments = 0, float thickness = 1.0f);
|
||||||
IMGUI_API void AddEllipseFilled(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot = 0.0f, int num_segments = 0);
|
IMGUI_API void AddEllipseFilled(const ImVec2& center, const ImVec2& radius, ImU32 col, float rot = 0.0f, int num_segments = 0);
|
||||||
IMGUI_API void AddText(const ImVec2& pos, ImU32 col, ImStrv text);
|
IMGUI_API void AddText(const ImVec2& pos, ImU32 col, ImStrv text);
|
||||||
inline void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end) { AddText(NULL, 0.0f, pos, col, ImStrv(text_begin, text_end)); }
|
|
||||||
IMGUI_API void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, ImStrv text, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);
|
IMGUI_API void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, ImStrv text, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL);
|
||||||
inline void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL) { AddText(font, font_size, pos, col, ImStrv(text_begin, text_end), wrap_width, cpu_fine_clip_rect); }
|
|
||||||
IMGUI_API void AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Cubic Bezier (4 control points)
|
IMGUI_API void AddBezierCubic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, const ImVec2& p4, ImU32 col, float thickness, int num_segments = 0); // Cubic Bezier (4 control points)
|
||||||
IMGUI_API void AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments = 0); // Quadratic Bezier (3 control points)
|
IMGUI_API void AddBezierQuadratic(const ImVec2& p1, const ImVec2& p2, const ImVec2& p3, ImU32 col, float thickness, int num_segments = 0); // Quadratic Bezier (3 control points)
|
||||||
|
|
||||||
@ -3136,6 +3140,11 @@ struct ImDrawList
|
|||||||
IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col);
|
IMGUI_API void AddConvexPolyFilled(const ImVec2* points, int num_points, ImU32 col);
|
||||||
IMGUI_API void AddConcavePolyFilled(const ImVec2* points, int num_points, ImU32 col);
|
IMGUI_API void AddConcavePolyFilled(const ImVec2* points, int num_points, ImU32 col);
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void AddText(const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end) { AddText(NULL, 0.0f, pos, col, ImStrv(text_begin, text_end)); }
|
||||||
|
inline void AddText(ImFont* font, float font_size, const ImVec2& pos, ImU32 col, const char* text_begin, const char* text_end, float wrap_width = 0.0f, const ImVec4* cpu_fine_clip_rect = NULL) { AddText(font, font_size, pos, col, ImStrv(text_begin, text_end), wrap_width, cpu_fine_clip_rect); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Image primitives
|
// Image primitives
|
||||||
// - Read FAQ to understand what ImTextureID is.
|
// - Read FAQ to understand what ImTextureID is.
|
||||||
// - "p_min" and "p_max" represent the upper-left and lower-right corners of the rectangle.
|
// - "p_min" and "p_max" represent the upper-left and lower-right corners of the rectangle.
|
||||||
@ -3297,9 +3306,12 @@ struct ImFontGlyphRangesBuilder
|
|||||||
inline void SetBit(size_t n) { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
inline void SetBit(size_t n) { int off = (int)(n >> 5); ImU32 mask = 1u << (n & 31); UsedChars[off] |= mask; } // Set bit n in the array
|
||||||
inline void AddChar(ImWchar c) { SetBit(c); } // Add character
|
inline void AddChar(ImWchar c) { SetBit(c); } // Add character
|
||||||
IMGUI_API void AddText(ImStrv text); // Add string (each character of the UTF-8 string are added)
|
IMGUI_API void AddText(ImStrv text); // Add string (each character of the UTF-8 string are added)
|
||||||
inline void AddText(const char* text, const char* text_end = NULL) { AddText(ImStrv(text, text_end)); }
|
|
||||||
IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext
|
IMGUI_API void AddRanges(const ImWchar* ranges); // Add ranges, e.g. builder.AddRanges(ImFontAtlas::GetGlyphRangesDefault()) to force add all of ASCII/Latin+Ext
|
||||||
IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges
|
IMGUI_API void BuildRanges(ImVector<ImWchar>* out_ranges); // Output new ranges
|
||||||
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline void AddText(const char* text, const char* text_end = NULL) { AddText(ImStrv(text, text_end)); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// See ImFontAtlas::AddCustomRectXXX functions.
|
// See ImFontAtlas::AddCustomRectXXX functions.
|
||||||
@ -3488,12 +3500,15 @@ struct ImFont
|
|||||||
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
// 'max_width' stops rendering after a certain width (could be turned into a 2d size). FLT_MAX to disable.
|
||||||
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
// 'wrap_width' enable automatic word-wrapping across multiple lines to fit into given width. 0.0f to disable.
|
||||||
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, ImStrv text, const char** remaining = NULL); // utf8
|
IMGUI_API ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, ImStrv text, const char** remaining = NULL); // utf8
|
||||||
inline ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining = NULL) { return CalcTextSizeA(size, max_width, wrap_width, ImStrv(text_begin, text_end), remaining); }
|
|
||||||
IMGUI_API const char* CalcWordWrapPositionA(float scale, ImStrv text, float wrap_width);
|
IMGUI_API const char* CalcWordWrapPositionA(float scale, ImStrv text, float wrap_width);
|
||||||
inline const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) { return CalcWordWrapPositionA(scale, ImStrv(text, text_end), wrap_width); }
|
|
||||||
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c);
|
IMGUI_API void RenderChar(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, ImWchar c);
|
||||||
IMGUI_API void RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, ImStrv text, float wrap_width = 0.0f, bool cpu_fine_clip = false);
|
IMGUI_API void RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, ImStrv text, float wrap_width = 0.0f, bool cpu_fine_clip = false);
|
||||||
inline void RenderText(ImDrawList* draw_list, float size, const ImVec2& pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) { RenderText(draw_list, size, pos, col, clip_rect, ImStrv(text_begin, text_end), wrap_width, cpu_fine_clip); }
|
|
||||||
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
|
inline ImVec2 CalcTextSizeA(float size, float max_width, float wrap_width, const char* text_begin, const char* text_end, const char** remaining = NULL) { return CalcTextSizeA(size, max_width, wrap_width, ImStrv(text_begin, text_end), remaining); }
|
||||||
|
inline const char* CalcWordWrapPositionA(float scale, const char* text, const char* text_end, float wrap_width) { return CalcWordWrapPositionA(scale, ImStrv(text, text_end), wrap_width); }
|
||||||
|
inline void RenderText(ImDrawList* draw_list, float size, ImVec2 pos, ImU32 col, const ImVec4& clip_rect, const char* text_begin, const char* text_end, float wrap_width = 0.0f, bool cpu_fine_clip = false) { RenderText(draw_list, size, pos, col, clip_rect, ImStrv(text_begin, text_end), wrap_width, cpu_fine_clip); }
|
||||||
|
#endif
|
||||||
|
|
||||||
// [Internal] Don't use!
|
// [Internal] Don't use!
|
||||||
IMGUI_API void BuildLookupTable();
|
IMGUI_API void BuildLookupTable();
|
||||||
@ -3606,6 +3621,11 @@ struct ImGuiPlatformImeData
|
|||||||
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
#ifndef IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||||
namespace ImGui
|
namespace ImGui
|
||||||
{
|
{
|
||||||
|
// OBSOLETED in 1.XX (string_view branch)
|
||||||
|
inline void PushID(const char* str_id_begin, const char* str_id_end){ PushID(ImStrv(str_id_begin, str_id_end)); }
|
||||||
|
inline ImGuiID GetID(const char* str_id_begin, const char* str_id_end) { return GetID(ImStrv(str_id_begin, str_id_end)); }
|
||||||
|
inline void TextUnformatted(const char* text, const char* text_end) { TextUnformatted(ImStrv(text, text_end)); }
|
||||||
|
inline ImVec2 CalcTextSize(const char* text, const char* text_end, bool hide_text_after_double_hash = false, float wrap_width = -1.0f) { return CalcTextSize(ImStrv(text, text_end), hide_text_after_double_hash, wrap_width); }
|
||||||
// OBSOLETED in 1.91.0 (from July 2024)
|
// OBSOLETED in 1.91.0 (from July 2024)
|
||||||
static inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); }
|
static inline void PushButtonRepeat(bool repeat) { PushItemFlag(ImGuiItemFlags_ButtonRepeat, repeat); }
|
||||||
static inline void PopButtonRepeat() { PopItemFlag(); }
|
static inline void PopButtonRepeat() { PopItemFlag(); }
|
||||||
@ -3620,8 +3640,8 @@ namespace ImGui
|
|||||||
//static inline bool BeginChild(ImStrv str_id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(str_id, size_arg, borders ? ImGuiChildFlags_Border : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Border
|
//static inline bool BeginChild(ImStrv str_id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(str_id, size_arg, borders ? ImGuiChildFlags_Border : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Border
|
||||||
//static inline bool BeginChild(ImGuiID id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(id, size_arg, borders ? ImGuiChildFlags_Border : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Border
|
//static inline bool BeginChild(ImGuiID id, const ImVec2& size_arg, bool borders, ImGuiWindowFlags window_flags) { return BeginChild(id, size_arg, borders ? ImGuiChildFlags_Border : ImGuiChildFlags_None, window_flags); } // Unnecessary as true == ImGuiChildFlags_Border
|
||||||
static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); }
|
static inline void ShowStackToolWindow(bool* p_open = NULL) { ShowIDStackToolWindow(p_open); }
|
||||||
IMGUI_API bool Combo(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1);
|
IMGUI_API bool Combo(ImStrv label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int popup_max_height_in_items = -1);
|
||||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1);
|
IMGUI_API bool ListBox(ImStrv label, int* current_item, bool (*old_callback)(void* user_data, int idx, const char** out_text), void* user_data, int items_count, int height_in_items = -1);
|
||||||
// OBSOLETED in 1.89.7 (from June 2023)
|
// OBSOLETED in 1.89.7 (from June 2023)
|
||||||
IMGUI_API void SetItemAllowOverlap(); // Use SetNextItemAllowOverlap() before item.
|
IMGUI_API void SetItemAllowOverlap(); // Use SetNextItemAllowOverlap() before item.
|
||||||
// OBSOLETED in 1.89.4 (from March 2023)
|
// OBSOLETED in 1.89.4 (from March 2023)
|
||||||
|
@ -1622,8 +1622,8 @@ void ImGui::TableSetupColumn(ImStrv label, ImGuiTableColumnFlags flags, float in
|
|||||||
{
|
{
|
||||||
char zero_terminator = 0;
|
char zero_terminator = 0;
|
||||||
column->NameOffset = (ImS16)table->ColumnsNames.size();
|
column->NameOffset = (ImS16)table->ColumnsNames.size();
|
||||||
table->ColumnsNames.append(label.Begin, label.End);
|
table->ColumnsNames.append(label);
|
||||||
table->ColumnsNames.append(&zero_terminator, &zero_terminator + 1);
|
table->ColumnsNames.append(ImStrv(&zero_terminator, &zero_terminator + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3087,7 +3087,7 @@ void ImGui::TableHeader(ImStrv label)
|
|||||||
label = "";
|
label = "";
|
||||||
ImGuiID id = window->GetID(label);
|
ImGuiID id = window->GetID(label);
|
||||||
label.End = FindRenderedTextEnd(label);
|
label.End = FindRenderedTextEnd(label);
|
||||||
ImVec2 label_size = CalcTextSize(label.Begin, label.End, true);
|
ImVec2 label_size = CalcTextSize(label, true);
|
||||||
ImVec2 label_pos = window->DC.CursorPos;
|
ImVec2 label_pos = window->DC.CursorPos;
|
||||||
|
|
||||||
// If we already got a row height, there's use that.
|
// If we already got a row height, there's use that.
|
||||||
|
@ -202,7 +202,7 @@ void ImGui::TextEx(ImStrv text, ImGuiTextFlags flags)
|
|||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
||||||
text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
|
text_size.x = ImMax(text_size.x, CalcTextSize(ImStrv(line, line_end)).x);
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
lines_skipped++;
|
lines_skipped++;
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ void ImGui::TextEx(ImStrv text, ImGuiTextFlags flags)
|
|||||||
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
const char* line_end = (const char*)memchr(line, '\n', text_end - line);
|
||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
|
text_size.x = ImMax(text_size.x, CalcTextSize(ImStrv(line, line_end)).x);
|
||||||
RenderText(pos, ImStrv(line, line_end), false);
|
RenderText(pos, ImStrv(line, line_end), false);
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
line_rect.Min.y += line_height;
|
line_rect.Min.y += line_height;
|
||||||
@ -238,7 +238,7 @@ void ImGui::TextEx(ImStrv text, ImGuiTextFlags flags)
|
|||||||
if (!line_end)
|
if (!line_end)
|
||||||
line_end = text_end;
|
line_end = text_end;
|
||||||
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
if ((flags & ImGuiTextFlags_NoWidthForLargeClippedText) == 0)
|
||||||
text_size.x = ImMax(text_size.x, CalcTextSize(line, line_end).x);
|
text_size.x = ImMax(text_size.x, CalcTextSize(ImStrv(line, line_end)).x);
|
||||||
line = line_end + 1;
|
line = line_end + 1;
|
||||||
lines_skipped++;
|
lines_skipped++;
|
||||||
}
|
}
|
||||||
@ -2119,12 +2119,12 @@ static const char* ImGuiGetNameFromIndexOldToNewCallback(void* user_data, int id
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ImGui::ListBox(const char* label, int* current_item, bool (*old_getter)(void*, int, const char**), void* user_data, int items_count, int height_in_items)
|
bool ImGui::ListBox(ImStrv label, int* current_item, bool (*old_getter)(void*, int, const char**), void* user_data, int items_count, int height_in_items)
|
||||||
{
|
{
|
||||||
ImGuiGetNameFromIndexOldToNewCallbackData old_to_new_data = { user_data, old_getter };
|
ImGuiGetNameFromIndexOldToNewCallbackData old_to_new_data = { user_data, old_getter };
|
||||||
return ListBox(label, current_item, ImGuiGetNameFromIndexOldToNewCallback, &old_to_new_data, items_count, height_in_items);
|
return ListBox(label, current_item, ImGuiGetNameFromIndexOldToNewCallback, &old_to_new_data, items_count, height_in_items);
|
||||||
}
|
}
|
||||||
bool ImGui::Combo(const char* label, int* current_item, bool (*old_getter)(void*, int, const char**), void* user_data, int items_count, int popup_max_height_in_items)
|
bool ImGui::Combo(ImStrv label, int* current_item, bool (*old_getter)(void*, int, const char**), void* user_data, int items_count, int popup_max_height_in_items)
|
||||||
{
|
{
|
||||||
ImGuiGetNameFromIndexOldToNewCallbackData old_to_new_data = { user_data, old_getter };
|
ImGuiGetNameFromIndexOldToNewCallbackData old_to_new_data = { user_data, old_getter };
|
||||||
return Combo(label, current_item, ImGuiGetNameFromIndexOldToNewCallback, &old_to_new_data, items_count, popup_max_height_in_items);
|
return Combo(label, current_item, ImGuiGetNameFromIndexOldToNewCallback, &old_to_new_data, items_count, popup_max_height_in_items);
|
||||||
@ -10031,9 +10031,9 @@ bool ImGui::TabItemEx(ImGuiTabBar* tab_bar, ImStrv label, bool* p_open, ImGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
char zero_c = 0;
|
||||||
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
tab->NameOffset = (ImS32)tab_bar->TabsNames.size();
|
||||||
tab_bar->TabsNames.append(label);
|
tab_bar->TabsNames.append(label);
|
||||||
char zero_c = 0;
|
|
||||||
tab_bar->TabsNames.append(ImStrv(&zero_c, &zero_c + 1));
|
tab_bar->TabsNames.append(ImStrv(&zero_c, &zero_c + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user