MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / drawListView

Function drawListView

source/ui/controls/listView.cpp:22–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20#include "../boxedwineui.h"
21
22void drawListView(BString listViewId, const std::vector<ListViewItem>& items, const ImVec2& size) {
23 ImGui::SetCursorPosX(0);
24 ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetColorU32(ImGuiCol_WindowBg) | 0xFF000000);
25 ImGui::BeginChild(1, size, false, 0);
26 ImGui::SetCursorPosY(ImGui::GetCursorPosY() + GlobalSettings::scaleFloatUI(5.0f));
27 int maxImageWidth = GlobalSettings::scaleIntUI(125);
28 for (auto& item : items) {
29 if (item.icon && item.icon->getWidth() > maxImageWidth) {
30 maxImageWidth = item.icon->getWidth();
31 }
32 }
33 ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
34 ImGui::Columns((int)(ImGui::GetWindowWidth()/maxImageWidth), nullptr, false);
35 for (auto& item : items) {
36 ImGui::Dummy(ImVec2(0.0f, GlobalSettings::scaleFloatUI(10.0f)));
37 ImGui::PushID(&item);
38 drawListViewItem(item);
39 ImGui::PopID();
40 ImGui::NextColumn();
41 }
42 ImGui::Columns(1);
43 ImGui::PopStyleVar();
44 ImGui::EndChild();
45 ImGui::PopStyleColor();
46}

Callers 1

uiDrawFunction · 0.85

Calls 3

ImVec2Class · 0.85
drawListViewItemFunction · 0.85
getWidthMethod · 0.45

Tested by

no test coverage detected