MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / onRender

Method onRender

forms/multilistbox.cpp:73–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71MultilistBox::~MultilistBox() = default;
72
73void MultilistBox::onRender()
74{
75 Control::onRender();
76
77 if (isDirty())
78 {
79 resolveLocation();
80 }
81
82 Vec2<int> controlOffset = {0, 0};
83
84 for (auto c = Controls.begin(); c != Controls.end(); c++)
85 {
86 auto ctrl = *c;
87 if (ctrl != scroller && isVisibleItem(ctrl))
88 {
89 ctrl->Location = controlOffset - this->scrollOffset;
90
91 if (ListOrientation == ScrollOrientation && ItemSize != 0)
92 {
93 switch (ScrollOrientation)
94 {
95 case Orientation::Vertical:
96 ctrl->Size.x = this->Size.x;
97 ctrl->Size.y = ItemSize;
98 break;
99 case Orientation::Horizontal:
100 ctrl->Size.x = ItemSize;
101 ctrl->Size.y = this->Size.y;
102 break;
103 }
104 }
105
106 switch (ListOrientation)
107 {
108 case Orientation::Vertical:
109 controlOffset.y += ctrl->Size.y + ItemSpacing;
110 if (ListOrientation != ScrollOrientation && controlOffset.y >= Size.y)
111 {
112 controlOffset.y = 0;
113 controlOffset.x += ctrl->Size.x + ItemSpacing;
114 }
115 break;
116 case Orientation::Horizontal:
117 controlOffset.x += ctrl->Size.x + ItemSpacing;
118 if (ListOrientation != ScrollOrientation && controlOffset.x >= Size.x)
119 {
120 controlOffset.x = 0;
121 controlOffset.y += ctrl->Size.y + ItemSpacing;
122 }
123 break;
124 }
125 }
126 }
127
128 if (scroller)
129 {
130 switch (ScrollOrientation)

Callers

nothing calls this directly

Calls 5

endMethod · 0.80
setMaximumMethod · 0.80
getMinimumMethod · 0.80
beginMethod · 0.45

Tested by

no test coverage detected