MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / toggle

Method toggle

src/Interface/ComboBox.cpp:359–379  ·  view source on GitHub ↗

* Opens/closes the combo box list. * @param first Is it the initialization toggle? */

Source from the content-addressed store, hash-verified

357 * @param first Is it the initialization toggle?
358 */
359void 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.

Callers 4

initMethod · 0.45
btnReserveKneelClickMethod · 0.45
mouseClickMethod · 0.45
mousePressMethod · 0.45

Calls 5

setModalMethod · 0.80
getVisibleRowsMethod · 0.80
scrollToMethod · 0.80
setVisibleMethod · 0.45
getVisibleMethod · 0.45

Tested by

no test coverage detected