MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CListBox

Method CListBox

engine/Poseidon/UI/Controls/UIControlsImpl.cpp:196–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194}
195
196CListBox::CListBox(ControlsContainer* parent, int idc, const ParamEntry& cls)
197 : Control(parent, CT_LISTBOX, idc, cls), CListBoxContainer(cls)
198{
199 _font = GLOB_ENGINE->LoadFont(GetFontID(cls >> "font"));
200 const ParamEntry* entry = cls.FindEntry("size");
201 if (entry)
202 {
203 _size = (float)(*entry) * _font->Height();
204 }
205 else
206 {
207 _size = cls >> "sizeEx";
208 }
209 float height = cls >> "rowHeight";
210 SetRowHeight(height);
211
212 _scrollUp = false;
213 _scrollDown = false;
214
215 _showStrings = _h / _rowHeight;
216 saturateMax(_showStrings, 0);
217
218 _scrollbar.SetPosition((_x + _w - sbWidth) * _scale, _y * _scale, sbWidth * _scale, _h * _scale);
219 _scrollbar.SetColor(_ftColor);
220 _scrollbar.SetRange(0, 0, _showStrings);
221 _scrollbar.SetPos(0);
222 _scrollbar.SetSpeed(1, floatMax(_showStrings - 1, 1));
223}
224
225void CListBox::SetPos(float x, float y, float w, float h)
226{

Callers

nothing calls this directly

Calls 11

GetFontIDFunction · 0.85
saturateMaxFunction · 0.85
floatMaxFunction · 0.85
LoadFontMethod · 0.45
FindEntryMethod · 0.45
HeightMethod · 0.45
SetPositionMethod · 0.45
SetColorMethod · 0.45
SetRangeMethod · 0.45
SetPosMethod · 0.45
SetSpeedMethod · 0.45

Tested by

no test coverage detected