* Opens/closes the combo box list. * @param first Is it the initialization toggle? */
| 357 | * @param first Is it the initialization toggle? |
| 358 | */ |
| 359 | void ComboBox::toggle(bool first) |
| 360 | { |
| 361 | _window->setVisible(!_window->getVisible()); |
| 362 | _list->setVisible(!_list->getVisible()); |
| 363 | _state->setModal(_window->getVisible() ? this : 0); |
| 364 | if (!first && !_window->getVisible()) |
| 365 | { |
| 366 | _toggled = true; |
| 367 | } |
| 368 | if (_list->getVisible()) |
| 369 | { |
| 370 | if (_sel < _list->getVisibleRows()/2) |
| 371 | { |
| 372 | _list->scrollTo(0); |
| 373 | } |
| 374 | else |
| 375 | { |
| 376 | _list->scrollTo(_sel - _list->getVisibleRows()/2); |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Sets a function to be called every time the slider's value changes. |
no test coverage detected