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.
features/string_view
ocornut ago%!(EXTRA string=1 year)
parent 1e2bf7bda5
commit 69586db0e9
  1. 2
      imgui.h
  2. 17
      imgui_widgets.cpp

@ -578,7 +578,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"
@ -692,7 +691,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

@ -1910,12 +1910,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)
{
@ -1981,11 +1975,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)
{
@ -7022,11 +7011,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)
{

Loading…
Cancel
Save