import de.unixwork.ui.kotlin.Toplevel
import de.unixwork.ui.kotlin.sidebarWindow
import de.unixwork.ui.kotlin.dialogWindow
+import de.unixwork.ui.kotlin.openFileDialog
class MainWindow {
val window : Toplevel
sourcelist(fill = true, varname = "feeds") { elm: FeedCollection ->
val item = SubListItem()
item.label = elm.name
+ item.buttonIcon = "folder"
+ item.buttonLabel = "Test"
+ item.badge = "123"
item
}
hbox(margin = 4, spacing = 4) {
rbutton4 = "Cancel",
modal = true,
showCloseButton = false,
+ width = 600,
+ height = 450,
onClick = { ev ->
if(ev.intValue == 1) {
val parent = groups?.selected
rlabel("Client Certificate")
textfield(value = cert, hexpand = true)
button(icon = "document-open") {
- // TODO
+ openFileDialog(ui) { event ->
+
+ }
}
}
}
eventData = new SubListEventData(eventDataPtr);
break;
}
+ case EventDataType.FILE_LIST: {
+ int flistCount = (int)ui.filelist_count.invoke(eventDataPtr);
+ String[] files = new String[flistCount];
+ for (int i=0;i<flistCount;i++) {
+ MemorySegment cstr = (MemorySegment)ui.filelist_get.invoke(eventDataPtr, i);
+ if(cstr != MemorySegment.NULL) {
+ long len = (long)ui.strlen.invoke(cstr);
+ cstr = cstr.reinterpret(len+1);
+ files[i] = cstr.getString(0);
+ }
+ }
+ eventData = files;
+ break;
+ }
}
}
} catch (Throwable e) {
}
return null;
}
+
+ public String[] getFileListEventData() {
+ if (eventDataType == EventDataType.FILE_LIST) {
+ return (String[])eventData;
+ }
+ return null;
+ }
}
public MethodHandle sublist_event_get_sublist_index;
public MethodHandle sublist_event_get_row_index;
+ public MethodHandle filelist_count;
+ public MethodHandle filelist_get;
+
public MethodHandle string_new;
public MethodHandle int_new;
public MethodHandle double_new;
FunctionDescriptor sigm_mm = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.ADDRESS);
FunctionDescriptor sigv_mm = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.ADDRESS);
FunctionDescriptor sigm_ml = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_LONG);
+ FunctionDescriptor sigm_mi = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.ADDRESS, ValueLayout.JAVA_INT);
FunctionDescriptor sigv_mb = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS, ValueLayout.JAVA_BOOLEAN);
FunctionDescriptor sigv_m = FunctionDescriptor.ofVoid(ValueLayout.ADDRESS);
FunctionDescriptor sigm_l = FunctionDescriptor.of(ValueLayout.ADDRESS, ValueLayout.JAVA_LONG);
MemorySegment sublist_event_get_sublist_index_addr = lib.find("ui_sublist_event_get_sublist_index").orElseThrow();
MemorySegment sublist_event_get_row_index_addr = lib.find("ui_sublist_event_get_row_index").orElseThrow();
+ MemorySegment filelist_count_addr = lib.find("ui_filelist_count").orElseThrow();
+ MemorySegment filelist_get_addr = lib.find("ui_filelist_get").orElseThrow();
+
MemorySegment string_new_addr = lib.find("ui_string_new").orElseThrow();
MemorySegment int_new_addr = lib.find("ui_int_new").orElseThrow();
MemorySegment double_new_addr = lib.find("ui_double_new").orElseThrow();
sublist_event_get_sublist_index = linker.downcallHandle(sublist_event_get_sublist_index_addr, sigi_m);
sublist_event_get_row_index = linker.downcallHandle(sublist_event_get_row_index_addr, sigi_m);
+ filelist_count = linker.downcallHandle(filelist_count_addr, sigi_m);
+ filelist_get = linker.downcallHandle(filelist_get_addr, sigm_mi);
+
string_new = linker.downcallHandle(string_new_addr, sigm_mm);
int_new = linker.downcallHandle(int_new_addr, sigm_mm);
double_new = linker.downcallHandle(double_new_addr, sigm_mm);