mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-18 14:16:36 +00:00
Clarified usage of ListBoxHeader() before we rename those functions + fixed demo code that didn't honor it correctly. (#1783)
This commit is contained in:
parent
f2e9dddeca
commit
429f48bb4f
4
imgui.h
4
imgui.h
@ -407,9 +407,9 @@ namespace ImGui
|
||||
IMGUI_API bool Selectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0, const ImVec2& size = ImVec2(0,0)); // "bool* p_selected" point to the selection state (read-write), as a convenient helper.
|
||||
IMGUI_API bool ListBox(const char* label, int* current_item, const char* const items[], int items_count, int height_in_items = -1);
|
||||
IMGUI_API bool ListBox(const char* label, int* current_item, bool (*items_getter)(void* data, int idx, const char** out_text), void* data, int items_count, int height_in_items = -1);
|
||||
IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. make sure to call ListBoxFooter() afterwards.
|
||||
IMGUI_API bool ListBoxHeader(const char* label, const ImVec2& size = ImVec2(0,0)); // use if you want to reimplement ListBox() will custom data or interactions. if the function return true, you can output elements then call ListBoxFooter() afterwards.
|
||||
IMGUI_API bool ListBoxHeader(const char* label, int items_count, int height_in_items = -1); // "
|
||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region
|
||||
IMGUI_API void ListBoxFooter(); // terminate the scrolling region. only call ListBoxFooter() if ListBoxHeader() returned true!
|
||||
|
||||
// Widgets: Value() Helpers. Output single value in "name: value" format (tip: freely declare more in your code to handle your types. you can add functions to the ImGui namespace)
|
||||
IMGUI_API void Value(const char* prefix, bool b);
|
||||
|
@ -1299,10 +1299,12 @@ void ImGui::ShowDemoWindow(bool* p_open)
|
||||
ImGui::Button("LEVERAGE\nBUZZWORD", size);
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::ListBoxHeader("List", size);
|
||||
ImGui::Selectable("Selected", true);
|
||||
ImGui::Selectable("Not Selected", false);
|
||||
ImGui::ListBoxFooter();
|
||||
if (ImGui::ListBoxHeader("List", size))
|
||||
{
|
||||
ImGui::Selectable("Selected", true);
|
||||
ImGui::Selectable("Not Selected", false);
|
||||
ImGui::ListBoxFooter();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user