]> uap-core.de Git - rssreader.git/commitdiff
implement filelist event data
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 20 Aug 2025 15:09:44 +0000 (17:09 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Wed, 20 Aug 2025 15:09:44 +0000 (17:09 +0200)
.gitignore
rss-application/src/main/kotlin/de/unixwork/rssreader/MainWindow.kt
ui-java/src/main/java/de/unixwork/ui/Event.java
ui-java/src/main/java/de/unixwork/ui/ToolkitFuncs.java

index 8f5d5faa606e26226489786be1a4d56a9662a848..5645253b8f0b8bc547e4a188263383b8f4fe2f83 100644 (file)
@@ -4,4 +4,5 @@
 out/
 .idea_modules/
 .DS_Store
+gmon.out
 /target/
index 5a2fe388e44ce51dfc5fec305aeae1ef75e4eed2..831eccfaf2057309490d08f0da30fa74d39efb39 100644 (file)
@@ -7,6 +7,7 @@ import de.unixwork.ui.UiText
 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
@@ -19,6 +20,9 @@ class MainWindow {
                     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) {
@@ -65,6 +69,8 @@ class MainWindow {
             rbutton4 = "Cancel",
             modal = true,
             showCloseButton = false,
+            width = 600,
+            height = 450,
             onClick = { ev ->
                 if(ev.intValue == 1) {
                     val parent = groups?.selected
@@ -123,7 +129,9 @@ class MainWindow {
                     rlabel("Client Certificate")
                     textfield(value = cert, hexpand = true)
                     button(icon = "document-open") {
-                        // TODO
+                        openFileDialog(ui) { event ->
+                            
+                        }
                     }
                 }
             }
index d2b8507e198730fbcf04dc501908f0f89e960bed..f3786f6de47e200f304b9eb6d8df36eaebe9bbba 100644 (file)
@@ -51,6 +51,20 @@ public class 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) {
@@ -129,4 +143,11 @@ public class Event {
         }
         return null;
     }
+
+    public String[] getFileListEventData() {
+        if (eventDataType == EventDataType.FILE_LIST) {
+            return (String[])eventData;
+        }
+        return null;
+    }
 }
index 66a987569722f18e9a8f7bf2a890226b889772b6..a7db8b753c43a98ae9bfb1f5cef84012da76d525 100644 (file)
@@ -42,6 +42,9 @@ public class ToolkitFuncs {
     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;
@@ -78,6 +81,7 @@ public class ToolkitFuncs {
         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);
@@ -118,6 +122,9 @@ public class ToolkitFuncs {
         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();
@@ -182,6 +189,9 @@ public class ToolkitFuncs {
         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);