| 194 | } |
| 195 | |
| 196 | CListBox::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 | |
| 225 | void CListBox::SetPos(float x, float y, float w, float h) |
| 226 | { |
nothing calls this directly
no test coverage detected