- ListFuncs ui = ListFuncs.getInstance();
- try {
- MemorySegment sel = (MemorySegment)ui.list_get_selection_allocated.invoke(valuePtr);
- int count = (int)ui.list_selection_get_count.invoke(sel);
- int[] selection = new int[count];
- MemorySegment rows = (MemorySegment)ui.list_selection_get_rows.invoke(sel);
- rows = rows.reinterpret(count * ValueLayout.JAVA_INT.byteSize());
- for(int i=0; i<count; i++) {
- selection[i] = (int)rows.getAtIndex(ValueLayout.JAVA_INT, i);
- }
- ui.list_selection_free.invoke(sel);
- return selection;
- } catch (Throwable e) {
- throw new RuntimeException(e);
- }