| 481 | void CListBox::OnSelChanged(int curSel) {} |
| 482 | |
| 483 | CCombo::CCombo(ControlsContainer* parent, int idc, const ParamEntry& cls) |
| 484 | : Control(parent, CT_COMBO, idc, cls), CListBoxContainer(cls) |
| 485 | { |
| 486 | _mouseSel = _selString; |
| 487 | _wholeHeight = cls >> "wholeHeight"; |
| 488 | _bgColor = GetPackedColor(cls >> "colorBackground"); |
| 489 | _font = GLOB_ENGINE->LoadFont(GetFontID(cls >> "font")); |
| 490 | const ParamEntry* entry = cls.FindEntry("size"); |
| 491 | if (entry) |
| 492 | { |
| 493 | _size = (float)(*entry) * _font->Height(); |
| 494 | } |
| 495 | else |
| 496 | { |
| 497 | _size = cls >> "sizeEx"; |
| 498 | } |
| 499 | |
| 500 | _expanded = false; |
| 501 | _scrollUp = false; |
| 502 | _scrollDown = false; |
| 503 | |
| 504 | _showStrings = (_wholeHeight - _h) / (_size); |
| 505 | if (_showStrings < 0) |
| 506 | { |
| 507 | _showStrings = 0; |
| 508 | } |
| 509 | |
| 510 | _scrollbar.SetPosition((_x + _w - sbWidth) * _scale, (_y + _h) * _scale, sbWidth * _scale, |
| 511 | (_wholeHeight - _h) * _scale); |
| 512 | _scrollbar.SetColor(_ftColor); |
| 513 | _scrollbar.SetRange(0, 0, _showStrings); |
| 514 | _scrollbar.SetPos(0); |
| 515 | _scrollbar.SetSpeed(1, floatMax(_showStrings - 1, 1)); |
| 516 | } |
| 517 | |
| 518 | void CCombo::SetPos(float x, float y, float w, float h) |
| 519 | { |
nothing calls this directly
no test coverage detected