1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-28 01:20:55 +01:00

ImStrv: Combo(), ListBox(): maybe seems better to not introducte the ImStrv [] versions?

As 1) user is unlikely to store that on their end. 2) nowadays with lambdas isn't an easy user-side conversion.
Then we limit explosion of an already messy API.
This commit is contained in:
ocornut 2024-04-03 10:02:32 +09:00 committed by ocornut
parent 1c4a1ece84
commit 23d4d10c4d
2 changed files with 1 additions and 18 deletions

View File

@ -594,7 +594,6 @@ namespace ImGui
IMGUI_API bool BeginCombo(ImStrv label, ImStrv preview_value, ImGuiComboFlags flags = 0);
IMGUI_API void EndCombo(); // only call EndCombo() if BeginCombo() returns true!
IMGUI_API bool Combo(ImStrv label, int* current_item, const char* const items[], int items_count, int popup_max_height_in_items = -1);
IMGUI_API bool Combo(ImStrv label, int* current_item, ImStrv const items[], int items_count, int popup_max_height_in_items = -1);
IMGUI_API bool Combo(ImStrv label, int* current_item, ImStrv (*getter)(void* user_data, int idx), void* user_data, int items_count, int popup_max_height_in_items = -1);
IMGUI_API bool Combo(ImStrv label, int* current_item, const char* items_separated_by_zeros, int popup_max_height_in_items = -1); // Separate items with \0 within a string, end item-list with \0\0. e.g. "One\0Two\0Three\0"
@ -721,7 +720,6 @@ namespace ImGui
IMGUI_API bool BeginListBox(ImStrv label, const ImVec2& size = ImVec2(0, 0)); // open a framed scrolling region
IMGUI_API void EndListBox(); // only call EndListBox() if BeginListBox() returned true!
IMGUI_API bool ListBox(ImStrv label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);
IMGUI_API bool ListBox(ImStrv label, int* current_item, ImStrv const items[], int items_count, int height_in_items = -1);
IMGUI_API bool ListBox(ImStrv label, int* current_item, ImStrv (*getter)(void* user_data, int idx), void* user_data, int items_count, int height_in_items = -1);
// Widgets: Data Plotting

View File

@ -2024,12 +2024,6 @@ static ImStrv Items_CharArrayGetter(void* data, int idx)
return items[idx];
}
static ImStrv Items_StrvArrayGetter(void* data, int idx)
{
ImStrv const* items = (ImStrv const*)data;
return items[idx];
}
// Getter for the old Combo() API: "item1\0item2\0item3\0"
static ImStrv Items_SingleStringGetter(void* data, int idx)
{
@ -2095,11 +2089,6 @@ bool ImGui::Combo(ImStrv label, int* current_item, ImStrv (*getter)(void* user_d
}
// Combo box helper allowing to pass an array of strings.
bool ImGui::Combo(ImStrv label, int* current_item, ImStrv const items[], int items_count, int height_in_items)
{
return Combo(label, current_item, Items_StrvArrayGetter, (void*)items, items_count, height_in_items);
}
// We cannot easily obsolete the 'const char* []' version as this would be stored on user side..
bool ImGui::Combo(ImStrv label, int* current_item, const char* const items[], int items_count, int height_in_items)
{
@ -8278,11 +8267,7 @@ void ImGui::EndListBox()
EndGroup(); // This is only required to be able to do IsItemXXX query on the whole ListBox including label
}
bool ImGui::ListBox(ImStrv label, int* current_item, ImStrv const items[], int items_count, int height_items)
{
return ListBox(label, current_item, Items_StrvArrayGetter, (void*)items, items_count, height_items);
}
// List box helper allowing to pass an array of strings.
// We cannot easily obsolete the 'const char* []' version as this would be stored on user side..
bool ImGui::ListBox(ImStrv label, int* current_item, const char* const items[], int items_count, int height_items)
{