static void update_list() { unsigned Count = airspace_warnings->warning_size(); if (Count > 0) { wAirspaceList->SetLength(Count); int i = -1; if (CursorAirspace != NULL) { i = airspace_warnings->get_warning_index(*CursorAirspace); if (i >= 0) wAirspaceList->SetCursorIndex(i); } if (i < 0) /* the selection may have changed, update CursorAirspace */ AirspaceWarningCursorCallback(wAirspaceList->GetCursorIndex()); } else { wAirspaceList->SetLength(1); CursorAirspace = NULL; } wAirspaceList->invalidate(); AutoHide(); }
static void UpdateList() { CopyList(); if (!warning_list.empty()) { warning_list_frame->SetLength(warning_list.size()); int i = -1; if (selected_airspace != NULL) { auto it = std::find(warning_list.begin(), warning_list.end(), *selected_airspace); if (it != warning_list.end()) { i = it - warning_list.begin(); warning_list_frame->SetCursorIndex(i); } } if (i < 0) /* the selection may have changed, update CursorAirspace */ AirspaceWarningCursorCallback(warning_list_frame->GetCursorIndex()); } else { warning_list_frame->SetLength(1); selected_airspace = NULL; } warning_list_frame->Invalidate(); UpdateButtons(); AutoHide(); }
static bool update_list() { unsigned Count = airspace_warnings.warning_size(); if (Count > 0) { wAirspaceList->SetLength(Count); int i = -1; if (CursorAirspace != NULL) { i = airspace_warnings.get_warning_index(*CursorAirspace); if (i >= 0) wAirspaceList->SetCursorIndex(i); } if (i < 0) /* the selection may have changed, update CursorAirspace */ AirspaceWarningCursorCallback(wAirspaceList->GetCursorIndex()); wAirspaceList->invalidate(); return true; } else { wAirspaceList->SetLength(1); CursorAirspace = NULL; if (wf && wf->is_visible()) // auto close OnCloseClicked(NULL); else wAirspaceList->invalidate(); return false; } }
void AirspaceWarningListHandler::OnCursorMoved(unsigned i) { AirspaceWarningCursorCallback(i); }